negroku 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27fa5f7e91a90a0727f5030182c467dee507258f
4
- data.tar.gz: a978002eef4ca9e34cd8631a74d609e99a678d3a
3
+ metadata.gz: d2c4e0a3ac3d5965ba4fe44d8d0e037f4d0d15be
4
+ data.tar.gz: 2d1265284143fe3f7a91b36b04be377a1ba2e89c
5
5
  SHA512:
6
- metadata.gz: ff78fa461580329961d0d8c5c8a0455f58e746e09853119f6a4f60ff9a34b95fdec22d2597d75d44d6701754ca527ba1174b2a83a5b69bc2295ade0155aa2004
7
- data.tar.gz: df1dea28babd7ea4b6168702bdff50fa3a163b695a9a5b26ff21ab05d97ac61e43c56de2e0b5c5391d6cc7baa95285192f55bb8efb9c421277b08124eebb5b5a
6
+ metadata.gz: 4b6f4de35703e0a13af39d15596e74c5a764ef65114ae4a678dbdf504de49297db8ecc1f9f7710daacce7e4a60240bb8a04ede61fd7f78494bcf08943edc3fd7
7
+ data.tar.gz: 86503258bc8023da9d0732e19053007fa2d33a899c2b9a13e0d27769c3eac54c9651e2eb9334b12a29bb24f2590075d3a5fa423304fa014205b8f8d3a3b0b74e
@@ -3,7 +3,7 @@ module Negroku::CLI
3
3
  desc 'Manage your apps env variables'
4
4
  command :env do |app|
5
5
 
6
- app.desc 'Adds multiple variables from rbenv-vars to a server'
6
+ app.desc 'Sets multiple variables from rbenv-vars to a server'
7
7
  app.command :bulk do |bulk|
8
8
  bulk.action do |global_options,options,args|
9
9
  Negroku::Env.bulk
@@ -7,19 +7,19 @@ module Negroku::Env
7
7
  if stage = selected_stage || select_stage
8
8
  variables = select_variables
9
9
  if variables.empty?
10
- puts I18n.t(:no_variables_added, scope: :negroku)
10
+ puts I18n.t(:no_variables_setted, scope: :negroku)
11
11
  else
12
- add_vars_to_stage(stage, variables)
12
+ set_vars_to_stage(stage, variables)
13
13
  end
14
14
  end
15
15
  end
16
16
 
17
- # Adds the variables to the selected stage using cap rbenv add
18
- def add_vars_to_stage(stage, variables)
17
+ # Sets the variables to the selected stage using cap rbenv set
18
+ def set_vars_to_stage(stage, variables)
19
19
  # convert to array using VAR=value
20
20
  vars_array = variables.map{|k,v| "#{k}=#{v}" }
21
21
  Capistrano::Application.invoke(stage)
22
- Capistrano::Application.invoke("rbenv:vars:add", *vars_array)
22
+ Capistrano::Application.invoke("rbenv:vars:set", *vars_array)
23
23
  end
24
24
 
25
25
  # build a list of variables from ENV_FILE and yeilds it
@@ -10,11 +10,11 @@ module Negroku::Stage
10
10
  }
11
11
 
12
12
  add_stage_file config
13
- Negroku::Env.bulk(config[:stage_name]) if ask_add_vars
13
+ Negroku::Env.bulk(config[:stage_name]) if ask_set_vars
14
14
  end
15
15
 
16
- def ask_add_vars
17
- question = I18n.t :ask_add_vars, scope: :negroku
16
+ def ask_set_vars
17
+ question = I18n.t :ask_set_vars, scope: :negroku
18
18
  Ask.confirm question, default: false
19
19
  end
20
20
 
@@ -22,6 +22,7 @@ end
22
22
 
23
23
  # Load Negroku tasks
24
24
  load_task "negroku"
25
+ load_task "env"
25
26
  load_task "rbenv" if required? 'capistrano/rbenv'
26
27
  load_task "nodenv" if required? 'capistrano/nodenv'
27
28
  load_task "bower" if required? 'capistrano/bower'
@@ -1,5 +1,5 @@
1
- # helper to build the add VAR cmd
2
- def build_add_var_cmd(vars_file, key, value)
1
+ # helper to build the set VAR cmd
2
+ def build_set_var_cmd(vars_file, key, value)
3
3
  puts "#{vars_file} #{key} #{value}"
4
4
  cmd = "if awk < #{vars_file} -F= '{print $1}' | grep --quiet -w #{key}; then "
5
5
  cmd += "sed -i 's/^#{key}=.*/#{key}=#{value.gsub("\/", "\\/")}/g' #{vars_file};"
@@ -7,8 +7,8 @@ en:
7
7
  choose_repo_url: 'Choose the repository url'
8
8
  type_repo_url: 'Type the url and username e.g. git@github.com:username/app-name.git'
9
9
  choose_stages: 'Select the stages you are going to use'
10
- select_stages_question: 'Select stages you want to add variables to'
11
- no_variables_added: 'No variables added'
10
+ select_stages_question: 'Select stages you want to set variables to'
11
+ no_variables_setted: 'No variables setted'
12
12
  ask_variables_message: "Give the variables values, if empty, it will be ignored"
