rake-n-bake 1.3.1 → 1.3.3

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: 1481d06881b8e45bf1e6bda665ec18306194d584
4
- data.tar.gz: 73d3d4afeb4f382a158005ca365f412b0b22e5a7
3
+ metadata.gz: 8b0e0c58e976c027c3e6d46c83ce7ef37c500f38
4
+ data.tar.gz: ca31e0d90434fa140cebfe2b8be41423599190b2
5
5
  SHA512:
6
- metadata.gz: 76047402eae3aff52ebb4cd326a4f11d70896d995b33600f5c14af4f928ba6a27d3fc5c44e8904912f3b64ec6126a0c59c548e9a1d54310000d7f136e06a6fbe
7
- data.tar.gz: 495c8a951a44125f23630413d960499a432e432d711bc710d9f540a1da87e686aca65551bb0259263067b58df018e8ae97e152864acafa26cbec302e6ab47150
6
+ metadata.gz: 7721faaf07af6a408d7925e28c79acae9e0bbeada83ea7a23cc8864184456a62f54a28d9227b8d943bc83da5aa8970f116127949791bea37b6bb9cf4e6030547
7
+ data.tar.gz: 7380815b55cbe45c034a7c52b89978e3e872f09460f65a6dbf13409a0068361df0ac6ff1896d40da00d90159cedbde9b3fad0be5787653e0eb0f77147e3c9034
data/.gitignore CHANGED
@@ -1,5 +1,7 @@
1
1
  /log/*
2
2
  /tmp/*
3
+ /bin/*
3
4
  *.gem
4
5
  *.sw?
6
+ *.orig
5
7
  Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.semver CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 3
4
- :patch: 1
4
+ :patch: 3
5
5
  :special: ''
6
6
  :metadata: ''
data/.travis.yml CHANGED
@@ -1,13 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.3.0
3
4
  - 2.2.2
4
5
  - 2.1.0
5
6
  - 2.0.0
6
7
  - 1.9.3
7
- - jruby-1.7.12
8
8
  - ruby-head
9
- jdk:
10
- - openjdk7
11
9
  matrix:
12
10
  allow_failures:
13
11
  - rvm: ruby-head
data/Gemfile CHANGED
@@ -9,13 +9,17 @@ group :development, :test do
9
9
  gem 'bundler-audit'
10
10
  gem 'cucumber'
11
11
  gem 'fasterer'
12
+ gem 'guard-bundler'
13
+ gem 'guard-rspec'
12
14
  gem 'metric_fu'
13
15
  gem 'rake'
14
16
  gem 'rspec'
15
17
  gem 'rubocop'
16
18
  gem 'rubycritic'
19
+ gem 'pry-byebug'
17
20
  gem 'semver2'
18
21
  gem 'simplecov'
19
22
  gem 'term-ansicolor', '~> 1.3'
20
23
  gem 'timecop'
24
+ gem 'traceroute'
21
25
  end
data/Guardfile ADDED
@@ -0,0 +1,82 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ guard :bundler do
19
+ require 'guard/bundler'
20
+ require 'guard/bundler/verify'
21
+ helper = Guard::Bundler::Verify.new
22
+
23
+ files = ['Gemfile']
24
+ files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
25
+
26
+ # Assume files are symlinked from somewhere
27
+ files.each { |file| watch(helper.real_path(file)) }
28
+ end
29
+
30
+ # Note: The cmd option is now required due to the increasing number of ways
31
+ # rspec may be run, below are examples of the most common uses.
32
+ # * bundler: 'bundle exec rspec'
33
+ # * bundler binstubs: 'bin/rspec'
34
+ # * spring: 'bin/rspec' (This will use spring if running and you have
35
+ # installed the spring binstubs per the docs)
36
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
37
+ # * 'just' rspec: 'rspec'
38
+
39
+ guard :rspec, cmd: "bundle exec rspec" do
40
+ require "guard/rspec/dsl"
41
+ dsl = Guard::RSpec::Dsl.new(self)
42
+
43
+ # Feel free to open issues for suggestions and improvements
44
+
45
+ # RSpec files
46
+ rspec = dsl.rspec
47
+ watch(rspec.spec_helper) { rspec.spec_dir }
48
+ watch(rspec.spec_support) { rspec.spec_dir }
49
+ watch(rspec.spec_files)
50
+
51
+ # Ruby files
52
+ ruby = dsl.ruby
53
+ dsl.watch_spec_files_for(ruby.lib_files)
54
+
55
+ # Rails files
56
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
57
+ dsl.watch_spec_files_for(rails.app_files)
58
+ dsl.watch_spec_files_for(rails.views)
59
+
60
+ watch(rails.controllers) do |m|
61
+ [
62
+ rspec.spec.("routing/#{m[1]}_routing"),
63
+ rspec.spec.("controllers/#{m[1]}_controller"),
64
+ rspec.spec.("acceptance/#{m[1]}")
65
+ ]
66
+ end
67
+
68
+ # Rails config changes
69
+ watch(rails.spec_helper) { rspec.spec_dir }
70
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
71
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
72
+
73
+ # Capybara features specs
74
+ watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
75
+ watch(rails.layouts) { |m| rspec.spec.("features/#{m[1]}") }
76
+
77
+ # Turnip features and steps
78
+ watch(%r{^spec/acceptance/(.+)\.feature$})
79
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
80
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
81
+ end
82
+ end
data/README.md CHANGED
@@ -39,7 +39,7 @@ task :default => [
39
39
  :"bake:code_quality:all",
40
40
  :"bake:rspec",
41
41
  :"bake:coverage:check_specs",
42
- :"bake:bundler_audit",
42
+ :"bake:bundle-audit",
43
43
  :"bake:rubocop",
44
44
  :"bake:rubycritic",
45
45
  :"bake:ok_rainbow",
@@ -54,7 +54,7 @@ Tasks are namespaced under `:bake` to prevent clashes. For example, the `:ok` ta
54
54
  ### :brakeman
55
55
  Run [Brakeman](http://brakemanscanner.org/) to look for security issues on a Rails project
56
56
 
57
- ### :bundler_audit
57
+ ### :bundle-audit
58
58
  Check the current Gemfile.lock for gem versions with known security issues, courtesy of [Bundler Audit](https://github.com/rubysec/bundler-audit#readme)
59
59
 
60
60
  ### :check_external_dependencies
@@ -119,6 +119,9 @@ Runs [Rubocop](https://github.com/bbatsov/rubocop) over the project and lists vi
119
119
  ### :rubycritic
120
120
  Runs the [RubyCritic](https://github.com/whitesmith/rubycritic) tool and generates a report about the health of your code
121
121
 
122
+ ### :traceroute
123
+ Runs [Traceroute](https://rubygems.org/gems/traceroute), a tool for finding unused routes within [Rails](http://rubyonrails.org/) apps
124
+
122
125
  Handy Tips for new tasks
123
126
  ------------------------
124
127
  - 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.
data/history.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ == v1.3.3 (01 March 2016)
2
+
3
+ == v1.3.2 (26 September 2015)
4
+
1
5
  == v1.3.1 (25 September 2015)
2
6
 
3
7
  * Fix SimpleCov task (was showing 100% coverage when report was missing; now fails with helpful error)
@@ -52,26 +52,38 @@ module RakeNBake
52
52
  end
53
53
 
54
54
  def self.update_history_file
55
- supported_history_files = %w[ history.rdoc CHANGELOG.md ]
56
- supported_history_files
57
- .select {|histf| File.exist? histf}
58
- .map do |histf|
59
- current_history = File.read histf
60
- File.open histf, 'w' do |f|
61
- f.puts "== #{current_version} (#{Time.now.strftime "%d %B %Y"})"
62
- f.puts
63
- f.print current_history
64
- end
65
- `git add #{histf}`
55
+ %w[ history.rdoc CHANGELOG.md ]
56
+ .select {|file| File.exist? file}
57
+ .each do |file|
58
+ add_version_to_top(file)
59
+ `git add #{file}`
66
60
  end
67
61
  end
68
62
 
63
+ def self.update_version_rb
64
+ return unless File.exists?('lib/version.rb')
65
+ version = current_version.to_s.sub(/^v/,'')
66
+ 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`
70
+ end
71
+
69
72
  def self.tag
70
73
  v = current_version.to_s
71
74
  `git add .semver && git commit -m 'Increment version to #{v}' && git tag #{v} -a -m '#{Time.now}'`
72
75
  branch = `git symbolic-ref HEAD`[%r{.*/(.*)}, 1]
