rake_rack 1.1.0 → 2.0.0

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: 779c63528007bd1658fa4b62921c28c23dcb2b4b
4
- data.tar.gz: 8ee6732d620c16c23a8a2ca5eae7e37aa09a18f0
3
+ metadata.gz: 917f8815273708d4b3c5da0390ed553b3a5bdab2
4
+ data.tar.gz: a7f8b74fe7ae9f4352957b1d25edcf1b7b1c710e
5
5
  SHA512:
6
- metadata.gz: db7319de2d9a9acd4d888086e02bc5bd24bd15cba8f28505464e9798e5d7a6d386608310ecf50f5271e53e53550db5dd07614b66288eb3174d347fd319802f77
7
- data.tar.gz: 8283c38a7352d8fadf04cab850f65f4a1837c27eb9d6293865b8675804b44ed42cf0e8cb060a78419d6364ea11c792dd12a29502ab41a55cf4ffdd66cccc8b2f
6
+ metadata.gz: 936e11a20ffcaf9fcb453b316515ec077543b9b40d175b9b3174b653d73f4b6de22275d06f58942468382ea095a7bff2f29c1e94b7474951a870119f1ea130f1
7
+ data.tar.gz: 5d27e61f57bcb1e9a288a58f61530fe78e0245226fcede9b045ea9246173ce4995af10a76c8854459f29f441eab9970916e168467565b801934feb5b82051605
data/Gemfile CHANGED
@@ -3,6 +3,7 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :development, :test do
6
+ gem 'semver2'
6
7
  gem 'rake'
7
8
  gem 'rspec'
8
9
  gem 'bundler-audit'
@@ -27,6 +27,7 @@ GEM
27
27
  rspec-mocks (3.0.3)
28
28
  rspec-support (~> 3.0.0)
29
29
  rspec-support (3.0.3)
30
+ semver2 (3.4.0)
30
31
  simplecov (0.9.0)
31
32
  docile (~> 1.1.0)
32
33
  multi_json
@@ -46,6 +47,7 @@ DEPENDENCIES
46
47
  rake
47
48
  rake_rack!
48
49
  rspec
50
+ semver2
49
51
  simplecov
50
52
  term-ansicolor (~> 1.3)
51
53
  timecop
data/README.md CHANGED
@@ -1,75 +1,4 @@
1
1
  RakeRack
2
2
  ========
3
3
 
