auto_tag_version 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +19 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +77 -53
- data/README.md +5 -3
- data/Rakefile +13 -0
- data/auto_tag_version.gemspec +1 -0
- data/config/initializers/app_version.rb +3 -0
- data/lib/auto_tag_version/utils.rb +25 -19
- data/lib/auto_tag_version/version.rb +1 -1
- data/lib/tasks/autotag.rake +1 -3
- data/spec/lib/auto_tag_version/utils_spec.rb +23 -64
- data/spec/spec_helper.rb +2 -0
- metadata +29 -14
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3daed2fb331a8613c937b4212eddf3bb32b13faa
|
4
|
+
data.tar.gz: 85835ecd6c13528d2981bd6495cabdfb264d70b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 144b49f4f80e57022a3d3e7f62addd8c70114823589f4ebfb54fd2b3726317f841121eb0d984c3614183be80ae793d56972759412d11dcc9102ed6eca5fe08b3
|
7
|
+
data.tar.gz: e4b6d40856523e35ba7b6ce5996cff7e1c677d2034bec23d5f867ed9d3e8d261e0e52a7232c88b76764760bed726c8ad640ddd3a3b42ddc4bc56ec6d69e10ead
|
data/.gitignore
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,75 +1,92 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
auto_tag_version (0.0
|
4
|
+
auto_tag_version (1.0.0)
|
5
5
|
railties
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionpack (
|
11
|
-
actionview (=
|
12
|
-
activesupport (=
|
13
|
-
rack (~>
|
14
|
-
rack-test (
|
15
|
-
rails-dom-testing (~>
|
10
|
+
actionpack (5.1.5)
|
11
|
+
actionview (= 5.1.5)
|
12
|
+
activesupport (= 5.1.5)
|
13
|
+
rack (~> 2.0)
|
14
|
+
rack-test (>= 0.6.3)
|
15
|
+
rails-dom-testing (~> 2.0)
|
16
16
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
17
|
-
actionview (
|
18
|
-
activesupport (=
|
17
|
+
actionview (5.1.5)
|
18
|
+
activesupport (= 5.1.5)
|
19
19
|
builder (~> 3.1)
|
20
|
-
|
21
|
-
rails-dom-testing (~>
|
22
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
23
|
-
activesupport (
|
20
|
+
erubi (~> 1.4)
|
21
|
+
rails-dom-testing (~> 2.0)
|
22
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
23
|
+
activesupport (5.1.5)
|
24
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
24
25
|
i18n (~> 0.7)
|
25
|
-
json (~> 1.7, >= 1.7.7)
|
26
26
|
minitest (~> 5.1)
|
27
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
28
27
|
tzinfo (~> 1.1)
|
29
|
-
builder (3.2.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
28
|
+
builder (3.2.3)
|
29
|
+
concurrent-ruby (1.0.5)
|
30
|
+
coveralls (0.8.21)
|
31
|
+
json (>= 1.8, < 3)
|
32
|
+
simplecov (~> 0.14.1)
|
33
|
+
term-ansicolor (~> 1.3)
|
34
|
+
thor (~> 0.19.4)
|
35
|
+
tins (~> 1.6)
|
36
|
+
crass (1.0.3)
|
37
|
+
diff-lcs (1.3)
|
38
|
+
docile (1.1.5)
|
39
|
+
erubi (1.7.1)
|
40
|
+
i18n (0.9.5)
|
41
|
+
concurrent-ruby (~> 1.0)
|
42
|
+
json (2.1.0)
|
43
|
+
loofah (2.2.2)
|
44
|
+
crass (~> 1.0.2)
|
35
45
|
nokogiri (>= 1.5.9)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
rack
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
rails-deprecated_sanitizer (>= 1.0.1)
|
49
|
-
rails-html-sanitizer (1.0.2)
|
46
|
+
method_source (0.9.0)
|
47
|
+
mini_portile2 (2.3.0)
|
48
|
+
minitest (5.11.3)
|
49
|
+
nokogiri (1.8.2)
|
50
|
+
mini_portile2 (~> 2.3.0)
|
51
|
+
rack (2.0.4)
|
52
|
+
rack-test (0.8.3)
|
53
|
+
rack (>= 1.0, < 3)
|
54
|
+
rails-dom-testing (2.0.3)
|
55
|
+
activesupport (>= 4.2.0)
|
56
|
+
nokogiri (>= 1.6)
|
57
|
+
rails-html-sanitizer (1.0.3)
|
50
58
|
loofah (~> 2.0)
|
51
|
-
railties (
|
52
|
-
actionpack (=
|
53
|
-
activesupport (=
|
59
|
+
railties (5.1.5)
|
60
|
+
actionpack (= 5.1.5)
|
61
|
+
activesupport (= 5.1.5)
|
62
|
+
method_source
|
54
63
|
rake (>= 0.8.7)
|
55
64
|
thor (>= 0.18.1, < 2.0)
|
56
|
-
rake (
|
57
|
-
rspec (3.
|
58
|
-
rspec-core (~> 3.
|
59
|
-
rspec-expectations (~> 3.
|
60
|
-
rspec-mocks (~> 3.
|
61
|
-
rspec-core (3.
|
62
|
-
rspec-support (~> 3.
|
63
|
-
rspec-expectations (3.
|
65
|
+
rake (12.3.1)
|
66
|
+
rspec (3.7.0)
|
67
|
+
rspec-core (~> 3.7.0)
|
68
|
+
rspec-expectations (~> 3.7.0)
|
69
|
+
rspec-mocks (~> 3.7.0)
|
70
|
+
rspec-core (3.7.1)
|
71
|
+
rspec-support (~> 3.7.0)
|
72
|
+
rspec-expectations (3.7.0)
|
64
73
|
diff-lcs (>= 1.2.0, < 2.0)
|
65
|
-
rspec-support (~> 3.
|
66
|
-
rspec-mocks (3.
|
74
|
+
rspec-support (~> 3.7.0)
|
75
|
+
rspec-mocks (3.7.0)
|
67
76
|
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
-
rspec-support (~> 3.
|
69
|
-
rspec-support (3.
|
70
|
-
|
71
|
-
|
72
|
-
|
77
|
+
rspec-support (~> 3.7.0)
|
78
|
+
rspec-support (3.7.1)
|
79
|
+
simplecov (0.14.1)
|
80
|
+
docile (~> 1.1.0)
|
81
|
+
json (>= 1.8, < 3)
|
82
|
+
simplecov-html (~> 0.10.0)
|
83
|
+
simplecov-html (0.10.2)
|
84
|
+
term-ansicolor (1.6.0)
|
85
|
+
tins (~> 1.0)
|
86
|
+
thor (0.19.4)
|
87
|
+
thread_safe (0.3.6)
|
88
|
+
tins (1.16.3)
|
89
|
+
tzinfo (1.2.5)
|
73
90
|
thread_safe (~> 0.1)
|
74
91
|
|
75
92
|
PLATFORMS
|
@@ -77,5 +94,12 @@ PLATFORMS
|
|
77
94
|
|
78
95
|
DEPENDENCIES
|
79
96
|
auto_tag_version!
|
97
|
+
coveralls
|
80
98
|
rake
|
81
99
|
rspec
|
100
|
+
|
101
|
+
RUBY VERSION
|
102
|
+
ruby 2.4.1p111
|
103
|
+
|
104
|
+
BUNDLED WITH
|
105
|
+
1.16.1
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
# Auto Tag Version
|
1
|
+
# Auto Tag Version [![Gem Version](https://badge.fury.io/rb/auto_tag_version.svg)](http://badge.fury.io/rb/auto_tag_version) [![Code Climate](https://codeclimate.com/github/rafaelbiriba/auto_tag_version/badges/gpa.svg)](https://codeclimate.com/github/rafaelbiriba/auto_tag_version) [![Travis](https://api.travis-ci.org/rafaelbiriba/auto_tag_version.svg?branch=master)](https://travis-ci.org/rafaelbiriba/auto_tag_version) [![Coverage Status](https://coveralls.io/repos/rafaelbiriba/auto_tag_version/badge.svg?branch=master&service=github)](https://coveralls.io/github/rafaelbiriba/auto_tag_version?branch=master)
|
2
|
+
|
2
3
|
Create/Update the application version file of your Rails app and automatically create the git tag.
|
3
4
|
|
4
5
|
## Prerequisite
|
@@ -29,6 +30,7 @@ module TestAPP
|
|
29
30
|
VERSION = 10.24.5
|
30
31
|
end
|
31
32
|
```
|
32
|
-
And them will commit this file and create a git tag. **(You need to push it manually!)**
|
33
33
|
|
34
|
-
|
34
|
+
And the file will be automatically commited and the git tag created. **(You need to push it manually!)**
|
35
|
+
|
36
|
+
You can access the version number of your application using **"TestAPP::VERSION"**
|
data/Rakefile
CHANGED
@@ -1,3 +1,16 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new
|
5
|
+
|
6
|
+
namespace :spec do
|
7
|
+
desc "Run Rspec test pushing Coverage results"
|
8
|
+
task :coveralls do
|
9
|
+
system "coveralls push"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
task :default => :spec
|
14
|
+
task :test => :spec
|
2
15
|
|
3
16
|
Dir.glob('lib/tasks/*.rake').each { |r| import r }
|
data/auto_tag_version.gemspec
CHANGED
@@ -1,28 +1,34 @@
|
|
1
1
|
module AutoTagVersion
|
2
|
+
class << self
|
3
|
+
def tag!(tag)
|
4
|
+
@tag = tag
|
5
|
+
create_version_file
|
6
|
+
commit_and_create_tag
|
7
|
+
end
|
2
8
|
|
3
|
-
|
4
|
-
|
5
|
-
end
|
9
|
+
private
|
10
|
+
attr_reader :tag
|
6
11
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
+
def content
|
13
|
+
content = "module #{app}; VERSION = '#{tag}'; end\n"
|
14
|
+
content += "# This file is created automatically by auto_tag_version gem\n"
|
15
|
+
content += "# Documentation at https://github.com/rafaelbiriba/auto_tag_version"
|
16
|
+
end
|
12
17
|
|
13
|
-
|
14
|
-
|
15
|
-
|
18
|
+
def app
|
19
|
+
Rails.application.class.parent_name
|
20
|
+
end
|
16
21
|
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
def version_file
|
23
|
+
File.join("config", "initializers", "app_version.rb")
|
24
|
+
end
|
20
25
|
|
21
|
-
|
22
|
-
|
23
|
-
|
26
|
+
def create_version_file
|
27
|
+
File.open(version_file, "w") { |f| f.write(content) }
|
28
|
+
end
|
24
29
|
|
25
|
-
|
26
|
-
|
30
|
+
def commit_and_create_tag
|
31
|
+
`git add #{version_file} && git commit -m "Bumping version #{tag}" && git tag #{tag}`
|
32
|
+
end
|
27
33
|
end
|
28
34
|
end
|
data/lib/tasks/autotag.rake
CHANGED
@@ -2,80 +2,39 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe AutoTagVersion do
|
4
4
|
subject do
|
5
|
-
|
6
|
-
end
|
7
|
-
|
8
|
-
describe ".tag" do
|
9
|
-
it "should save and return the tag" do
|
10
|
-
subject.tag 123
|
11
|
-
expect(subject.tag).to be 123
|
12
|
-
end
|
5
|
+
AutoTagVersion
|
13
6
|
end
|
14
7
|
|
8
|
+
module Rails; def self.application; end; end
|
9
|
+
module APP; end;
|
15
10
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
allow(subject).to receive(:tag).and_return("1.1.1")
|
20
|
-
end
|
11
|
+
let(:tag_version) { "1.2.3" }
|
12
|
+
let(:app) { APP }
|
13
|
+
let(:app_version_path) { "config/initializers/app_version.rb" }
|
21
14
|
|
22
|
-
|
23
|
-
|
24
|
-
end
|
15
|
+
before do
|
16
|
+
allow(Rails).to receive_message_chain("application.class.parent_name").and_return(app.to_s)
|
25
17
|
end
|
26
18
|
|
27
|
-
describe ".
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
before do
|
35
|
-
allow(Rails).to receive_message_chain("application.class.parent_name").and_return(app)
|
36
|
-
end
|
19
|
+
describe ".tag!" do
|
20
|
+
context "VERSION variable available" do
|
21
|
+
before do
|
22
|
+
subject.tag!(tag_version)
|
23
|
+
load(app_version_path)
|
24
|
+
end
|
37
25
|
|
38
|
-
|
39
|
-
|
26
|
+
it "should save the correct tag version" do
|
27
|
+
expect(app::VERSION).to eq(tag_version)
|
28
|
+
end
|
40
29
|
end
|
41
|
-
end
|
42
30
|
|
43
|
-
|
44
|
-
|
45
|
-
expect(subject.version_file).to eql "config/initializers/app_version.rb"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe ".create_version_file" do
|
50
|
-
let :file do
|
51
|
-
"spec_test_file"
|
52
|
-
end
|
53
|
-
|
54
|
-
before do
|
55
|
-
allow(subject).to receive(:version_file).and_return(file)
|
56
|
-
allow(subject).to receive(:content).and_return("test")
|
57
|
-
end
|
58
|
-
|
59
|
-
after do
|
60
|
-
FileUtils.rm file
|
61
|
-
end
|
62
|
-
|
63
|
-
it "should create the version file" do
|
64
|
-
subject.create_version_file
|
65
|
-
expect(`cat #{file}`).to eql "test"
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe ".commit_and_create_tag" do
|
70
|
-
before do
|
71
|
-
allow(subject).to receive(:version_file).and_return("test")
|
72
|
-
allow(subject).to receive(:tag).and_return("1.2.3")
|
73
|
-
end
|
31
|
+
context "git integration" do
|
32
|
+
let(:git_msg) { "git add #{app_version_path} && git commit -m \"Bumping version #{tag_version}\" && git tag #{tag_version}" }
|
74
33
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
34
|
+
it "should run the correct git command" do
|
35
|
+
expect(subject).to receive(:`).with(git_msg)
|
36
|
+
subject.tag!(tag_version)
|
37
|
+
end
|
79
38
|
end
|
80
39
|
end
|
81
40
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,55 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auto_tag_version
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafael Biriba
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
description: Generate auto tag
|
@@ -59,14 +73,15 @@ executables: []
|
|
59
73
|
extensions: []
|
60
74
|
extra_rdoc_files: []
|
61
75
|
files:
|
62
|
-
- .
|
63
|
-
- .
|
64
|
-
- .ruby-
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".ruby-gemset"
|
65
79
|
- Gemfile
|
66
80
|
- Gemfile.lock
|
67
81
|
- README.md
|
68
82
|
- Rakefile
|
69
83
|
- auto_tag_version.gemspec
|
84
|
+
- config/initializers/app_version.rb
|
70
85
|
- lib/auto_tag_version.rb
|
71
86
|
- lib/auto_tag_version/railtie.rb
|
72
87
|
- lib/auto_tag_version/utils.rb
|
@@ -84,17 +99,17 @@ require_paths:
|
|
84
99
|
- lib
|
85
100
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
101
|
requirements:
|
87
|
-
- -
|
102
|
+
- - ">="
|
88
103
|
- !ruby/object:Gem::Version
|
89
104
|
version: '0'
|
90
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
106
|
requirements:
|
92
|
-
- -
|
107
|
+
- - ">="
|
93
108
|
- !ruby/object:Gem::Version
|
94
109
|
version: '0'
|
95
110
|
requirements: []
|
96
111
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.
|
112
|
+
rubygems_version: 2.6.12
|
98
113
|
signing_key:
|
99
114
|
specification_version: 4
|
100
115
|
summary: Generate auto tag
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby-2.0.0-p598
|