73
76
  puts "To push the new tag, use 'git push origin #{branch} --tags'"
74
77
  end
78
+
79
+ def self.add_version_to_top file
80
+ current_history = File.read file
81
+ File.open file, 'w' do |f|
82
+ f.puts "== #{current_version} (#{Time.now.strftime "%d %B %Y"})"
83
+ f.puts
84
+ f.print current_history
85
+ end
86
+ end
75
87
  end
76
88
  end
77
89
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RakeNBake
2
- VERSION = "1.3.1"
2
+ VERSION = '1.3.3'
3
3
  end
@@ -3,7 +3,13 @@ require production_code
3
3
  require 'yaml'
4
4
 
5
5
  describe RakeNBake::SemverVersioning do
6
- let(:version) {
6
+ before(:example) { SEMVER_FILES.map{|f| remove_file f} }
7
+
8
+ let(:changelog) { project_root_file 'CHANGELOG.md' }
9
+ let(:history_rdoc) { project_root_file 'history.rdoc' }
10
+ let(:semver) { project_root_file '.semver' }
11
+
12
+ let(:version) do
7
13
  {
8
14
  major: '1',
9
15
  minor: '2',
@@ -11,32 +17,8 @@ describe RakeNBake::SemverVersioning do
11
17
  special: '',
12
18
  metadata: ''
13
19
  }
14
- }
15
- before(:all) do
16
- if File.exist? File.join(File.dirname(__FILE__), '../.semver')
17
- @current_semver_file = File.read(File.join(File.dirname(__FILE__), '../.semver'), force: true)
18
- end
19
- if File.exist? File.join(File.dirname(__FILE__), '../history.rdoc')
20
- @current_history_file = File.read(File.join(File.dirname(__FILE__), '../history.rdoc'), force: true)
21
- end
22
20
  end
