Class: Publish

Inherits:
Array show all
Defined in:
lib/tasks/publish.rb

Instance Attribute Summary

Attributes inherited from Array

#env

Instance Method Summary collapse

Methods inherited from Array

#add, #add_passive, #add_quiet, #execute, #has_command?, #intialize, #to_html

Instance Method Details

#updateObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/tasks/publish.rb', line 7

def update
	if(File.exists?('.git') && defined?(VERSION))
		add_quiet "<%Git.tag('#{Rake.application.original_dir}','#{VERSION}')%>"
	end

	if(Internet.available?)
		if(File.exists?('.git'))
			if(`git branch`.include?('* master'))
				Dir.glob('*.gemspec').each{|gemspec_file|
					add_passive "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
				}
			end
		end
		if(File.exists?('.svn'))
			if(`svn info`.include?('/trunk'))
				Dir.glob('*.gemspec').each{|gemspec_file|
					add_quiet "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
				}
			end
		end
	end

	Dir.glob("#{Rake.application.original_dir}/**/*.{nupkg,msi,gem}").each{|publish_file|
		dest="#{Environment.default.publish_dir}/#{File.basename(publish_file)}"
		add_quiet "<%FileUtils.cp('#{publish_file}','#{dest}')%>" if(!File.exists?(dest))
	}
end