Commit ebaa59cb authored by James Larrowe's avatar James Larrowe Committed by Ed Reel

Update Code package (#3000) (#3000)

Use only 'code-oss' in postinst.
parent de087bf3
require 'package' require 'package'
class Code < Package class Code < Package
description 'Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux and macOS.'
homepage 'https://code.visualstudio.com/' @version = "1.30.1"
version '1.25.1'
case ARCH case ARCH
when 'x86_64' when 'x86_64'
source_url 'https://vscode-update.azurewebsites.net/1.25.1/linux-x64/stable' @arch = 'x64'
source_sha256 '5856bbebf38aa05d584da4722869bbe507cf123f69f7ffab5f1532d73dbf3438'
when 'i686' when 'i686'
source_url 'https://vscode-update.azurewebsites.net/1.25.1/linux-ia32/stable' @arch = 'ia32'
source_sha256 'af6adc2e2500e50bfebe7ee7b97d661b6e774a590136bf5f89334132a5b292e2' when 'armv7l', 'aarch64'
else @arch = 'arm'
source_url 'https://raw.githubusercontent.com/Microsoft/vscode/1.25.1/README.md'
source_sha256 'c1c5e6ec903730a4e116c1cfd83bb29acd227195d97f2ec8944452808232c310'
end end
description 'Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux and macOS.'
homepage 'https://code.visualstudio.com/'
version '1.30.1'
source_url "https://github.com/Microsoft/vscode/archive/#{@version}.tar.gz"
source_sha256 'bf558c2818159fd2a47fa80c882794505b5d73d118f94f46d09c98b388d9e203'
binary_url ({ binary_url ({
}) })
binary_sha256 ({ binary_sha256 ({
}) })
depends_on 'nodebrew'
depends_on 'yarn' => :build
depends_on 'gtk2' depends_on 'gtk2'
depends_on 'libsecret'
depends_on 'libgconf' depends_on 'libgconf'
depends_on 'xdg_base' depends_on 'xdg_base'
depends_on 'sommelier' depends_on 'sommelier'
def self.install ENV['PATH'] = "#{ENV['HOME']}/.nodebrew/current/bin:#{ENV['PATH']}"
case ARCH
when 'x86_64', 'i686' def self.build
system "mkdir", "-p", "#{CREW_DEST_PREFIX}/share/code" node_old = `nodebrew ls | fgrep 'current: ' | cut -d' ' -f2`
system "mkdir", "-p", "#{CREW_DEST_PREFIX}/bin" system "nodebrew install 8.15.0 || true"
system "cp", "-rpa", ".", "#{CREW_DEST_PREFIX}/share/code/" system "nodebrew use 8.15.0"
system "ln", "-s", "#{CREW_PREFIX}/share/code/bin/code", "#{CREW_DEST_PREFIX}/bin/code" system "npm install gulp"
else system "yarn install"
puts system "yarn run gulp vscode-linux-#{@arch}"
puts 'Visual Studio Code is currently not supported on ARM and AArch64.'.lightred system "nodebrew use #{node_old}"
puts 'Please try HeadMelted.'.lightred
puts 'https://code.headmelted.com'.lightred
puts
puts 'Happy coding!'.lightgreen
puts
exit 1
end end
def self.install
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/share"
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/bin"
system "mv", "../VSCode-linux-#{@arch}", "#{CREW_DEST_PREFIX}/share/code"
system "sed -i -e 's,ELECTRON_RUN_AS_NODE=1 ,,g' #{CREW_DEST_PREFIX}/share/code/bin/code-oss"
# ^^^ Do not remove this line.
system "ln", "-s", "../share/code/bin/code-oss", "#{CREW_DEST_PREFIX}/bin/code"
system "ln", "-s", "../share/code/bin/code-oss", "#{CREW_DEST_PREFIX}/bin/code-oss"
end end
def self.postinstall def self.postinstall
puts puts
puts 'Congratulations! You have installed Visual Studio Code on Chrome OS!'.lightgreen puts 'Congratulations! You have installed Visual Studio Code on Chrome OS!'.lightgreen
puts 'Now, please run \'code\' to start Visual Studio.'.lightgreen puts 'Now, please run \'code-oss\' to start Visual Studio.'.lightgreen
puts 'Happy coding!'.lightgreen puts 'Happy coding!'.lightgreen
puts puts
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment