lib/ratch/toolset/ruby/pack/tgz in ratch-0.3.0 vs lib/ratch/toolset/ruby/pack/tgz in ratch-0.4.0

- old
+ new

@@ -1,85 +1,46 @@ #!/usr/bin/env ratch -# generate gem package +# generate tar gzip package -begin - require 'rubygems/specification' - Gem::manage_gems -rescue LoadError - raise LoadError, "RubyGems is not installed?" -end +require 'ratch/extra/stage' +require 'ratch/extra/zip' -require 'ratch/project/package' +# Create a Tar'd Gzip package. -# +main 'pack/tgz' do + status "Creating .tgz package" -main 'pack/gem' do - # load config (TODO) - #source = Dir.pwd - store = 'pkg' - package = Ratch::Package.load - #status "Creating RubyGem(s)" - file = nil - #cd(source) do - #status "vi #{metadata.name}.gemspec" - builder = ::Gem::Builder.new(gemspec(package)) - #status "gem build #{package.name}" - unless dryrun? - file = builder.build - file = File.expand_path(file) - end - #end - transfer(file, store) -end + config = configuration['pack'] || {} + config = config['tgz'] || {} -# Create Gem::Specification. + package = package.clone + package.update(config) -def gemspec(package) - distribute = package.filelist - #distribute = Dir.multiglob_with_default( '**/*', distribute ) + store = config[:store] || 'pkg' + templ = config[:template] - ::Gem::Specification.new do |spec| - spec.name = package.name - spec.version = package.version - spec.summary = package.brief - spec.description = package.description - spec.author = package.author - spec.email = package.email - spec.rubyforge_project = package.development if /rubyforge.org/ =~ package.development - spec.homepage = package.homepage + name = package.stage_name(templ) + stage = File.join(store, name) + files = package.filelist - # Platform: ruby, mswin32, i586-linux, powerpc-darwin, current - spec.platform = 'ruby' # TODO current support! + stage(stage, files) - spec.require_paths = [package.gem_path].flatten.reverse - - #if package.platform != 'ruby' - # spec.require_paths.concat(spec.require_paths.collect{ |d| File.join(d, platform) }) - #end - - spec.bindir = "bin" - spec.executables = package.executables - spec.requirements = package.requirements - spec.has_rdoc = package.document - - if package.dependencies - package.dependencies.each do |d,v| - spec.add_dependency(*[d,v].compact) - end + if dryrun? + status "tar -cxf #{name}.tgz" + else + file = nil + cd(store) do + file = tgz(name) end - - spec.extensions = package.compile - - spec.files = distribute - - spec.test_files = distribute.select{ |f| f =~ /^test\// } # TODO make test_files configurable + transfer(file, store) end end # Transfer package file to storage location. def transfer(file, store) - dest = File.join(store, File.basename(file)) # move to store, unless already there + # move to store, unless already there + dest = File.join(store, File.basename(file)) dest = File.expand_path(dest) mv(file, store) unless file == dest end