lib/dockly/rake_task.rb in dockly-1.9.0 vs lib/dockly/rake_task.rb in dockly-1.10.0

- old
+ new

@@ -51,50 +51,99 @@ namespace :dockly do task :load do raise "No dockly.rb found!" unless File.exist?('dockly.rb') end + prepare_targets = [] + upload_targets = [] build_targets = [] namespace :deb do Dockly.debs.values.each do |inst| - deb inst.name => 'dockly:load' do |name| - Thread.current[:rake_task] = name - inst.build + namespace :prepare do + task inst.name => 'dockly:load' do |name| + inst.create_package! + end end + + namespace :upload do + deb inst.name => 'dockly:load' do |name| + inst.upload_to_s3 + end + end + + deb inst.name => [ + 'dockly:load', + "dockly:deb:prepare:#{inst.name}", + "dockly:deb:upload:#{inst.name}" + ] + prepare_targets << "dockly:deb:prepare:#{inst.name}" + upload_targets << "dockly:deb:upload:#{inst.name}" build_targets << "dockly:deb:#{inst.name}" end end namespace :rpm do Dockly.rpms.values.each do |inst| - rpm inst.name => 'dockly:load' do |name| - Thread.current[:rake_task] = name - inst.build + namespace :prepare do + task inst.name => 'dockly:load' do |name| + inst.create_package! + end end + + namespace :upload do + rpm inst.name => 'dockly:load' do |name| + inst.upload_to_s3 + end + end + + rpm inst.name => [ + 'dockly:load', + "dockly:rpm:prepare:#{inst.name}", + "dockly:rpm:upload:#{inst.name}" + ] + prepare_targets << "dockly:rpm:prepare:#{inst.name}" + upload_targets << "dockly:rpm:upload:#{inst.name}" build_targets << "dockly:rpm:#{inst.name}" end end namespace :docker do Dockly.dockers.values.each do |inst| - docker inst.name => 'dockly:load' do - Thread.current[:rake_task] = inst.name - inst.generate! + # For backwards compatibility + namespace :noexport do + task inst.name => "dockly:docker:prepare:#{inst.name}" end - namespace :noexport do + namespace :prepare do task inst.name => 'dockly:load' do Thread.current[:rake_task] = inst.name inst.generate_build end end + namespace :upload do + task inst.name => 'dockly:load' do + Thread.current[:rake_task] = inst.name + inst.export_only + end + end + + docker inst.name => [ + 'dockly:load', + "dockly:docker:prepare:#{inst.name}", + "dockly:docker:upload:#{inst.name}" + ] + # Docker image will be generated by 'dockly:deb:package' unless inst.s3_bucket.nil? + prepare_targets << "dockly:docker:prepare:#{inst.name}" + upload_targets << "dockly:docker:upload:#{inst.name}" build_targets << "dockly:docker:#{inst.name}" end end end + multitask :prepare_all => prepare_targets + multitask :upload_all => upload_targets multitask :build_all => build_targets end