Skip to content
Browse files

First Commit

  • Loading branch information...
0 parents commit c4ce898595fe07ea28c50e61537920830e5fb79f Iain Hecker committed Nov 4, 2008
Showing with 84 additions and 0 deletions.
  1. +14 −0 README.textile
  2. +11 −0 Rakefile
  3. +59 −0 tasks/rake_svn_tasks.rake
14 README.textile
@@ -0,0 +1,14 @@
+h1. RakeSvn
+
+Some handy rake tasks for subversion.
+
+* *svn:repository* prints and sets current svn repository url
+* *svn:tags* lists all tags
+* *svn:tag* tag the current trunk, use VERSION=x to name it
+* *svn:add* adds all new files to svn
+* *svn:rm* removes all missing files from svn
+* *svn:both* adds all new files and removes missing files to svn
+* *svn:ignores* sets common ignores for rails
+
+
+Copyright (c) 2008 Iain Hecker, released under the MIT license
11 Rakefile
@@ -0,0 +1,11 @@
+require 'rake'
+require 'spec/rake/spectask'
+
+desc 'Default: run specs.'
+task :default => :spec
+
+desc 'Run the specs'
+Spec::Rake::SpecTask.new(:spec) do |t|
+ t.spec_opts = ['--colour --format progress --loadby mtime --reverse']
+ t.spec_files = FileList['spec/**/*_spec.rb']
+end
59 tasks/rake_svn_tasks.rake
@@ -0,0 +1,59 @@
+namespace :svn do
+
+ desc "Gets the current svn repository url."
+ task :repository do
+ SVN_BASE = `svn info | grep ^URL | awk '{print $2}'`
+ puts "Using repository #{SVN_BASE}"
+ end
+
+ desc "Tag current trunk. Use VERSION to provide a version number."
+ task :tag => :repository do
+ version = ENV['VERSION'] or raise 'Provide a VERSION-number, e.g. rake svn:tag VERSION=0.1.3'
+ trunk, tag = SVN_BASE + "trunk", SVN_BASE + "tags/#{version}"
+ system *(%w(svn copy -m) << "Tagged release number #{version} as a copy from trunk." << trunk << tag)
+ end
+
+ desc "List all tags."
+ task :tags => :repository do
+ system *(%w(svn list -v) << "#{SVN_BASE}tags")
+ end
+
+ desc "Add all new files to repository"
+ task :add => :repository do
+ system "svn status | grep '^\?' | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs svn add --force"
+ end
+
+ desc "Deletes all missing files from the repository"
+ task :rm => :repository do
+ system "svn status | grep '^\!' | sed -e 's/! *//' | sed -e 's/ /\ /g' | xargs svn rm --force"
+ end
+
+ desc "Perfom both add and rm"
+ task :both => [:add, :rm]
+
+ desc "Configure Subversion for Rails"
+ task :ignores do
+ system "svn remove log/*"
+ system "svn commit -m 'removing all log files from subversion'"
+ system 'svn propset svn:ignore "*.log" log/'
+ system "svn update log/"
+ system "svn commit -m 'Ignoring all files in /log/ ending in .log'"
+ system 'svn propset svn:ignore "*.db" db/'
+ system "svn update db/"
+ system "svn commit -m 'Ignoring all files in /db/ ending in .db'"
+ system "svn move config/database.yml config/database.example"
+ system "svn commit -m 'Moving database.yml to database.example to provide a template for anyone who checks out the code'"
+ system 'svn propset svn:ignore "database.yml" config/'
+ system "svn update config/"
+ system "svn commit -m 'Ignoring database.yml'"
+ system "svn remove public/stylesheets/*.css"
+ system "svn commit -m 'Removing stylesheets, in favor of sass'"
+ system 'svn propset svn:ignore "*.css" public/stylesheets'
+ system "svn commit -m 'Ignoring css files in favor of sass'"
+ system 'svn propset svn:ignore "schema.rb" db/'
+ system "svn commit -m 'Ignoring schema.rb'"
+ end
+
+
+end
+

0 comments on commit c4ce898

Please sign in to comment.
Something went wrong with that request. Please try again.