prima-twig 0.6.1 → 0.7.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/twig-deploy +3 -2
  3. data/lib/prima_twig.rb +14 -3
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c6047c9ace3d88c09e5a747a6159c4d226a10571
4
- data.tar.gz: 631397c7c84eee6a6549d7706c897d204fd6b03e
3
+ metadata.gz: 14f41b618524f4a74e631876dadac8fbdce9eae3
4
+ data.tar.gz: 32c0b37bef2be34d311c2e403e6d72d9791e8d01
5
5
  SHA512:
6
- metadata.gz: 10584aa9623d832030570bba130753420ae06a77d74f625833912874ee6ca9bc7d041df083ff80d174b8695f99ebc2a9c2805dc44405646445a471c1b39237da
7
- data.tar.gz: 2bb151c80f82e1932ef817811decfa414bf9e378705abf3ab39ac7559f68e2f1967978e6d2186ce6d638efde466841a0998a61a1ec816b26b0b03aaa4bab3318
6
+ metadata.gz: 1430375d556637f94253201e2b511728832d966e19f8bdac0995a5ba4bfc7d464a7ab6d63ce6ceab268e3c88b01191c69891d0c4d903977a3154efa5da2f0415
7
+ data.tar.gz: e80df85d1aae33a4d5c4508d23172aa03bdf93abd34345baf9dfa6459a3b11b6e9faf4d705a22f0f6f3491b4da8ced55565f726ef27621813f56624b6a8705a8
data/bin/twig-deploy CHANGED
@@ -53,8 +53,7 @@ class Review
53
53
 
54
54
  def execute!
55
55
  stop_if @prima.head_detached?, :detached_head
56
-
57
- `git checkout master && git pull`
56
+ stop_if @prima.repo_has_modified_files?, "Non posso deployare con file non commitati"
58
57
 
59
58
  output "Recupero degli artifacts in corso, attendi qualche secondo...".yellow
60
59
  artifacts = get_artifacts[0..49]
@@ -80,6 +79,8 @@ class Review
80
79
 
81
80
  exit unless @prima.yesno "Sei sicuro di voler effettuare il deploy in produzione?".blue
82
81
 
82
+ exec_step "git fetch"
83
+ exec_step "git checkout #{artifact_rev}"
83
84
  exec_step deploy_command
84
85
 
85
86
  stack_name_web = 'ecs-task-web-production'
data/lib/prima_twig.rb CHANGED
@@ -12,7 +12,7 @@ class Prima
12
12
  LABEL_HOTFIX='hotfix'
13
13
  LABEL_NEXT_RELEASE='next release'
14
14
  LABEL_IN_STAGING='in staging'
15
- CONFIG_KEYS=['github', 'mandrill', 'aws_key_id', 'aws_key_secret']
15
+ CONFIG_KEYS=['github', 'mandrill']
16
16
  attr_reader :gh, :twig, :config, :rugged, :aws
17
17
 
18
18
  def initialize
@@ -81,8 +81,7 @@ class Prima
81
81
  def create_clients
82
82
  @gh = Octokit::Client.new(:access_token => @config['github'])
83
83
  Aws.config.update({
84
- region: 'eu-west-1',
85
- credentials: Aws::Credentials.new(@config['aws_key_id'], @config['aws_key_secret']),
84
+ region: 'eu-west-1'
86
85
  })
87
86
  end
88
87
 
@@ -129,6 +128,18 @@ class Prima
129
128
  branch_name.downcase
130
129
  end
131
130
 
131
+ def repo_has_modified_files?
132
+ modified = false
133
+ @rugged.status do |file, status_data|
134
+ if status_data.first != :ignored
135
+ puts "#{file}: #{status_data.inspect}"
136
+ modified = true
137
+ break
138
+ end
139
+ end
140
+ modified
141
+ end
142
+
132
143
  # proxy di tutti i metodi a rugged
133
144
  def method_missing(method)
134
145
  @rugged.send method
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prima-twig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Giachino
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-08-01 00:00:00.000000000 Z
14
+ date: 2016-08-02 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: twig