Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 121 lines (97 sloc) 3.747 kB
bc2a64e @wr0ngway Initial version
wr0ngway authored
1 require 'rake'
2 require 'rake/testtask'
3
bf90879 @wr0ngway jeweller for gems
wr0ngway authored
4 begin
5 require 'jeweler'
6 Jeweler::Tasks.new do |s|
7 s.name = "rubber"
ff1791c @wr0ngway helper script for running vulcanize outside of rails
wr0ngway authored
8 s.executables = "vulcanize"
bf90879 @wr0ngway jeweller for gems
wr0ngway authored
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"
ef0a279 @wr0ngway Add rubber to gemfile when generating if needed
wr0ngway authored
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
bf90879 @wr0ngway jeweller for gems
wr0ngway authored
20 s.rubyforge_project = 'rubber'
21 s.authors = ["Matt Conway"]
c9c3e52 @wr0ngway add rails/init.rb to gemspec, automate gemcutter gem creation
wr0ngway authored
22 s.files = FileList["[A-Z][A-Z]*", "{bin,generators,lib,rails,recipes}/**/*"]
ce9617b @nirvdrum Work around issue with capistrano 2.5.16.
nirvdrum authored
23 s.add_dependency 'capistrano', '>= 2.4.0'
90b20ba @nirvdrum We need a newer amazon-ec2 for tags support.
nirvdrum authored
24 s.add_dependency 'amazon-ec2', '>= 0.9.17'
bf90879 @wr0ngway jeweller for gems
wr0ngway authored
25 s.add_dependency 'aws-s3'
26 s.add_dependency 'nettica'
0d30207 @nirvdrum Added a warning message about upgrading rubber and RVM.
nirvdrum authored
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
bf90879 @wr0ngway jeweller for gems
wr0ngway authored
44 end
44d989b @wr0ngway add gemcutter, simplify changelog
wr0ngway authored
45 Jeweler::GemcutterTasks.new
bf90879 @wr0ngway jeweller for gems
wr0ngway authored
46 rescue LoadError
b5539b5 @nirvdrum Jeweler is available on gemcutter.
nirvdrum authored
47 puts "Jeweler not available. Install it with: sudo gem install jeweler"
bf90879 @wr0ngway jeweller for gems
wr0ngway authored
48 end
bc2a64e @wr0ngway Initial version
wr0ngway authored
49
44d989b @wr0ngway add gemcutter, simplify changelog
wr0ngway authored
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
06475d9 @wr0ngway add changelog generation
wr0ngway authored
61 task :changelog do
62
44d989b @wr0ngway add gemcutter, simplify changelog
wr0ngway authored
63 changelog_file = 'CHANGELOG'
64 entries = ""
65
66 # Get a list of current tags
06475d9 @wr0ngway add changelog generation
wr0ngway authored
67 tags = `git tag -l`.split
c5a8d83 @wr0ngway fix changelog gen
wr0ngway authored
68 tags = tags.sort_by {|t| t[1..-1].split(".").collect {|s| s.to_i } }
44d989b @wr0ngway add gemcutter, simplify changelog
wr0ngway authored
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)
06475d9 @wr0ngway add changelog generation
wr0ngway authored
74 head = entries.split.first
75 if head =~ /\d\.\d\.\d/
76 last_tag = "v#{head}"
77 idx = tags.index(last_tag)
44d989b @wr0ngway add gemcutter, simplify changelog
wr0ngway authored
78 current_tag = tags[idx + 1]
06475d9 @wr0ngway add changelog generation
wr0ngway authored
79 end
80 end
81
44d989b @wr0ngway add gemcutter, simplify changelog
wr0ngway authored
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
06475d9 @wr0ngway add changelog generation
wr0ngway authored
91
92 if last_tag == current_tag
93 puts "Nothing to do for equal revisions: #{last_tag}..#{current_tag}"
94 exit
95 end
44d989b @wr0ngway add gemcutter, simplify changelog
wr0ngway authored
96
97
98 # Generate changelog from repo
06475d9 @wr0ngway add changelog generation
wr0ngway authored
99 log=`git log --pretty='format:%s <%h> [%cn]' #{last_tag}..#{current_tag}`
44d989b @wr0ngway add gemcutter, simplify changelog
wr0ngway authored
100
101 # Strip out maintenance entries
6e08329 @wr0ngway fix for ruby1.9
wr0ngway authored
102 log = log.lines.to_a.delete_if {|l| l =~ /^Regenerated gemspec/ || l =~ /^Version bump/ || l =~ /^Updated changelog/ }
06475d9 @wr0ngway add changelog generation
wr0ngway authored
103
44d989b @wr0ngway add gemcutter, simplify changelog
wr0ngway authored
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
06475d9 @wr0ngway add changelog generation
wr0ngway authored
112 end
113
44d989b @wr0ngway add gemcutter, simplify changelog
wr0ngway authored
114 # Commit and push
115 sh "git ci -m'Updated changelog' #{changelog_file}"
116 sh "git push"
bc2a64e @wr0ngway Initial version
wr0ngway authored
117 end
bf90879 @wr0ngway jeweller for gems
wr0ngway authored
118
f04deb1 @nirvdrum It's no longer gemcutter:release.
nirvdrum authored
119 task :my_release => ['release', 'changelog', 'release'] do
44d989b @wr0ngway add gemcutter, simplify changelog
wr0ngway authored
120 end
Something went wrong with that request. Please try again.