pulsar 0.3.4 → 0.3.5

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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/.hound.yml +3 -0
  3. data/.rubocop.yml +5 -0
  4. data/.ruby-version +1 -1
  5. data/.travis.yml +4 -1
  6. data/README.md +4 -4
  7. data/Rakefile +3 -3
  8. data/lib/pulsar.rb +9 -8
  9. data/lib/pulsar/commands/all.rb +4 -4
  10. data/lib/pulsar/commands/init.rb +7 -5
  11. data/lib/pulsar/commands/main.rb +43 -32
  12. data/lib/pulsar/commands/utils.rb +7 -3
  13. data/lib/pulsar/generators/init_repo/apps/your_app/defaults.rb +1 -1
  14. data/lib/pulsar/generators/init_repo/apps/your_app/production.rb +2 -2
  15. data/lib/pulsar/generators/init_repo/apps/your_app/staging.rb +2 -2
  16. data/lib/pulsar/generators/init_repo/recipes/generic/cleanup.rb +9 -9
  17. data/lib/pulsar/generators/init_repo/recipes/generic/utils.rb +6 -3
  18. data/lib/pulsar/helpers/all.rb +7 -5
  19. data/lib/pulsar/helpers/capistrano.rb +4 -4
  20. data/lib/pulsar/helpers/clamp.rb +32 -33
  21. data/lib/pulsar/helpers/path.rb +15 -2
  22. data/lib/pulsar/helpers/shell.rb +3 -3
  23. data/lib/pulsar/options/all.rb +5 -3
  24. data/lib/pulsar/options/conf_repo.rb +17 -16
  25. data/lib/pulsar/options/shared.rb +3 -2
  26. data/lib/pulsar/version.rb +1 -1
  27. data/pulsar.gemspec +17 -17
  28. data/spec/pulsar/commands/init_spec.rb +4 -3
  29. data/spec/pulsar/commands/list_spec.rb +63 -47
  30. data/spec/pulsar/commands/main_spec.rb +175 -125
  31. data/spec/pulsar/commands/utils_spec.rb +13 -13
  32. data/spec/pulsar/helpers/capistrano_spec.rb +37 -31
  33. data/spec/pulsar/helpers/clamp_spec.rb +68 -37
  34. data/spec/pulsar/helpers/shell_spec.rb +3 -3
  35. data/spec/spec_helper.rb +12 -11
  36. data/spec/support/dummies/dummy_conf/Gemfile +1 -1
  37. data/spec/support/dummies/dummy_conf/apps/base.rb +5 -5
  38. data/spec/support/dummies/dummy_conf/apps/dummy_app/custom_stage.rb +2 -2
  39. data/spec/support/dummies/dummy_conf/apps/dummy_app/defaults.rb +1 -1
  40. data/spec/support/dummies/dummy_conf/apps/dummy_app/production.rb +2 -2
  41. data/spec/support/dummies/dummy_conf/apps/dummy_app/staging.rb +2 -2
  42. data/spec/support/dummies/dummy_conf/apps/other_dummy_app/custom_stage.rb +2 -2
  43. data/spec/support/dummies/dummy_conf/apps/other_dummy_app/defaults.rb +1 -1
  44. data/spec/support/dummies/dummy_conf/apps/other_dummy_app/production.rb +2 -2
  45. data/spec/support/dummies/dummy_conf/apps/other_dummy_app/staging.rb +2 -2
  46. data/spec/support/modules/helpers.rb +40 -35
  47. metadata +20 -17
@@ -1,42 +1,57 @@
1
1
  module Helpers
2
2
  def base_args
3
- [ "--conf-repo", dummy_conf_path ]
3
+ ['--conf-repo', dummy_conf_path]
4
4
  end
5
5
 
6
6
  def capfile_count
7
- Dir.glob("#{tmp_path}/capfile-*").length
7
+ Dir.glob("#{spec_tmp_path}/tmp/capfile-*").length
8
8
  end
9
9
 
10
10
  def dummy_app(stage = :production)
11
- [ "dummy_app", stage.to_s ]
11
+ ['dummy_app', stage.to_s]
12
12
  end
13
13
 
14
14
  def dummy_conf_path
15
- File.join(File.dirname(__FILE__), "..", "dummies", "dummy_conf")
15
+ File.join(File.dirname(__FILE__), '..', 'dummies', 'dummy_conf')
16
16
  end
17
17
 
18
18
  def dummy_dotfile_options
19
19
  {
20
- "PULSAR_APP_NAME" => "dummy_app",
21
- "PULSAR_CONF_REPO" => dummy_conf_path,
22
- "PULSAR_DEFAULT_TASK" => "capistrano:task"
20
+ 'PULSAR_APP_NAME' => 'dummy_app',
21
+ 'PULSAR_CONF_REPO' => dummy_conf_path,
22
+ 'PULSAR_DEFAULT_TASK' => 'capistrano:task'
23
23
  }
24
24
  end
25
25
 
26
- def dummy_rack_app_path
27
- File.join(File.dirname(__FILE__), "..", "dummies", "dummy_app")
26
+ def dummy_app_path
27
+ File.join(File.dirname(__FILE__), '..', 'dummies', 'dummy_app')
28
28
  end
29
29
 
30
30
  def full_cap_args
