pulsar 0.3.5 → 1.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/.rubocop.yml +150 -0
- data/.ruby-version +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +4 -265
- data/bin/pulsar +1 -1
- data/circle.yml +22 -0
- data/lib/pulsar.rb +28 -7
- data/lib/pulsar/cli.rb +79 -0
- data/lib/pulsar/constants.rb +5 -0
- data/lib/pulsar/generators/initial_repo/Gemfile +3 -0
- data/lib/pulsar/generators/{init_repo → initial_repo}/README.md +1 -1
- data/lib/pulsar/generators/initial_repo/apps/Capfile +8 -0
- data/lib/pulsar/generators/initial_repo/apps/deploy.rb +35 -0
- data/lib/pulsar/generators/initial_repo/apps/your_app/Capfile +18 -0
- data/lib/pulsar/generators/initial_repo/apps/your_app/deploy.rb +4 -0
- data/lib/pulsar/generators/initial_repo/apps/your_app/production.rb +3 -0
- data/lib/pulsar/generators/initial_repo/apps/your_app/staging.rb +3 -0
- data/lib/pulsar/generators/initial_repo/recipes/generic/rake.rake +12 -0
- data/lib/pulsar/generators/{init_repo/apps/your_app/recipes/production → initial_repo/recipes/rails}/.gitkeep +0 -0
- data/lib/pulsar/interactors/add_applications.rb +48 -0
- data/lib/pulsar/interactors/cleanup.rb +9 -0
- data/lib/pulsar/interactors/clone_repository.rb +50 -0
- data/lib/pulsar/interactors/copy_environment_file.rb +30 -0
- data/lib/pulsar/interactors/copy_initial_repository.rb +22 -0
- data/lib/pulsar/interactors/create_capfile.rb +32 -0
- data/lib/pulsar/interactors/create_deploy_file.rb +32 -0
- data/lib/pulsar/interactors/create_run_dirs.rb +21 -0
- data/lib/pulsar/interactors/identify_repository_location.rb +23 -0
- data/lib/pulsar/interactors/identify_repository_type.rb +34 -0
- data/lib/pulsar/interactors/run_bundle_install.rb +28 -0
- data/lib/pulsar/interactors/run_capistrano.rb +30 -0
- data/lib/pulsar/organizers/deploy.rb +16 -0
- data/lib/pulsar/organizers/install.rb +7 -0
- data/lib/pulsar/organizers/list.rb +12 -0
- data/lib/pulsar/version.rb +1 -1
- data/pulsar.gemspec +13 -11
- data/spec/features/deploy_spec.rb +162 -0
- data/spec/features/install_spec.rb +66 -0
- data/spec/features/list_spec.rb +140 -0
- data/spec/spec_helper.rb +26 -14
- data/{lib/pulsar/generators/init_repo/apps/your_app/recipes/staging → spec/support/dummies}/.gitkeep +0 -0
- data/spec/support/dummies/conf/dir/Gemfile +3 -0
- data/spec/support/dummies/conf/dir/apps/Capfile +9 -0
- data/spec/support/dummies/conf/dir/apps/blog/Capfile +1 -0
- data/spec/support/dummies/conf/dir/apps/blog/deploy.rb +4 -0
- data/spec/support/dummies/conf/dir/apps/blog/production.rb +4 -0
- data/spec/support/dummies/conf/dir/apps/blog/staging.rb +4 -0
- data/spec/support/dummies/conf/dir/apps/deploy.rb +1 -0
- data/{lib/pulsar/generators/init_repo/recipes/rails/.gitkeep → spec/support/dummies/conf/dir/apps/ecommerce/staging.rb} +0 -0
- data/spec/support/dummies/conf/dir/recipes/.gitkeep +0 -0
- data/spec/support/dummies/conf/dotenv +1 -0
- data/spec/support/dummies/conf/empty/apps/.gitkeep +0 -0
- data/spec/support/dummies/conf/empty/recipes/.gitkeep +0 -0
- data/spec/support/dummies/conf/wrong_bundle/Gemfile +3 -0
- data/spec/support/dummies/conf/wrong_bundle/apps/Capfile +9 -0
- data/spec/support/dummies/conf/wrong_bundle/apps/blog/Capfile +1 -0
- data/spec/support/dummies/conf/wrong_bundle/apps/blog/deploy.rb +4 -0
- data/spec/support/dummies/conf/wrong_bundle/apps/blog/production.rb +4 -0
- data/spec/support/dummies/conf/wrong_bundle/apps/deploy.rb +1 -0
- data/spec/support/dummies/conf/wrong_bundle/recipes/.gitkeep +0 -0
- data/spec/support/dummies/conf/wrong_cap/Gemfile +3 -0
- data/spec/support/dummies/conf/wrong_cap/apps/Capfile +0 -0
- data/spec/support/dummies/conf/wrong_cap/apps/blog/deploy.rb +4 -0
- data/spec/support/dummies/conf/wrong_cap/apps/blog/production.rb +4 -0
- data/spec/support/dummies/conf/wrong_cap/apps/deploy.rb +1 -0
- data/spec/support/dummies/conf/wrong_cap/recipes/.gitkeep +0 -0
- data/spec/units/cli/deploy_spec.rb +116 -0
- data/spec/units/cli/install_spec.rb +44 -0
- data/spec/units/cli/list_spec.rb +107 -0
- data/spec/units/constants_spec.rb +21 -0
- data/spec/units/interactors/add_applications_spec.rb +46 -0
- data/spec/units/interactors/cleanup_spec.rb +21 -0
- data/spec/units/interactors/clone_initial_repository_spec.rb +41 -0
- data/spec/units/interactors/clone_repository_spec.rb +122 -0
- data/spec/units/interactors/copy_environment_file_spec.rb +80 -0
- data/spec/units/interactors/create_capfile_spec.rb +77 -0
- data/spec/units/interactors/create_deploy_file_spec.rb +70 -0
- data/spec/units/interactors/create_run_dirs_spec.rb +47 -0
- data/spec/units/interactors/identify_repository_location_spec.rb +49 -0
- data/spec/units/interactors/identify_repository_type_spec.rb +85 -0
- data/spec/units/interactors/run_bundle_install_spec.rb +60 -0
- data/spec/units/interactors/run_capistrano_spec.rb +92 -0
- data/spec/units/organizers/deploy_spec.rb +28 -0
- data/spec/units/organizers/install_spec.rb +13 -0
- data/spec/units/organizers/list_spec.rb +24 -0
- metadata +179 -106
- data/.ruby-gemset +0 -1
- data/.travis.yml +0 -17
- data/bin/pulsar-utils +0 -5
- data/lib/pulsar/commands/all.rb +0 -6
- data/lib/pulsar/commands/init.rb +0 -23
- data/lib/pulsar/commands/list.rb +0 -19
- data/lib/pulsar/commands/main.rb +0 -64
- data/lib/pulsar/commands/utils.rb +0 -14
- data/lib/pulsar/generators/init_repo/Gemfile +0 -7
- data/lib/pulsar/generators/init_repo/apps/base.rb +0 -41
- data/lib/pulsar/generators/init_repo/apps/your_app/defaults.rb +0 -9
- data/lib/pulsar/generators/init_repo/apps/your_app/production.rb +0 -12
- data/lib/pulsar/generators/init_repo/apps/your_app/recipes/custom_recipe.rb +0 -14
- data/lib/pulsar/generators/init_repo/apps/your_app/staging.rb +0 -12
- data/lib/pulsar/generators/init_repo/recipes/generic/cleanup.rb +0 -50
- data/lib/pulsar/generators/init_repo/recipes/generic/utils.rb +0 -9
- data/lib/pulsar/helpers/all.rb +0 -8
- data/lib/pulsar/helpers/capistrano.rb +0 -47
- data/lib/pulsar/helpers/clamp.rb +0 -223
- data/lib/pulsar/helpers/path.rb +0 -71
- data/lib/pulsar/helpers/shell.rb +0 -31
- data/lib/pulsar/options/all.rb +0 -6
- data/lib/pulsar/options/conf_repo.rb +0 -41
- data/lib/pulsar/options/shared.rb +0 -15
- data/spec/pulsar/commands/init_spec.rb +0 -10
- data/spec/pulsar/commands/list_spec.rb +0 -127
- data/spec/pulsar/commands/main_spec.rb +0 -360
- data/spec/pulsar/commands/utils_spec.rb +0 -33
- data/spec/pulsar/helpers/capistrano_spec.rb +0 -70
- data/spec/pulsar/helpers/clamp_spec.rb +0 -105
- data/spec/pulsar/helpers/shell_spec.rb +0 -11
- data/spec/support/dummies/dummy_app/config.ru +0 -3
- data/spec/support/dummies/dummy_conf/Gemfile +0 -4
- data/spec/support/dummies/dummy_conf/apps/base.rb +0 -46
- data/spec/support/dummies/dummy_conf/apps/dummy_app/custom_stage.rb +0 -5
- data/spec/support/dummies/dummy_conf/apps/dummy_app/defaults.rb +0 -7
- data/spec/support/dummies/dummy_conf/apps/dummy_app/production.rb +0 -5
- data/spec/support/dummies/dummy_conf/apps/dummy_app/recipes/custom_recipe.rb +0 -1
- data/spec/support/dummies/dummy_conf/apps/dummy_app/recipes/production/custom_recipe.rb +0 -1
- data/spec/support/dummies/dummy_conf/apps/dummy_app/recipes/staging/custom_recipe.rb +0 -1
- data/spec/support/dummies/dummy_conf/apps/dummy_app/staging.rb +0 -5
- data/spec/support/dummies/dummy_conf/apps/other_dummy_app/custom_stage.rb +0 -5
- data/spec/support/dummies/dummy_conf/apps/other_dummy_app/defaults.rb +0 -7
- data/spec/support/dummies/dummy_conf/apps/other_dummy_app/production.rb +0 -5
- data/spec/support/dummies/dummy_conf/apps/other_dummy_app/staging.rb +0 -5
- data/spec/support/dummies/dummy_conf/recipes/generic/recipe.rb +0 -3
- data/spec/support/modules/helpers.rb +0 -85
- data/spec/support/modules/output_capture.rb +0 -21
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Pulsar::UtilsCommand do
|
4
|
-
let(:pulsar) { Pulsar::UtilsCommand.new('') }
|
5
|
-
|
6
|
-
context '--version option' do
|
7
|
-
before do
|
8
|
-
begin
|
9
|
-
pulsar.parse(['--version'])
|
10
|
-
rescue SystemExit => e
|
11
|
-
@system_exit = e
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'shows version' do
|
16
|
-
expect(stdout).to include(Pulsar::VERSION)
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'exits with a zero status' do
|
20
|
-
expect(@system_exit).not_to be_nil
|
21
|
-
expect(@system_exit.status).to be 0
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'subcommands' do
|
26
|
-
it 'should be cap and list and init' do
|
27
|
-
help = pulsar.help
|
28
|
-
expect(help).to match(/Subcommands:/)
|
29
|
-
expect(help).to match(/list/)
|
30
|
-
expect(help).to match(/init/)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Pulsar::Helpers::Capistrano do
|
4
|
-
include Pulsar::Helpers::Capistrano
|
5
|
-
|
6
|
-
context 'load_recipes' do
|
7
|
-
it 'loads capistrano recipes from CONFIG_PATH env variable' do
|
8
|
-
ENV['CONFIG_PATH'] = '/config/path'
|
9
|
-
allow(File).to receive(:directory?).and_return(true)
|
10
|
-
allow(File).to receive(:exist?).and_return(true)
|
11
|
-
allow(self).to receive(:load)
|
12
|
-
|
13
|
-
load_recipes { generic :recipe }
|
14
|
-
|
15
|
-
expect(self)
|
16
|
-
.to have_received(:load).with('/config/path/recipes/generic/recipe.rb')
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'raises a missing recipe exception when no recipe folder is found' do
|
20
|
-
allow(File).to receive(:directory?).and_return(false)
|
21
|
-
|
22
|
-
expect { load_recipes { generic :recipe } }
|
23
|
-
.to raise_error(RuntimeError, /no recipes of type generic/)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'raises a missing recipe exception when no recipe is found' do
|
27
|
-
allow(File).to receive(:directory?).and_return(true)
|
28
|
-
allow(File).to receive(:exist?).and_return(false)
|
29
|
-
|
30
|
-
expect { load_recipes { generic :missing_recipe } }
|
31
|
-
.to raise_error(RuntimeError, /no missing_recipe recipe/)
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'does not load if :app_only and pulsar is not inside an application' do
|
35
|
-
ENV.delete('APP_PATH')
|
36
|
-
allow(File).to receive(:directory?).and_return(true)
|
37
|
-
allow(File).to receive(:exist?).and_return(true)
|
38
|
-
allow(self).to receive(:load)
|
39
|
-
|
40
|
-
load_recipes(app_only: true) { generic :recipe }
|
41
|
-
|
42
|
-
expect(self).not_to have_received(:load)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'loads if :app_only is true and pulsar is inside an application' do
|
46
|
-
ENV['APP_PATH'] = '/app/path'
|
47
|
-
allow(File).to receive(:directory?).and_return(true)
|
48
|
-
allow(File).to receive(:exist?).and_return(true)
|
49
|
-
allow(self).to receive(:load)
|
50
|
-
|
51
|
-
load_recipes(app_only: true) { generic :recipe }
|
52
|
-
|
53
|
-
expect(self).to have_received(:load)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context 'from_application_path?' do
|
58
|
-
it 'returns true if APP_PATH env variable is set' do
|
59
|
-
ENV['APP_PATH'] = '/app/path'
|
60
|
-
|
61
|
-
expect(from_application_path?).to be true
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'returns false if APP_PATH env variable is not set' do
|
65
|
-
ENV.delete('APP_PATH')
|
66
|
-
|
67
|
-
expect(from_application_path?).to be false
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,105 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Pulsar::Helpers::Clamp do
|
4
|
-
include Pulsar::Helpers::Clamp
|
5
|
-
|
6
|
-
context 'fetch_repo' do
|
7
|
-
it 'supports directories' do
|
8
|
-
allow(File).to receive(:directory?).and_return(true)
|
9
|
-
allow(self).to receive(:conf_repo).and_return('conf-repo/path')
|
10
|
-
allow(self).to receive(:fetch_directory_repo)
|
11
|
-
|
12
|
-
fetch_repo
|
13
|
-
|
14
|
-
expect(self)
|
15
|
-
.to have_received(:fetch_directory_repo).with('conf-repo/path')
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'supports full git path' do
|
19
|
-
allow(File).to receive(:directory?).and_return(false)
|
20
|
-
allow(self).to receive(:fetch_git_repo)
|
21
|
-
allow(self)
|
22
|
-
.to receive(:conf_repo)
|
23
|
-
.and_return('git://github.com/gh_user/pulsar-conf.git')
|
24
|
-
|
25
|
-
fetch_repo
|
26
|
-
|
27
|
-
expect(self)
|
28
|
-
.to have_received(:fetch_git_repo)
|
29
|
-
.with('git://github.com/gh_user/pulsar-conf.git')
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'supports full git path on ssh' do
|
33
|
-
allow(File).to receive(:directory?).and_return(false)
|
34
|
-
allow(self).to receive(:fetch_git_repo)
|
35
|
-
allow(self)
|
36
|
-
.to receive(:conf_repo)
|
37
|
-
.and_return('git@github.com:gh_user/pulsar-conf.git')
|
38
|
-
|
39
|
-
fetch_repo
|
40
|
-
|
41
|
-
expect(self)
|
42
|
-
.to have_received(:fetch_git_repo)
|
43
|
-
.with('git@github.com:gh_user/pulsar-conf.git')
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'supports full git path on http' do
|
47
|
-
allow(File).to receive(:directory?).and_return(false)
|
48
|
-
allow(self).to receive(:fetch_git_repo)
|
49
|
-
allow(self)
|
50
|
-
.to receive(:conf_repo)
|
51
|
-
.and_return('https://github.com/gh_user/pulsar.git')
|
52
|
-
|
53
|
-
fetch_repo
|
54
|
-
|
55
|
-
expect(self)
|
56
|
-
.to have_received(:fetch_git_repo)
|
57
|
-
.with('https://github.com/gh_user/pulsar.git')
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'supports github path' do
|
61
|
-
allow(File).to receive(:directory?).and_return(false)
|
62
|
-
allow(self).to receive(:conf_repo).and_return('gh-user/pulsar-conf')
|
63
|
-
allow(self).to receive(:fetch_git_repo)
|
64
|
-
|
65
|
-
fetch_repo
|
66
|
-
|
67
|
-
expect(self)
|
68
|
-
.to have_received(:fetch_git_repo)
|
69
|
-
.with('git@github.com:gh-user/pulsar-conf.git')
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context 'run_capistrano' do
|
74
|
-
before do
|
75
|
-
allow(self).to receive(:config_path).and_return(dummy_conf_path)
|
76
|
-
allow(self).to receive(:verbose?).and_return(false)
|
77
|
-
allow(self).to receive(:capfile_path).and_return('/stubbed/capfile')
|
78
|
-
allow(self).to receive(:run_cmd)
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'runs capistrano when pulsar is invoked from outside an application' do
|
82
|
-
cap_cmd = 'bundle exec cap'
|
83
|
-
env_vars = "CONFIG_PATH=#{config_path}"
|
84
|
-
cmd_args = "--file #{capfile_path} deploy"
|
85
|
-
full_cmd = "#{cap_cmd} #{env_vars} #{cmd_args}"
|
86
|
-
|
87
|
-
run_capistrano('deploy')
|
88
|
-
|
89
|
-
expect(self).to have_received(:run_cmd).with(full_cmd, anything)
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'runs capistrano when pulsar is invoked from inside an application' do
|
93
|
-
allow(self).to receive(:application_path).and_return('/app/path')
|
94
|
-
|
95
|
-
cap_cmd = 'bundle exec cap'
|
96
|
-
env_vars = "CONFIG_PATH=#{config_path} APP_PATH=#{application_path}"
|
97
|
-
cmd_args = "--file #{capfile_path} deploy"
|
98
|
-
full_cmd = "#{cap_cmd} #{env_vars} #{cmd_args}"
|
99
|
-
|
100
|
-
run_capistrano('deploy')
|
101
|
-
|
102
|
-
expect(self).to have_received(:run_cmd).with(full_cmd, anything)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# This is apps/base.rb
|
2
|
-
|
3
|
-
#
|
4
|
-
# Require and extend with additional modules
|
5
|
-
#
|
6
|
-
require 'pulsar'
|
7
|
-
|
8
|
-
extend Pulsar::Helpers::Capistrano
|
9
|
-
|
10
|
-
#
|
11
|
-
# Load deploy capistrano recipe
|
12
|
-
#
|
13
|
-
load 'deploy'
|
14
|
-
|
15
|
-
#
|
16
|
-
# Configure libraries/recipes from Gemfile
|
17
|
-
#
|
18
|
-
require 'bundler/capistrano'
|
19
|
-
|
20
|
-
#
|
21
|
-
# Load default recipes
|
22
|
-
#
|
23
|
-
load_recipes do
|
24
|
-
generic :recipe
|
25
|
-
end
|
26
|
-
|
27
|
-
#
|
28
|
-
# Put here shared configuration that should be by default
|
29
|
-
#
|
30
|
-
set :scm, :git
|
31
|
-
|
32
|
-
set :ssh_options, forward_agent: true
|
33
|
-
|
34
|
-
set :default_run_options, pty: true
|
35
|
-
|
36
|
-
set :deploy_to, defer { "/var/www/#{application}" }
|
37
|
-
|
38
|
-
set :deploy_via, :remote_cache
|
39
|
-
|
40
|
-
set :user, 'www-data'
|
41
|
-
|
42
|
-
set :use_sudo, false
|
43
|
-
|
44
|
-
set :rake, 'bundle exec rake'
|
45
|
-
|
46
|
-
set :rails_env, defer { stage }
|
@@ -1 +0,0 @@
|
|
1
|
-
# This is apps/dummy_app/recipes/custom_recipe.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
# This is apps/dummy_app/recipes/production/custom_recipe.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
# This is apps/dummy_app/recipes/staging/custom_recipe.rb
|
@@ -1,85 +0,0 @@
|
|
1
|
-
module Helpers
|
2
|
-
def base_args
|
3
|
-
['--conf-repo', dummy_conf_path]
|
4
|
-
end
|
5
|
-
|
6
|
-
def capfile_count
|
7
|
-
Dir.glob("#{spec_tmp_path}/tmp/capfile-*").length
|
8
|
-
end
|
9
|
-
|
10
|
-
def dummy_app(stage = :production)
|
11
|
-
['dummy_app', stage.to_s]
|
12
|
-
end
|
13
|
-
|
14
|
-
def dummy_conf_path
|
15
|
-
File.join(File.dirname(__FILE__), '..', 'dummies', 'dummy_conf')
|
16
|
-
end
|
17
|
-
|
18
|
-
def dummy_dotfile_options
|
19
|
-
{
|
20
|
-
'PULSAR_APP_NAME' => 'dummy_app',
|
21
|
-
'PULSAR_CONF_REPO' => dummy_conf_path,
|
22
|
-
'PULSAR_DEFAULT_TASK' => 'capistrano:task'
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
def dummy_app_path
|
27
|
-
File.join(File.dirname(__FILE__), '..', 'dummies', 'dummy_app')
|
28
|
-
end
|
29
|
-
|
30
|
-
def full_cap_args
|
31
|
-
base_args +
|
32
|
-
['--home-dir', spec_tmp_path, '--keep-capfile', '--skip-cap-run']
|
33
|
-
end
|
34
|
-
|
35
|
-
def full_list_args
|
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
|
51
|
-
end
|
52
|
-
|
53
|
-
def latest_capfile
|
54
|
-
capfile = File.open(Dir.glob("#{spec_tmp_path}/tmp/capfile-*").first)
|
55
|
-
content = capfile.read
|
56
|
-
capfile.close
|
57
|
-
|
58
|
-
content
|
59
|
-
end
|
60
|
-
|
61
|
-
def reload_main_command
|
62
|
-
Pulsar.instance_eval { remove_const :MainCommand }
|
63
|
-
load 'pulsar/commands/main.rb'
|
64
|
-
|
65
|
-
stub_bundle_install
|
66
|
-
end
|
67
|
-
|
68
|
-
def spec_tmp_path
|
69
|
-
File.join(File.dirname(__FILE__), '..', 'tmp')
|
70
|
-
end
|
71
|
-
|
72
|
-
def stub_bundle_install
|
73
|
-
allow_any_instance_of(Pulsar::MainCommand).to receive(:bundle_install)
|
74
|
-
end
|
75
|
-
|
76
|
-
def stub_config(path, options)
|
77
|
-
extended_path = File.expand_path(path)
|
78
|
-
|
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))
|
84
|
-
end
|
85
|
-
end
|