Sha256: 9baac500f2a072da41dc46b2a399b1730c33cf3014709af7f84d8019dce2467e

Contents?: true

Size: 1.94 KB

Versions: 1

Compression:

Stored size: 1.94 KB

Contents

puts __FILE__ if defined?(DEBUG)

desc 'performs setup commands'
task :setup do Tasks.execute_task :setup;end

#
# use the SVN_EXPORTS hash to define svn exports destined for DEV_ROOT/dep
#
# SVN_EXPORT={ 'System.Data.SQLite/1.0.93.0' => 'https://third-party.googlecode.com/svn/trunk/System.Data.SQLite/1.0.93.0' }
#
class Setup < Array
	def update
		add 'bundle install' if(File.exists?('Gemfile'))

		Dir.glob('*.gemspec').each{|gemspec_file|
			add "<%Gemspec.update('#{gemspec_file}')%>"
		}

		if(Dir.glob('**/packages.config').length > 0)
			Dir.glob('*.sln').each{|sln_file|
				add "nuget restore #{sln_file}"
			}
		end

		if(defined?(SVN_EXPORTS))
			SVN_EXPORTS.each{|k,v|
				if(!File.exists?("#{Command.dev_root}/dep/#{k}"))
			      FileUtils.mkdir_p(File.dirname("#{Command.dev_root}/dep/#{k}")) if !File.exists?("#{Command.dev_root}/dep/#{k}")
				  dest="#{Command.dev_root}/dep/#{k}"
			      add "svn export #{v} #{Command.dev_root}/dep/#{k}" if !dest.include?("@")
				  add "svn export #{v} #{Command.dev_root}/dep/#{k}@" if dest.include?("@")
		        end
			}
		end

		if(defined?(GIT_EXPORTS))
			GIT_EXPORTS.each{|k,v|
				directory = "#{Command.dev_root}/dep/#{k}"
				if(!File.exists?(directory))
					if(v.include?('@'))
						puts `git clone #{v.split('@')[0]} #{directory}`
						Dir.chdir(directory) do
							puts `git reset --hard #{v.split('@')[1]}`
						end
					else
						add "git clone #{v} #{directory}"
					end
				end
			}
		end

		if(defined?(VERSION))
			#Text.replace_in_file('HelloLibrary.nuspec',/<version>[\d.]+<\/version>/,"<version>#{VERSION}</version>")
			Dir.glob('*.nuspec').each{|nuspec|
				add "<%Text.replace_in_file('#{nuspec}',/<version>[\d.]+<\/version>/,'<version>#{VERSION}</version>%>'"
			}
			Dir.glob('**/AssemblyInfo.cs').each{|assemblyInfo|
				add "<%Text.replace_in_file('#{assemblyInfo}',Version\(\"[\d.]+\"\),'Version(\"#{VERSION}\")'"
			}
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dev-2.0.164 lib/tasks/setup.rb