snooze 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +12 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +26 -0
- data/LICENSE +20 -0
- data/README.rdoc +23 -0
- data/Rakefile +8 -0
- data/bin/snooze +8 -0
- data/lib/snooze.rb +7 -0
- data/snooze.gemspec +33 -0
- data/spec/spec_helper.rb +10 -0
- data/tasks/github-gem.rake +367 -0
- metadata +100 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
Snooze (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.2.1)
|
10
|
+
rake (10.0.3)
|
11
|
+
rspec (2.13.0)
|
12
|
+
rspec-core (~> 2.13.0)
|
13
|
+
rspec-expectations (~> 2.13.0)
|
14
|
+
rspec-mocks (~> 2.13.0)
|
15
|
+
rspec-core (2.13.0)
|
16
|
+
rspec-expectations (2.13.0)
|
17
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
18
|
+
rspec-mocks (2.13.0)
|
19
|
+
|
20
|
+
PLATFORMS
|
21
|
+
ruby
|
22
|
+
|
23
|
+
DEPENDENCIES
|
24
|
+
Snooze!
|
25
|
+
rake
|
26
|
+
rspec (~> 2.8)
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013-2014 Bart ten Brinke
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
= Snooze
|
2
|
+
|
3
|
+
For devops who run recurring jobs like rake tasks or bas scripts,
|
4
|
+
Snooze.io is a notification service that tells you when something is wrong.
|
5
|
+
Unlike just alerting when a job breaks, Snooze also alerts when a job did not run at all.
|
6
|
+
|
7
|
+
== Installation & basic usage
|
8
|
+
|
9
|
+
Log in to http://www.snooze.io and create your account
|
10
|
+
|
11
|
+
Install Snooze a Ruby gem:
|
12
|
+
|
13
|
+
$ gem install snooze
|
14
|
+
|
15
|
+
TODO: ADD More info here
|
16
|
+
|
17
|
+
== Additional information
|
18
|
+
|
19
|
+
Snooze was designed and built by Bart ten Brinke from Retrosync.
|
20
|
+
If you have any issues, the fastest way to contact me is either through github or via email. (contact@snooze.io)
|
21
|
+
|
22
|
+
* Snooze homepage: http://www.snooze.io
|
23
|
+
* Retrosync homepage: http://www.retrosync.com
|
data/Rakefile
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
Dir[File.dirname(__FILE__) + "/tasks/*.rake"].each { |file| load(file) }
|
2
|
+
|
3
|
+
# Create rake tasks for a gem manages by github. The tasks are created in the
|
4
|
+
# gem namespace
|
5
|
+
GithubGem::RakeTasks.new(:gem)
|
6
|
+
|
7
|
+
# Set the RSpec runner with specdoc output as default task.
|
8
|
+
task :default => "spec:specdoc"
|
data/bin/snooze
ADDED
data/lib/snooze.rb
ADDED
data/snooze.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "snooze"
|
3
|
+
|
4
|
+
# Do not set the version and date field manually, this is done by the release script
|
5
|
+
s.version = "0.2.0"
|
6
|
+
s.date = "2013-03-05"
|
7
|
+
|
8
|
+
s.bindir = 'bin'
|
9
|
+
s.executables = ['snooze']
|
10
|
+
s.default_executable = 'snooze'
|
11
|
+
|
12
|
+
s.summary = "A command line tool to inform the webservice at snooze.io that a job has run."
|
13
|
+
s.description = <<-eos
|
14
|
+
For devops who run recurring jobs like rake tasks or bas scripts,
|
15
|
+
Snooze.io is a notification service that tells you when something is wrong.
|
16
|
+
Unlike just alerting when a job breaks, Snooze also alerts when a job did not run at all.
|
17
|
+
eos
|
18
|
+
|
19
|
+
s.rdoc_options << '--title' << s.name << '--main' << 'README.rdoc' << '--line-numbers' << '--inline-source'
|
20
|
+
s.extra_rdoc_files = ['README.rdoc']
|
21
|
+
|
22
|
+
s.add_development_dependency('rake')
|
23
|
+
s.add_development_dependency('rspec', '~> 2.8')
|
24
|
+
|
25
|
+
s.authors = ['Bart ten Brinke']
|
26
|
+
s.email = ['contact@snooze.io']
|
27
|
+
s.homepage = 'http://snooze.io'
|
28
|
+
|
29
|
+
# The files and test_files directives are set automatically by the release script.
|
30
|
+
# Do not change them by hand, but make sure to add the files to the git repository.
|
31
|
+
s.files = %w(.gitignore Gemfile Gemfile.lock LICENSE README.rdoc Rakefile bin/snooze lib/snooze.rb snooze.gemspec spec/spec_helper.rb tasks/github-gem.rake)
|
32
|
+
s.test_files = %w()
|
33
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,367 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/tasklib'
|
4
|
+
require 'date'
|
5
|
+
require 'set'
|
6
|
+
|
7
|
+
module GithubGem
|
8
|
+
|
9
|
+
# Detects the gemspc file of this project using heuristics.
|
10
|
+
def self.detect_gemspec_file
|
11
|
+
FileList['*.gemspec'].first
|
12
|
+
end
|
13
|
+
|
14
|
+
# Detects the main include file of this project using heuristics
|
15
|
+
def self.detect_main_include
|
16
|
+
if File.exist?(File.expand_path("../lib/#{File.basename(detect_gemspec_file, '.gemspec').gsub(/-/, '/')}.rb", detect_gemspec_file))
|
17
|
+
"lib/#{File.basename(detect_gemspec_file, '.gemspec').gsub(/-/, '/')}.rb"
|
18
|
+
elsif FileList['lib/*.rb'].length == 1
|
19
|
+
FileList['lib/*.rb'].first
|
20
|
+
else
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class RakeTasks
|
26
|
+
|
27
|
+
include Rake::DSL if Rake.const_defined?('DSL')
|
28
|
+
|
29
|
+
attr_reader :gemspec, :modified_files
|
30
|
+
attr_accessor :gemspec_file, :task_namespace, :main_include, :root_dir, :spec_pattern, :test_pattern, :remote, :remote_branch, :local_branch
|
31
|
+
|
32
|
+
# Initializes the settings, yields itself for configuration
|
33
|
+
# and defines the rake tasks based on the gemspec file.
|
34
|
+
def initialize(task_namespace = :gem)
|
35
|
+
@gemspec_file = GithubGem.detect_gemspec_file
|
36
|
+
@task_namespace = task_namespace
|
37
|
+
@main_include = GithubGem.detect_main_include
|
38
|
+
@modified_files = Set.new
|
39
|
+
@root_dir = Dir.pwd
|
40
|
+
@test_pattern = 'test/**/*_test.rb'
|
41
|
+
@spec_pattern = 'spec/**/*_spec.rb'
|
42
|
+
@local_branch = 'master'
|
43
|
+
@remote = 'origin'
|
44
|
+
@remote_branch = 'master'
|
45
|
+
|
46
|
+
yield(self) if block_given?
|
47
|
+
|
48
|
+
load_gemspec!
|
49
|
+
define_tasks!
|
50
|
+
end
|
51
|
+
|
52
|
+
protected
|
53
|
+
|
54
|
+
def git
|
55
|
+
@git ||= ENV['GIT'] || 'git'
|
56
|
+
end
|
57
|
+
|
58
|
+
# Define Unit test tasks
|
59
|
+
def define_test_tasks!
|
60
|
+
require 'rake/testtask'
|
61
|
+
|
62
|
+
namespace(:test) do
|
63
|
+
Rake::TestTask.new(:basic) do |t|
|
64
|
+
t.pattern = test_pattern
|
65
|
+
t.verbose = true
|
66
|
+
t.libs << 'test'
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
desc "Run all unit tests for #{gemspec.name}"
|
71
|
+
task(:test => ['test:basic'])
|
72
|
+
end
|
73
|
+
|
74
|
+
# Defines RSpec tasks
|
75
|
+
def define_rspec_tasks!
|
76
|
+
require 'rspec/core/rake_task'
|
77
|
+
|
78
|
+
namespace(:spec) do
|
79
|
+
desc "Verify all RSpec examples for #{gemspec.name}"
|
80
|
+
RSpec::Core::RakeTask.new(:basic) do |t|
|
81
|
+
t.pattern = spec_pattern
|
82
|
+
end
|
83
|
+
|
84
|
+
desc "Verify all RSpec examples for #{gemspec.name} and output specdoc"
|
85
|
+
RSpec::Core::RakeTask.new(:specdoc) do |t|
|
86
|
+
t.pattern = spec_pattern
|
87
|
+
t.rspec_opts = ['--format', 'documentation', '--color']
|
88
|
+
end
|
89
|
+
|
90
|
+
desc "Run RCov on specs for #{gemspec.name}"
|
91
|
+
RSpec::Core::RakeTask.new(:rcov) do |t|
|
92
|
+
t.pattern = spec_pattern
|
93
|
+
t.rcov = true
|
94
|
+
t.rcov_opts = ['--exclude', '"spec/*,gems/*"', '--rails']
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
desc "Verify all RSpec examples for #{gemspec.name} and output specdoc"
|
99
|
+
task(:spec => ['spec:specdoc'])
|
100
|
+
end
|
101
|
+
|
102
|
+
# Defines the rake tasks
|
103
|
+
def define_tasks!
|
104
|
+
|
105
|
+
define_test_tasks! if has_tests?
|
106
|
+
define_rspec_tasks! if has_specs?
|
107
|
+
|
108
|
+
namespace(@task_namespace) do
|
109
|
+
desc "Updates the filelist in the gemspec file"
|
110
|
+
task(:manifest) { manifest_task }
|
111
|
+
|
112
|
+
desc "Builds the .gem package"
|
113
|
+
task(:build => :manifest) { build_task }
|
114
|
+
|
115
|
+
desc "Sets the version of the gem in the gemspec"
|
116
|
+
task(:set_version => [:check_version, :check_current_branch]) { version_task }
|
117
|
+
task(:check_version => :fetch_origin) { check_version_task }
|
118
|
+
|
119
|
+
task(:fetch_origin) { fetch_origin_task }
|
120
|
+
task(:check_current_branch) { check_current_branch_task }
|
121
|
+
task(:check_clean_status) { check_clean_status_task }
|
122
|
+
task(:check_not_diverged => :fetch_origin) { check_not_diverged_task }
|
123
|
+
|
124
|
+
checks = [:check_current_branch, :check_clean_status, :check_not_diverged, :check_version]
|
125
|
+
checks.unshift('spec:basic') if has_specs?
|
126
|
+
checks.unshift('test:basic') if has_tests?
|
127
|
+
# checks.push << [:check_rubyforge] if gemspec.rubyforge_project
|
128
|
+
|
129
|
+
desc "Perform all checks that would occur before a release"
|
130
|
+
task(:release_checks => checks)
|
131
|
+
|
132
|
+
release_tasks = [:release_checks, :set_version, :build, :github_release, :gemcutter_release]
|
133
|
+
# release_tasks << [:rubyforge_release] if gemspec.rubyforge_project
|
134
|
+
|
135
|
+
desc "Release a new version of the gem using the VERSION environment variable"
|
136
|
+
task(:release => release_tasks) { release_task }
|
137
|
+
|
138
|
+
namespace(:release) do
|
139
|
+
desc "Release the next version of the gem, by incrementing the last version segment by 1"
|
140
|
+
task(:next => [:next_version] + release_tasks) { release_task }
|
141
|
+
|
142
|
+
desc "Release the next version of the gem, using a patch increment (0.0.1)"
|
143
|
+
task(:patch => [:next_patch_version] + release_tasks) { release_task }
|
144
|
+
|
145
|
+
desc "Release the next version of the gem, using a minor increment (0.1.0)"
|
146
|
+
task(:minor => [:next_minor_version] + release_tasks) { release_task }
|
147
|
+
|
148
|
+
desc "Release the next version of the gem, using a major increment (1.0.0)"
|
149
|
+
task(:major => [:next_major_version] + release_tasks) { release_task }
|
150
|
+
end
|
151
|
+
|
152
|
+
# task(:check_rubyforge) { check_rubyforge_task }
|
153
|
+
# task(:rubyforge_release) { rubyforge_release_task }
|
154
|
+
task(:gemcutter_release) { gemcutter_release_task }
|
155
|
+
task(:github_release => [:commit_modified_files, :tag_version]) { github_release_task }
|
156
|
+
task(:tag_version) { tag_version_task }
|
157
|
+
task(:commit_modified_files) { commit_modified_files_task }
|
158
|
+
|
159
|
+
task(:next_version) { next_version_task }
|
160
|
+
task(:next_patch_version) { next_version_task(:patch) }
|
161
|
+
task(:next_minor_version) { next_version_task(:minor) }
|
162
|
+
task(:next_major_version) { next_version_task(:major) }
|
163
|
+
|
164
|
+
desc "Updates the gem release tasks with the latest version on Github"
|
165
|
+
task(:update_tasks) { update_tasks_task }
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
# Updates the files list and test_files list in the gemspec file using the list of files
|
170
|
+
# in the repository and the spec/test file pattern.
|
171
|
+
def manifest_task
|
172
|
+
# Load all the gem's files using "git ls-files"
|
173
|
+
repository_files = `#{git} ls-files`.split("\n")
|
174
|
+
test_files = Dir[test_pattern] + Dir[spec_pattern]
|
175
|
+
|
176
|
+
update_gemspec(:files, repository_files)
|
177
|
+
update_gemspec(:test_files, repository_files & test_files)
|
178
|
+
end
|
179
|
+
|
180
|
+
# Builds the gem
|
181
|
+
def build_task
|
182
|
+
sh "gem build -q #{gemspec_file}"
|
183
|
+
Dir.mkdir('pkg') unless File.exist?('pkg')
|
184
|
+
sh "mv #{gemspec.name}-#{gemspec.version}.gem pkg/#{gemspec.name}-#{gemspec.version}.gem"
|
185
|
+
end
|
186
|
+
|
187
|
+
def newest_version
|
188
|
+
`#{git} tag`.split("\n").map { |tag| tag.split('-').last }.compact.map { |v| Gem::Version.new(v) }.max || Gem::Version.new('0.0.0')
|
189
|
+
end
|
190
|
+
|
191
|
+
def next_version(increment = nil)
|
192
|
+
next_version = newest_version.segments
|
193
|
+
increment_index = case increment
|
194
|
+
when :micro then 3
|
195
|
+
when :patch then 2
|
196
|
+
when :minor then 1
|
197
|
+
when :major then 0
|
198
|
+
else next_version.length - 1
|
199
|
+
end
|
200
|
+
|
201
|
+
next_version[increment_index] ||= 0
|
202
|
+
next_version[increment_index] = next_version[increment_index].succ
|
203
|
+
((increment_index + 1)...next_version.length).each { |i| next_version[i] = 0 }
|
204
|
+
|
205
|
+
Gem::Version.new(next_version.join('.'))
|
206
|
+
end
|
207
|
+
|
208
|
+
def next_version_task(increment = nil)
|
209
|
+
ENV['VERSION'] = next_version(increment).version
|
210
|
+
puts "Releasing version #{ENV['VERSION']}..."
|
211
|
+
end
|
212
|
+
|
213
|
+
# Updates the version number in the gemspec file, the VERSION constant in the main
|
214
|
+
# include file and the contents of the VERSION file.
|
215
|
+
def version_task
|
216
|
+
update_gemspec(:version, ENV['VERSION']) if ENV['VERSION']
|
217
|
+
update_gemspec(:date, Date.today)
|
218
|
+
|
219
|
+
update_version_file(gemspec.version)
|
220
|
+
update_version_constant(gemspec.version)
|
221
|
+
end
|
222
|
+
|
223
|
+
def check_version_task
|
224
|
+
raise "#{ENV['VERSION']} is not a valid version number!" if ENV['VERSION'] && !Gem::Version.correct?(ENV['VERSION'])
|
225
|
+
proposed_version = Gem::Version.new((ENV['VERSION'] || gemspec.version).dup)
|
226
|
+
raise "This version (#{proposed_version}) is not higher than the highest tagged version (#{newest_version})" if newest_version >= proposed_version
|
227
|
+
end
|
228
|
+
|
229
|
+
# Checks whether the current branch is not diverged from the remote branch
|
230
|
+
def check_not_diverged_task
|
231
|
+
raise "The current branch is diverged from the remote branch!" if `#{git} rev-list HEAD..#{remote}/#{remote_branch}`.split("\n").any?
|
232
|
+
end
|
233
|
+
|
234
|
+
# Checks whether the repository status ic clean
|
235
|
+
def check_clean_status_task
|
236
|
+
raise "The current working copy contains modifications" if `#{git} ls-files -m`.split("\n").any?
|
237
|
+
end
|
238
|
+
|
239
|
+
# Checks whether the current branch is correct
|
240
|
+
def check_current_branch_task
|
241
|
+
raise "Currently not on #{local_branch} branch!" unless `#{git} branch`.split("\n").detect { |b| /^\* / =~ b } == "* #{local_branch}"
|
242
|
+
end
|
243
|
+
|
244
|
+
# Fetches the latest updates from Github
|
245
|
+
def fetch_origin_task
|
246
|
+
sh git, 'fetch', remote
|
247
|
+
end
|
248
|
+
|
249
|
+
# Commits every file that has been changed by the release task.
|
250
|
+
def commit_modified_files_task
|
251
|
+
really_modified = `#{git} ls-files -m #{modified_files.entries.join(' ')}`.split("\n")
|
252
|
+
if really_modified.any?
|
253
|
+
really_modified.each { |file| sh git, 'add', file }
|
254
|
+
sh git, 'commit', '-m', "Released #{gemspec.name} gem version #{gemspec.version}."
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
# Adds a tag for the released version
|
259
|
+
def tag_version_task
|
260
|
+
sh git, 'tag', '-a', "#{gemspec.name}-#{gemspec.version}", '-m', "Released #{gemspec.name} gem version #{gemspec.version}."
|
261
|
+
end
|
262
|
+
|
263
|
+
# Pushes the changes and tag to github
|
264
|
+
def github_release_task
|
265
|
+
sh git, 'push', '--tags', remote, remote_branch
|
266
|
+
end
|
267
|
+
|
268
|
+
def gemcutter_release_task
|
269
|
+
sh "gem", 'push', "pkg/#{gemspec.name}-#{gemspec.version}.gem"
|
270
|
+
end
|
271
|
+
|
272
|
+
# Gem release task.
|
273
|
+
# All work is done by the task's dependencies, so just display a release completed message.
|
274
|
+
def release_task
|
275
|
+
puts
|
276
|
+
puts "Release successful."
|
277
|
+
end
|
278
|
+
|
279
|
+
private
|
280
|
+
|
281
|
+
# Checks whether this project has any RSpec files
|
282
|
+
def has_specs?
|
283
|
+
FileList[spec_pattern].any?
|
284
|
+
end
|
285
|
+
|
286
|
+
# Checks whether this project has any unit test files
|
287
|
+
def has_tests?
|
288
|
+
FileList[test_pattern].any?
|
289
|
+
end
|
290
|
+
|
291
|
+
# Loads the gemspec file
|
292
|
+
def load_gemspec!
|
293
|
+
@gemspec = eval(File.read(@gemspec_file))
|
294
|
+
end
|
295
|
+
|
296
|
+
# Updates the VERSION file with the new version
|
297
|
+
def update_version_file(version)
|
298
|
+
if File.exists?('VERSION')
|
299
|
+
File.open('VERSION', 'w') { |f| f << version.to_s }
|
300
|
+
modified_files << 'VERSION'
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
# Updates the VERSION constant in the main include file if it exists
|
305
|
+
def update_version_constant(version)
|
306
|
+
if main_include && File.exist?(main_include)
|
307
|
+
file_contents = File.read(main_include)
|
308
|
+
if file_contents.sub!(/^(\s+VERSION\s*=\s*)[^\s].*$/) { $1 + version.to_s.inspect }
|
309
|
+
File.open(main_include, 'w') { |f| f << file_contents }
|
310
|
+
modified_files << main_include
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
# Updates an attribute of the gemspec file.
|
316
|
+
# This function will open the file, and search/replace the attribute using a regular expression.
|
317
|
+
def update_gemspec(attribute, new_value, literal = false)
|
318
|
+
|
319
|
+
unless literal
|
320
|
+
new_value = case new_value
|
321
|
+
when Array then "%w(#{new_value.join(' ')})"
|
322
|
+
when Hash, String then new_value.inspect
|
323
|
+
when Date then new_value.strftime('%Y-%m-%d').inspect
|
324
|
+
else raise "Cannot write value #{new_value.inspect} to gemspec file!"
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
spec = File.read(gemspec_file)
|
329
|
+
regexp = Regexp.new('^(\s+\w+\.' + Regexp.quote(attribute.to_s) + '\s*=\s*)[^\s].*$')
|
330
|
+
if spec.sub!(regexp) { $1 + new_value }
|
331
|
+
File.open(gemspec_file, 'w') { |f| f << spec }
|
332
|
+
modified_files << gemspec_file
|
333
|
+
|
334
|
+
# Reload the gemspec so the changes are incorporated
|
335
|
+
load_gemspec!
|
336
|
+
|
337
|
+
# Also mark the Gemfile.lock file as changed because of the new version.
|
338
|
+
modified_files << 'Gemfile.lock' if File.exist?(File.join(root_dir, 'Gemfile.lock'))
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
# Updates the tasks file using the latest file found on Github
|
343
|
+
def update_tasks_task
|
344
|
+
require 'net/https'
|
345
|
+
require 'uri'
|
346
|
+
|
347
|
+
uri = URI.parse('https://raw.github.com/wvanbergen/github-gem/master/tasks/github-gem.rake')
|
348
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
349
|
+
http.use_ssl = true
|
350
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
351
|
+
response = http.request(Net::HTTP::Get.new(uri.path))
|
352
|
+
|
353
|
+
if Net::HTTPSuccess === response
|
354
|
+
open(__FILE__, "w") { |file| file.write(response.body) }
|
355
|
+
relative_file = File.expand_path(__FILE__).sub(%r[^#{@root_dir}/], '')
|
356
|
+
if `#{git} ls-files -m #{relative_file}`.split("\n").any?
|
357
|
+
sh git, 'add', relative_file
|
358
|
+
sh git, 'commit', '-m', "Updated to latest gem release management tasks."
|
359
|
+
else
|
360
|
+
puts "Release managament tasks already are at the latest version."
|
361
|
+
end
|
362
|
+
else
|
363
|
+
raise "Download failed with HTTP status #{response.code}!"
|
364
|
+
end
|
365
|
+
end
|
366
|
+
end
|
367
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: snooze
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Bart ten Brinke
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '2.8'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.8'
|
46
|
+
description: ! " For devops who run recurring jobs like rake tasks or bas scripts,\n
|
47
|
+
\ Snooze.io is a notification service that tells you when something is wrong.\n
|
48
|
+
\ Unlike just alerting when a job breaks, Snooze also alerts when a job did not
|
49
|
+
run at all.\n"
|
50
|
+
email:
|
51
|
+
- contact@snooze.io
|
52
|
+
executables:
|
53
|
+
- snooze
|
54
|
+
extensions: []
|
55
|
+
extra_rdoc_files:
|
56
|
+
- README.rdoc
|
57
|
+
files:
|
58
|
+
- .gitignore
|
59
|
+
- Gemfile
|
60
|
+
- Gemfile.lock
|
61
|
+
- LICENSE
|
62
|
+
- README.rdoc
|
63
|
+
- Rakefile
|
64
|
+
- bin/snooze
|
65
|
+
- lib/snooze.rb
|
66
|
+
- snooze.gemspec
|
67
|
+
- spec/spec_helper.rb
|
68
|
+
- tasks/github-gem.rake
|
69
|
+
homepage: http://snooze.io
|
70
|
+
licenses: []
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options:
|
73
|
+
- --title
|
74
|
+
- snooze
|
75
|
+
- --main
|
76
|
+
- README.rdoc
|
77
|
+
- --line-numbers
|
78
|
+
- --inline-source
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 1.8.24
|
96
|
+
signing_key:
|
97
|
+
specification_version: 3
|
98
|
+
summary: A command line tool to inform the webservice at snooze.io that a job has
|
99
|
+
run.
|
100
|
+
test_files: []
|