lib/application.rb in docman-0.0.46 vs lib/application.rb in docman-0.0.47
- old
+ new
@@ -88,11 +88,11 @@
raise "Wrong deploy target: #{deploy_target_name}" if @deploy_target.nil?
@deploy_target['name'] = deploy_target_name
@docroot_config = DocrootConfig.new(@workspace_dir, deploy_target)
@docroot_config.states_dependin_on(name, version).keys.each do |state|
execute('deploy', state, name)
- write_environment @deploy_target['states'][state]
+ write_environment(@deploy_target['states'][state], name)
write_state state
result = state
end
end
result
@@ -114,12 +114,21 @@
def write_state state
filepath = File.join(@workspace_dir, 'state')
File.open(filepath, 'w') { |file| file.write(state) }
end
- def write_environment(environment)
+ def write_environment(env, name)
+ environment = environment(env)
+
+ properties = {}
+ properties['ENV'] = env
+ properties['project_last_result'] = environment['previous'][name]['result'] unless environment['previous'][name]['result'].nil?
+ properties['last_project'] = name
+
filepath = File.join(@workspace_dir, 'last_deploy.properties')
- File.open(filepath, 'w') { |file| file.write("ENV=#{environment}") }
+ File.open(filepath, 'w') do |file|
+ properties.each {|key, value| file.puts "#{key}=#{value}\n" }
+ end
end
def execute(action, state, name = nil, tag = nil)
params = Marshal.load(Marshal.dump(@deploy_target))
params['state'] = state