prima-twig 0.3.14 → 0.3.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/twig-deploy +9 -5
  3. data/bin/twig-feature +5 -26
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ead28bbfa78f0b329e874ab92a5fe95c6523cfd
4
- data.tar.gz: 8671d58512706646b028e3a383d625f2f722624f
3
+ metadata.gz: 5dab35c26ee55ae2e771ac4dd176795c7e69da1f
4
+ data.tar.gz: 9d0086562a16a7e34d433d976c7156d5a66b13f6
5
5
  SHA512:
6
- metadata.gz: b6fa1fc6abd993bb648dff6abdfaea747a86fb1389fb58b7b3d55b7948c77d901b45d1411d978d0928ff81868cce7f1caf94dffd08bf3999157dfcdb78561164
7
- data.tar.gz: f0d55640376ee9e89fe6dee3b8f63adf24937fb851801dded6dd9d0a3d2fafad345a1d95d5bfa6782d7ee8de0b8232db95c561e4539194c883edc9aa07425abd
6
+ metadata.gz: f1c50b513fa8737cd7f99d6c7589cd34eda2e01254c3ebcae62c108ed9e2c38b0d87846e58e13978a4100f8c3f7f84db50727a6135f76e4d5515a1ae54d03e9c
7
+ data.tar.gz: b6cff8e063470531f3df19912f9b59a2fd26e03387dd3656b3cb366df6e2a93f725c6a47d50820d09804e9fd08dd1235e1a9c74e4e1ed462c86452e5895ef277
data/bin/twig-deploy CHANGED
@@ -8,6 +8,7 @@ require 'aws-sdk'
8
8
  require 'redcarpet'
9
9
  require 'mail'
10
10
  require 'erb'
11
+ require 'base64'
11
12
 
12
13
  def help_content
13
14
  <<-HELP
@@ -53,16 +54,16 @@ class Review
53
54
  `git checkout master && git pull`
54
55
 
55
56
  output "Recupero degli artifacts in corso, attendi qualche secondo...".yellow
56
- artifacts = get_artifacts
57
+ artifacts = get_artifacts[0..49]
57
58
 
58
59
  artifact_rev = choose do |menu|
59
60
  menu.prompt = 'Scegli la release da deployare: '.cyan
60
61
  menu.shell = true
61
62
 
62
63
  artifacts.each do |v|
63
- branch = v[:branch]
64
- title = @prima.reduce_size(branch, 100)
65
- msg = "#{title} #{v[:created_at].strftime('%d/%m/%Y %H:%M:%S')} #{v[:rev]}".light_blue
64
+ title = @prima.reduce_size(v[:branch], 100)
65
+ commit_msg = @prima.reduce_size(v[:commit_msg], 100)
66
+ msg = "#{title} #{v[:created_at].strftime('%d/%m/%Y %H:%M:%S')} #{v[:rev]} #{commit_msg}".light_blue
66
67
  menu.choice(msg) {v[:rev]}
67
68
  end
68
69
  end
@@ -87,6 +88,7 @@ class Review
87
88
  body << "Utente: #{user}\n\n"
88
89
  body << "Revision: [#{artifact[:rev]}](https://github.com/primait/prima/commit/#{artifact[:rev]}) del #{artifact[:created_at].strftime('%d/%m/%Y %H:%M:%S')}\n\n"
89
90
  body << "Branch: [#{artifact[:branch]}](https://github.com/primait/prima/tree/#{artifact[:branch]})\n"
91
+ body << "Commit: #{artifact[:commit_msg]}\n"
90
92
 
91
93
  htmlBody = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new).render body
92
94
 
@@ -118,7 +120,9 @@ class Review
118
120
  rev = l.key.match(/(\w{15}).zip$/).captures.first if l.key.match(/(\w{15}).zip$/)
119
121
  if rev
120
122
  object = s3.head_object(bucket: 'prima-artifacts', key: l.key)
121
- artifacts << {rev: rev, created_at: object.last_modified, branch: object.metadata['branch']} if object.metadata.has_key? 'branch'
123
+ commit_msg = ''
124
+ commit_msg = Base64.decode64(object.metadata['commit_msg']).strip if object.metadata.has_key? 'commit_msg'
125
+ artifacts << {rev: rev, created_at: object.last_modified, branch: object.metadata['branch'], commit_msg: commit_msg } if object.metadata.has_key? 'branch'
122
126
  end
123
127
  end
124
128
  artifacts.sort_by { |v| v[:created_at] }.reverse
data/bin/twig-feature CHANGED
@@ -145,7 +145,7 @@ class Release
145
145
  ]
146
146
  create_stack(stack_name_db, stack_body, parameters, tags) unless stack_exists?(stack_name_db)
147
147
 
