sti_deploy 0.3.1 → 0.4.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/lang/en.yml +6 -3
- data/lang/pt-BR.yml +6 -3
- data/lib/generators/sti_deploy/templates/sti_deploy.yml +13 -8
- data/lib/sti_deploy.rb +10 -5
- data/lib/sti_deploy/configuration.rb +4 -4
- data/lib/sti_deploy/deploy.rb +6 -50
- data/lib/sti_deploy/deploy_type.rb +9 -2
- data/lib/sti_deploy/git.rb +46 -7
- data/lib/sti_deploy/git/commit.rb +30 -0
- data/lib/sti_deploy/git/merge.rb +47 -0
- data/lib/sti_deploy/version.rb +5 -36
- data/lib/sti_deploy/version/hotfix.rb +13 -0
- data/lib/sti_deploy/version/pre_release.rb +14 -0
- data/lib/sti_deploy/version/release.rb +14 -0
- data/lib/sti_deploy/version/release_candidate.rb +14 -0
- data/lib/sti_deploy/version/version_bumper.rb +24 -0
- data/lib/version.rb +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 484d5b6189243cace8416105b7ca73f138bf56a1
|
4
|
+
data.tar.gz: 87900c87e1ac599c135e72c78a4a0fd1fd356d6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8779c37c0b98f3cb4ba950e843ea357c3df6f4f8b98f16dfbb07da75dd550b8650c15c0bee1af37f84c524d8f3c90c0ff2259fa0532ef8baac7f2b3d99739b49
|
7
|
+
data.tar.gz: f8952e022d876d925602f27311d0b20be235d9f373ee285361c83fc35f43d20cad3655706e3a019e5ff2fa2fe72b5505e1dbe44c8e58cb6d2987973393c48c7a
|
data/lang/en.yml
CHANGED
@@ -6,16 +6,19 @@ en:
|
|
6
6
|
detected: "Version number detected: %{version}"
|
7
7
|
increment: "\nThe version number will be bumped from \"%{old}\" to \"%{new}\"."
|
8
8
|
deploy_type:
|
9
|
-
prompt: "\nIs the deploy for
|
10
|
-
invalid: 'Invalid option. Type in only "
|
9
|
+
prompt: "\nIs the deploy for (h)otfix, release (c)andidate, (p)re-release, or (r)elease? Type in \"c\", \"h\", \"p\", or \"r\": "
|
10
|
+
invalid: 'Invalid option. Type in only "c", "h", "p", or "r", imbecile!'
|
11
11
|
release_message:
|
12
12
|
prompt: "\nInform a summary of the changes made, in order to create a Git tag:\n> "
|
13
13
|
invalid: 'Please write a proper summary (min of 10 chars)!'
|
14
14
|
git:
|
15
15
|
by: by
|
16
|
-
preparing: Setting up for deploy.
|
17
16
|
committing: "\nCommiting the new version number..."
|
17
|
+
merge_error: "There was an error during the merge from \"%{origin}\" to \"%{target}\". Please resolve any conflicts and try again."
|
18
18
|
merging: "\nMerging from \"%{origin}\" to \"%{target}\"..."
|
19
|
+
preparing: Setting up for deploy.
|
20
|
+
pull_error: "There was an error trying to checkout and pull from \"%{origin}\". Abort, abort!"
|
21
|
+
push_error: "There was an error trying to push to \"%{target}\". Abort, abort!"
|
19
22
|
tagging: "\nCreating a new tag..."
|
20
23
|
system:
|
21
24
|
interrupted: "\n\nDeploy aborted. Bye-bye."
|
data/lang/pt-BR.yml
CHANGED
@@ -6,16 +6,19 @@ pt-BR:
|
|
6
6
|
detected: "Número de versão detectado: %{version}"
|
7
7
|
increment: "\nA versão será incrementada de \"%{old}\" para \"%{new}\"."
|
8
8
|
deploy_type:
|
9
|
-
prompt: "\nO deploy é para
|
10
|
-
invalid: 'Tipo inválido. Digite apenas "
|
9
|
+
prompt: "\nO deploy é para (h)otfix, (c)andidato de release, (p)ré-release, ou (r)elease? Digite \"c\", \"h\", \"p\", ou \"r\": "
|
10
|
+
invalid: 'Tipo inválido. Digite apenas "c", "h", "p", ou "r", animal!'
|
11
11
|
release_message:
|
12
12
|
prompt: "\nEscreva um resumo das alterações feitas, para criar a tag no Git:\n> "
|
13
13
|
invalid: 'Escreva uma mensagem decente (min 10 chars)!'
|
14
14
|
git:
|
15
15
|
by: por
|
16
|
-
preparing: Preparando para deploy.
|
17
16
|
committing: "\nComitando a nova versão..."
|
17
|
+
merge_error: "Houve um erro durante o merge de \"%{origin}\" para \"%{target}\". Resolva os conflitos e tente novamente."
|
18
18
|
merging: "\nFazendo merge de \"%{origin}\" para \"%{target}\"..."
|
19
|
+
preparing: Preparando para deploy.
|
20
|
+
pull_error: "Houve um erro durante o checkout e pull de \"%{origin}\". Abortar, abortar!"
|
21
|
+
push_error: "Houve um erro durante o push para \"%{target}\". Abortar, abortar!"
|
19
22
|
tagging: "\nCriando uma nova tag..."
|
20
23
|
system:
|
21
24
|
interrupted: "\n\nDeploy abortado. Bye-bye."
|
@@ -3,11 +3,16 @@ language: '<LANG>'
|
|
3
3
|
version_path: 'config/initializers/version.rb'
|
4
4
|
branches:
|
5
5
|
hotfix:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
commit: hotfix
|
7
|
+
merge: producao
|
8
|
+
release_candidate:
|
9
|
+
commit: master
|
10
|
+
merge: homologacao
|
11
|
+
pre_release:
|
12
|
+
commit: projeto
|
13
|
+
merge: homologacao
|
14
|
+
release:
|
15
|
+
commit: homologacao
|
16
|
+
merge:
|
17
|
+
- producao
|
18
|
+
- hotfix
|
data/lib/sti_deploy.rb
CHANGED
@@ -8,13 +8,18 @@ require_relative 'sti_deploy/version'
|
|
8
8
|
require_relative 'sti_deploy/git'
|
9
9
|
require_relative 'sti_deploy/deploy_type'
|
10
10
|
require_relative 'sti_deploy/deploy'
|
11
|
+
require_relative 'sti_deploy/version/version_bumper'
|
12
|
+
|
13
|
+
Dir[__dir__ + '/sti_deploy/version/*.rb'].each { |file| require_relative(file) }
|
14
|
+
Dir[__dir__ + '/sti_deploy/deploy/*.rb'].each { |file| require_relative(file) }
|
11
15
|
|
12
16
|
# Program exit codes:
|
13
17
|
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
+
# 0: Program exited successfully
|
19
|
+
# 1: Error: A valid version number within the version file was not found
|
20
|
+
# 2: Error: Version file was not found
|
21
|
+
# 3: Error: Program was interrupted (CTRL+C)
|
22
|
+
# 4: Error: There was an error during the Git commit or merge process
|
18
23
|
|
19
24
|
module StiDeploy
|
20
25
|
class << self
|
@@ -26,7 +31,7 @@ module StiDeploy
|
|
26
31
|
Messages.puts 'system.finished', color: :green
|
27
32
|
rescue Interrupt
|
28
33
|
Messages.puts 'system.interrupted', color: :red
|
29
|
-
exit(
|
34
|
+
exit(3)
|
30
35
|
end
|
31
36
|
end
|
32
37
|
end
|
@@ -21,14 +21,14 @@ module StiDeploy
|
|
21
21
|
read('git_username') || ''
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
25
|
-
read('branches')[deploy_type.
|
24
|
+
def commit_branch(deploy_type)
|
25
|
+
read('branches')[deploy_type.to_s]['commit'] || 'master'
|
26
26
|
rescue StandardError
|
27
27
|
'master'
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
31
|
-
read('branches')[deploy_type.
|
30
|
+
def merge_branch(deploy_type)
|
31
|
+
read('branches')[deploy_type.to_s]['merge'] || 'master'
|
32
32
|
rescue StandardError
|
33
33
|
'master'
|
34
34
|
end
|
data/lib/sti_deploy/deploy.rb
CHANGED
@@ -2,22 +2,21 @@
|
|
2
2
|
|
3
3
|
module StiDeploy
|
4
4
|
class Deploy
|
5
|
-
attr_reader :version, :type
|
5
|
+
attr_reader :version, :type
|
6
6
|
|
7
7
|
def initialize
|
8
8
|
@version = Version.load_version
|
9
|
-
@git_user = Configuration.git_username
|
10
9
|
end
|
11
10
|
|
12
11
|
def update_version!
|
13
12
|
version.bump(read_type)
|
14
13
|
version.update_file!
|
14
|
+
Messages.puts('version.increment', old: version.old, new: version.to_s,
|
15
|
+
color: :green)
|
15
16
|
end
|
16
17
|
|
17
18
|
def commit_merge_and_tag!
|
18
|
-
|
19
|
-
git_merge! unless same_origin_target_branches?
|
20
|
-
git_tag!
|
19
|
+
Git.new(version, type).commit_merge_and_tag!(read_release_message)
|
21
20
|
end
|
22
21
|
|
23
22
|
private
|
@@ -25,7 +24,7 @@ module StiDeploy
|
|
25
24
|
def read_type
|
26
25
|
Messages.print('deploy_type.prompt')
|
27
26
|
type = gets.chomp
|
28
|
-
return @type = DeployType.new(type) if %w[
|
27
|
+
return @type = DeployType.new(type) if %w[c C h H p P r R].include? type
|
29
28
|
Messages.puts('deploy_type.invalid')
|
30
29
|
read_type
|
31
30
|
end
|
@@ -33,52 +32,9 @@ module StiDeploy
|
|
33
32
|
def read_release_message
|
34
33
|
Messages.print('release_message.prompt')
|
35
34
|
msg = gets.chomp
|
36
|
-
return
|
35
|
+
return msg if msg.size >= 10
|
37
36
|
Messages.puts('release_message.invalid')
|
38
37
|
read_release_message
|
39
38
|
end
|
40
|
-
|
41
|
-
def git_commit!
|
42
|
-
read_release_message
|
43
|
-
Messages.puts('git.committing', color: :yellow)
|
44
|
-
Git.add_version
|
45
|
-
Git.commit(message: commit_message)
|
46
|
-
Git.push(branch: origin_branch)
|
47
|
-
end
|
48
|
-
|
49
|
-
def git_merge!
|
50
|
-
Messages.puts('git.merging', origin: origin_branch, target: target_branch,
|
51
|
-
color: :yellow)
|
52
|
-
Git.checkout(branch: target_branch)
|
53
|
-
Git.pull(branch: target_branch)
|
54
|
-
Git.merge(branch: origin_branch)
|
55
|
-
Git.push(branch: target_branch)
|
56
|
-
Git.checkout(branch: origin_branch)
|
57
|
-
end
|
58
|
-
|
59
|
-
def git_tag!
|
60
|
-
Messages.puts('git.tagging', color: :yellow)
|
61
|
-
Git.tag(version: version.to_s, message: message)
|
62
|
-
Git.push_tags
|
63
|
-
end
|
64
|
-
|
65
|
-
def commit_message
|
66
|
-
by = I18n.t('messages.git.by')
|
67
|
-
preparing = I18n.t('messages.git.preparing')
|
68
|
-
return "#{preparing} #{message}" if git_user.nil? || git_user.empty?
|
69
|
-
"#{by} #{git_user}: #{preparing} #{message}"
|
70
|
-
end
|
71
|
-
|
72
|
-
def same_origin_target_branches?
|
73
|
-
origin_branch == target_branch
|
74
|
-
end
|
75
|
-
|
76
|
-
def origin_branch
|
77
|
-
Configuration.origin_branch(type)
|
78
|
-
end
|
79
|
-
|
80
|
-
def target_branch
|
81
|
-
Configuration.target_branch(type)
|
82
|
-
end
|
83
39
|
end
|
84
40
|
end
|
@@ -4,16 +4,23 @@ module StiDeploy
|
|
4
4
|
class DeployType
|
5
5
|
attr_reader :type
|
6
6
|
|
7
|
+
DEPLOY_TYPES = {
|
8
|
+
c: 'release_candidate',
|
9
|
+
h: 'hotfix',
|
10
|
+
p: 'pre_release',
|
11
|
+
r: 'release'
|
12
|
+
}
|
13
|
+
|
7
14
|
def initialize(type)
|
8
15
|
@type = type.downcase
|
9
16
|
end
|
10
17
|
|
11
18
|
def full_name
|
12
|
-
|
19
|
+
DEPLOY_TYPES[type.to_sym]
|
13
20
|
end
|
14
21
|
|
15
22
|
def to_s
|
16
|
-
|
23
|
+
full_name
|
17
24
|
end
|
18
25
|
end
|
19
26
|
end
|
data/lib/sti_deploy/git.rb
CHANGED
@@ -2,38 +2,77 @@
|
|
2
2
|
|
3
3
|
module StiDeploy
|
4
4
|
class Git
|
5
|
+
attr_reader :version, :deploy_type
|
6
|
+
|
5
7
|
class << self
|
6
8
|
def add_version
|
7
9
|
`git add #{Configuration.version_path}`
|
8
10
|
end
|
9
11
|
|
10
12
|
def commit(message: '')
|
11
|
-
`git commit -m "#{message.tr('"', '\"')}"
|
13
|
+
`git commit -m "#{message.tr('"', '\"')}"`.zero?
|
12
14
|
end
|
13
15
|
|
14
16
|
def checkout(branch: 'master')
|
15
|
-
`git checkout #{branch}
|
17
|
+
`git checkout #{branch}`.zero?
|
16
18
|
end
|
17
19
|
|
18
20
|
def merge(branch: 'master')
|
19
|
-
`git merge #{branch}
|
21
|
+
`git merge #{branch}`.zero?
|
20
22
|
end
|
21
23
|
|
22
24
|
def tag(version: '', message: '')
|
23
|
-
`git tag -a v#{version.to_s} -m "#{message.tr('"', '\"')}"
|
25
|
+
`git tag -a v#{version.to_s} -m "#{message.tr('"', '\"')}"`.zero?
|
24
26
|
end
|
25
27
|
|
26
28
|
def pull(branch: 'master', remote: 'origin')
|
27
|
-
`git pull #{remote} #{branch}
|
29
|
+
`git pull #{remote} #{branch}`.zero?
|
28
30
|
end
|
29
31
|
|
30
32
|
def push(branch: 'master', remote: 'origin')
|
31
|
-
`git push #{remote} #{branch}
|
33
|
+
`git push #{remote} #{branch}`.zero?
|
32
34
|
end
|
33
35
|
|
34
36
|
def push_tags
|
35
|
-
`git push --tags
|
37
|
+
`git push --tags`.zero?
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def initialize(version, deploy_type)
|
42
|
+
@version = version
|
43
|
+
@deploy_type = deploy_type
|
44
|
+
end
|
45
|
+
|
46
|
+
def commit_merge_and_tag!(message)
|
47
|
+
commit!(message)
|
48
|
+
merge!
|
49
|
+
tag!(message)
|
50
|
+
end
|
51
|
+
|
52
|
+
def commit!(message)
|
53
|
+
Git::Commit.new(commit_branch, message).commit!
|
54
|
+
end
|
55
|
+
|
56
|
+
def merge!
|
57
|
+
merge_branches.each do |target_branch|
|
58
|
+
Git::Merge.new(commit_branch, target_branch).merge!
|
36
59
|
end
|
37
60
|
end
|
61
|
+
|
62
|
+
def tag!(message)
|
63
|
+
Messages.puts('git.tagging', color: :yellow)
|
64
|
+
Git.tag(version: version.to_s, message: message)
|
65
|
+
Git.push_tags
|
66
|
+
end
|
67
|
+
|
68
|
+
def commit_branch
|
69
|
+
Configuration.commit_branch(deploy_type)
|
70
|
+
end
|
71
|
+
|
72
|
+
# Can be more than one branch, example: merge staging to production and
|
73
|
+
# hotfix, to synchronize production with hotfix and staging.
|
74
|
+
def merge_branches
|
75
|
+
Array(Configuration.merge_branch(deploy_type))
|
76
|
+
end
|
38
77
|
end
|
39
78
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module StiDeploy
|
2
|
+
class Git
|
3
|
+
class Commit
|
4
|
+
attr_reader :branch, :git_user, :message
|
5
|
+
|
6
|
+
def initialize(branch, message)
|
7
|
+
@branch = branch
|
8
|
+
@git_user = Configuration.git_username
|
9
|
+
@message = commit_message(git_user, message)
|
10
|
+
end
|
11
|
+
|
12
|
+
def commit!
|
13
|
+
Messages.puts('git.committing', color: :yellow)
|
14
|
+
Git.add_version
|
15
|
+
return true if Git.commit(message: message) && Git.push(branch: origin)
|
16
|
+
Messages.puts('git.push_error', target: origin, color: :red)
|
17
|
+
exit(4)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def commit_message(git_user, message)
|
23
|
+
by = I18n.t('messages.git.by')
|
24
|
+
preparing = I18n.t('messages.git.preparing')
|
25
|
+
return "#{preparing} #{message}" if git_user.nil? || git_user.empty?
|
26
|
+
"#{by} #{git_user}: #{preparing} #{message}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module StiDeploy
|
2
|
+
class Git
|
3
|
+
class Merge
|
4
|
+
attr_reader :origin, :target
|
5
|
+
|
6
|
+
def initialize(origin_branch, target_branch)
|
7
|
+
@origin = origin_branch
|
8
|
+
@target = target_branch
|
9
|
+
end
|
10
|
+
|
11
|
+
def merge!
|
12
|
+
return unless needs_merge?
|
13
|
+
Messages.puts('git.merging', origin: origin, target: target,
|
14
|
+
color: :yellow)
|
15
|
+
update_target_branch! && try_merge! && finalize_merge!
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
# Makes sure the branch is updated
|
21
|
+
def update_target_branch!
|
22
|
+
return true if Git.checkout(branch: target) && Git.pull(branch: target)
|
23
|
+
Messages.puts('git.pull_error', origin: origin_branch, color: :red)
|
24
|
+
exit(4)
|
25
|
+
end
|
26
|
+
|
27
|
+
def try_merge!
|
28
|
+
return true if Git.merge(branch: origin)
|
29
|
+
Messages.puts('git.merge_error', origin: origin_branch,
|
30
|
+
target: target_branch, color: :red)
|
31
|
+
exit(4)
|
32
|
+
end
|
33
|
+
|
34
|
+
def finalize_merge!
|
35
|
+
return true if Git.push(branch: target) && Git.checkout(branch: origin)
|
36
|
+
Messages.puts('git.push_error', target: target_branch, color: :red)
|
37
|
+
exit(4)
|
38
|
+
end
|
39
|
+
|
40
|
+
# It only needs to merge if the origin branch is different from the
|
41
|
+
# target branch (no need to merge to the same branch).
|
42
|
+
def needs_merge?
|
43
|
+
origin_branch.to_s != target_branch.to_s
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/sti_deploy/version.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
module StiDeploy
|
4
4
|
class Version
|
5
5
|
attr_accessor :major, :minor, :hotfix, :rc, :pre
|
6
|
+
attr_reader :old
|
6
7
|
|
7
8
|
FULL_VERSION_REGEX = /[\d]+.[\d]+.[\d]+(rc[\d]+)?(pre[\d]+)?/
|
8
9
|
|
@@ -21,7 +22,7 @@ module StiDeploy
|
|
21
22
|
return true if File.file?(Configuration.version_path)
|
22
23
|
Messages.puts('version.file_not_found',
|
23
24
|
path: Configuration.version_path, color: :red)
|
24
|
-
exit(
|
25
|
+
exit(1)
|
25
26
|
end
|
26
27
|
|
27
28
|
def read_current_version
|
@@ -35,7 +36,7 @@ module StiDeploy
|
|
35
36
|
return true if version && !version.is_a?(File)
|
36
37
|
Messages.puts('version.not_found', path: Configuration.version_path,
|
37
38
|
color: :red)
|
38
|
-
exit(
|
39
|
+
exit(2)
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
@@ -44,13 +45,11 @@ module StiDeploy
|
|
44
45
|
.map(&:to_i)
|
45
46
|
self.rc = version[/rc[\d]+/].to_s.tr('rc', '').to_i
|
46
47
|
self.pre = version[/pre[\d]+/].to_s.tr('pre', '').to_i
|
48
|
+
@old = to_s
|
47
49
|
end
|
48
50
|
|
49
51
|
def bump(deploy_type)
|
50
|
-
|
51
|
-
send("bump_#{deploy_type}")
|
52
|
-
Messages.puts('version.increment', old: old, new: to_s, color: :green)
|
53
|
-
to_s
|
52
|
+
VersionBumper.from_deploy_type(deploy_type, self).bump
|
54
53
|
end
|
55
54
|
|
56
55
|
def update_file!
|
@@ -65,35 +64,5 @@ module StiDeploy
|
|
65
64
|
base += "pre#{pre}" if pre > 0
|
66
65
|
base
|
67
66
|
end
|
68
|
-
|
69
|
-
private
|
70
|
-
|
71
|
-
# Bump hot(f)ix
|
72
|
-
def bump_f
|
73
|
-
self.hotfix += 1
|
74
|
-
end
|
75
|
-
|
76
|
-
# Bump (h)omologação
|
77
|
-
def bump_h
|
78
|
-
self.minor += 1 if rc.zero? # Se ainda não existir RC, dá bump no minor
|
79
|
-
self.hotfix = 0
|
80
|
-
self.rc += 1
|
81
|
-
end
|
82
|
-
|
83
|
-
# Bump (p)rojeto
|
84
|
-
def bump_p
|
85
|
-
self.minor += 1 if pre.zero? # Se ainda não existir PRE, dá bump no minor
|
86
|
-
self.hotfix = 0
|
87
|
-
self.pre += 1
|
88
|
-
end
|
89
|
-
|
90
|
-
# Bump (r)release
|
91
|
-
def bump_r
|
92
|
-
# Se ainda não estiver em PRE nem RC, da bump no minor
|
93
|
-
self.minor += 1 if pre.zero? && rc.zero?
|
94
|
-
self.hotfix = 0
|
95
|
-
self.pre = 0
|
96
|
-
self.rc = 0
|
97
|
-
end
|
98
67
|
end
|
99
68
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module StiDeploy
|
4
|
+
class Version
|
5
|
+
class Release < VersionBumper
|
6
|
+
def bump_version
|
7
|
+
version.minor += 1 if version.pre.zero? && version.rc.zero?
|
8
|
+
version.hotfix = 0
|
9
|
+
version.pre = 0
|
10
|
+
version.rc = 0
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module StiDeploy
|
2
|
+
class Version
|
3
|
+
class VersionBumper
|
4
|
+
attr_reader :version
|
5
|
+
|
6
|
+
# We use eval here because the only possible strings that will be
|
7
|
+
# evaluated live in a hardcoded hash inside StiDeploy::DeployType.
|
8
|
+
#
|
9
|
+
# rubocop:disable Security/Eval
|
10
|
+
def self.from_deploy_type(deploy_type, version)
|
11
|
+
class_name = deploy_type.to_s.split('_').map(&:capitalize).join
|
12
|
+
klass = eval("StiDeploy::Version::#{class_name}")
|
13
|
+
klass.new(version)
|
14
|
+
end
|
15
|
+
# rubocop:enable Security/Eval
|
16
|
+
|
17
|
+
def initialize(version)
|
18
|
+
@version = version
|
19
|
+
end
|
20
|
+
|
21
|
+
def bump; end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sti_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Castro Azevedo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -74,8 +74,15 @@ files:
|
|
74
74
|
- lib/sti_deploy/deploy.rb
|
75
75
|
- lib/sti_deploy/deploy_type.rb
|
76
76
|
- lib/sti_deploy/git.rb
|
77
|
+
- lib/sti_deploy/git/commit.rb
|
78
|
+
- lib/sti_deploy/git/merge.rb
|
77
79
|
- lib/sti_deploy/messages.rb
|
78
80
|
- lib/sti_deploy/version.rb
|
81
|
+
- lib/sti_deploy/version/hotfix.rb
|
82
|
+
- lib/sti_deploy/version/pre_release.rb
|
83
|
+
- lib/sti_deploy/version/release.rb
|
84
|
+
- lib/sti_deploy/version/release_candidate.rb
|
85
|
+
- lib/sti_deploy/version/version_bumper.rb
|
79
86
|
- lib/version.rb
|
80
87
|
homepage: https://github.com/roooodcastro/sti_deploy
|
81
88
|
licenses:
|