rake-n-bake 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.semver +1 -1
- data/README.md +1 -1
- data/history.rdoc +2 -0
- data/lib/{assistant_baker.rb → baker.rb} +1 -1
- data/lib/rake-n-bake.rb +1 -1
- data/lib/semver_versioning.rb +9 -5
- data/lib/version.rb +1 -1
- data/spec/{assistant_baker_spec.rb → baker_spec.rb} +1 -1
- data/spec/semver_versioning_spec.rb +65 -22
- data/tasks/brakeman.rake +2 -2
- data/tasks/bundle-audit.rake +3 -3
- data/tasks/check_external_deps.rake +1 -1
- data/tasks/coverage.rake +6 -6
- data/tasks/fasterer.rake +2 -2
- data/tasks/metric_fu.rake +1 -1
- data/tasks/rails_best_practices.rake +2 -2
- data/tasks/rspec.rake +5 -5
- data/tasks/rubocop.rake +1 -1
- data/tasks/ruby_critic.rake +2 -2
- data/tasks/semver.rake +1 -2
- data/tasks/traceroute.rake +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48b193c4dd6c74aeddec374e3d7d4ca441cc8ea5
|
4
|
+
data.tar.gz: 0d504fc8b732db739a32392d3df497ef1bc4e364
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d48ae9d2f14f58703471ce23c6c229612c0d1d96dee0eb5c72b4f21647811a41704eb4b34c3e575644ae08190f92e921ad11bf2d80a9d48e85379c5ff8f971bc
|
7
|
+
data.tar.gz: 9a51d706fafd3ab1a9b4e0cb2eeff67aa1b8051b926b1d383d992f51d913e4d4120c5f997a6196c0c929c834e8a12749f2efbece2dc509c7520a505c800d412a
|
data/.semver
CHANGED
data/README.md
CHANGED
@@ -130,7 +130,7 @@ Runs [Traceroute](https://rubygems.org/gems/traceroute), a tool for finding unus
|
|
130
130
|
|
131
131
|
Handy Tips for new tasks
|
132
132
|
------------------------
|
133
|
-
- All tasks loaded by `lib/rake_n_bake.rb` will have access to the `RakeNBake::
|
133
|
+
- All tasks loaded by `lib/rake_n_bake.rb` will have access to the `RakeNBake::Baker`. This is intended for truely common things, like logging out when a particular step runs or passes.
|
134
134
|
|
135
135
|
Contributing
|
136
136
|
------------
|
data/history.rdoc
CHANGED
data/lib/rake-n-bake.rb
CHANGED
data/lib/semver_versioning.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'semver'
|
2
|
+
|
2
3
|
module RakeNBake
|
3
4
|
class SemverVersioning
|
4
5
|
def self.current_version
|
@@ -61,12 +62,16 @@ module RakeNBake
|
|
61
62
|
end
|
62
63
|
|
63
64
|
def self.update_version_rb
|
64
|
-
|
65
|
+
version_files = Dir.glob('lib{,/*}/version.rb').uniq
|
66
|
+
return unless version_files.size == 1
|
67
|
+
version_file = version_files[0]
|
68
|
+
|
65
69
|
version = current_version.to_s.sub(/^v/,'')
|
66
70
|
version_string = "VERSION = '#{version}'"
|
67
|
-
version_file_content = File.read(
|
68
|
-
|
69
|
-
|
71
|
+
version_file_content = File.read(version_file).sub(/VERSION = .*$/, version_string)
|
72
|
+
|
73
|
+
File.write(version_file, version_file_content)
|
74
|
+
`git add #{version_file}`
|
70
75
|
end
|
71
76
|
|
72
77
|
def self.tag
|
@@ -86,4 +91,3 @@ module RakeNBake
|
|
86
91
|
end
|
87
92
|
end
|
88
93
|
end
|
89
|
-
|
data/lib/version.rb
CHANGED
@@ -134,32 +134,75 @@ describe RakeNBake::SemverVersioning do
|
|
134
134
|
describe '#update_version_rb' do
|
135
135
|
before { File.write(project_root_file('.semver'), YAML.dump(version)) }
|
136
136
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
137
|
+
context 'when version.rb is in the top of the lib directory' do
|
138
|
+
around do |example|
|
139
|
+
FileUtils.cp 'lib/version.rb', 'lib/version.rb.orig'
|
140
|
+
example.run
|
141
|
+
FileUtils.mv 'lib/version.rb.orig', 'lib/version.rb'
|
142
|
+
`git reset lib/version.rb`
|
143
|
+
end
|
143
144
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
145
|
+
it 'writes the version into lib/version.rb' do
|
146
|
+
expect{ described_class.update_version_rb }
|
147
|
+
.to change{ File.read('lib/version.rb').include? "VERSION = '1.2.3'" }
|
148
|
+
.from(false)
|
149
|
+
.to(true)
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'does nothing if lib/version.rb does not exist' do
|
153
|
+
FileUtils.rm 'lib/version.rb'
|
154
|
+
expect{ described_class.update_version_rb }
|
155
|
+
.to_not change{ File.exists? 'lib/version.rb' }
|
156
|
+
.from(false)
|
157
|
+
end
|
150
158
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
159
|
+
it 'stages to change lib/version.rb to git' do
|
160
|
+
expect{ described_class.update_version_rb }
|
161
|
+
.to change{ `git status`.include? 'lib/version.rb' }
|
162
|
+
.from(false)
|
163
|
+
.to(true)
|
164
|
+
end
|
156
165
|
end
|
157
166
|
|
158
|
-
|
159
|
-
|
160
|
-
.
|
161
|
-
.
|
162
|
-
.
|
167
|
+
context 'when version.rb is inside the gem directory in lib' do
|
168
|
+
around do |example|
|
169
|
+
FileUtils.mkdir 'lib/gemname/'
|
170
|
+
FileUtils.cp 'lib/version.rb', 'lib/gemname/version.rb'
|
171
|
+
FileUtils.mv 'lib/version.rb', 'lib/version.rb.orig'
|
172
|
+
example.run
|
173
|
+
FileUtils.rm_rf 'lib/gemname'
|
174
|
+
FileUtils.mv 'lib/version.rb.orig', 'lib/version.rb'
|
175
|
+
`git reset lib/version.rb`
|
176
|
+
`git rm lib/gemname/version.rb &>/dev/null`
|
177
|
+
end
|
178
|
+
|
179
|
+
it 'writes the version into lib/gemname/version.rb' do
|
180
|
+
expect{ described_class.update_version_rb }
|
181
|
+
.to change{ File.read('lib/gemname/version.rb').include? "VERSION = '1.2.3'" }
|
182
|
+
.from(false)
|
183
|
+
.to(true)
|
184
|
+
end
|
185
|
+
|
186
|
+
it 'does nothing if lib/gemname/version.rb does not exist' do
|
187
|
+
FileUtils.rm 'lib/gemname/version.rb'
|
188
|
+
expect{ described_class.update_version_rb }
|
189
|
+
.to_not change{ File.exists? 'lib/gemname/version.rb' }
|
190
|
+
.from(false)
|
191
|
+
end
|
192
|
+
|
193
|
+
it 'stages changes to lib/gemname/version.rb to git' do
|
194
|
+
expect{ described_class.update_version_rb }
|
195
|
+
.to change{ `git status`.include? 'lib/gemname/version.rb' }
|
196
|
+
.from(false)
|
197
|
+
.to(true)
|
198
|
+
end
|
199
|
+
|
200
|
+
it 'does nothing if there are multiple version.rb files found' do
|
201
|
+
FileUtils.cp 'lib/version.rb.orig', 'lib/version.rb'
|
202
|
+
described_class.update_version_rb
|
203
|
+
expect(`git status`).to_not match /version.rb/
|
204
|
+
end
|
205
|
+
|
163
206
|
end
|
164
207
|
end
|
165
208
|
|
data/tasks/brakeman.rake
CHANGED
@@ -5,7 +5,7 @@ begin
|
|
5
5
|
|
6
6
|
desc "Run Brakeman"
|
7
7
|
task :brakeman, :output_files do |t, args|
|
8
|
-
RakeNBake::
|
8
|
+
RakeNBake::Baker.log_step 'Running Brakeman'
|
9
9
|
|
10
10
|
files = args[:output_files].split(' ') if args[:output_files]
|
11
11
|
Brakeman.run :app_path => ".", :output_files => files, :print_report => true
|
@@ -19,7 +19,7 @@ rescue LoadError
|
|
19
19
|
tasks.map(&:to_sym).each do |t|
|
20
20
|
desc 'brakeman is not available (gem not installed)'
|
21
21
|
task t do
|
22
|
-
RakeNBake::
|
22
|
+
RakeNBake::Baker.log_missing_gem 'brakeman'
|
23
23
|
abort
|
24
24
|
end
|
25
25
|
end
|
data/tasks/bundle-audit.rake
CHANGED
@@ -4,10 +4,10 @@ begin
|
|
4
4
|
namespace :bake do
|
5
5
|
desc 'Check Gemfile.lock for security issues'
|
6
6
|
task :'bundle-audit' do
|
7
|
-
RakeNBake::
|
7
|
+
RakeNBake::Baker.log_step 'Updating DB of security advisories'
|
8
8
|
system('bundle exec bundle-audit update')
|
9
9
|
|
10
|
-
RakeNBake::
|
10
|
+
RakeNBake::Baker.log_step 'Checking gems for known security warnings'
|
11
11
|
exit 1 unless system('bundle exec bundle-audit check')
|
12
12
|
end
|
13
13
|
end
|
@@ -20,7 +20,7 @@ rescue LoadError
|
|
20
20
|
tasks.each do |t|
|
21
21
|
desc "This task is not available"
|
22
22
|
task t do
|
23
|
-
RakeNBake::
|
23
|
+
RakeNBake::Baker.log_missing_gem 'bundler-audit'
|
24
24
|
abort
|
25
25
|
end
|
26
26
|
end
|
@@ -4,7 +4,7 @@ namespace :bake do
|
|
4
4
|
task :check_external_dependencies do
|
5
5
|
checker = RakeNBake::DependencyChecker.new(@external_dependencies)
|
6
6
|
|
7
|
-
RakeNBake::
|
7
|
+
RakeNBake::Baker.log_step 'Checking external dependencies'
|
8
8
|
checker.check
|
9
9
|
puts
|
10
10
|
|
data/tasks/coverage.rake
CHANGED
@@ -6,7 +6,7 @@ begin
|
|
6
6
|
if File.exists?(report)
|
7
7
|
SimpleCov.coverage_dir coverage_dir
|
8
8
|
else
|
9
|
-
RakeNBake::
|
9
|
+
RakeNBake::Baker.log_warn "SimpleCov report could not be found at #{report}"
|
10
10
|
fail
|
11
11
|
end
|
12
12
|
end
|
@@ -14,9 +14,9 @@ begin
|
|
14
14
|
def check_coverage_level_above level
|
15
15
|
coverage = SimpleCov.result.covered_percent
|
16
16
|
if coverage >= level
|
17
|
-
RakeNBake::
|
17
|
+
RakeNBake::Baker.log_passed "Feature coverage is at #{coverage}%"
|
18
18
|
else
|
19
|
-
RakeNBake::
|
19
|
+
RakeNBake::Baker.log_warn "Spec coverage was only #{coverage}%"
|
20
20
|
fail
|
21
21
|
end
|
22
22
|
end
|
@@ -27,7 +27,7 @@ begin
|
|
27
27
|
|
28
28
|
desc 'Check coverage from RSpec'
|
29
29
|
task :check_specs do
|
30
|
-
RakeNBake::
|
30
|
+
RakeNBake::Baker.log_step 'Checking spec coverage'
|
31
31
|
coverage_dir = 'log/coverage/spec'
|
32
32
|
set_coverage_dir(coverage_dir)
|
33
33
|
check_coverage_level_above COVERAGE_PERCENT
|
@@ -35,7 +35,7 @@ begin
|
|
35
35
|
|
36
36
|
desc 'Check coverage from Cucumber'
|
37
37
|
task :check_cucumber do
|
38
|
-
RakeNBake::
|
38
|
+
RakeNBake::Baker.log_step 'Checking feature coverage'
|
39
39
|
coverage_dir = 'log/coverage/features'
|
40
40
|
set_coverage_dir(coverage_dir)
|
41
41
|
check_coverage_level_above COVERAGE_PERCENT
|
@@ -50,7 +50,7 @@ rescue LoadError
|
|
50
50
|
%w[check_specs check_cucumber].map(&:to_sym).each do |t|
|
51
51
|
desc 'SimpleCov rake tasks are not available (gem not installed)'
|
52
52
|
task t do
|
53
|
-
RakeNBake::
|
53
|
+
RakeNBake::Baker.log_missing_gem 'simplecov', 'SimpleCov'
|
54
54
|
abort
|
55
55
|
end
|
56
56
|
end
|
data/tasks/fasterer.rake
CHANGED
@@ -3,7 +3,7 @@ begin
|
|
3
3
|
|
4
4
|
namespace :bake do
|
5
5
|
task :fasterer do
|
6
|
-
RakeNBake::
|
6
|
+
RakeNBake::Baker.log_step 'Running Fasterer'
|
7
7
|
system('fasterer')
|
8
8
|
end
|
9
9
|
end
|
@@ -15,7 +15,7 @@ rescue LoadError
|
|
15
15
|
tasks.map(&:to_sym).each do |t|
|
16
16
|
desc 'fasterer is not available (gem not installed)'
|
17
17
|
task t do
|
18
|
-
RakeNBake::
|
18
|
+
RakeNBake::Baker.log_missing_gem 'fasterer'
|
19
19
|
abort
|
20
20
|
end
|
21
21
|
end
|
data/tasks/metric_fu.rake
CHANGED
@@ -7,7 +7,7 @@ rescue LoadError
|
|
7
7
|
%w[all cane churn flay flog hotspots only reek roodi saikuro stats].map(&:to_sym).each do |t|
|
8
8
|
desc 'metric_fu rake tasks are not available (gem not installed)'
|
9
9
|
task t do
|
10
|
-
RakeNBake::
|
10
|
+
RakeNBake::Baker.log_missing_gem 'metric_fu'
|
11
11
|
abort
|
12
12
|
end
|
13
13
|
end
|
@@ -4,7 +4,7 @@ begin
|
|
4
4
|
namespace :bake do
|
5
5
|
desc 'a code metric tool to check the quality of rails code'
|
6
6
|
task :rails_best_practices do
|
7
|
-
RakeNBake::
|
7
|
+
RakeNBake::Baker.log_step 'Running Rails best practices'
|
8
8
|
fail unless system('bundle exec rails_best_practices')
|
9
9
|
end
|
10
10
|
end
|
@@ -13,7 +13,7 @@ rescue LoadError
|
|
13
13
|
namespace :bake do
|
14
14
|
desc 'rails best practices is not available (gem not installed)'
|
15
15
|
task :rails_best_practices do
|
16
|
-
RakeNBake::
|
16
|
+
RakeNBake::Baker.log_missing_gem 'rails_best_practices'
|
17
17
|
abort
|
18
18
|
end
|
19
19
|
end
|
data/tasks/rspec.rake
CHANGED
@@ -3,7 +3,7 @@ begin
|
|
3
3
|
|
4
4
|
RSpec::Core::RakeTask.new(:"bake:rspec") do |t|
|
5
5
|
t.verbose = false
|
6
|
-
RakeNBake::
|
6
|
+
RakeNBake::Baker.log_step 'Running specs'
|
7
7
|
end
|
8
8
|
|
9
9
|
RSPEC_SUBDIRS = %w[integration features requests]
|
@@ -12,7 +12,7 @@ begin
|
|
12
12
|
RSpec::Core::RakeTask.new(:"bake:rspec:#{subdir}") do |t|
|
13
13
|
t.verbose = false
|
14
14
|
t.pattern = "spec/#{subdir}/**/*_spec.rb"
|
15
|
-
RakeNBake::
|
15
|
+
RakeNBake::Baker.log_step "Running #{subdir} specs"
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -23,13 +23,13 @@ begin
|
|
23
23
|
file_list = file_list.exclude "spec/#{subdir}/**/*_spec.rb"
|
24
24
|
end
|
25
25
|
t.pattern = file_list
|
26
|
-
RakeNBake::
|
26
|
+
RakeNBake::Baker.log_step 'Running unit specs'
|
27
27
|
end
|
28
28
|
|
29
29
|
RSpec::Core::RakeTask.new(:"bake:rspec:tag", :tag) do |t, task_args|
|
30
30
|
t.verbose = false
|
31
31
|
t.rspec_opts = "--tag #{task_args[:tag]}"
|
32
|
-
RakeNBake::
|
32
|
+
RakeNBake::Baker.log_step "Running specs tagged #{task_args[:tag]}"
|
33
33
|
end
|
34
34
|
|
35
35
|
RSpec::Core::RakeTask.new(:"bake:rspec_test_prepare" => :"test:prepare") do |t|
|
@@ -42,7 +42,7 @@ rescue LoadError
|
|
42
42
|
%w[rspec rspec_test_prepare].map(&:to_sym).each do |t|
|
43
43
|
desc 'RSpec rake tasks are not available (gem not installed)'
|
44
44
|
task t do
|
45
|
-
RakeNBake::
|
45
|
+
RakeNBake::Baker.log_missing_gem 'rspec', 'RSpec'
|
46
46
|
abort
|
47
47
|
end
|
48
48
|
end
|
data/tasks/rubocop.rake
CHANGED
data/tasks/ruby_critic.rake
CHANGED
@@ -3,7 +3,7 @@ begin
|
|
3
3
|
|
4
4
|
namespace :bake do
|
5
5
|
task :rubycritic do
|
6
|
-
RakeNBake::
|
6
|
+
RakeNBake::Baker.log_step 'Running rubycritic'
|
7
7
|
system('rubycritic')
|
8
8
|
end
|
9
9
|
end
|
@@ -15,7 +15,7 @@ rescue LoadError
|
|
15
15
|
tasks.map(&:to_sym).each do |t|
|
16
16
|
desc 'rubycritic is not available (gem not installed)'
|
17
17
|
task t do
|
18
|
-
RakeNBake::
|
18
|
+
RakeNBake::Baker.log_missing_gem 'rubycritic'
|
19
19
|
abort
|
20
20
|
end
|
21
21
|
end
|
data/tasks/semver.rake
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
begin
|
2
2
|
require_relative '../lib/semver_versioning'
|
3
|
-
require_relative '../lib/assistant_baker'
|
4
3
|
|
5
4
|
namespace :bake do
|
6
5
|
namespace :semver do
|
@@ -62,7 +61,7 @@ rescue LoadError
|
|
62
61
|
tasks.each do |t|
|
63
62
|
desc 'SemVer rake tasks are not available (gem not installed)'
|
64
63
|
task t do
|
65
|
-
RakeNBake::
|
64
|
+
RakeNBake::Baker.log_missing_gem 'semver2'
|
66
65
|
abort
|
67
66
|
end
|
68
67
|
end
|
data/tasks/traceroute.rake
CHANGED
@@ -13,7 +13,7 @@ if defined? Rails
|
|
13
13
|
tasks.map(&:to_sym).each do |t|
|
14
14
|
desc 'Traceroute is not available (gem not installed)'
|
15
15
|
task t do
|
16
|
-
RakeNBake::
|
16
|
+
RakeNBake::Baker.log_missing_gem 'traceroute'
|
17
17
|
abort
|
18
18
|
end
|
19
19
|
end
|
@@ -26,7 +26,7 @@ else
|
|
26
26
|
tasks.map(&:to_sym).each do |t|
|
27
27
|
desc 'Traceroute is not available Rails is required'
|
28
28
|
task t do
|
29
|
-
RakeNBake::
|
29
|
+
RakeNBake::Baker.log_warn 'Traceroute requires rails'
|
30
30
|
abort
|
31
31
|
end
|
32
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-n-bake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Vickerstaff
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -76,7 +76,7 @@ files:
|
|
76
76
|
- bin/term_mandel
|
77
77
|
- bin/thor
|
78
78
|
- history.rdoc
|
79
|
-
- lib/
|
79
|
+
- lib/baker.rb
|
80
80
|
- lib/dependency_checker.rb
|
81
81
|
- lib/rake-n-bake.rb
|
82
82
|
- lib/rake_n_bake.rb
|
@@ -84,7 +84,7 @@ files:
|
|
84
84
|
- lib/version.rb
|
85
85
|
- rake-n-bake.gemspec
|
86
86
|
- spec/.keep
|
87
|
-
- spec/
|
87
|
+
- spec/baker_spec.rb
|
88
88
|
- spec/dependency_checker_spec.rb
|
89
89
|
- spec/semver_versioning_spec.rb
|
90
90
|
- spec/spec_helper.rb
|