148
- create_prima_artifact(prima_branch[:revision]) unless artifact_exists?('prima-artifacts', "prima/#{prima_branch[:revision]}")
148
+ create_prima_artifact(prima_branch[:revision], prima_branch[:name]) unless artifact_exists?('prima-artifacts', "prima/#{prima_branch[:revision]}")
149
149
  create_urania_artifact(urania_branch[:revision]) unless artifact_exists?('prima-artifacts', "microservices/urania/#{urania_branch[:revision]}-qa.tar.gz")
150
150
  create_backoffice_artifact(backoffice_branch[:revision], deploy_id) unless artifact_exists?('prima-artifacts', "backoffice/#{backoffice_branch[:revision]}-#{deploy_id}.zip")
151
151
 
@@ -434,7 +434,7 @@ class Release
434
434
  Dir.chdir '../../'
435
435
  end
436
436
 
437
- def create_prima_artifact(revision)
437
+ def create_prima_artifact(revision, branch_name)
438
438
  @prima_built = true
439
439
  output "Preparo l'artifact .zip\n".yellow
440
440
 
@@ -453,24 +453,8 @@ class Release
453
453
  stack_name_backoffice = "ecs-task-backoffice-qa-notneeded"
454
454
  backoffice_qa_host = get_route53_hostname(stack_name_backoffice)
455
455
 
456
- base_cmd = 'docker run -v $PWD:/code -w /code --link redis:redis prima_'
457
456
  [
458
- "docker-compose build web php",
459
- "docker run -d --name redis redis:2.8",
460
- "#{base_cmd}web 'bash' '-c' 'sed -i \"s/replaceme.qa.staging.colaster.com/#{backoffice_qa_host}/g\" app/config/config_qa.yml'",
461
- "cd ../../ && docker run -e GIT_DIR=$PWD -v $PWD:/usr/app/src -w /usr/app/src/projects/prima blinkmobile/bower install --allow-root",
462
- "#{base_cmd}web composer install -n",
463
- "#{base_cmd}web npm install",
464
- "#{base_cmd}php ./app/console -e=prod assets:install web",
465
- "#{base_cmd}php ./app/console -e=prod fos:js-routing:dump",
466
- "#{base_cmd}php ./app/console -e=prod cypress:ng-routing:dump",
467
- "#{base_cmd}php ./app/console -e=prod bazinga:js-translation:dump web",
468
- "#{base_cmd}web ./node_modules/.bin/brunch build -e staging",
469
- "#{base_cmd}web composer dump-autoload --optimize --no-dev",
470
- "#{base_cmd}compass compass compile --force -c web/compass/config_prod.rb web/compass/",
471
- "docker run -v $PWD:/code -w /code -e NODE_ENV=production prima_web ./node_modules/.bin/webpack --optimize-minimize",
472
- "docker kill redis && docker rm redis",
473
- "sudo chown -R `whoami` ."
457
+ "bin/local_build_artifact.sh #{branch_name}"
474
458
  ].each do |cmd|
475
459
  output "Eseguo #{cmd}".yellow
476
460
  res = %x[ #{cmd} ]
@@ -480,15 +464,10 @@ class Release
480
464
  color = 'green'
481
465
  end
482
466
  output res.send color
483
- exec_step "docker kill redis && docker rm redis" if color == 'red'
467
+ exec_step "docker stop redis" if color == 'red'
484
468
  stop_if (color == 'red'), "Errore durante la build dell'artifact".red
485
469
  end
486
470
 
487
- exec_step 'rsync -avd --exclude-from app/deploy/aws_docker/qa/.rsync-exclude-qa . /tmp/prima'
488
- exec_step "rm -f #{@artifact_path}; cd /tmp/prima && zip -ryq #{@artifact_path} ."
489
-
490
- upload_artifact(@artifact_path, "prima/#{revision}.zip")
491
-
492
471
  Dir.chdir "../../"
493
472
  end
494
473
 
@@ -660,7 +639,7 @@ class Release
660
639
  output "Recupero la lista dei branch del progetto #{project_name}..."
661
640
  out = %x[ git fetch ]
662
641
  branches = %x[ git for-each-ref --sort=-committerdate refs/remotes/ --format='%(refname) %(objectname)' | sed 's/refs\\/remotes\\/origin\\///g' ]
663
- .split("\n").delete_if { |b| b.include?('HEAD') || b.include?('dev') }
642
+ .split("\n").delete_if { |b| b.include?('HEAD') || b.include?('dev') }[0..49]
664
643
 
665
644
  branch_name = choose do |menu|
666
645
  menu.prompt = "Scegli il branch di #{project_name} da deployare: ".cyan
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.3.14
4
+ version: 0.3.15
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-03-21 00:00:00.000000000 Z
14
+ date: 2016-03-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: twig
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  requirements: []
183
183
  rubyforge_project:
184
- rubygems_version: 2.0.14
184
+ rubygems_version: 2.0.14.1
185
185
  signing_key:
186
186
  specification_version: 4
187
187
  summary: The Prima twig toolbelt