rubicon 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: '091921ef223a86af5d062f9cfd523f64fb56c0f8'
4
+ data.tar.gz: 6ce3ef233ffb2a366ee947a404ba175faf0f911a
5
+ SHA512:
6
+ metadata.gz: e8e314762a7aff21fe5224eb3198dc04d02982f0882487fcffef8e54562e44cb6ec82cba424e3bcf9818cc006901978e21f4932fd4103e587a4bd46ae62bf02f
7
+ data.tar.gz: 4f4a9e5597bad31c1f590a11e9824dc80a014680c37846da78617eab7c9c6f6ada3035e24b01e6f876947a5ce0c514b6b40fdfde0a077bb8f59e6e1867a4c03e
@@ -0,0 +1,20 @@
1
+ Copyright 2018
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,47 @@
1
+ # Rubicon
2
+
3
+ Easy project version management.
4
+ Based on [A successful Git branching model](https://nvie.com/posts/a-successful-git-branching-model/) we have built this useful gem. It allows you to manage project version, branch-naming convention and git tags using rails tasks.
5
+
6
+ ## Installation
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rubicon'
11
+ ```
12
+
13
+ And then execute:
14
+ ```
15
+ $ bundle install
16
+ ```
17
+
18
+ Or install it yourself as:
19
+ ```bash
20
+ $ gem install rubicon
21
+ ```
22
+
23
+ ## Available features
24
+
25
+ Update major version (1.X.X => 2.0.0)
26
+ ```
27
+ bundle exec rails version:major
28
+ ```
29
+ Update minor version (X.1.X => X.2.0)
30
+ ```
31
+ bundle exec rails version:minor
32
+ ```
33
+ Update patch version (X.X.1 => X.X.2)
34
+ ```
35
+ bundle exec rails version:patch
36
+ ```
37
+ ## License
38
+
39
+ Rubicon is released under the [MIT License](https://opensource.org/licenses/MIT)
40
+
41
+ ## About Codica
42
+
43
+ ![Codica logo](https://www.codica.com/assets/images/logo/logo.svg)
44
+
45
+ Rubicon was started by the team at [Codica](https://www.codica.com/).
46
+
47
+
@@ -0,0 +1,27 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Rubicon'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ require 'bundler/gem_tasks'
18
+
19
+ require 'rake/testtask'
20
+
21
+ Rake::TestTask.new(:test) do |t|
22
+ t.libs << 'test'
23
+ t.pattern = 'test/**/*_test.rb'
24
+ t.verbose = false
25
+ end
26
+
27
+ task default: :test
@@ -0,0 +1,9 @@
1
+ require 'rubicon/railtie'
2
+ require 'rubicon/git'
3
+ require 'rubicon/file'
4
+ require 'rubicon/version'
5
+ require 'systemu'
6
+
7
+ module Rubicon
8
+ attr_accessor :version_file
9
+ end
@@ -0,0 +1,15 @@
1
+ module Rubicon
2
+ module File
3
+ def write(version = '0.0.0')
4
+ ::File.open(version_file, 'w') { |f| f.write(version) }
5
+ end
6
+
7
+ def version_file
8
+ "#{Rails.root}/VERSION"
9
+ end
10
+
11
+ def read
12
+ IO.read(version_file)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ module Rubicon
2
+ module Git
3
+ def git_command(str)
4
+ systemu(str).second
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Rubicon
2
+ class Railtie < ::Rails::Railtie
3
+ rake_tasks do
4
+ load 'tasks/rubicon_tasks.rake'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,40 @@
1
+ module Rubicon
2
+ class Version
3
+ POSITIONS = { major: 0, minor: 1, patch: 2 }.freeze
4
+
5
+ include Rubicon::File
6
+ include Rubicon::Git
7
+
8
+ attr_reader :current
9
+
10
+ def initialize
11
+ @current = read
12
+ end
13
+
14
+ def release(category)
15
+ new_version = bump_version(category).join('.')
16
+ write(new_version)
17
+ git_tag(new_version)
18
+ end
19
+
20
+ private
21
+
22
+ def old_version
23
+ current.split('.').map(&:to_i)
24
+ end
25
+
26
+ def bump_version(category, array = old_version)
27
+ position = POSITIONS[category]
28
+
29
+ array[position] += 1
30
+ stable = array[0..position]
31
+ reset = Array.new(array[(position + 1)..-1].size, 0)
32
+
33
+ stable + reset
34
+ end
35
+
36
+ def git_tag(version)
37
+ git_command("git tag v#{version}")
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,21 @@
1
+ namespace :rubicon do
2
+ desc 'bump the patch version (1.2.x)'
3
+ task patch: :environment do
4
+ update_version(:patch)
5
+ end
6
+
7
+ desc 'bump the minor version (1.x.0)'
8
+ task minor: :environment do
9
+ update_version(:minor)
10
+ end
11
+
12
+ desc 'bump the major version (x.0.0)'
13
+ task major: :environment do
14
+ update_version(:major)
15
+ end
16
+ end
17
+
18
+ def update_version(step)
19
+ app_version = Rubicon::Version.new
20
+ app_version.release(step)
21
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubicon
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - RostislavKor
8
+ - volkov-sergey
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2018-06-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 5.0.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 5.0.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: systemu
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: sqlite3
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ description: Based on [A successful Git branching model](https://nvie.com/posts/a-successful-git-branching-model/)
57
+ we have built this useful gem. It allows you to manage project version, branch-naming
58
+ convention and git tags using rails tasks.
59
+ email:
60
+ - rkorin.codica@gmail.com
61
+ - sergvolkov.codica@gmail.com
62
+ executables: []
63
+ extensions: []
64
+ extra_rdoc_files: []
65
+ files:
66
+ - MIT-LICENSE
67
+ - README.md
68
+ - Rakefile
69
+ - lib/rubicon.rb
70
+ - lib/rubicon/file.rb
71
+ - lib/rubicon/git.rb
72
+ - lib/rubicon/railtie.rb
73
+ - lib/rubicon/version.rb
74
+ - lib/tasks/rubicon_tasks.rake
75
+ homepage: https://github.com/codica2/rubicon
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.6.11
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: Easy project version management.
99
+ test_files: []