23
21
 
24
- after(:all) do
25
- if @current_semver_file
26
- File.write(File.join(File.dirname(__FILE__), '../.semver'), @current_semver_file, force: true)
27
- end
28
- if @current_history_file
29
- File.write(File.join(File.dirname(__FILE__), '../history.rdoc'), @current_history_file, force: true)
30
- end
31
- end
32
- before(:each) do
33
- FileUtils.rm(File.join(File.dirname(__FILE__), '../.semver'), force: true)
34
- FileUtils.rm(File.join(File.dirname(__FILE__), '../history.rdoc'), force: true)
35
- end
36
- after(:each) do
37
- FileUtils.rm(File.join(File.dirname(__FILE__), '../.semver'), force: true)
38
- FileUtils.rm(File.join(File.dirname(__FILE__), '../history.rdoc'), force: true)
39
- end
40
22
  describe '#current_version' do
41
23
  context 'when there is no .semver file' do
42
24
  it 'returns the current version' do
@@ -45,9 +27,7 @@ describe RakeNBake::SemverVersioning do
45
27
  end
46
28
 
47
29
  context 'when there is a .semver file' do
48
- before do
49
- File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
50
- end
30
+ before { File.write(semver, YAML.dump(version)) }
51
31
 
52
32
  it 'returns the current version' do
53
33
  expect(described_class.current_version.to_s).to eq 'v1.2.3'
@@ -56,9 +36,8 @@ describe RakeNBake::SemverVersioning do
56
36
  end
57
37
 
58
38
  describe 'inc_major' do
59
- before do
60
- File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
61
- end
39
+ before { File.write(semver, YAML.dump(version)) }
40
+
62
41
  it 'increases major and resets minor and patch' do
63
42
  described_class.inc_major
64
43
  expect(described_class.current_version.to_s).to eq 'v2.0.0'
@@ -66,9 +45,8 @@ describe RakeNBake::SemverVersioning do
66
45
  end
67
46
 
68
47
  describe 'inc_minor' do
69
- before do
70
- File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
71
- end
48
+ before { File.write(semver, YAML.dump(version)) }
49
+
72
50
  it 'increases minor and resets patch' do
73
51
  described_class.inc_minor
74
52
  expect(described_class.current_version.to_s).to eq 'v1.3.0'
@@ -76,9 +54,8 @@ describe RakeNBake::SemverVersioning do
76
54
  end
77
55
 
78
56
  describe 'inc_patch' do
79
- before do
80
- File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
81
- end
57
+ before { File.write(semver, YAML.dump(version)) }
58
+
82
59
  it 'increases minor and resets patch' do
