= JSON.parse(File.read(properties_file)) properties.keys.each do |key| desc "Run provision to #{key}" namespace :itamae do desc "Run itamae to #{key}" task key.split('.')[0] do command = "bundle exec itamae ssh" command << " -h #{key}" command << " -i #{properties[key]['private_key']}" command << " -p #{properties[key]['ssh_port']}" command << " -j #{properties_file}" properties[key]['roles'].each {|role| command << " provision/#{role}/#{role}.rb"} puts command system command end end namespace :serverspec do desc "Run serverspec to #{key}" RSpec::Core::RakeTask.new(key.split('.')[0].to_sym) do |t| ENV['TARGET_HOST'] = key t.pattern = 'spec/{' + properties[key]['roles'].join(',') + '}/*_spec.rb' end end end 11 https://gist.github.com/rrreeeyyy/84efc2907814c56a2b4a ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 24