dean 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/dean/cli.rb +2 -2
- data/lib/dean/commands/version_bumper.rb +9 -9
- data/lib/dean/semver_helper.rb +12 -2
- data/lib/dean/version.rb +1 -1
- data/spec/semver_helper_spec.rb +11 -0
- data/spec/version_bumper_spec.rb +25 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce1e331fdc1b3848040eb5d33b7ea84754d05294
|
4
|
+
data.tar.gz: 692c8cde3defaf9fb74dec7570be97138a40c954
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 597267a15aedf8d57039d4e543b8e398a39682cd218470be6797f20fbdbaa4f8c9c689a4edf686fbf49b97def23fac0a43983f14d30033f960e7d89538546e4f
|
7
|
+
data.tar.gz: 1a5d7cbea9e4b69c26c86958f92aa02d69a0bb096f53efece8691e8c5f8db4df183de3fc597134dacbb8d64422d4493dc48b0d0e30cc6809b0a1100fa5997e08
|
data/CHANGELOG.md
ADDED
data/lib/dean/cli.rb
CHANGED
@@ -5,14 +5,14 @@ module Dean
|
|
5
5
|
class Application < Thor
|
6
6
|
|
7
7
|
desc 'bump_version VALUE', 'Bump the given version VALUE of the project'
|
8
|
-
def bump(value)
|
8
|
+
def bump(value, name=nil)
|
9
9
|
plists = []
|
10
10
|
Dean::ConfigurationHelper.new.all_environments.each do |environment|
|
11
11
|
plists.push environment[:plist]
|
12
12
|
end
|
13
13
|
old_version = Dean::ProjectVersionHelper.new.version_from_plist plists[0]
|
14
14
|
|
15
|
-
Dean::VersionBumper.new.bump_all_environments value.to_sym
|
15
|
+
Dean::VersionBumper.new.bump_all_environments value.to_sym, name
|
16
16
|
|
17
17
|
# commit and tag, here only for the moment!
|
18
18
|
new_version = Dean::ProjectVersionHelper.new.version_from_plist plists[0]
|
@@ -1,21 +1,21 @@
|
|
1
1
|
module Dean
|
2
2
|
class VersionBumper
|
3
3
|
|
4
|
-
def bump_all_environments(value)
|
4
|
+
def bump_all_environments(value, name=nil)
|
5
5
|
configurations_helper = ConfigurationHelper.new
|
6
6
|
# TODO: this is a dirty hack! please remove it soon!
|
7
7
|
environments = configurations_helper.all_environments.uniq { |e| e[:plist] }
|
8
8
|
environments.each do |environment|
|
9
|
-
bump_environment value, environment
|
9
|
+
bump_environment value, environment, name
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
def bump_environment(value, environment)
|
14
|
-
bump environment[:plist], value
|
15
|
-
bump_short environment[:plist], value
|
13
|
+
def bump_environment(value, environment, name=nil)
|
14
|
+
bump environment[:plist], value, name
|
15
|
+
bump_short environment[:plist], value, name
|
16
16
|
end
|
17
17
|
|
18
|
-
def bump(plist, value)
|
18
|
+
def bump(plist, value, name=nil)
|
19
19
|
version = Dean::ProjectVersionHelper.new.version_from_plist plist
|
20
20
|
semver_helper = Dean::SemverHelper.new
|
21
21
|
|
@@ -28,13 +28,13 @@ module Dean
|
|
28
28
|
elsif value == :patch
|
29
29
|
new_version = semver_helper.bump_patch version
|
30
30
|
elsif value == :pre
|
31
|
-
new_version = semver_helper.bump_pre version
|
31
|
+
new_version = semver_helper.bump_pre version, name
|
32
32
|
end
|
33
33
|
|
34
34
|
Dean::ProjectVersionHelper.new.set_version_in_plist new_version, plist
|
35
35
|
end
|
36
36
|
|
37
|
-
def bump_short(plist, value)
|
37
|
+
def bump_short(plist, value, name=nil)
|
38
38
|
version = Dean::ProjectVersionHelper.new.short_version_from_plist plist
|
39
39
|
semver_helper = Dean::SemverHelper.new
|
40
40
|
|
@@ -47,7 +47,7 @@ module Dean
|
|
47
47
|
elsif value == :patch
|
48
48
|
new_version = semver_helper.bump_patch version
|
49
49
|
elsif value == :pre
|
50
|
-
new_version = semver_helper.bump_pre version
|
50
|
+
new_version = semver_helper.bump_pre version, name
|
51
51
|
end
|
52
52
|
|
53
53
|
Dean::ProjectVersionHelper.new.set_short_version_in_plist new_version, plist
|
data/lib/dean/semver_helper.rb
CHANGED
@@ -26,16 +26,26 @@ module Dean
|
|
26
26
|
semver.to_s
|
27
27
|
end
|
28
28
|
|
29
|
-
def bump_pre version
|
29
|
+
def bump_pre version, name=nil
|
30
30
|
semver = semver version
|
31
31
|
pre = semver.pre
|
32
32
|
|
33
|
-
|
33
|
+
if not pre
|
34
|
+
pre_name = name ? name : "pre"
|
35
|
+
semver.pre = pre_name + ".1"
|
36
|
+
return semver.to_s
|
37
|
+
end
|
34
38
|
|
35
39
|
split = pre.split('.')
|
36
40
|
if split.length == 1
|
41
|
+
if name
|
42
|
+
semver.pre = name
|
43
|
+
end
|
37
44
|
semver.pre += '.1'
|
38
45
|
else
|
46
|
+
if name
|
47
|
+
split[0] = name
|
48
|
+
end
|
39
49
|
value = split[-1]
|
40
50
|
split[-1] = (value.to_i + 1).to_s
|
41
51
|
semver.pre = split.join '.'
|
data/lib/dean/version.rb
CHANGED
data/spec/semver_helper_spec.rb
CHANGED
@@ -31,6 +31,10 @@ describe Dean::SemverHelper do
|
|
31
31
|
expect(helper.bump_pre '1.0.0-pre').to eq '1.0.0-pre.1'
|
32
32
|
end
|
33
33
|
|
34
|
+
it "shuold set the pre value of the given version to pre.1 if no pre value is present" do
|
35
|
+
expect(helper.bump_pre '1.0.0').to eq '1.0.0-pre.1'
|
36
|
+
end
|
37
|
+
|
34
38
|
context "when bumping a version with a pre value" do
|
35
39
|
it "shold remove the pre value if bumping the major value" do
|
36
40
|
expect(helper.bump_major '1.0.0-pre.0').to eq '2.0.0'
|
@@ -44,4 +48,11 @@ describe Dean::SemverHelper do
|
|
44
48
|
expect(helper.bump_patch '1.0.0-pre').to eq '1.0.1'
|
45
49
|
end
|
46
50
|
end
|
51
|
+
|
52
|
+
context "when bumping a version pre value passing a name parameter" do
|
53
|
+
it "shuold bump the pre value of the given version, changing the name to the given one" do
|
54
|
+
pre_name = "any_string"
|
55
|
+
expect(helper.bump_pre '1.0.0-pre.2', pre_name).to eq "1.0.0-#{pre_name}.3"
|
56
|
+
end
|
57
|
+
end
|
47
58
|
end
|
data/spec/version_bumper_spec.rb
CHANGED
@@ -66,6 +66,19 @@ describe Dean::VersionBumper do
|
|
66
66
|
bumper.bump tempfile.path, :pre
|
67
67
|
expect(Plist::parse_xml(tempfile.path)['CFBundleVersion']).to eq '0.0.0-pre.1'
|
68
68
|
end
|
69
|
+
|
70
|
+
it "should bump the pre value of the given verison when passed the :pre parameter, and set the pre name to the given one" do
|
71
|
+
tempfile = setup_plist '0.0.0-pre.0'
|
72
|
+
pre_name = "any_string"
|
73
|
+
bumper.bump tempfile.path, :pre, pre_name
|
74
|
+
expect(Plist::parse_xml(tempfile.path)['CFBundleVersion']).to eq "0.0.0-#{pre_name}.1"
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should bump the pre value of the given version to pre.1 when there is no pre" do
|
78
|
+
tempfile = setup_plist '0.0.0'
|
79
|
+
bumper.bump tempfile.path, :pre
|
80
|
+
expect(Plist::parse_xml(tempfile.path)['CFBundleVersion']).to eq '0.0.0-pre.1'
|
81
|
+
end
|
69
82
|
end
|
70
83
|
|
71
84
|
context "bumping the short version value of a plist file" do
|
@@ -97,7 +110,19 @@ describe Dean::VersionBumper do
|
|
97
110
|
tempfile = setup_plist '0.0.0', '0.0.0-pre.0'
|
98
111
|
bumper.bump_short tempfile.path, :pre
|
99
112
|
expect(Plist::parse_xml(tempfile.path)['CFBundleShortVersionString']).to eq '0.0.0-pre.1'
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should bump the pre value of the given verison when passed the :pre parameter, and set the pre name to the given one" do
|
116
|
+
tempfile = setup_plist '0.0.0', '0.0.0-pre.0'
|
117
|
+
pre_name = "any_string"
|
118
|
+
bumper.bump_short tempfile.path, :pre, pre_name
|
119
|
+
expect(Plist::parse_xml(tempfile.path)['CFBundleShortVersionString']).to eq "0.0.0-#{pre_name}.1"
|
120
|
+
end
|
100
121
|
|
122
|
+
it "should bump the pre value of the given version to pre.1 when there is no pre" do
|
123
|
+
tempfile = setup_plist '0.0.0', '0.0.0'
|
124
|
+
bumper.bump_short tempfile.path, :pre
|
125
|
+
expect(Plist::parse_xml(tempfile.path)['CFBundleShortVersionString']).to eq '0.0.0-pre.1'
|
101
126
|
end
|
102
127
|
end
|
103
128
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dean
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Giovanni Lodi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -146,6 +146,7 @@ extra_rdoc_files: []
|
|
146
146
|
files:
|
147
147
|
- .gitignore
|
148
148
|
- .travis.yml
|
149
|
+
- CHANGELOG.md
|
149
150
|
- Gemfile
|
150
151
|
- LICENSE.txt
|
151
152
|
- README.md
|
@@ -187,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
188
|
version: '0'
|
188
189
|
requirements: []
|
189
190
|
rubyforge_project:
|
190
|
-
rubygems_version: 2.
|
191
|
+
rubygems_version: 2.0.5
|
191
192
|
signing_key:
|
192
193
|
specification_version: 4
|
193
194
|
summary: An (opinionated) CLI tool to ease mundane tasks of the iOS beta distribution,
|
@@ -199,4 +200,3 @@ test_files:
|
|
199
200
|
- spec/semver_helper_spec.rb
|
200
201
|
- spec/spec_helper.rb
|
201
202
|
- spec/version_bumper_spec.rb
|
202
|
-
has_rdoc:
|