Permalink
Newer
Older
100644 121 lines (97 sloc) 3.67 KB
Matt Conway
Jan 25, 2008
1
require 'rake'
2
require 'rake/testtask'
3
Matt Conway
Jun 12, 2009
4
begin
5
require 'jeweler'
6
Jeweler::Tasks.new do |s|
7
s.name = "rubber"
8
s.executables = "vulcanize"
Matt Conway
Jun 12, 2009
9
s.summary = "A capistrano plugin for managing multi-instance deployments to the cloud (ec2)"
10
s.email = "matt@conwaysplace.com"
11
s.homepage = "http://github.com/wr0ngway/rubber"
12
s.description = <<-DESC
13
The rubber plugin enables relatively complex multi-instance deployments of RubyOnRails applications to
14
Amazon's Elastic Compute Cloud (EC2). Like capistrano, rubber is role based, so you can define a set
15
of configuration files for a role and then assign that role to as many concrete instances as needed. One
16
can also assign multiple roles to a single instance. This lets one start out with a single ec2 instance
17
(belonging to all roles), and add new instances into the mix as needed to scale specific facets of your
18
deployment, e.g. adding in instances that serve only as an 'app' role to handle increased app server load.
19
DESC
Matt Conway
Jun 12, 2009
20
s.rubyforge_project = 'rubber'
21
s.authors = ["Matt Conway"]
22
s.files = FileList["[A-Z][A-Z]*", "{bin,generators,lib,rails,recipes}/**/*"]
23
s.add_dependency 'capistrano', '>= 2.4.0'
24
s.add_dependency 'amazon-ec2', '>= 0.9.17'
Matt Conway
Jun 12, 2009
25
s.add_dependency 'aws-s3'
26
s.add_dependency 'nettica'
27
28
s.post_install_message = <<-POST_INSTALL_MESSAGE
29
30
#{"*" * 80}
31
32
Thank you for installing rubber. Please note that this is a major upgrade
33
and we've moved towards using RVM for Ruby configuration on your EC2 instances.
34
35
If you're upgrading rubber, please make sure to read the upgrade notes and
36
make the necessary configuration changes:
37
38
http://wiki.github.com/wr0ngway/rubber/upgrading
39
40
#{"*" * 80}
41
42
POST_INSTALL_MESSAGE
43
Matt Conway
Jun 12, 2009
44
end
45
Jeweler::GemcutterTasks.new
Matt Conway
Jun 12, 2009
46
rescue LoadError
47
puts "Jeweler not available. Install it with: sudo gem install jeweler"
Matt Conway
Jun 12, 2009
48
end
Matt Conway
Jan 25, 2008
49
50
desc 'Test the rubber plugin.'
51
Rake::TestTask.new(:test) do |t|
52
t.libs << 'lib'
53
t.libs << 'test'
54
t.pattern = 'test/**/*_test.rb'
55
t.verbose = true
56
end
57
58
desc 'Default: run unit tests.'
59
task :default => :test
60
61
task :changelog do
62
63
changelog_file = 'CHANGELOG'
64
entries = ""
65
66
# Get a list of current tags
67
tags = `git tag -l`.split
Matt Conway
Sep 11, 2010
68
tags = tags.sort_by {|t| t[1..-1].split(".").collect {|s| s.to_i } }
69
# If we already have a changelog, make the last tag be the
70
# last one in the changelog, and the next one be the one
71
# following that in the tag list
72
if File.exist?(changelog_file)
73
entries = File.read(changelog_file)
74
head = entries.split.first
75
if head =~ /\d\.\d\.\d/
76
last_tag = "v#{head}"
77
idx = tags.index(last_tag)
78
current_tag = tags[idx + 1]
79
end
80
end
81
82
# Figure out last/current tags and do some validation
83
last_tag ||= tags[-2]
84
current_tag ||= tags[-1]
85
86
if last_tag.nil? && current_tag.nil?
87
puts "Cannot generate a changelog without first tagging your repository"
88
puts "Tags should be in the form vN.N.N"
89
exit
90
end
91
92
if last_tag == current_tag
93
puts "Nothing to do for equal revisions: #{last_tag}..#{current_tag}"
94
exit
95
end
96
97
98
# Generate changelog from repo
99
log=`git log --pretty='format:%s <%h> [%cn]' #{last_tag}..#{current_tag}`
100
101
# Strip out maintenance entries
Matt Conway
Apr 12, 2010
102
log = log.lines.to_a.delete_if {|l| l =~ /^Regenerated gemspec/ || l =~ /^Version bump/ || l =~ /^Updated changelog/ }
103
104
# Write out changelog file
105
File.open(changelog_file, 'w') do |out|
106
out.puts current_tag.gsub(/^v/, '')
107
out.puts "-----"
108
out.puts "\n"
109
out.puts log
110
out.puts "\n"
111
out.puts entries
112
end
113
114
# Commit and push
115
sh "git ci -m'Updated changelog' #{changelog_file}"
116
sh "git push"
Matt Conway
Jan 25, 2008
117
end
Matt Conway
Jun 12, 2009
118
Matt Conway
Apr 5, 2010
119
task :my_release => ['release', 'changelog', 'gemcutter:release'] do