version_tracker 0.1.0 → 0.3.0
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.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/bin/version +5 -4
- data/lib/version_tracker/command_line.rb +34 -10
- data/lib/version_tracker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b4adb628c383c9b7db13a434efa7ad8a5b5f12e3
|
|
4
|
+
data.tar.gz: df838bc2f082253c5ab5339b0fca1d09b77418a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8c419dd6dcfb4fd26da5e69b00902d2adc3e25ddfcb166b32948ac9848870892b5a06a641077e1120d09ebbf9183eb5dec999070801cd2f781f92cdf69e3bc90
|
|
7
|
+
data.tar.gz: 70ef0b890972591ba6429d1043308fe3f229e44b82a4589c37c4853fb6223dde56213c3c57666e50a95d71e3b6ff83dd8caf67e6c223e0cf28a0d50aba2c1ed7
|
data/README.md
CHANGED
|
@@ -23,12 +23,13 @@ Or install it yourself as:
|
|
|
23
23
|
|
|
24
24
|
### Using Command Line
|
|
25
25
|
```
|
|
26
|
+
version [read] # Display current VERSION
|
|
26
27
|
version init [value] # Initialize VERSION File with provided value.
|
|
27
28
|
# Default: 0.0.0 if value is not provided and VERSION File does not exist
|
|
28
|
-
version
|
|
29
|
-
|
|
29
|
+
version bump [part] # Bump VERSION based on part.
|
|
30
|
+
# Valid part: major, minor, patch (Default: patch)
|
|
30
31
|
version tag # Tag using current VERSION
|
|
31
|
-
|
|
32
|
+
|
|
32
33
|
OPTIONS:
|
|
33
34
|
-r, --release Push to release branch using current version
|
|
34
35
|
-m, --message=MESSAGE Push with custom commit message
|
data/bin/version
CHANGED
|
@@ -11,9 +11,11 @@ option_parser =
|
|
|
11
11
|
Version Tracker: Manages Rails Application Version
|
|
12
12
|
|
|
13
13
|
USAGE:
|
|
14
|
-
version
|
|
15
|
-
version
|
|
16
|
-
|
|
14
|
+
version [read] # Display current VERSION
|
|
15
|
+
version init [value] # Initialize VERSION File with provided value.
|
|
16
|
+
# Default: 0.0.0 if value is not provided and VERSION File does not exist
|
|
17
|
+
version bump [part] # Bump VERSION based on part.
|
|
18
|
+
# Valid part: major, minor, patch (Default: patch)
|
|
17
19
|
version tag # Tag using current VERSION
|
|
18
20
|
|
|
19
21
|
OPTIONS:
|
|
@@ -46,6 +48,5 @@ option_parser.parse!
|
|
|
46
48
|
result, status = VersionTracker::CommandLine.new.execute ARGV, options
|
|
47
49
|
|
|
48
50
|
puts result
|
|
49
|
-
puts option_parser if status == VersionTracker::CommandLine::RESULT_STATUS::ERROR
|
|
50
51
|
|
|
51
52
|
exit status
|
|
@@ -85,20 +85,17 @@ module VersionTracker
|
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
def release
|
|
88
|
+
origin_branch = self.current_branch
|
|
88
89
|
branch = ['release', @version_tracker.version].join '/'
|
|
90
|
+
exists = system "git rev-parse --quiet --verify #{branch}"
|
|
89
91
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
system ['git', 'checkout', create_branch, branch].join(' ')
|
|
94
|
-
self.git_commit branch
|
|
92
|
+
self.checkout branch, :create => !exists
|
|
93
|
+
self.git_push branch, origin_branch, :create => !exists
|
|
95
94
|
end
|
|
96
95
|
|
|
97
96
|
|
|
98
97
|
def push
|
|
99
|
-
|
|
100
|
-
branch = result.gsub /\n/, ''
|
|
101
|
-
self.git_commit branch
|
|
98
|
+
self.git_push self.current_branch
|
|
102
99
|
end
|
|
103
100
|
|
|
104
101
|
|
|
@@ -107,10 +104,37 @@ module VersionTracker
|
|
|
107
104
|
end
|
|
108
105
|
|
|
109
106
|
|
|
110
|
-
def
|
|
107
|
+
def git_push branch, origin_branch = nil, options = {:create => false}
|
|
111
108
|
system 'git add VERSION'
|
|
112
109
|
system "git commit -m '#{self.message}'"
|
|
113
|
-
|
|
110
|
+
|
|
111
|
+
return if system("git push origin #{branch}")
|
|
112
|
+
|
|
113
|
+
self.revert_branch(origin_branch) unless origin_branch == branch
|
|
114
|
+
self.delete_branch branch if !!options[:create]
|
|
115
|
+
raise VersionTrackerError, 'Error encountered while pushing to git'
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def current_branch
|
|
120
|
+
result = `git rev-parse --abbrev-ref HEAD`
|
|
121
|
+
result.gsub /\n/, ''
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def checkout branch, options = {:create => false}
|
|
126
|
+
create_branch = '-b' if !!options[:create]
|
|
127
|
+
system ['git', 'checkout', create_branch, branch].join(' ')
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def revert_branch branch
|
|
132
|
+
self.checkout branch
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def delete_branch branch
|
|
137
|
+
system "git branch -D #{branch}"
|
|
114
138
|
end
|
|
115
139
|
|
|
116
140
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: version_tracker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Braymon Ramirez
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-07-
|
|
11
|
+
date: 2015-07-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|