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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e848e6763983f8635b52f18a27ac1865f4f98819
4
- data.tar.gz: fbdbb9122b16d1565ff43b02463c8ba437902d0b
3
+ metadata.gz: 48b193c4dd6c74aeddec374e3d7d4ca441cc8ea5
4
+ data.tar.gz: 0d504fc8b732db739a32392d3df497ef1bc4e364
5
5
  SHA512:
6
- metadata.gz: 23ef3dd8ef40ad016cfb6690b314e717bdacaec33003736e0aff2da0dfff49f6c7d77bf51ed53c4020c641cf041e6aa3e6414c8569c46685b8b3936aba0b27f0
7
- data.tar.gz: de4442cd527e2baa46e2aa7f27628c7e2fb7ff70e9c011fa880b26f78214d4344849d989bb704db7172581ce359ec2bf793e7afb5166945fac33731803a90881
6
+ metadata.gz: d48ae9d2f14f58703471ce23c6c229612c0d1d96dee0eb5c72b4f21647811a41704eb4b34c3e575644ae08190f92e921ad11bf2d80a9d48e85379c5ff8f971bc
7
+ data.tar.gz: 9a51d706fafd3ab1a9b4e0cb2eeff67aa1b8051b926b1d383d992f51d913e4d4120c5f997a6196c0c929c834e8a12749f2efbece2dc509c7520a505c800d412a
data/.semver CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 4
4
- :patch: 1
4
+ :patch: 2
5
5
  :special: ''
6
6
  :metadata: ''
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::AssistantBaker`. This is intended for truely common things, like logging out when a particular step runs or passes.
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
@@ -1,3 +1,5 @@
1
+ == v1.4.2 (12 October 2016)
2
+
1
3
  == v1.4.1 (08 September 2016)
2
4
 
3
5
  * Update Rake dependency
@@ -2,7 +2,7 @@
2
2
  require 'term/ansicolor'
3
3
 
4
4
  module RakeNBake
5
- class AssistantBaker
5
+ class Baker
6
6
  def self.log_step message
7
7
  puts Term::ANSIColor.blue +
8
8
  Term::ANSIColor.underline +
data/lib/rake-n-bake.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  $:.unshift File.dirname(__FILE__)
2
2
 
3
3
  require 'rake'
4
- require_relative 'assistant_baker'
4
+ require_relative 'baker'
5
5
 
6
6
  dir = File.expand_path("../tasks", File.dirname(__FILE__))
7
7
  Dir.glob("#{dir}/*.rake").each { |r| import r}
@@ -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
- return unless File.exists?('lib/version.rb')
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('lib/version.rb').sub(/VERSION = .*$/, version_string)
68
- File.write('lib/version.rb', version_file_content)
69
- `git add lib/version.rb`
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
@@ -1,3 +1,3 @@
1
1
  module RakeNBake
2
- VERSION = '1.4.1'
2
+ VERSION = '1.4.2'
3
3
  end
@@ -2,7 +2,7 @@
2
2
  require 'spec_helper'
3
3
  require production_code
4
4
 
5
- describe RakeNBake::AssistantBaker do
5
+ describe RakeNBake::Baker do
6
6
  describe '#log_step' do
7
7
  it 'puts the given message' do
8
8
  expect{described_class.log_step 'Foo'}.to output(/Foo/).to_stdout
@@ -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
- around do |example|
138
- FileUtils.cp 'lib/version.rb', 'lib/version.rb.orig'
139
- example.run
140
- FileUtils.mv 'lib/version.rb.orig', 'lib/version.rb'
141
- `git reset lib/version.rb`
142
- end
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
- it 'writes the version into lib/version.rb' do
145
- expect{ described_class.update_version_rb }
146
- .to change{ File.read('lib/version.rb').include? "VERSION = '1.2.3'" }
147
- .from(false)
148
- .to(true)
149
- end
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
- it 'does nothing if lib/version.rb does not exist' do
152
- FileUtils.rm 'lib/version.rb'
153
- expect{ described_class.update_version_rb }
154
- .to_not change{ File.exists? 'lib/version.rb' }
155
- .from(false)
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
- it 'stages to change lib/version.rb to git' do
159
- expect{ described_class.update_version_rb }
160
- .to change{ `git status`.include? 'lib/version.rb' }
161
- .from(false)
162
- .to(true)
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::AssistantBaker.log_step 'Running Brakeman'
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::AssistantBaker.log_missing_gem 'brakeman'
22
+ RakeNBake::Baker.log_missing_gem 'brakeman'
23
23
  abort
24
24
  end
25
25
  end
@@ -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::AssistantBaker.log_step 'Updating DB of security advisories'
7
+ RakeNBake::Baker.log_step 'Updating DB of security advisories'
8
8
  system('bundle exec bundle-audit update')
9
9
 
10
- RakeNBake::AssistantBaker.log_step 'Checking gems for known security warnings'
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::AssistantBaker.log_missing_gem 'bundler-audit'
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::AssistantBaker.log_step 'Checking external dependencies'
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::AssistantBaker.log_warn "SimpleCov report could not be found at #{report}"
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::AssistantBaker.log_passed "Feature coverage is at #{coverage}%"
17
+ RakeNBake::Baker.log_passed "Feature coverage is at #{coverage}%"
18
18
  else
19
- RakeNBake::AssistantBaker.log_warn "Spec coverage was only #{coverage}%"
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::AssistantBaker.log_step 'Checking spec coverage'
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::AssistantBaker.log_step 'Checking feature coverage'
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::AssistantBaker.log_missing_gem 'simplecov', 'SimpleCov'
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::AssistantBaker.log_step 'Running Fasterer'
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::AssistantBaker.log_missing_gem 'fasterer'
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::AssistantBaker.log_missing_gem 'metric_fu'
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::AssistantBaker.log_step 'Running Rails best practices'
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::AssistantBaker.log_missing_gem 'rails_best_practices'
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::AssistantBaker.log_step 'Running specs'
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::AssistantBaker.log_step "Running #{subdir} specs"
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::AssistantBaker.log_step 'Running unit specs'
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::AssistantBaker.log_step "Running specs tagged #{task_args[:tag]}"
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::AssistantBaker.log_missing_gem 'rspec', 'RSpec'
45
+ RakeNBake::Baker.log_missing_gem 'rspec', 'RSpec'
46
46
  abort
47
47
  end
48
48
  end
data/tasks/rubocop.rake CHANGED
@@ -13,7 +13,7 @@ rescue LoadError
13
13
  tasks.map(&:to_sym).each do |t|
14
14
  desc 'rubocop is not available (gem not installed)'
15
15
  task t do
16
- RakeNBake::AssistantBaker.log_missing_gem 'rubocop'
16
+ RakeNBake::Baker.log_missing_gem 'rubocop'
17
17
  abort
18
18
  end
19
19
  end
@@ -3,7 +3,7 @@ begin
3
3
 
4
4
  namespace :bake do
5
5
  task :rubycritic do
6
- RakeNBake::AssistantBaker.log_step 'Running rubycritic'
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::AssistantBaker.log_missing_gem 'rubycritic'
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::AssistantBaker.log_missing_gem 'semver2'
64
+ RakeNBake::Baker.log_missing_gem 'semver2'
66
65
  abort
67
66
  end
68
67
  end
@@ -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::AssistantBaker.log_missing_gem 'traceroute'
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::AssistantBaker.log_warn 'Traceroute requires rails'
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.1
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-09-08 00:00:00.000000000 Z
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/assistant_baker.rb
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/assistant_baker_spec.rb
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