Sha256: 08968f8dae2f0749647aafcb9fc79445380eca8a4920fd46c9dfc9b99329192b
Contents?: true
Size: 1.93 KB
Versions: 1
Compression:
Stored size: 1.93 KB
Contents
class Tasks::Toolbelt::Build::Tarball < Tasks::Toolbelt around_ensure :cleanup def call # checkout requested revision checkout_revision # clean directories clean # copy files into release copy_files_into_release # add revision when given append_revision_to_release_version if options.revision.present? # vendorize the bundle copy_vendored_gems # build tar package_release_into_tar end protected def checkout_revision raise "You have unstaged commits." if %x{git status} =~ /Changes not staged for commit/ sh "git checkout #{revision}" raise "Unable to checkout #{revision}" unless %x{git branch | grep '*'} =~ /#{revision}/ end def copy_files_into_release # for each path ['lib', 'bin'].each do |path| # recursively copy into release cp_r File.join( root_path, path ), File.join( release_path, path ) end end def clean rm_rf tarball_path # create release mkdir_p release_path end def append_revision_to_release_version version_file = File.join( release_path, 'lib/quandl/command/version.rb') IO.write(version_file, File.open(version_file) do |f| f.read.gsub(version, "#{version}-#{revision}") end ) end def copy_vendored_gems Bundler.with_clean_env do sh( "bundle install --without development test --path #{release_path}/vendor" ) mv File.join(release_path, "vendor/ruby/1.9.1/gems"), File.join(release_path, "vendor") rm_rf File.join(release_path, "vendor/ruby") end end def package_release_into_tar # path to tarball tarball_filename = File.basename([ release_path, revision, 'tar.gz' ].compact.join(".")) # enter tarball build directory Dir.chdir(tarball_path) do # create targz Tar.pack( 'quandl-command', File.join(tarball_path, tarball_filename) ) end end def cleanup rm_rf File.join( root_path, '.bundle') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
quandl-0.2.22 | tasks/toolbelt/build/tarball.rb |