83
60
  described_class.inc_patch
84
61
  expect(described_class.current_version.to_s).to eq 'v1.2.4'
@@ -86,9 +63,8 @@ describe RakeNBake::SemverVersioning do
86
63
  end
87
64
 
88
65
  describe 'prerelease' do
89
- before do
90
- File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
91
- end
66
+ before { File.write(semver, YAML.dump(version)) }
67
+
92
68
  it 'sets the prerelease to the supplied string' do
93
69
  described_class.prerelease 'something'
94
70
  expect(described_class.current_version.to_s).to eq 'v1.2.3-something'
@@ -96,9 +72,8 @@ describe RakeNBake::SemverVersioning do
96
72
  end
97
73
 
98
74
  describe 'inc_prerelease' do
99
- before do
100
- File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
101
- end
75
+ before { File.write(semver, YAML.dump(version)) }
76
+
102
77
  it 'increments major version and sets the prerelease to the supplied string' do
103
78
  described_class.inc_prerelease 'something'
104
79
  expect(described_class.current_version.to_s).to eq 'v2.0.0-something'
@@ -106,30 +81,29 @@ describe RakeNBake::SemverVersioning do
106
81
  end
107
82
 
108
83
  describe 'release' do
109
- before do
110
- v = version
111
- v[:special] = "a string"
112
- File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(v))
113
- end
84
+ before { File.write(semver, YAML.dump( version.merge(special: "rc5") )) }
85
+
114
86
  it 'removes the prerelease' do
115
- described_class.release
116
- expect(described_class.current_version.to_s).to eq 'v1.2.3'
87
+ expect{ described_class.release }
88
+ .to change{ described_class.current_version.to_s}
89
+ .from('v1.2.3-rc5')
90
+ .to('v1.2.3')
117
91
  end
118
92
  end
119
93
 
120
94
  describe '#update_history_file' do
121
95
  context 'when there is no history file' do
122
96
  it 'does nothing' do
123
- described_class.update_history_file
124
- expect(File.exist? '../history.rdoc').to eq false
125
- expect(File.exist? '../CHANGELOG.md').to eq false
97
+ expect{ described_class.update_history_file }
98
+ .to_not change{ [history_rdoc, changelog].any?{|file| File.exists? file} }
99
+ .from(false)
126
100
  end
127
101
  end
128
102
 
129
103
  context 'when there is a history.rdoc file' do
130
104
  before do
131
- File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
132
- File.write(File.join(File.dirname(__FILE__), '../history.rdoc'), '* Some changes')
105
+ File.write(semver, YAML.dump(version))
106
+ File.write(history_rdoc, '* Some changes')
133
107
  end
134
108
 
135
109
  after { File.unlink(File.join(File.dirname(__FILE__), '../history.rdoc')) }
@@ -137,30 +111,61 @@ describe RakeNBake::SemverVersioning do
137
111
  it 'Adds the version number and date to the top of the file and adds it to git' do
138
112
  expect(Object).to receive(:`).with('git add history.rdoc')
139
113
  described_class.update_history_file
140
- expect(File.read(File.join(File.dirname(__FILE__), '../history.rdoc')).lines.first).to eq "== v1.2.3 (#{Time.now.strftime "%d %B %Y"})\n"
114
+ expect(File.read(history_rdoc).lines.first).to eq "== v1.2.3 (#{Time.now.strftime "%d %B %Y"})\n"
141
115
  end
142
116
  end
143
117
 
144
118
  context 'when there is a CHANGELOG.md file' do
145
119
  before do
146
- File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
147
- File.write(File.join(File.dirname(__FILE__), '../CHANGELOG.md'), '* Some changes')
120
+ File.write(semver, YAML.dump(version))
121
+ File.write(changelog, '* Some changes')
148
122
  end
149
123
 
150
- after { File.unlink(File.join(File.dirname(__FILE__), '../CHANGELOG.md')) }
124
+ after { File.unlink(changelog) }
151
125
 
152
126
  it 'Adds the version number and date to the top of the file and adds it to git' do
153
127
  expect(Object).to receive(:`).with('git add CHANGELOG.md')
154
128
  described_class.update_history_file
155
- expect(File.read(File.join(File.dirname(__FILE__), '../CHANGELOG.md')).lines.first).to eq "== v1.2.3 (#{Time.now.strftime "%d %B %Y"})\n"
129
+ expect(File.read(changelog).lines.first).to eq "== v1.2.3 (#{Time.now.strftime "%d %B %Y"})\n"
156
130
  end