13
13
  rbenv_vars_not_found: ".rbenv-vars does not exists"
14
14
  no_stages_found: "There are no stages available"
@@ -16,4 +16,4 @@ en:
16
16
  select_branch: "Select the branch to use"
17
17
  ask_domains: "Type the domains to use"
18
18
  ask_server_url: "Type the server url to deploy to"
19
- ask_add_vars: "Do you want to add rbenv-vars to the server now?"
19
+ ask_set_vars: "Do you want to set rbenv-vars to the server now?"
@@ -0,0 +1,8 @@
1
+ ## env.rake
2
+ #
3
+
4
+ namespace :env do
5
+ desc 'Env variables changed'
6
+ task :changed do
7
+ end
8
+ end
@@ -1,5 +1,4 @@
1
1
  require 'negroku/helpers/templates'
2
-
3
2
  ## eye.rb
4
3
  #
5
4
  # Adds eye variables and tasks
@@ -21,6 +20,11 @@ namespace :load do
21
20
  end
22
21
  end
23
22
 
23
+ namespace :env do
24
+ desc 'Env variables changed'
25
+ task :changed do
26
+ end
27
+ end
24
28
 
25
29
  namespace :eye do
26
30
 
@@ -79,6 +83,12 @@ namespace :negroku do
79
83
  before "deploy:published", "negroku:eye:setup"
80
84
  after "negroku:eye:setup", "eye:load"
81
85
 
86
+ after 'env:changed', 'hard-restart' do
87
+ invoke 'eye:stop'
88
+ invoke 'eye:load'
89
+ invoke 'eye:start'
90
+ end
91
+
82
92
  define_logs(:eye, {
83
93
  app: 'eye.log'
84
94
  })
@@ -17,12 +17,6 @@ namespace :load do
17
17
  end
18
18
  end
19
19
 
20
- namespace :env do
21
- desc 'Env variables changed'
22
- task :changed do
23
- end
24
- end
25
-
26
20
  namespace :rbenv do
27
21
  namespace :vars do
28
22
  desc "Show current environmental variables"
@@ -34,8 +28,8 @@ namespace :rbenv do
34
28
  end
35
29
  end
36
30
 
37
- desc "Add environmental variables in the form VAR=value"
38
- task :add, [:variable] => 'deploy:check:directories' do |t, args|
31
+ desc "Sets environmental variables in the form VAR=value"
32
+ task :set, [:variable] => 'deploy:check:directories' do |t, args|
39
33
 
40
34
  vars = [args.variable] + args.extras
41
35
 
@@ -43,7 +37,7 @@ namespace :rbenv do
43
37
  within shared_path do
44
38
  vars.compact.each do |var|
45
39
  key, value = var.split('=')
46
- cmd = build_add_var_cmd("#{shared_path}/.rbenv-vars", key, value)
40
+ cmd = build_set_var_cmd("#{shared_path}/.rbenv-vars", key, value)
47
41
  execute cmd
48
42
  end
49
43
  end
@@ -55,8 +49,8 @@ namespace :rbenv do
55
49
 
56
50
  end
57
51
 
58
- desc "Remove environmental variable"
59
- task :remove, [:key] do |t, args|
52
+ desc "Unset environmental variable"
53
+ task :unset, [:key] do |t, args|
60
54
  on release_roles :app do
61
55
  within shared_path do
62
56
  execute :sed, "-i", "/^#{args[:key]}=/d", ".rbenv-vars"
@@ -83,12 +83,6 @@ namespace :negroku do
83
83
  invoke 'unicorn:restart'
84
84
  end
85
85
 
86
- after 'env:changed', 'hard-restart' do
87
- invoke 'unicorn:stop'
88
- sleep 5
89
- invoke 'unicorn:start'
90
- end
91
-
92
86
  # Ensure the folders needed exist
93
87
  after 'deploy:check', 'deploy:check:directories' do
94
88
  on release_roles fetch(:unicorn_roles) do
@@ -1,3 +1,3 @@
1
1
  module Negroku
2
- VERSION = '2.0.3'
2
+ VERSION = '2.1.0'
3
3
  end
@@ -18,7 +18,7 @@ describe "stage cli" do
18
18
  allow(Negroku::Stage).to receive(:ask_server_url).and_return("server_url")
19
19
  allow(Negroku::Stage).to receive(:add_stage_file)
20
20
 
21
- expect(Negroku::Stage).to receive(:ask_add_vars).and_return(true)
21
+ expect(Negroku::Stage).to receive(:ask_set_vars).and_return(true)
22
22
  expect(Negroku::Env).to receive(:bulk).with("deleteme")
23
23
 
24
24
  expect{Negroku::Stage.add}.not_to raise_error
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: negroku
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Ignacio Donoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-17 00:00:00.000000000 Z
11
+ date: 2015-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -317,6 +317,7 @@ files:
317
317
  - lib/negroku/tasks/bower.rake
318
318
  - lib/negroku/tasks/bundler.rake
319
319
  - lib/negroku/tasks/delayed_job.rake
320
+ - lib/negroku/tasks/env.rake
320
321
  - lib/negroku/tasks/eye.rake
321
322
  - lib/negroku/tasks/eye/delayed_job.rake
322
323
  - lib/negroku/tasks/eye/unicorn.rake