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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60225e47f0ff28d5b992e944694a69d88c34f2ef
4
- data.tar.gz: b9230a1cb2dde00383b5fa65f117989ca0677b25
3
+ metadata.gz: 3daed2fb331a8613c937b4212eddf3bb32b13faa
4
+ data.tar.gz: 85835ecd6c13528d2981bd6495cabdfb264d70b6
5
5
  SHA512:
6
- metadata.gz: 2e0bd632eaabb484ba050287bebdc7ba8d6e8862b21ab8260c9aac60cb009671940800be833f88e08f436c84b99bcd356e60dd87d3080660863dfd19d3aa0d4f
7
- data.tar.gz: 911f6c0a0793c208e650222f07142cf3c43b52d0ea003e337c4df63ebf8864b744701fabbffa846b6634ef908ae3106f3ccb787f563044fa8ce2dc65b68b54d3
6
+ metadata.gz: 144b49f4f80e57022a3d3e7f62addd8c70114823589f4ebfb54fd2b3726317f841121eb0d984c3614183be80ae793d56972759412d11dcc9102ed6eca5fe08b3
7
+ data.tar.gz: e4b6d40856523e35ba7b6ce5996cff7e1c677d2034bec23d5f867ed9d3e8d261e0e52a7232c88b76764760bed726c8ad640ddd3a3b42ddc4bc56ec6d69e10ead
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ InstalledFiles
7
+ _yardoc
8
+ coverage
9
+ doc/
10
+ lib/bundler/man
11
+ pkg
12
+ rdoc
13
+ spec/reports
14
+ test/tmp
15
+ test/version_tmp
16
+ tmp
17
+ .coveralls.yml
18
+ .DS_Store
19
+ config/initializers/*
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
+ ruby "2.4.1"
2
3
 
3
4
  gemspec
data/Gemfile.lock CHANGED
@@ -1,75 +1,92 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- auto_tag_version (0.0.1)
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 (4.2.5)
11
- actionview (= 4.2.5)
12
- activesupport (= 4.2.5)
13
- rack (~> 1.6)
14
- rack-test (~> 0.6.2)
15
- rails-dom-testing (~> 1.0, >= 1.0.5)
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 (4.2.5)
18
- activesupport (= 4.2.5)
17
+ actionview (5.1.5)
18
+ activesupport (= 5.1.5)
19
19
  builder (~> 3.1)
20
- erubis (~> 2.7.0)
21
- rails-dom-testing (~> 1.0, >= 1.0.5)
22
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
- activesupport (4.2.5)
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.2)
30
- diff-lcs (1.2.5)
31
- erubis (2.7.0)
32
- i18n (0.7.0)
33
- json (1.8.3)
34
- loofah (2.0.3)
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
- mini_portile2 (2.0.0)
37
- minitest (5.8.3)
38
- nokogiri (1.6.7)
39
- mini_portile2 (~> 2.0.0.rc2)
40
- rack (1.6.4)
41
- rack-test (0.6.3)
42
- rack (>= 1.0)
43
- rails-deprecated_sanitizer (1.0.3)
44
- activesupport (>= 4.2.0.alpha)
45
- rails-dom-testing (1.0.7)
46
- activesupport (>= 4.2.0.beta, < 5.0)
47
- nokogiri (~> 1.6.0)
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 (4.2.5)
52
- actionpack (= 4.2.5)
53
- activesupport (= 4.2.5)
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 (10.4.2)
57
- rspec (3.4.0)
58
- rspec-core (~> 3.4.0)
59
- rspec-expectations (~> 3.4.0)
60
- rspec-mocks (~> 3.4.0)
61
- rspec-core (3.4.1)
62
- rspec-support (~> 3.4.0)
63
- rspec-expectations (3.4.0)
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.4.0)
66
- rspec-mocks (3.4.0)
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.4.0)
69
- rspec-support (3.4.1)
70
- thor (0.19.1)
71
- thread_safe (0.3.5)
72
- tzinfo (1.2.2)
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
- You can get the version number in your application as **"TestAPP::VERSION"**
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 }
@@ -17,4 +17,5 @@ Gem::Specification.new do |s|
17
17
  s.add_dependency "railties"
18
18
  s.add_development_dependency "rake"
19
19
  s.add_development_dependency "rspec"
20
+ s.add_development_dependency "coveralls"
20
21
  end
@@ -0,0 +1,3 @@
1
+ module APP; VERSION = '1.2.3'; end
2
+ # This file is created automatically by auto_tag_version gem
3
+ # Documentation at https://github.com/rafaelbiriba/auto_tag_version
@@ -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
- def self.tag tag = nil
4
- @tag = @tag || tag
5
- end
9
+ private
10
+ attr_reader :tag
6
11
 
7
- def self.content
8
- content = "module #{app}; VERSION = '#{tag}'; end\n"
9
- content += "# This file is created automatically by auto_tag_version gem\n"
10
- content += "# Documentation at https://github.com/rafaelbiriba/auto_tag_version"
11
- end
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
- def self.app
14
- Rails.application.class.parent_name
15
- end
18
+ def app
19
+ Rails.application.class.parent_name
20
+ end
16
21
 
17
- def self.version_file
18
- File.join("config", "initializers", "app_version.rb")
19
- end
22
+ def version_file
23
+ File.join("config", "initializers", "app_version.rb")
24
+ end
20
25
 
21
- def self.create_version_file
22
- File.open(version_file, "w") { |f| f.write(content) }
23
- end
26
+ def create_version_file
27
+ File.open(version_file, "w") { |f| f.write(content) }
28
+ end
24
29
 
25
- def self.commit_and_create_tag
26
- `git add #{version_file} && git commit -m "Bumping version #{tag}" && git tag #{tag}`
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
@@ -1,3 +1,3 @@
1
1
  module AutoTagVersion
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -5,8 +5,6 @@ task :autotag do
5
5
  elsif ENV["TAG"].blank?
6
6
  puts "TAG not found! USAGE: rake autotag TAG=0.0.0"
7
7
  else
8
- AutoTagVersion.tag ENV["TAG"]
9
- AutoTagVersion.create_version_file
10
- AutoTagVersion.commit_and_create_tag
8
+ AutoTagVersion.tag!(ENV["TAG"])
11
9
  end
12
10
  end
@@ -2,80 +2,39 @@ require 'spec_helper'
2
2
 
3
3
  describe AutoTagVersion do
4
4
  subject do
5
- AutoTagVersion
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
- describe ".content" do
17
- before do
18
- allow(subject).to receive(:app).and_return("App")
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
- it "should create the content for version file" do
23
- expect(subject.content).to eql "module App; VERSION = '1.1.1'; end\n# This file is created automatically by auto_tag_version gem\n# Documentation at https://github.com/rafaelbiriba/auto_tag_version"
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 ".app" do
28
- module Rails; def self.application; end; end
29
-
30
- let :app do
31
- "APP"
32
- end
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
- it "should return the Rails app name" do
39
- expect(subject.app).to eql app
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
- describe ".version_file" do
44
- it "should return the version filepath" do
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
- it "should commit and create the git tag" do
76
- git_msg = "git add test && git commit -m \"Bumping version 1.2.3\" && git tag 1.2.3"
77
- expect(subject).to receive(:`).with(git_msg)
78
- subject.commit_and_create_tag
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
@@ -1,4 +1,6 @@
1
1
  require "auto_tag_version"
2
+ require "coveralls"
3
+ Coveralls.wear!
2
4
 
3
5
  RSpec.configure do |config|
4
6
  # rspec-expectations config goes here. You can use an alternate
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.1
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: 2015-12-07 00:00:00.000000000 Z
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
- - .rspec
63
- - .ruby-gemset
64
- - .ruby-version
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.4.5
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