157
131
  end
158
132
  end
159
133
 
160
- describe 'tag' do
161
- before do
162
- File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
134
+ describe '#update_version_rb' do
135
+ before { File.write(project_root_file('.semver'), YAML.dump(version)) }
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
143
+
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)
163
149
  end
150
+
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)
156
+ end
157
+
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)
163
+ end
164
+ end
165
+
166
+ describe 'tag' do
167
+ before { File.write(project_root_file('.semver'), YAML.dump(version)) }
168
+
164
169
  it 'tags with the curren semver release and outputs push instructions' do
165
170
  expect(Object).to receive(:`).with("git add .semver && git commit -m 'Increment version to v1.2.3' && git tag v1.2.3 -a -m '#{Time.now}'")
166
171
  expect(Object).to receive(:`).with('git symbolic-ref HEAD').and_return 'refs/heads/master'
@@ -168,5 +173,6 @@ describe RakeNBake::SemverVersioning do
168
173
  described_class.tag
169
174
  end
170
175
  end
176
+
171
177
  end
172
178
 
data/spec/spec_helper.rb CHANGED
@@ -11,20 +11,49 @@ def production_code
11
11
  './'+ spec.gsub('_spec','').gsub(/spec/, 'lib')
12
12
  end
13
13
 
14
- SimpleCov.start do
15
- add_filter '/vendor/'
16
- add_filter '/spec/'
17
- coverage_dir 'log/coverage/spec'
14
+ def project_root_file name
15
+ File.join(File.dirname(__FILE__), '..', name)
16
+ end
17
+
18
+ def backup_file_name(name)
19
+ project_root_file(name) + '.orig'
20
+ end
21
+
22
+ def backup_file name
23
+ file = project_root_file(name)
24
+ backup = backup_file_name(name)
25
+ FileUtils.mv file, backup if File.exists?(file)
26
+ end
27
+
28
+ def restore_file name
29
+ file = project_root_file(name)
30
+ backup = backup_file_name(name)
31
+ FileUtils.mv backup, file if File.exists?(backup)
18
32
  end
19
33
 
34
+ def remove_file name
35
+ FileUtils.rm project_root_file(name), force: true
36
+ end
37
+
38
+ SEMVER_FILES = [ '.semver', 'history.rdoc', 'CHANGELOG.md' ]
39
+
20
40
  RSpec.configure do |config|
21
41
  config.include ArubaDoubles
22
42
 
23
- config.before :each do
43
+ config.before :suite do
24
44
  Aruba::RSpec.setup
45
+ SEMVER_FILES.map{|f| backup_file f}
25
46
  end
26
47
 
27
- config.after :each do
48
+ config.after :suite do
49
+ SEMVER_FILES.map{|f| restore_file f}
28
50
  Aruba::RSpec.teardown
29
51
  end
30
52
  end
53
+
54
+ SimpleCov.start do
55
+ add_filter '/vendor/'
56
+ add_filter '/spec/'
57
+ coverage_dir 'log/coverage/spec'
58
+ end
59
+
@@ -3,15 +3,15 @@ begin
3
3
 
4
4
  namespace :bake do
5
5
  desc 'Check Gemfile.lock for security issues'
6
- task :bundler_audit do
6
+ task :'bundle-audit' do
7
7
  RakeNBake::AssistantBaker.log_step 'Checking gems for known security warnings'
8
- Bundler::Audit::CLI.start
8
+ exit 1 unless system('bundle exec bundle-audit')
9
9
  end
10
10
  end
11
11
 
12
12
  rescue LoadError
13
13
 
14
- tasks = %w[bundler_audit].map(&:to_sym)
14
+ tasks = %w[bundle-audit].map(&:to_sym)
15
15
 
16
16
  namespace :bake do
17
17
  tasks.each do |t|
data/tasks/ok.rake CHANGED
@@ -26,14 +26,39 @@ namespace :bake do
26
26
 
27
27
  desc 'Print the "ALL TESTS PASSED" message WITH A SWEET RAINBOW!!!'
28
28
  task :ok_rainbow do
