This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
forked from rubber/rubber
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
120 lines (97 loc) · 3.67 KB
/
Rakefile
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
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 = "[email protected]"
s.homepage = "http://github.com/wr0ngway/rubber"
s.description = <<-DESC
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.
DESC
s.rubyforge_project = 'rubber'
s.authors = ["Matt Conway"]
s.files = FileList["[A-Z][A-Z]*", "{bin,generators,lib,rails,recipes}/**/*"]
s.add_dependency 'capistrano', '>= 2.4.0'
s.add_dependency 'amazon-ec2', '>= 0.9.0'
s.add_dependency 'aws-s3'
s.add_dependency 'nettica'
s.post_install_message = <<-POST_INSTALL_MESSAGE
#{"*" * 80}
Thank you for installing rubber. Please note that this is a major upgrade
and we've moved towards using RVM for Ruby configuration on your EC2 instances.
If you're upgrading rubber, please make sure to read the upgrade notes and
make the necessary configuration changes:
http://wiki.github.com/wr0ngway/rubber/upgrading
#{"*" * 80}
POST_INSTALL_MESSAGE
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install jeweler"
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
tags = tags.sort_by {|t| t[1..-1].split(".").collect {|s| s.to_i } }
# 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.lines.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 => ['release', 'changelog', 'gemcutter:release'] do
end