public
Description: A capistrano/rails plugin that makes it easy to deploy/manage/scale to EC2
Homepage: http://github.com/wr0ngway/rubber/wikis
Clone URL: git://github.com/wr0ngway/rubber.git
Click here to lend your support to: rubber and make a donation at www.pledgie.com !
rubber / Rakefile
100644 99 lines (82 sloc) 3.316 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
require 'rake'
require 'rake/testtask'
 
begin
  require 'jeweler'
  Jeweler::Tasks.new do |s|
    s.name = "rubber"
    s.executables = "vulcanize"
    s.summary = "A capistrano plugin for managing multi-instance deployments to the cloud (ec2)"
    s.email = "matt@conwaysplace.com"
    s.homepage = "http://github.com/wr0ngway/rubber"
    s.description = "The rubber plugin enables relatively complex multi-instance deployments of RubyOnRails applications to Amazon's Elastic Compute Cloud (EC2). Like capistrano, rubber is role based, so you can define a set of configuration files for a role and then assign that role to as many concrete instances as needed. One can also assign multiple roles to a single instance. This lets one start out with a single ec2 instance (belonging to all roles), and add new instances into the mix as needed to scale specific facets of your deployment, e.g. adding in instances that serve only as an 'app' role to handle increased app server load."
    s.rubyforge_project = 'rubber'
    s.authors = ["Matt Conway"]
    s.files = FileList["[A-Z][A-Z]*", "{bin,generators,lib,rails,recipes}/**/*"]
    s.add_dependency 'capistrano'
    s.add_dependency 'amazon-ec2', '>= 0.5.0'
    s.add_dependency 'aws-s3'
    s.add_dependency 'nettica'
    s.add_dependency 'httparty'
    s.add_dependency 'rails'
  end
  Jeweler::GemcutterTasks.new
rescue LoadError
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end
 
desc 'Test the rubber plugin.'
Rake::TestTask.new(:test) do |t|
  t.libs << 'lib'
  t.libs << 'test'
  t.pattern = 'test/**/*_test.rb'
  t.verbose = true
end
 
desc 'Default: run unit tests.'
task :default => :test
 
task :changelog do
 
  changelog_file = 'CHANGELOG'
  entries = ""
 
  # Get a list of current tags
  tags = `git tag -l`.split
 
  # If we already have a changelog, make the last tag be the
  # last one in the changelog, and the next one be the one
  # following that in the tag list
  if File.exist?(changelog_file)
    entries = File.read(changelog_file)
    head = entries.split.first
    if head =~ /\d\.\d\.\d/
      last_tag = "v#{head}"
      idx = tags.index(last_tag)
      current_tag = tags[idx + 1]
    end
  end
 
  # Figure out last/current tags and do some validation
  last_tag ||= tags[-2]
  current_tag ||= tags[-1]
 
  if last_tag.nil? && current_tag.nil?
    puts "Cannot generate a changelog without first tagging your repository"
    puts "Tags should be in the form vN.N.N"
    exit
  end
 
  if last_tag == current_tag
    puts "Nothing to do for equal revisions: #{last_tag}..#{current_tag}"
    exit
  end
 
 
  # Generate changelog from repo
  log=`git log --pretty='format:%s <%h> [%cn]' #{last_tag}..#{current_tag}`
 
  # Strip out maintenance entries
  log = log.to_a.delete_if {|l| l =~ /^Regenerated gemspec/ || l =~ /^Version bump/ || l =~ /^Updated changelog/ }
 
  # Write out changelog file
  File.open(changelog_file, 'w') do |out|
    out.puts current_tag.gsub(/^v/, '')
    out.puts "-----"
    out.puts "\n"
    out.puts log
    out.puts "\n"
    out.puts entries
  end
 
  # Commit and push
  sh "git ci -m'Updated changelog' #{changelog_file}"
  sh "git push"
end
 
task :my_release => ['version:bump:patch', 'release', 'changelog', 'gemcutter:release'] do
end