29
+ title = "ALL TESTS PASSED"
30
+ sement_size = %w[ - -- --- ----- ----------- ----- --- -- - ]
31
+ rows = [
32
+ [ :clear, :clear, :clear, :clear, :red, :clear, :clear, :clear, :clear ],
33
+ [ :clear, :clear, :clear, :red, :yellow, :red, :clear, :clear, :clear ],
34
+ [ :clear, :clear, :red, :yellow, :green, :yellow, :red, :clear, :clear ],
35
+ [ :clear, :red, :yellow, :green, :blue, :green, :yellow, :red, :clear ],
36
+ [ :red, :yellow, :green, :blue, :magenta, :blue, :green, :yellow, :red ],
37
+ [ :yellow, :green, :blue, :magenta, :clear, :magenta, :blue, :green, :yellow ],
38
+ [ :green, :blue, :magenta, :clear, :clear, :clear, :magenta, :blue, :green ],
39
+ [ :blue, :magenta, :text, :text, :text, :text, title, :magenta, :blue ],
40
+ ]
41
+
29
42
  puts
30
- print C.clear( " "), C.clear( " "), C.clear( " "), C.on_red( " "), C.clear( " "), C.clear( " "), C.clear( " "),"\n"
31
- print C.clear( " "), C.clear( " "), C.on_red( " "), C.on_yellow( " "), C.on_red( " "), C.clear( " "), C.clear( " "),"\n"
32
- print C.clear( " "), C.on_red( " "), C.on_yellow( " "), C.on_green( " "), C.on_yellow( " "), C.on_red( " "), C.clear( " "),"\n"
33
- print C.on_red( " "), C.on_yellow( " "), C.on_green( " "), C.on_blue( " "), C.on_green( " "), C.on_yellow( " "), C.on_red( " "),"\n"
34
- print C.on_yellow(" "), C.on_green( " "), C.on_blue( " "), C.on_magenta(" "), C.on_blue( " "), C.on_green( " "), C.on_yellow( " "),"\n"
35
- print C.on_green( " "), C.on_blue( " "), C.on_magenta(" "), C.clear( " "), C.on_magenta(" "), C.on_blue( " "), C.on_green( " "),"\n"
36
- print C.on_blue( " "), C.on_magenta(" "), C.clear( " "), C.bold, C.green( " ALL TESTS PASSED "), C.clear( " "), C.on_magenta(" "), C.on_blue( " "),"\n"
43
+ rows.each do |row|
44
+ text_block_length = 0
45
+ sement_size.zip(row).each do |size, colour|
46
+ string = size.gsub('-',' ')
47
+ case colour
48
+ when :clear
49
+ print C.clear(string)
50
+ when :text
51
+ text_block_length += size.length
52
+ when String
53
+ text_block_length += size.length
54
+ print C.bold, C.green(colour.center(text_block_length)), C.clear
55
+ else
56
+ cmd = "on_#{colour}".to_sym
57
+ print C.send(cmd, string)
58
+ end
59
+ end
60
+ puts
61
+ end
37
62
  puts C.reset
38
63
  end
39
64
  end
data/tasks/semver.rake CHANGED
@@ -7,13 +7,14 @@ begin
7
7
 
8
8
  desc "Display the latest version (from .semver)"
9
9
  task :version do
10
- RakeNBake::SemverVersioning.current_version
10
+ puts RakeNBake::SemverVersioning.current_version
11
11
  end
12
12
 
13
13
  desc 'Increment major version in .semver (eg 1.2.3 => 2.0.0)'
14
14
  task :major do
15
15
  RakeNBake::SemverVersioning.inc_major
16
16
  RakeNBake::SemverVersioning.update_history_file
17
+ RakeNBake::SemverVersioning.update_version_rb
17
18
  RakeNBake::SemverVersioning.tag
18
19
  end
19
20
 
@@ -21,6 +22,7 @@ begin
21
22
  task :minor do
22
23
  RakeNBake::SemverVersioning.inc_minor
23
24
  RakeNBake::SemverVersioning.update_history_file
25
+ RakeNBake::SemverVersioning.update_version_rb
24
26
  RakeNBake::SemverVersioning.tag
25
27
  end
26
28
 
@@ -28,22 +30,16 @@ begin
28
30
  task :patch do
29
31
  RakeNBake::SemverVersioning.inc_patch
30
32
  RakeNBake::SemverVersioning.update_history_file
33
+ RakeNBake::SemverVersioning.update_version_rb
31
34
  RakeNBake::SemverVersioning.tag
