forked from heroku/legacy-cli
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:heroku/heroku
- Loading branch information
Showing
81 changed files
with
6,232 additions
and
1,532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ pkg | |
rdoc | ||
.DS_Store | ||
*.swp | ||
*.rbc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
source "http://rubygems.org" | ||
|
||
gemspec | ||
|
||
group :development do | ||
gem "fakefs" | ||
gem "parka", ">= 0.6.2" | ||
gem "rake", ">= 0.8.7" | ||
gem "rspec", ">= 2.0" | ||
gem "taps", ">= 0.3.23" | ||
gem "webmock" | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,51 @@ | ||
$:.unshift File.expand_path("../lib", __FILE__) | ||
require "heroku/version" | ||
|
||
require 'rake' | ||
require 'spec/rake/spectask' | ||
|
||
desc "Run all specs" | ||
Spec::Rake::SpecTask.new('spec') do |t| | ||
t.spec_opts = ['--colour --format progress --loadby mtime --reverse'] | ||
t.spec_files = FileList['spec/**/*_spec.rb'] | ||
end | ||
require "rubygems" | ||
require "bundler/setup" | ||
|
||
desc "Print specdocs" | ||
Spec::Rake::SpecTask.new(:doc) do |t| | ||
t.spec_opts = ["--format", "specdoc", "--dry-run"] | ||
t.spec_files = FileList['spec/*_spec.rb'] | ||
end | ||
PROJECT_ROOT = File.expand_path("..", __FILE__) | ||
$:.unshift "#{PROJECT_ROOT}/lib" | ||
|
||
desc "Generate RCov code coverage report" | ||
Spec::Rake::SpecTask.new('rcov') do |t| | ||
t.spec_files = FileList['spec/*_spec.rb'] | ||
t.rcov = true | ||
t.rcov_opts = ['--exclude', 'examples'] | ||
end | ||
require "heroku/version" | ||
require "rspec/core/rake_task" | ||
|
||
def gem_paths | ||
%x{ bundle show }.split("\n").map do |line| | ||
if line =~ /^ \* (.*?) \((.*?)\)/ | ||
%x{ bundle show #{$1} }.strip | ||
end | ||
end.compact | ||
desc "Run all specs" | ||
RSpec::Core::RakeTask.new(:spec) do |t| | ||
t.verbose = true | ||
end | ||
|
||
GEM_BLACKLIST = %w( bundler heroku ) | ||
|
||
def copy_gems(package_gem_dir) | ||
lines = %x{ bundle show }.strip.split("\n") | ||
raise "error running bundler" unless $?.success? | ||
task :default => :spec | ||
|
||
%x{ env BUNDLE_WITHOUT="development:test" bundle show }.split("\n").each do |line| | ||
if line =~ /^ \* (.*?) \((.*?)\)/ | ||
next if GEM_BLACKLIST.include?($1) | ||
puts "vendoring: #{$1}-#{$2}" | ||
gem_dir = %x{ bundle show #{$1} }.strip | ||
%x{ cp -R #{gem_dir} #{package_gem_dir}/ } | ||
end | ||
end.compact | ||
def builder(action, ext) | ||
package_file = "pkg/heroku-#{Heroku::VERSION}.#{ext}" | ||
puts "#{action}: #{package_file}" | ||
system "build/#{ext}/#{action} #{PROJECT_ROOT} #{package_file}" | ||
end | ||
|
||
def package_path(path, stream) | ||
puts "#{path}/**/*.rb" | ||
Dir["#{path}/**/*"].each do |file| | ||
next unless File.file?(file) | ||
puts "finding file: #{file}" | ||
relative = file.gsub(/^#{path}/, '') | ||
relative.gsub!(/^\//, '') | ||
stream.puts("__FILE__ #{relative}") | ||
stream.puts(File.read(file)) | ||
stream.puts("__ENDFILE__") | ||
namespace :package do | ||
desc "package the gem version" | ||
task :gem do | ||
builder :package, :gem | ||
end | ||
end | ||
|
||
desc "Package as a single file" | ||
task :package do | ||
base_dir = File.dirname(__FILE__) | ||
|
||
require "tmpdir" | ||
package_dir = "#{Dir.mktmpdir}/heroku-#{Heroku::VERSION}" | ||
package_gem_dir = "#{package_dir}/vendor/gems" | ||
|
||
puts "building in: #{package_dir}" | ||
%x{ mkdir -p #{package_gem_dir} } | ||
copy_gems package_gem_dir | ||
|
||
%x{ cp -R #{base_dir}/lib #{package_dir} } | ||
|
||
File.open("#{package_dir}/heroku", "w") do |file| | ||
file.puts <<-PREAMBLE | ||
#!/usr/bin/env ruby | ||
gem_dir = File.expand_path("../vendor/gems", __FILE__) | ||
Dir["\#{gem_dir}/**/lib"].each do |libdir| | ||
$:.unshift libdir | ||
desc "package the tgz version" | ||
task :tgz do | ||
builder :package, :tgz | ||
end | ||
end | ||
|
||
$:.unshift File.expand_path("../lib", __FILE__) | ||
desc "package all" | ||
task :package => %w( package:gem package:tgz ) | ||
|
||
require 'heroku' | ||
require 'heroku/command' | ||
args = ARGV.dup | ||
ARGV.clear | ||
command = args.shift.strip rescue 'help' | ||
Heroku::Command.run(command, args) | ||
PREAMBLE | ||
namespace :release do | ||
desc "release the gem version" | ||
task :gem => "package:gem" do | ||
builder :release, :gem | ||
end | ||
|
||
%x{ chmod +x #{package_dir}/heroku } | ||
|
||
if plugins = (ENV["PLUGINS"] || "").split(" ") | ||
plugins.each do |plugin| | ||
puts "plugin: #{plugin}" | ||
%x{ mkdir -p #{package_dir}/plugins } | ||
%x{ cd #{package_dir}/plugins && git clone #{plugin} 2>&1 } | ||
%x{ rm -rf $(find #{package_dir}/plugins -name .git) } | ||
end | ||
desc "release the tgz version" | ||
task :tgz => "package:tgz" do | ||
builder :release, :tgz | ||
end | ||
|
||
%x{ mkdir -p #{base_dir}/pkg } | ||
%x{ cd #{package_dir}/.. && tar czvpf #{base_dir}/pkg/heroku-#{Heroku::VERSION}.tgz * 2>&1 } | ||
|
||
puts "package: pkg/heroku-#{Heroku::VERSION}.tgz" | ||
end | ||
|
||
task :default => :spec | ||
desc "release all" | ||
task :release => %w( release:gem release:tgz ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
begin | ||
require "octotest" | ||
rescue LoadError | ||
puts "missing the 'octotest' gem" | ||
exit 1 | ||
end | ||
|
||
Autotest.add_discovery { "octotest" } | ||
Autotest.add_discovery { "rspec" } | ||
Autotest.add_discovery { "rspec2" } | ||
|
||
ENV["OCTOTEST_RUBIES"] = "ruby-1.8.7@heroku-gem ruby-1.9.2@heroku-gem" | ||
ENV["OCTOTEST_RUBIES"] ||= "ruby-1.8.7 ruby-1.9.2 rbx" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env ruby | ||
|
||
project_root = ARGV.shift | ||
package_file = ARGV.shift | ||
|
||
unless project_root && package_file | ||
puts "usage: gem/package PROJECT_ROOT PACKAGE_FILE" | ||
exit 1 | ||
end | ||
|
||
Dir.chdir(project_root) | ||
|
||
system "parka build -f #{project_root}/#{package_file}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env ruby | ||
|
||
package_file = ARGV.shift | ||
|
||
unless package_file | ||
puts "usage: gem/release PACKAGE_FILE" | ||
exit 1 | ||
end | ||
|
||
Dir.chdir(File.expand_path("../..", package_file)) | ||
|
||
system "parka push -f #{package_file}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#!/usr/bin/env ruby | ||
|
||
project_root = ARGV.shift | ||
package_file = ARGV.shift | ||
|
||
unless project_root && package_file | ||
puts "usage: tgz/package PROJECT_ROOT PACKAGE_FILE" | ||
exit 1 | ||
end | ||
|
||
GEM_BLACKLIST = %w( bundler heroku ) | ||
|
||
def gem_paths | ||
%x{ bundle show }.split("\n").map do |line| | ||
if line =~ /^ \* (.*?) \((.*?)\)/ | ||
%x{ bundle show #{$1} }.strip | ||
end | ||
end.compact | ||
end | ||
|
||
def copy_gems(package_gem_dir) | ||
lines = %x{ bundle show }.strip.split("\n") | ||
raise "error running bundler" unless $?.success? | ||
|
||
%x{ env BUNDLE_WITHOUT="development:test" bundle show }.split("\n").each do |line| | ||
if line =~ /^ \* (.*?) \((.*?)\)/ | ||
next if GEM_BLACKLIST.include?($1) | ||
puts "vendoring: #{$1}-#{$2}" | ||
gem_dir = %x{ bundle show #{$1} }.strip | ||
%x{ cp -R #{gem_dir} #{package_gem_dir}/ } | ||
end | ||
end.compact | ||
end | ||
|
||
def package_path(path, stream) | ||
puts "#{path}/**/*.rb" | ||
Dir["#{path}/**/*"].each do |file| | ||
next unless File.file?(file) | ||
puts "finding file: #{file}" | ||
relative = file.gsub(/^#{path}/, '') | ||
relative.gsub!(/^\//, '') | ||
stream.puts("__FILE__ #{relative}") | ||
stream.puts(File.read(file)) | ||
stream.puts("__ENDFILE__") | ||
end | ||
end | ||
|
||
Dir.chdir(project_root) | ||
|
||
version = package_file.match(/heroku-([a-z0-9\.]+)\./)[1] | ||
|
||
require "tmpdir" | ||
package_dir = "#{Dir.mktmpdir}/heroku-#{version}" | ||
package_gem_dir = "#{package_dir}/vendor/gems" | ||
|
||
puts "building in: #{package_dir}" | ||
%x{ mkdir -p #{package_gem_dir} } | ||
copy_gems package_gem_dir | ||
|
||
%x{ cd #{project_root} && find . -name "*.rbc" -delete } | ||
%x{ cp -R #{project_root}/data #{package_dir} } | ||
%x{ cp -R #{project_root}/lib #{package_dir} } | ||
|
||
File.open("#{package_dir}/heroku", "w") do |file| | ||
file.puts <<-PREAMBLE | ||
#!/usr/bin/env ruby | ||
gem_dir = File.expand_path("../vendor/gems", __FILE__) | ||
Dir["\#{gem_dir}/**/lib"].each do |libdir| | ||
$:.unshift libdir | ||
end | ||
$:.unshift File.expand_path("../lib", __FILE__) | ||
require 'heroku' | ||
require 'heroku/command' | ||
args = ARGV.dup | ||
ARGV.clear | ||
command = args.shift.strip rescue 'help' | ||
Heroku::Command.load | ||
Heroku::Command.run(command, args) | ||
PREAMBLE | ||
end | ||
|
||
%x{ chmod +x #{package_dir}/heroku } | ||
|
||
if plugins = (ENV["PLUGINS"] || "").split(" ") | ||
plugins.each do |plugin| | ||
puts "plugin: #{plugin}" | ||
%x{ mkdir -p #{package_dir}/plugins } | ||
%x{ cd #{package_dir}/plugins && git clone #{plugin} 2>&1 } | ||
%x{ rm -rf $(find #{package_dir}/plugins -name .git) } | ||
end | ||
end | ||
|
||
%x{ mkdir -p #{project_root}/pkg } | ||
%x{ cd #{package_dir}/.. && tar czvpf #{project_root}/#{package_file} * 2>&1 } |
Oops, something went wrong.