sti_deploy 0.1.9 → 0.2.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 +41 -1
- data/lang/en.yml +7 -0
- data/lang/pt-BR.yml +7 -0
- data/lib/generators/sti_deploy/install_generator.rb +90 -0
- data/lib/generators/sti_deploy/templates/sti_deploy.yml +13 -0
- data/lib/sti_deploy/configuration.rb +0 -1
- data/lib/sti_deploy/messages.rb +1 -0
- data/lib/version.rb +1 -1
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b37d901874e0ce71fbf27b26e4de59f2c4ca56ae
|
4
|
+
data.tar.gz: 7dadc0eb56dd04471d43145deb4b70bc7d22204d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cbda8c33a65025c68aa78e5372430004a13ef93e1d32a9863c5b55bc85b7712d1f0e46f2b860c759d5dcd027294db32cb98584690ab9231260fb6230fabca83
|
7
|
+
data.tar.gz: c37506275d303987bd9748c74c0c32ee8a77d3031fda5a6dadd341f473e459d7e50746dc05c12e9f6fa52953302c48d64f63215bc9f331a6c5c24038c2383c8b
|
data/README.md
CHANGED
@@ -1,2 +1,42 @@
|
|
1
1
|
# STI Deploy
|
2
|
-
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/sti_deploy)
|
4
|
+
|
5
|
+
Um programa automatizado para acelerar o processo de fazer o release de uma
|
6
|
+
versão para deploy. Foi desenvolvido para funcionar com um processo de deploy
|
7
|
+
específico.
|
8
|
+
|
9
|
+
## Funcionamento
|
10
|
+
|
11
|
+
Esse programa disponibiliza um executável `sti_deploy` que realiza as seguintes
|
12
|
+
ações:
|
13
|
+
|
14
|
+
1. Detecta o arquivo que contém o número de versão do projeto e o lê
|
15
|
+
2. Pergunta o tipo de deploy (staging, hotfix)
|
16
|
+
3. Faz um bump na versão de acordo com o tipo escolhido
|
17
|
+
4. Pergunta por uma mensagem contendo as notas de release
|
18
|
+
5. Faz o commit e push para o branch atual
|
19
|
+
6. Se necessário, faz o merge e push para o branch de release configurado
|
20
|
+
7. Faz checkout de volta ao branch de trabalho
|
21
|
+
8. Cria e dá push em uma nova tag para o release
|
22
|
+
|
23
|
+
## Instalação
|
24
|
+
|
25
|
+
Instale a gem usando:
|
26
|
+
|
27
|
+
gem install sti_deploy
|
28
|
+
|
29
|
+
Execute o instalador:
|
30
|
+
|
31
|
+
rails g sti_deploy:install
|
32
|
+
|
33
|
+
O instalador irá pedir o idioma desejado, o nome do usuário no Git. Com isso,
|
34
|
+
será criado um arquivo `sti_deploy.yml` no root do projeto, e esse arquivo será
|
35
|
+
adicionado ao `.gitignore`, pois ele **não deve ser commitado**.
|
36
|
+
|
37
|
+
## Utilização
|
38
|
+
|
39
|
+
Para utilizar, basta executar o comando `sti_deploy` no terminal, no diretório
|
40
|
+
root do projeto. O script irá pedir os dados necessários para fazer os commits,
|
41
|
+
merges e tags necessárias para dar início ao deploy. A gem **não** realiza o
|
42
|
+
deploy em si.
|
data/lang/en.yml
CHANGED
@@ -20,3 +20,10 @@ en:
|
|
20
20
|
system:
|
21
21
|
interrupted: "\n\nDeploy aborted. Bye-bye."
|
22
22
|
finished: "\nThe deploy init process has finished!"
|
23
|
+
generator:
|
24
|
+
language_chosen: Language set to English!
|
25
|
+
username_prompt: "\nType in your Git username:"
|
26
|
+
username_chosen: "Username configured!\n"
|
27
|
+
gitignore_updated: 'The new file sti_deploy.yml was added to the .gitignore file!'
|
28
|
+
gitignore_skipped: "\nThe .gitignore file already ignores the new sti_deploy.yml file!"
|
29
|
+
finish: "\nThe installation of StiDeploy is finished!"
|
data/lang/pt-BR.yml
CHANGED
@@ -20,3 +20,10 @@ pt-BR:
|
|
20
20
|
system:
|
21
21
|
interrupted: "\n\nDeploy abortado. Bye-bye."
|
22
22
|
finished: "\nO processo de início do deploy está terminado!"
|
23
|
+
generator:
|
24
|
+
language_chosen: 'Idioma configurado para Português!'
|
25
|
+
username_prompt: "\nDigite o seu nome de usuário do Git:"
|
26
|
+
username_chosen: "Nome de usuário configurado!\n"
|
27
|
+
gitignore_updated: 'O novo arquivo sti_deploy.yml foi adicionado ao .gitignore!'
|
28
|
+
gitignore_skipped: "O arquivo do .gitignore já ignora o novo arquivo sti_deploy.yml!"
|
29
|
+
finish: "\nA instalação do StiDeploy foi concluída!"
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# Generator para configurar a gem na aplicação host.
|
2
|
+
|
3
|
+
require 'sti_deploy/messages'
|
4
|
+
|
5
|
+
module StiDeploy
|
6
|
+
class InstallGenerator < Rails::Generators::Base
|
7
|
+
source_root File.expand_path('../templates', __FILE__)
|
8
|
+
|
9
|
+
desc <<DESC
|
10
|
+
Description:
|
11
|
+
- Copies the configuration file to the root of the project
|
12
|
+
- Configures the username, branches and languages
|
13
|
+
- Adds the new configuration file to the .gitignore file
|
14
|
+
DESC
|
15
|
+
|
16
|
+
def copy_install_file
|
17
|
+
copy_file('sti_deploy.yml', 'sti_deploy.yml')
|
18
|
+
end
|
19
|
+
|
20
|
+
def set_language
|
21
|
+
language = choose_language
|
22
|
+
if language
|
23
|
+
I18n.locale = language
|
24
|
+
replace_in_file('sti_deploy.yml', '<LANG>', language)
|
25
|
+
StiDeploy::Messages.load_messages
|
26
|
+
StiDeploy::Messages.puts('generator.language_chosen', color: :green)
|
27
|
+
else
|
28
|
+
puts 'Invalid option. Please choose a valid option!'
|
29
|
+
set_language
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def set_username
|
34
|
+
replace_in_file('sti_deploy.yml', '<USERNAME>', choose_username.strip)
|
35
|
+
StiDeploy::Messages.puts('generator.username_chosen', color: :green)
|
36
|
+
end
|
37
|
+
|
38
|
+
def add_file_to_gitignore
|
39
|
+
return if file_not_found('.gitignore')
|
40
|
+
ignore_lines_sti_deploy = File.readlines('.gitignore').map do |line|
|
41
|
+
line.include?('sti_deploy.yml')
|
42
|
+
end
|
43
|
+
if ignore_lines_sti_deploy.any?
|
44
|
+
StiDeploy::Messages.puts('generator.gitignore_skipped', color: :yellow)
|
45
|
+
else
|
46
|
+
append_to_file '.gitignore', "sti_deploy.yml\n"
|
47
|
+
StiDeploy::Messages.puts('generator.gitignore_updated', color: :green)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def finish_install
|
52
|
+
StiDeploy::Messages.puts('generator.finish', color: :light_blue)
|
53
|
+
end
|
54
|
+
|
55
|
+
protected
|
56
|
+
|
57
|
+
def file_not_found(file, say_if_not_found = true)
|
58
|
+
unless File.exists?(file)
|
59
|
+
msg = "#{file} not found, configure manually"
|
60
|
+
shell.say_status('not found', msg, :red) if say_if_not_found
|
61
|
+
return true
|
62
|
+
end
|
63
|
+
false
|
64
|
+
end
|
65
|
+
|
66
|
+
def choose_language
|
67
|
+
puts 'Which language do you prefer?'
|
68
|
+
I18n.available_locales.each_with_index do |locale, index|
|
69
|
+
puts " #{index + 1}: #{locale}"
|
70
|
+
end
|
71
|
+
print '> '
|
72
|
+
choice = gets
|
73
|
+
options_array = I18n.available_locales.size.times.map { |i| i + 1 }
|
74
|
+
return nil unless options_array.include?(choice.to_i)
|
75
|
+
I18n.available_locales[choice.to_i - 1]
|
76
|
+
end
|
77
|
+
|
78
|
+
def choose_username
|
79
|
+
StiDeploy::Messages.puts('generator.username_prompt')
|
80
|
+
print '> '
|
81
|
+
gets
|
82
|
+
end
|
83
|
+
|
84
|
+
def replace_in_file(file_name, from, to)
|
85
|
+
contents = File.read(file_name)
|
86
|
+
new_contents = contents.gsub(from, to.to_s)
|
87
|
+
File.open(file_name, 'w') { |file| file.puts new_contents }
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
git_username: '<USERNAME>'
|
2
|
+
language: '<LANG>'
|
3
|
+
version_path: 'config/initializers/version.rb'
|
4
|
+
branches:
|
5
|
+
hotfix:
|
6
|
+
origin: hotfix
|
7
|
+
target: producao
|
8
|
+
project:
|
9
|
+
origin: projeto
|
10
|
+
target: homologacao
|
11
|
+
staging:
|
12
|
+
origin: master
|
13
|
+
target: homologacao
|
data/lib/sti_deploy/messages.rb
CHANGED
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.2.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-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.6
|
33
|
+
version: '0.6'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.6
|
40
|
+
version: '0.6'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.49
|
47
|
+
version: '0.49'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.49
|
54
|
+
version: '0.49'
|
55
55
|
description: A small program to make commits and merges faster. This program automagically
|
56
56
|
bumps the version number, commits to the working branch, merges to the deploy branch,
|
57
57
|
and creates a release tag.
|
@@ -67,6 +67,8 @@ files:
|
|
67
67
|
- bin/sti_deploy
|
68
68
|
- lang/en.yml
|
69
69
|
- lang/pt-BR.yml
|
70
|
+
- lib/generators/sti_deploy/install_generator.rb
|
71
|
+
- lib/generators/sti_deploy/templates/sti_deploy.yml
|
70
72
|
- lib/sti_deploy.rb
|
71
73
|
- lib/sti_deploy/configuration.rb
|
72
74
|
- lib/sti_deploy/deploy.rb
|
@@ -85,9 +87,9 @@ require_paths:
|
|
85
87
|
- lib
|
86
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
89
|
requirements:
|
88
|
-
- - "
|
90
|
+
- - "~>"
|
89
91
|
- !ruby/object:Gem::Version
|
90
|
-
version: '
|
92
|
+
version: '2.1'
|
91
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
94
|
requirements:
|
93
95
|
- - ">="
|
@@ -95,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
97
|
version: '0'
|
96
98
|
requirements: []
|
97
99
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.6.
|
100
|
+
rubygems_version: 2.6.14
|
99
101
|
signing_key:
|
100
102
|
specification_version: 4
|
101
103
|
summary: A small program to make commits and merges faster.
|