32
35
  end
33
36
 
34
- desc 'Add or modify the current prerelease version (eg 1.2.3-rc1 => 1.2.3-rc2'
37
+ desc 'Add or modify the current prerelease version (eg 1.2.3-rc1 => 1.2.3-rc2)'
35
38
  task :prerelease, [:version] do |task, args|
36
39
  version = args[:version] || fail("Invalid usage: rake bake:semver:prerelase['release name']")
37
40
  RakeNBake::SemverVersioning.prerelease version
38
41
  RakeNBake::SemverVersioning.update_history_file
39
- RakeNBake::SemverVersioning.tag
40
- end
41
-
42
- desc 'Increment major version and add a prerelease version (eg 1.2.3 => 2.0.0-rc1)'
43
- task :inc_prerelease, [:version] do |task, args|
44
- version = args[:version] || fail("Invalid usage: rake bake:semver:inc_prerelase['release name']")
45
- RakeNBake::SemverVersioning.inc_prerelease version
46
- RakeNBake::SemverVersioning.update_history_file
42
+ RakeNBake::SemverVersioning.update_version_rb
47
43
  RakeNBake::SemverVersioning.tag
48
44
  end
49
45
 
@@ -51,6 +47,7 @@ begin
51
47
  task :release do
52
48
  RakeNBake::SemverVersioning.release
53
49
  RakeNBake::SemverVersioning.update_history_file
50
+ RakeNBake::SemverVersioning.update_version_rb
54
51
  RakeNBake::SemverVersioning.tag
55
52
  end
56
53
  end
@@ -0,0 +1,34 @@
1
+ if defined? Rails
2
+ begin
3
+ require 'traceroute'
4
+
5
+ namespace :bake do
6
+ Rake::Task["traceroute"].invoke
7
+ end
8
+
9
+ rescue LoadError
10
+ tasks = %w[ traceroute ]
11
+
12
+ namespace :bake do
13
+ tasks.map(&:to_sym).each do |t|
14
+ desc 'Traceroute is not available (gem not installed)'
15
+ task t do
16
+ RakeNBake::AssistantBaker.log_missing_gem 'traceroute'
17
+ abort
18
+ end
19
+ end
20
+ end
21
+ end
22
+ else
23
+ tasks = %w[ traceroute ]
24
+
25
+ namespace :bake do
26
+ tasks.map(&:to_sym).each do |t|
27
+ desc 'Traceroute is not available Rails is required'
28
+ task t do
29
+ RakeNBake::AssistantBaker.log_warn 'Traceroute requires rails'
30
+ abort
31
+ end
32
+ end
33
+ end
34
+ 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.3.1
4
+ version: 1.3.3
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: 2015-09-25 00:00:00.000000000 Z
12
+ date: 2016-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -49,10 +49,12 @@ extra_rdoc_files: []
49
49
  files:
50
50
  - ".bundle/config"
51
51
  - ".gitignore"
52
+ - ".rspec"
52
53
  - ".ruby-version"
53
54
  - ".semver"
54
55
  - ".travis.yml"
55
56
  - Gemfile
57
+ - Guardfile
56
58
  - README.md
57
59
  - Rakefile
58
60
  - bin/bundle-audit
@@ -87,7 +89,7 @@ files:
87
89
  - spec/semver_versioning_spec.rb
88
90
  - spec/spec_helper.rb
89
91
  - tasks/brakeman.rake
90
- - tasks/bundler_audit.rake
92
+ - tasks/bundle-audit.rake
91
93
  - tasks/check_external_deps.rake
92
94
  - tasks/code_quality.rake
93
95
  - tasks/coverage.rake
@@ -99,6 +101,7 @@ files:
99
101
  - tasks/rubocop.rake
100
102
  - tasks/ruby_critic.rake
101
103
  - tasks/semver.rake
104
+ - tasks/traceroute.rake
102
105
  homepage: https://github.com/RichardVickerstaff/rake-n-bake
103
106
  licenses:
104
107
  - MIT
@@ -120,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
123
  version: '0'
121
124
  requirements: []
122
125
  rubyforge_project:
123
- rubygems_version: 2.4.5
126
+ rubygems_version: 2.4.8
124
127
  signing_key:
125
128
  specification_version: 4
126
129
  summary: Common rake tasks, baked to perfection and ready to serve!