pulsar/Rakefile

124 lines
3.4 KiB
Ruby
Raw Normal View History

ATOM_SRC_PATH = File.dirname(__FILE__)
BUILD_DIR = 'atom-build'
2012-09-22 02:03:59 +04:00
desc "Build Atom via `xcodebuild`"
task :build => "create-xcode-project" do
2013-01-29 01:02:27 +04:00
command = "xcodebuild -target Atom -configuration Release SYMROOT=#{BUILD_DIR}"
2012-08-31 03:46:57 +04:00
output = `#{command}`
if $?.exitstatus != 0
$stderr.puts "Error #{$?.exitstatus}:\n#{output}"
exit($?.exitstatus)
end
end
desc "Create xcode project from gyp file"
task "create-xcode-project" => "update-cef" do
`rm -rf atom.xcodeproj`
`gyp --depth=. -D CODE_SIGN="#{ENV['CODE_SIGN']}" atom.gyp`
end
desc "Update CEF to the latest version specified by the prebuilt-cef submodule"
task "update-cef" => "bootstrap" do
exit 1 unless system %{prebuilt-cef/script/download -f cef}
Dir.glob('cef/*.gypi').each do |filename|
`sed -i '' -e "s/'include\\//'cef\\/include\\//" -e "s/'libcef_dll\\//'cef\\/libcef_dll\\//" #{filename}`
end
end
task "bootstrap" do
`script/bootstrap`
end
2013-02-25 21:20:26 +04:00
desc "Copies Atom.app to /Applications and creates `atom` cli app"
task :install => [:clean, :build] do
path = application_path()
exit 1 if not path
# Install Atom.app
2013-02-25 21:20:26 +04:00
dest_path = "/Applications/#{File.basename(path)}"
`rm -rf #{dest_path}`
`cp -r #{path} #{File.expand_path(dest_path)}`
# Install atom cli
2013-02-26 00:40:59 +04:00
if File.directory?("/opt/boxen")
cli_path = "/opt/boxen/bin/atom"
else
cli_path = "/opt/github/bin/atom"
end
2013-02-25 21:20:26 +04:00
FileUtils.cp("#{ATOM_SRC_PATH}/atom.sh", cli_path)
FileUtils.chmod(0755, cli_path)
Rake::Task["clone-default-bundles"].invoke()
2013-02-25 21:20:26 +04:00
puts "\033[32mAtom is installed at `#{dest_path}`. Atom cli is installed at `#{cli_path}`\033[0m"
end
2013-02-25 21:20:26 +04:00
desc "Package up the app for speakeasy"
2013-02-28 22:16:01 +04:00
task :package => ["setup-codesigning", "build"] do
2013-02-22 02:21:22 +04:00
path = application_path()
exit 1 if not path
dest_path = '/tmp/atom-for-speakeasy/Atom.tar.bz2'
2013-02-25 21:20:26 +04:00
`mkdir -p $(dirname #{dest_path})`
2013-02-23 04:14:43 +04:00
`rm -rf #{dest_path}`
`tar --directory $(dirname #{path}) -jcf #{dest_path} $(basename #{path})`
2013-02-25 21:20:26 +04:00
`open $(dirname #{dest_path})`
2013-02-23 04:14:43 +04:00
end
task "setup-codesigning" do
ENV['CODE_SIGN'] = "Developer ID Application: GitHub"
end
2013-01-03 21:57:13 +04:00
desc "Clone default bundles into vendor/bundles directory"
task "clone-default-bundles" do
2013-01-03 23:02:03 +04:00
`git submodule --quiet sync`
`git submodule --quiet update --recursive --init`
end
desc "Clean build Atom via `xcodebuild`"
task :clean do
output = `xcodebuild clean`
2012-12-27 02:38:25 +04:00
`rm -rf #{application_path()}`
`rm -rf #{BUILD_DIR}`
`rm -rf /tmp/atom-compiled-scripts`
end
desc "Run the specs"
2013-02-21 01:56:22 +04:00
task :test => ["update-cef", "clone-default-bundles", "build"] do
`pkill Atom`
2013-02-15 01:36:28 +04:00
if path = application_path()
cmd = "#{path}/Contents/MacOS/Atom --test --resource-path=#{ATOM_SRC_PATH} 2> /dev/null"
2013-02-15 01:36:28 +04:00
system(cmd)
exit($?.exitstatus)
else
exit(1)
end
end
desc "Run the benchmarks"
task :benchmark do
2012-09-22 00:27:19 +04:00
Rake::Task["run"].invoke("--benchmark")
end
task :nof do
system %{find . -name *spec.coffee | grep --invert-match --regexp "#{BUILD_DIR}\\|##package-name##" | xargs sed -E -i "" "s/f+(it|describe) +(['\\"])/\\1 \\2/g"}
end
task :tags do
system %{find src native cef vendor -not -name "*spec.coffee" -type f -print0 | xargs -0 ctags}
end
def application_path
applications = FileList["#{BUILD_DIR}/**/Atom.app"]
if applications.size == 0
$stderr.puts "No Atom application found in directory `#{BUILD_DIR}`"
elsif applications.size > 1
$stderr.puts "Multiple Atom applications found \n\t" + applications.join("\n\t")
else
return applications.first
end
return nil
end