Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 209 lines (176 sloc) 5.914 kB
34a3106 Added hoptoad_notifier
jyurek authored
1 require 'rake'
2 require 'rake/testtask'
3 require 'rake/rdoctask'
bf486bb @jferris Addd a gemspec
jferris authored
4 require 'rake/gempackagetask'
7df97d7 @jferris Added a test for the installation process
jferris authored
5 require 'cucumber/rake/task'
34a3106 Added hoptoad_notifier
jyurek authored
6
7 desc 'Default: run unit tests.'
7df97d7 @jferris Added a test for the installation process
jferris authored
8 task :default => [:test, :cucumber]
34a3106 Added hoptoad_notifier
jyurek authored
9
e1e6a38 @mike-burns Change wording to refer to the gem instead of plugin, and start a lis…
mike-burns authored
10 desc 'Test the hoptoad_notifier gem.'
34a3106 Added hoptoad_notifier
jyurek authored
11 Rake::TestTask.new(:test) do |t|
12 t.libs << 'lib'
13 t.pattern = 'test/**/*_test.rb'
14 t.verbose = true
15 end
16
b1ece68 @qrush Vendoring ginger and adding rake ginger task
qrush authored
17 desc 'Run ginger tests'
18 task :ginger do
19 $LOAD_PATH << File.join(*%w[vendor ginger lib])
20 ARGV.clear
21 ARGV << 'test'
22 load File.join(*%w[vendor ginger bin ginger])
23 end
c4e26cb @qrush Starting YARD'ing up the plugin
qrush authored
24
fd02920 @qrush Adding changeling:minor and changeling:patch to automate notifier rel…
qrush authored
25 namespace :changeling do
26 desc "Bumps the version by a minor or patch version, depending on what was passed in."
27 task :bump, :part do |t, args|
28 # Thanks, Jeweler!
29 if HoptoadNotifier::VERSION =~ /^(\d+)\.(\d+)\.(\d+)(?:\.(.*?))?$/
30 major = $1.to_i
31 minor = $2.to_i
32 patch = $3.to_i
33 build = $4
34 else
35 abort
36 end
37
38 case args[:part]
39 when /minor/
40 minor += 1
41 patch = 0
42 when /patch/
43 patch += 1
44 else
45 abort
46 end
47
48 version = [major, minor, patch, build].compact.join('.')
49
50 File.open(File.join("lib", "hoptoad_notifier", "version.rb"), "w") do |f|
51 f.write <<EOF
52 module HoptoadNotifier
53 VERSION = "#{version}".freeze
54 end
55 EOF
56 end
57 end
58
59 desc "Writes out the new CHANGELOG and prepares the release"
60 task :change do
61 load 'lib/hoptoad_notifier/version.rb'
62 file = "CHANGELOG"
63 old = File.read(file)
64 version = HoptoadNotifier::VERSION
65 message = "Bumping to version #{version}"
66
67 File.open(file, "w") do |f|
68 f.write <<EOF
69 Version #{version} - #{Date.today}
70 ===============================================================================
71
72 #{`git log $(git tag | tail -1)..HEAD | git shortlog`}
73 #{old}
74 EOF
75 end
76
77 exec ["#{ENV["EDITOR"]} #{file}",
78 "git commit -aqm '#{message}'",
79 "git tag -a -m '#{message}' v#{version}",
5948491 @qrush Adding rake changeling:push
qrush authored
80 "echo '\n\n\033[32mMarked v#{version} /' `git show-ref -s refs/heads/master` 'for release. Run: rake changeling:push\033[0m\n\n'"].join(' && ')
fd02920 @qrush Adding changeling:minor and changeling:patch to automate notifier rel…
qrush authored
81 end
82
83 desc "Bump by a minor version (1.2.3 => 1.3.0)"
84 task :minor do |t|
85 Rake::Task['changeling:bump'].invoke(t.name)
86 Rake::Task['changeling:change'].invoke
87 end
88
89 desc "Bump by a patch version, (1.2.3 => 1.2.4)"
90 task :patch do |t|
91 Rake::Task['changeling:bump'].invoke(t.name)
92 Rake::Task['changeling:change'].invoke
93 end
5948491 @qrush Adding rake changeling:push
qrush authored
94
95 desc "Push the latest version and tags"
96 task :push do |t|
97 system("git push origin master")
98 system("git push origin $(git tag | tail -1)")
99 end
fd02920 @qrush Adding changeling:minor and changeling:patch to automate notifier rel…
qrush authored
100 end
101
c4e26cb @qrush Starting YARD'ing up the plugin
qrush authored
102 begin
103 require 'yard'
104 YARD::Rake::YardocTask.new do |t|
df14a50 @qrush Removing INSTALL and making sure the testing and license file show up
qrush authored
105 t.files = ['lib/**/*.rb', 'TESTING.rdoc']
c4e26cb @qrush Starting YARD'ing up the plugin
qrush authored
106 end
107 rescue LoadError
108 end
bf486bb @jferris Addd a gemspec
jferris authored
109
7df97d7 @jferris Added a test for the installation process
jferris authored
110 GEM_ROOT = File.dirname(__FILE__).freeze
111 VERSION_FILE = File.join(GEM_ROOT, 'lib', 'hoptoad_notifier', 'version')
bf486bb @jferris Addd a gemspec
jferris authored
112
113 require VERSION_FILE
114
115 gemspec = Gem::Specification.new do |s|
116 s.name = %q{hoptoad_notifier}
117 s.version = HoptoadNotifier::VERSION
118 s.summary = %q{Send your application errors to our hosted service and reclaim your inbox.}
119
120 s.files = FileList['[A-Z]*', 'generators/**/*.*', 'lib/**/*.rb',
243db66 @jferris Include rescue.erb in the gem (bumped to 2.1.2)
jferris authored
121 'test/**/*.rb', 'rails/**/*.rb', 'script/*',
122 'lib/templates/*.erb']
bf486bb @jferris Addd a gemspec
jferris authored
123 s.require_path = 'lib'
124 s.test_files = Dir[*['test/**/*_test.rb']]
125
126 s.has_rdoc = true
127 s.extra_rdoc_files = ["README.rdoc"]
128 s.rdoc_options = ['--line-numbers', "--main", "README.rdoc"]
129
59a9be6 @qrush Bump to 2.1.3 and adding dependencies to the gemspec
qrush authored
130 s.add_runtime_dependency("activesupport")
131 s.add_development_dependency("activerecord")
132 s.add_development_dependency("actionpack")
133 s.add_development_dependency("jferris-mocha")
134 s.add_development_dependency("nokogiri")
135 s.add_development_dependency("shoulda")
136
bf486bb @jferris Addd a gemspec
jferris authored
137 s.authors = ["thoughtbot, inc"]
138 s.email = %q{support@hoptoadapp.com}
139 s.homepage = "http://www.hoptoadapp.com"
140
141 s.platform = Gem::Platform::RUBY
142 end
143
144 Rake::GemPackageTask.new gemspec do |pkg|
145 pkg.need_tar = true
146 pkg.need_zip = true
147 end
148
149 desc "Clean files generated by rake tasks"
150 task :clobber => [:clobber_rdoc, :clobber_package]
151
152 desc "Generate a gemspec file"
153 task :gemspec do
154 File.open("#{gemspec.name}.gemspec", 'w') do |f|
155 f.write gemspec.to_ruby
156 end
157 end
158
7df97d7 @jferris Added a test for the installation process
jferris authored
159 LOCAL_GEM_ROOT = File.join(GEM_ROOT, 'tmp', 'local_gems').freeze
1f87891 @jferris Added integration coverage and fixes for older versions of Rails
jferris authored
160 RAILS_VERSIONS = IO.read('SUPPORTED_RAILS_VERSIONS').strip.split("\n")
d071193 @jferris Added integration/readme coverage of Sinatra apps
jferris authored
161 LOCAL_GEMS = [['sham_rack', nil], ['capistrano', nil], ['sqlite3-ruby', nil], ['sinatra', nil]] +
1f87891 @jferris Added integration coverage and fixes for older versions of Rails
jferris authored
162 RAILS_VERSIONS.collect { |version| ['rails', version] }
7df97d7 @jferris Added a test for the installation process
jferris authored
163
164 task :vendor_test_gems do
8294dcd @jferris Restore gem path after vendoring
jferris authored
165 old_gem_path = ENV['GEM_PATH']
166 old_gem_home = ENV['GEM_HOME']
167 ENV['GEM_PATH'] = LOCAL_GEM_ROOT
168 ENV['GEM_HOME'] = LOCAL_GEM_ROOT
1f87891 @jferris Added integration coverage and fixes for older versions of Rails
jferris authored
169 LOCAL_GEMS.each do |gem_name, version|
170 gem_file_pattern = [gem_name, version || '*'].compact.join('-')
171 version_option = version ? "-v #{version}" : ''
172 pattern = File.join(LOCAL_GEM_ROOT, 'gems', "#{gem_file_pattern}")
7df97d7 @jferris Added a test for the installation process
jferris authored
173 existing = Dir.glob(pattern).first
174 unless existing
2f16e06 @jferris Less noisy
jferris authored
175 command = "gem install -i #{LOCAL_GEM_ROOT} --no-ri --no-rdoc --backtrace #{version_option} #{gem_name}"
1f87891 @jferris Added integration coverage and fixes for older versions of Rails
jferris authored
176 puts "Vendoring #{gem_file_pattern}..."
33eebc4 @jferris Fail loudly when a gem can't be vendored
jferris authored
177 unless system("#{command} 2>&1")
178 puts "Command failed: #{command}"
179 exit(1)
7df97d7 @jferris Added a test for the installation process
jferris authored
180 end
181 end
182 end
8294dcd @jferris Restore gem path after vendoring
jferris authored
183 ENV['GEM_PATH'] = old_gem_path
184 ENV['GEM_HOME'] = old_gem_home
7df97d7 @jferris Added a test for the installation process
jferris authored
185 end
186
187 Cucumber::Rake::Task.new(:cucumber) do |t|
188 t.fork = true
189 t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
190 end
191
192 task :cucumber => [:gemspec, :vendor_test_gems]
1f87891 @jferris Added integration coverage and fixes for older versions of Rails
jferris authored
193
194 namespace :cucumber do
195 namespace :rails do
6fbbe2b @jferris Added integration tests for rescuing
jferris authored
196 RAILS_VERSIONS.each do |version|
1f87891 @jferris Added integration coverage and fixes for older versions of Rails
jferris authored
197 desc "Test integration of the gem with Rails #{version}"
198 task version do
6fbbe2b @jferris Added integration tests for rescuing
jferris authored
199 puts "Testing Rails #{version}"
1f87891 @jferris Added integration coverage and fixes for older versions of Rails
jferris authored
200 ENV['RAILS_VERSION'] = version
201 system("cucumber --format progress features/rails.feature")
202 end
203 end
204
205 desc "Test integration of the gem with all Rails versions"
6fbbe2b @jferris Added integration tests for rescuing
jferris authored
206 task :all => RAILS_VERSIONS
1f87891 @jferris Added integration coverage and fixes for older versions of Rails
jferris authored
207 end
208 end
Something went wrong with that request. Please try again.