4
- Commonly used Rake tasks
5
- ------------------------
6
- ...collected together and given a new coat of paint (and nothing to do with [Rack](http://rack.github.io/))
7
-
8
-
9
- [![Build Status](https://travis-ci.org/RichardVickerstaff/rake_rack.svg?branch=master)](https://travis-ci.org/RichardVickerstaff/rake_rack)
10
- [![Gem Version](https://badge.fury.io/rb/rake_rack.svg)](http://badge.fury.io/rb/rake_rack)
11
-
12
- RakeRack is a collection of widely applicable Rake tasks used on many projects.
13
- They have been extracted into a gem to allow them to easily be reused and maintained.
14
-
15
- RakeRack tasks are used on the project itself, so you can always take a peek at our [Rakefile](https://github.com/RichardVickerstaff/rake_rack/blob/master/Rakefile) or the [tasks themselves](https://github.com/RichardVickerstaff/rake_rack/tree/master/tasks) to work out what is going on
16
-
17
- Installation
18
- ------------
19
- Install the gem or add `gem "rake_rack"` to your Gemfile.
20
-
21
- Usage
22
- -----
23
- 1. Add `require "rake_rack"` to your Rakefile
24
- 2. Call the tasks that you want, in with your usual Rake tasks.
25
-
26
- Tasks are namespaced under `:rake_rack` to prevent clashes.
27
- For example, this means the `:ok` task is called by invoking `:rake_rack:ok`
28
-
29
- Tasks
30
- -----
31
- ### :bundler_audit
32
- Check the current Gemfile.lock for gem versions with known security issues, courtesy of [Bundler Audit](https://github.com/rubysec/bundler-audit#readme)
33
-
34
- ### :check_external_dependencies
35
- Check that each command in the `@external_dependencies` array is present on the system path (and fails the task if it isn't)
36
- For example:
37
- ```ruby
38
- @external_dependencies = ['ruby', 'postgres', 'foo']
39
- ```
40
- You can also use the underlying checker object by creating an instance of `RakeRack::DependencyChecker` with your array of dependencies and calling `#check` or `#missing` on it.
41
-
42
- ### :code_quality
43
- #### :all
44
- Runs `[:trailing_spaces, :shoulds, :debugger, :pry, :console_log]` tasks. It does not run `:time_check`
45
- ##### :trailing_spaces
46
- Check for trailing spaces in `[spec, features, lib, app, factories, db]`.
47
- ##### :shoulds
48
- Check for legacy 'it "should blah"' style specs
49
- ##### :debugger
50
- Check for debugger statements in `[lib, app, spec, features]`.
51
- ##### :pry
52
- Check for binding.pry statements in `[lib, app, spec, features]`.
53
- ##### :console_log
54
- Check for console.log statements in `app/assets/javascripys`.
55
- ##### :time_check
56
- Check for `Time.now` statements in `[lib, app]` (Time.zone.now is more reliable for servers wanting to use UTC).
57
- This check is NOT part of :all as `Time.zone.now` is an ActiveSupport method.
58
-
59
- ### :coverage
60
- #### :check_specs
61
- Look at SimpleCov results for spec coverage in `log/coverage/spec` and fail the build if not 100%
62
- #### :check_cucumber
63
- Look at SimpleCov results for Cucumber coverage in `log/coverage/features` and fail the build if not 100%
64
-
65
- ### :ok
66
- Useful at the end of any Rake tasks which test your application, it prints `***** ALL TESTS PASSED *****`.
67
-
68
- ### :ok_rainbow
69
- Run this task last to print a more magical version of `:ok`
70
-
71
- Contributing
72
- ------------
73
- 1. Make a fork
74
- 2. Make and push your changes to your fork
75
- 3. Create a Pull Reques
4
+ This gem has moved to rake-n-bake, please use that instead.
@@ -0,0 +1,62 @@
1
+ require 'semver'
2
+ class RakeRack
3
+ class SemverVersioning
4
+ def self.current_version
5
+ if File.exist? SemVer.file_name
6
+ SemVer.find
7
+ else
8
+ version = SemVer.new
9
+ version.save SemVer.file_name
10
+ version
11
+ end
12
+ end
13
+
14
+ def self.inc_major
15
+ v = current_version
16
+ v.major = v.major.to_i + 1
17
+ v.minor = '0'
18
+ v.patch = '0'
19
+ v.save
20
+ end
21
+
22
+ def self.inc_minor
23
+ v = current_version
24
+ v.minor = v.minor.to_i + 1
25
+ v.patch = '0'
26
+ v.save
27
+ end
28
+
29
+ def self.inc_patch
30
+ v = current_version
31
+ v.patch = v.patch.to_i + 1
32
+ v.save
33
+ end
34
+
35
+ def self.prerelease s
36
+ v = current_version
37
+ v.special = s
38
+ v.save
39
+ end
40
+
41
+ def self.inc_prerelease s
42
+ inc_major
43
+ v = current_version
44
+ v.special = s
45
+ v.save
46
+ end
47
+
48
+ def self.release
49
+ v = current_version
50
+ v.special = ''
51
+ v.save
52
+ end
53
+
54
+ def self.tag
55
+ v = current_version.to_s
56
+ `git add .semver && git commit -m 'Increment version to #{v}' && git tag #{v}`
57
+ branch = `git symbolic-ref HEAD`[%r{.*/(.*)}, 1]
58
+ puts "To push the new tag, use 'git push origin #{branch} --tags'"
59
+ end
60
+ end
61
+ end
62
+
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "rake_rack"
7
- spec.version = '1.1.0'
7
+ spec.version = '2.0.0'
8
8
  spec.authors = ["Richard Vickerstaff"]
9
9
  spec.email = ["m3akq@btinternet.com"]
10
10
  spec.description = "A set of rake tasks I commonly use - Formerly known as pool_net"
@@ -13,6 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.license = "MIT"
14
14
  spec.files = `git ls-files`.split($/)
15
15
  spec.require_paths = ["lib","tasks"]
16
+ spec.post_install_message = "This gem has moved to rake-n-bake, please use that instead"
16
17
 
17
18
  spec.add_runtime_dependency "rake", "~> 10"
18
19
  spec.add_runtime_dependency "term-ansicolor", "~> 1.3"
@@ -0,0 +1,123 @@
1
+ require 'spec_helper'
2
+ require 'yaml'
3
+
4
+ describe RakeRack::SemverVersioning do
5
+ let(:version) {
6
+ {
7
+ major: '1',
8
+ minor: '2',
9
+ patch: '3',
10
+ special: '',
11
+ metadata: ''
12
+ }
13
+ }
14
+ before(:all) do
15
+ if File.exist? File.join(File.dirname(__FILE__), '../.semver')
16
+ @current_semver_file = File.read(File.join(File.dirname(__FILE__), '../.semver'), force: true)
17
+ end
18
+ end
19
+
20
+ after(:all) do
21
+ if @current_semver_file
22
+ File.write(File.join(File.dirname(__FILE__), '../.semver'), @current_semver_file, force: true)
23
+ end
24
+ end
25
+ before do
26
+ FileUtils.rm(File.join(File.dirname(__FILE__), '../.semver'), force: true)
27
+ end
28
+ after do
29
+ FileUtils.rm(File.join(File.dirname(__FILE__), '../.semver'), force: true)
30
+ end
31
+ describe '#current_version' do
32
+ context 'when there is no .semver file' do
33
+ it 'returns the current version' do
34
+ expect(described_class.current_version.to_s).to eq 'v0.0.0'
35
+ end
36
+ end
37
+
38
+ context 'when there is a .semver file' do
39
+ before do
40
+ File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
41
+ end
42
+
43
+ it 'returns the current version' do
44
+ expect(described_class.current_version.to_s).to eq 'v1.2.3'
45
+ end
46
+ end
47
+ end
48
+
49
+ describe 'inc_major' do
50
+ before do
51
+ File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
52
+ end
53
+ it 'increases major and resets minor and patch' do
54
+ described_class.inc_major
55
+ expect(described_class.current_version.to_s).to eq 'v2.0.0'
56
+ end
57
+ end
58
+
59
+ describe 'inc_minor' do
60
+ before do
61
+ File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
62
+ end
63
+ it 'increases minor and resets patch' do
64
+ described_class.inc_minor
65
+ expect(described_class.current_version.to_s).to eq 'v1.3.0'
66
+ end
67
+ end
68
+
69
+ describe 'inc_patch' do
70
+ before do
71
+ File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
72
+ end
73
+ it 'increases minor and resets patch' do
74
+ described_class.inc_patch
75
+ expect(described_class.current_version.to_s).to eq 'v1.2.4'
76
+ end
77
+ end
78
+
79
+ describe 'prerelease' do
80
+ before do
81
+ File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
82
+ end
83
+ it 'sets the prerelease to the supplied string' do
84
+ described_class.prerelease 'something'
85
+ expect(described_class.current_version.to_s).to eq 'v1.2.3-something'
86
+ end
87
+ end
88
+
89
+ describe 'inc_prerelease' do
90
+ before do
91
+ File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
92
+ end
93
+ it 'increments major version and sets the prerelease to the supplied string' do
94
+ described_class.inc_prerelease 'something'
95
+ expect(described_class.current_version.to_s).to eq 'v2.0.0-something'
96
+ end
97
+ end
98
+
99
+ describe 'release' do
100
+ before do
101
+ v = version
102
+ v[:special] = "a string"
103
+ File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(v))
104
+ end
105
+ it 'removes the prerelease' do
106
+ described_class.release
107
+ expect(described_class.current_version.to_s).to eq 'v1.2.3'
108
+ end
109
+ end
110
+
111
+ describe 'tag' do
112
+ before do
113
+ File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
114
+ end
115
+ it 'tags with the curren semver release and outputs push instructions' do
116
+ expect(Object).to receive(:`).with("git add .semver && git commit -m 'Increment version to v1.2.3' && git tag v1.2.3")
117
+ expect(Object).to receive(:`).with('git symbolic-ref HEAD').and_return 'refs/heads/master'
118
+ expect(Object).to receive(:puts).with("To push the new tag, use 'git push origin master --tags'")
119
+ described_class.tag
120
+ end
121
+ end
122
+ end
123
+
@@ -4,6 +4,7 @@ require 'tempfile'
4
4
 
5
5
  SimpleCov.start do
6
6
  add_filter '/vendor/'
7
+ add_filter '/spec/'
7
8
  coverage_dir 'log/coverage/spec'
8
9
  end
9
10
 
@@ -0,0 +1,53 @@
1
+ begin
2
+ require 'semver'
3
+ namespace :rake_rack do
4
+ namespace :semver do
5
+
6
+ desc "Display the latest version (form .semver)"
7
+ task :version do
8
+ RakeRack::SemverVersioning.latest_version
9
+ RakeRack::SemverVersioning.tag
10
+ end
11
+
12
+ desc 'Increment major version in .semver (eg 1.2.3 => 2.0.0)'
13
+ task :major do
14
+ RakeRack::SemverVersioning.inc_major
15
+ RakeRack::SemverVersioning.tag
16
+ end
17
+
18
+ desc 'Increment minor version in .semver (eg 1.2.3 => 1.3.0)'
19
+ task :minor do
20
+ RakeRack::SemverVersioning.inc_minor
21
+ RakeRack::SemverVersioning.tag
22
+ end
23
+
24
+ desc 'Increment patch version in .semver (eg 1.2.3 => 2.0.0)'
25
+ task :patch do
26
+ RakeRack::SemverVersioning.inc_patch
27
+ RakeRack::SemverVersioning.tag
28
+ end
29
+
30
+ desc 'Add or modify the current prerelease version (eg 1.2.3-rc1 => 1.2.3-rc2'
31
+ task :prerelease, [:version] do |task, args|
32
+ version = args[:version] || fail("Invalid usage: rake rake_rack:semver:prerelase['release name']")
33
+ RakeRack::SemverVersioning.prerelease version
34
+ RakeRack::SemverVersioning.tag
35
+ end
36
+
37
+ desc 'Increment major version and add a prerelease version (eg 1.2.3 => 2.0.0-rc1)'
38
+ task :inc_prerelease, [:version] do |task, args|
39
+ version = args[:version] || fail("Invalid usage: rake rake_rack:semver:inc_prerelase['release name']")
40
+ RakeRack::SemverVersioning.inc_prerelease version
41
+ RakeRack::SemverVersioning.tag
42
+ end
43
+
44
+ desc 'Remove prerelease version (eg 1.2.3-rc2 => 1.2.3)'
45
+ task :release do
46
+ RakeRack::SemverVersioning.release
47
+ RakeRack::SemverVersioning.tag
48
+ end
49
+ end
50
+ end
51
+ rescue LoadError
52
+ $stderr.puts "Error: Semver not avaialble"
53
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake_rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Vickerstaff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-19 00:00:00.000000000 Z
11
+ date: 2014-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -55,10 +55,12 @@ files:
55
55
  - history.rdoc
56
56
  - lib/dependency_checker.rb
57
57
  - lib/rake_rack.rb
58
+ - lib/semver_versioning.rb
58
59
  - lib/version.rb
59
60
  - rake_rack.gemspec
60
61
  - spec/.keep
61
62
  - spec/dependency_checker_spec.rb
63
+ - spec/semver_versioning_spec.rb
62
64
  - spec/spec_helper.rb
63
65
  - spec/version_spec.rb
64
66
  - tasks/bundler_audit.rake
@@ -67,12 +69,13 @@ files:
67
69
  - tasks/coverage.rake
68
70
  - tasks/ok.rake
69
71
  - tasks/rspec.rake
72
+ - tasks/semver.rake
70
73
  - tasks/version.rake
71
74
  homepage: https://github.com/RichardVickerstaff/rake_rack
72
75
  licenses:
73
76
  - MIT
74
77
  metadata: {}
75
- post_install_message:
78
+ post_install_message: This gem has moved to rake-n-bake, please use that instead
76
79
  rdoc_options: []
77
80
  require_paths:
78
81
  - lib