31
- base_args + [ "--tmp-dir", tmp_path, "--keep-capfile", "--skip-cap-run" ]
31
+ base_args +
32
+ ['--home-dir', spec_tmp_path, '--keep-capfile', '--skip-cap-run']
32
33
  end
33
34
 
34
35
  def full_list_args
35
- base_args + [ "--tmp-dir", tmp_path, "--keep-capfile" ]
36
+ base_args + ['--home-dir', spec_tmp_path, '--keep-capfile']
37
+ end
38
+
39
+ def hash_to_env_vars(hash)
40
+ dotfile_lines = []
41
+
42
+ hash.each do |option, value|
43
+ if value.nil?
44
+ dotfile_lines << option
45
+ else
46
+ dotfile_lines << "#{option}=\"#{value}\"\n"
47
+ end
48
+ end
49
+
50
+ dotfile_lines
36
51
  end
37
52
 
38
53
  def latest_capfile
39
- capfile = File.open(Dir.glob("#{tmp_path}/capfile-*").first)
54
+ capfile = File.open(Dir.glob("#{spec_tmp_path}/tmp/capfile-*").first)
40
55
  content = capfile.read
41
56
  capfile.close
42
57
 
@@ -44,37 +59,27 @@ module Helpers
44
59
  end
45
60
 
46
61
  def reload_main_command
47
- Pulsar.instance_eval{ remove_const :MainCommand }
48
- load "pulsar/commands/main.rb"
62
+ Pulsar.instance_eval { remove_const :MainCommand }
63
+ load 'pulsar/commands/main.rb'
49
64
 
50
65
  stub_bundle_install
51
66
  end
52
67
 
53
- def stub_bundle_install
54
- Pulsar::MainCommand.any_instance.stub(:bundle_install)
68
+ def spec_tmp_path
69
+ File.join(File.dirname(__FILE__), '..', 'tmp')
55
70
  end
56
71
 
57
- def stub_dotfile(path, options)
58
- extended_path = "#{File.expand_path(path)}/.pulsar"
59
- dotfile_lines = []
60
-
61
- options.each do |option, value|
62
- if value.nil?
63
- dotfile_lines << option
64
- else
65
- dotfile_lines << "#{option}=\"#{value}\"\n"
66
- end
67
- end
68
-
69
- File.stub(:file?).and_return(true)
70
- File.stub(:readlines).with(extended_path).and_return(dotfile_lines)
72
+ def stub_bundle_install
73
+ allow_any_instance_of(Pulsar::MainCommand).to receive(:bundle_install)
71
74
  end
72
75
 
73
- def tmp_dir
74
- "tmp"
75
- end
76
+ def stub_config(path, options)
77
+ extended_path = File.expand_path(path)
76
78
 
77
- def tmp_path(dir=tmp_dir)
78
- File.join(File.dirname(__FILE__), "..", dir)
79
+ allow(File).to receive(:file?).and_return(false)
80
+ allow(File).to receive(:file?).with(extended_path).and_return(true)
81
+ allow(File)
82
+ .to receive(:readlines)
83
+ .with(extended_path).and_return(hash_to_env_vars(options))
79
84
  end
80
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pulsar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alberto Vena
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-23 00:00:00.000000000 Z
12
+ date: 2015-02-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clamp
@@ -59,56 +59,56 @@ dependencies:
59
59
  requirements:
60
60
  - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: 10.0.4
62
+ version: 10.3.2
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: 10.0.4
69
+ version: 10.3.2
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - '='
75
75
  - !ruby/object:Gem::Version
76
- version: 2.12.0
76
+ version: 3.1.0
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - '='
82
82
  - !ruby/object:Gem::Version
83
- version: 2.12.0
83
+ version: 3.1.0
84
84
  - !ruby/object:Gem::Dependency
85
- name: rr
85
+ name: codeclimate-test-reporter
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '='
88
+ - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 1.0.4
90
+ version: 0.4.6
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '='
95
+ - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: 1.0.4
97
+ version: 0.4.6
98
98
  - !ruby/object:Gem::Dependency
99
- name: coveralls
99
+ name: rubocop
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - '='
102
+ - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: 0.6.3
104
+ version: 0.29.1
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - '='
109
+ - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: 0.6.3
111
+ version: 0.29.1
112
112
  description: Manage your Capistrano deployments with ease
113
113
  email:
114
114
  - info@nebulab.it
@@ -119,7 +119,9 @@ extensions: []
119
119
  extra_rdoc_files: []
120
120
  files:
121
121
  - ".gitignore"
122
+ - ".hound.yml"
122
123
  - ".rspec"
124
+ - ".rubocop.yml"
123
125
  - ".ruby-gemset"
124
126
  - ".ruby-version"
125
127
  - ".travis.yml"
@@ -202,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
204
  version: '0'
203
205
  requirements: []
204
206
  rubyforge_project:
205
- rubygems_version: 2.2.2
207
+ rubygems_version: 2.4.5
206
208
  signing_key:
207
209
  specification_version: 4
208
210
  summary: Pulsar helps with Capistrano configuration management. It uses a repository
@@ -235,3 +237,4 @@ test_files:
235
237
  - spec/support/modules/helpers.rb
236
238
  - spec/support/modules/output_capture.rb
237
239
  - spec/support/tmp/.gitkeep
240
+ has_rdoc: