public
Description: Sashimi is a Rails plugins manager
Homepage: http://lucaguidi.com/pages/sashimi
Clone URL: git://github.com/jodosha/sashimi.git
sashimi / Rakefile
100644 85 lines (73 sloc) 2.534 kb
1
2
3
4
5
6
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
$:.unshift 'lib'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
 
repositories = %w( origin rubyforge )
 
desc 'Default: run unit tests.'
task :default => :test
 
desc 'Test the sashimi gem.'
Rake::TestTask.new(:test) do |t|
  t.libs << 'lib'
  t.pattern = 'test/**/*_test.rb'
  t.verbose = true
end
 
desc 'Generate documentation for the sashimi gem.'
Rake::RDocTask.new(:rdoc) do |rdoc|
  rdoc.rdoc_dir = 'rdoc'
  rdoc.title = 'Sashimi'
  rdoc.options << '--line-numbers' << '--inline-source'
  rdoc.rdoc_files.include('README')
  rdoc.rdoc_files.include('lib/**/*.rb')
end
 
desc 'Build and install the gem (useful for development purposes).'
task :install do
  require 'sashimi'
  system "gem build sashimi.gemspec"
  system "sudo gem uninstall sashimi"
  system "sudo gem install --local --no-rdoc --no-ri sashimi-#{Sashimi::VERSION::STRING}.gem"
  system "rm sashimi-*.gem"
end
 
desc 'Build and prepare files for release.'
task :dist => :clean do
  require 'sashimi'
  system "gem build sashimi.gemspec"
  system "cd .. && tar -czf sashimi-#{Sashimi::VERSION::STRING}.tar.gz sashimi"
  system "cd .. && tar -cjf sashimi-#{Sashimi::VERSION::STRING}.tar.bz2 sashimi"
  system "cd .. && cp sashimi-* sashimi"
end
 
desc 'Clean the working copy from release files.'
task :clean do
  require 'sashimi'
  version = Sashimi::VERSION::STRING
  system "rm sashimi-#{version}.gem" if File.exist? "sashimi-#{version}.gem"
  system "rm sashimi-#{version}.tar.gz" if File.exist? "sashimi-#{version}.tar.gz"
  system "rm sashimi-#{version}.tar.bz2" if File.exist? "sashimi-#{version}.tar.bz2"
end
 
desc 'Show the file list for the gemspec file'
task :files do
  puts "Files:\n #{Dir['**/*'].reject {|f| File.directory?(f)}.sort.inspect}"
  puts "Test files:\n #{Dir['test/**/*_test.rb'].reject {|f| File.directory?(f)}.sort.inspect}"
end
 
namespace :git do
  desc 'Push local Git commits to all remote centralized repositories.'
  task :push do
    repositories.each do |repository|
      puts "Pushing #{repository}...\n"
      system "git push #{repository} master"
    end
  end
  
  desc 'Perform a git-tag'
  task :tag do
    puts "Please enter the tag name: "
    tag_name = STDIN.gets.chomp
    exit(1) if tag_name.nil? or tag_name.empty?
    system "git tag -s #{tag_name}"
  end
  
  desc 'Push all the tags to remote centralized repositories.'
  task :push_tags do
    repositories.each do |repository|
      puts "Pushing tags to #{repository}...\n"
      system "git push --tags #{repository}"
    end
  end
end