bebox 0.1.3 → 0.1.4
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -18
- data/bebox.gemspec +1 -1
- data/lib/bebox.rb +1 -0
- data/lib/bebox/cli.rb +7 -1
- data/lib/bebox/commands/commands_helper.rb +2 -2
- data/lib/bebox/commands/environment_commands.rb +6 -6
- data/lib/bebox/commands/general_commands.rb +2 -2
- data/lib/bebox/commands/node_commands.rb +18 -14
- data/lib/bebox/commands/prepare_commands.rb +17 -14
- data/lib/bebox/commands/profile_commands.rb +8 -8
- data/lib/bebox/commands/provision_commands.rb +7 -7
- data/lib/bebox/commands/role_commands.rb +14 -14
- data/lib/bebox/logger.rb +2 -0
- data/lib/bebox/node.rb +0 -1
- data/lib/bebox/profile.rb +1 -1
- data/lib/bebox/project.rb +1 -1
- data/lib/bebox/vagrant_helper.rb +5 -3
- data/lib/bebox/version.rb +1 -1
- data/lib/bebox/wizards/environment_wizard.rb +5 -5
- data/lib/bebox/wizards/node_wizard.rb +23 -22
- data/lib/bebox/wizards/profile_wizard.rb +24 -25
- data/lib/bebox/wizards/project_wizard.rb +34 -28
- data/lib/bebox/wizards/provision_wizard.rb +13 -12
- data/lib/bebox/wizards/role_wizard.rb +15 -21
- data/lib/i18n/en.yml +198 -0
- data/spec/cli_spec.rb +66 -26
- data/spec/fixtures/commands/environment_help.erb.test +1 -0
- data/spec/fixtures/commands/general_help.erb.test +1 -0
- data/spec/fixtures/commands/in_project_help.erb.test +1 -0
- data/spec/fixtures/commands/node_help.erb.test +1 -0
- data/spec/fixtures/commands/profile_help.erb.test +1 -0
- data/spec/fixtures/commands/role_help.erb.test +1 -0
- data/spec/spec_helper.rb +7 -1
- data/spec/wizards/profile_wizard_spec.rb +12 -0
- metadata +23 -22
- data/spec/fixtures/commands/environment_help.test +0 -1
- data/spec/fixtures/commands/general_help.test +0 -1
- data/spec/fixtures/commands/in_project_help.test +0 -1
- data/spec/fixtures/commands/node_help.test +0 -1
- data/spec/fixtures/commands/profile_help.test +0 -1
- data/spec/fixtures/commands/role_help.test +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dbcd794821165fbd1d616c747b8ba8125fd255b
|
4
|
+
data.tar.gz: 36cf6cbe8f4c35d2b21e49e61ceb648ada9b903a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2eb096841311aa6c652aeabfe79eda7faac54f091a7b615d0cf4af72d5b31b973631b0fc8e4b08a04c3de65a5dce76b215067051833f125fba5b7b9ab4a518ea
|
7
|
+
data.tar.gz: 0aeaf4a6e8cc853373856e4011f6f256555a961133c55917b8b83a7474749d6412ec25f79272c039ee483d79ad19bdefd28a28f073096a163f47fd2bb755a674
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bebox (0.1.
|
4
|
+
bebox (0.1.4)
|
5
5
|
colorize (= 0.6.0)
|
6
|
+
fast_gettext (= 0.9.0)
|
6
7
|
gli (= 2.10.0)
|
7
8
|
highline (= 1.6.21)
|
8
9
|
progressbar (= 0.21.0)
|
@@ -26,28 +27,16 @@ GEM
|
|
26
27
|
minitest (~> 5.1)
|
27
28
|
thread_safe (~> 0.1)
|
28
29
|
tzinfo (~> 1.1)
|
29
|
-
aruba (0.5.4)
|
30
|
-
childprocess (>= 0.3.6)
|
31
|
-
cucumber (>= 1.1.1)
|
32
|
-
rspec-expectations (>= 2.7.0)
|
33
30
|
awesome_print (1.2.0)
|
34
31
|
binding_of_caller (0.7.2)
|
35
32
|
debug_inspector (>= 0.0.1)
|
36
33
|
builder (3.2.2)
|
37
|
-
childprocess (0.5.3)
|
38
|
-
ffi (~> 1.0, >= 1.0.11)
|
39
34
|
codeclimate-test-reporter (0.4.0)
|
40
35
|
simplecov (>= 0.7.1, < 1.0.0)
|
41
36
|
coderay (1.1.0)
|
42
37
|
colorize (0.6.0)
|
43
38
|
columnize (0.8.9)
|
44
39
|
coolline (0.4.3)
|
45
|
-
cucumber (1.3.14)
|
46
|
-
builder (>= 2.1.2)
|
47
|
-
diff-lcs (>= 1.1.3)
|
48
|
-
gherkin (~> 2.12)
|
49
|
-
multi_json (>= 1.7.5, < 2.0)
|
50
|
-
multi_test (>= 0.1.1)
|
51
40
|
debug_inspector (0.0.2)
|
52
41
|
debugger (1.6.6)
|
53
42
|
columnize (>= 0.3.1)
|
@@ -61,9 +50,7 @@ GEM
|
|
61
50
|
erubis (2.7.0)
|
62
51
|
factory_girl (4.3.0)
|
63
52
|
activesupport (>= 3.0.0)
|
64
|
-
|
65
|
-
gherkin (2.12.2)
|
66
|
-
multi_json (~> 1.3)
|
53
|
+
fast_gettext (0.9.0)
|
67
54
|
gli (2.10.0)
|
68
55
|
grit (2.5.0)
|
69
56
|
diff-lcs (~> 1.1)
|
@@ -89,7 +76,6 @@ GEM
|
|
89
76
|
mime-types (1.25.1)
|
90
77
|
minitest (5.3.3)
|
91
78
|
multi_json (1.9.2)
|
92
|
-
multi_test (0.1.1)
|
93
79
|
net-ssh (2.9.1)
|
94
80
|
posix-spawn (0.3.8)
|
95
81
|
progressbar (0.21.0)
|
@@ -155,7 +141,6 @@ PLATFORMS
|
|
155
141
|
ruby
|
156
142
|
|
157
143
|
DEPENDENCIES
|
158
|
-
aruba (= 0.5.4)
|
159
144
|
bebox!
|
160
145
|
codeclimate-test-reporter (= 0.4.0)
|
161
146
|
factory_girl (= 4.3.0)
|
data/bebox.gemspec
CHANGED
@@ -26,7 +26,6 @@ spec = Gem::Specification.new do |s|
|
|
26
26
|
s.executables << 'bebox'
|
27
27
|
s.required_ruby_version = '>= 1.9.2'
|
28
28
|
s.add_development_dependency('rake', '10.3.1')
|
29
|
-
s.add_development_dependency('aruba', '0.5.4')
|
30
29
|
s.add_development_dependency('rspec', '2.14.1')
|
31
30
|
s.add_development_dependency('jazz_hands', '0.5.2')
|
32
31
|
s.add_development_dependency('serverspec', '1.6.0')
|
@@ -38,4 +37,5 @@ spec = Gem::Specification.new do |s|
|
|
38
37
|
s.add_runtime_dependency('highline', '1.6.21')
|
39
38
|
s.add_runtime_dependency('progressbar', '0.21.0')
|
40
39
|
s.add_runtime_dependency('colorize', '0.6.0')
|
40
|
+
s.add_runtime_dependency('fast_gettext', '0.9.0')
|
41
41
|
end
|
data/lib/bebox.rb
CHANGED
data/lib/bebox/cli.rb
CHANGED
@@ -6,10 +6,16 @@ module Bebox
|
|
6
6
|
attr_accessor :project_root
|
7
7
|
|
8
8
|
def initialize(*args)
|
9
|
+
|
10
|
+
# Configure the i18n directory and locale
|
11
|
+
FastGettext.add_text_domain('bebox', path: File.join((File.expand_path '..', File.dirname(__FILE__)), 'i18n'), type: :yaml)
|
12
|
+
FastGettext.set_locale('en')
|
13
|
+
FastGettext.text_domain = 'bebox'
|
14
|
+
|
9
15
|
# add the GLI magic on to the Bebox::Cli instance
|
10
16
|
self.extend GLI::App
|
11
17
|
|
12
|
-
program_desc '
|
18
|
+
program_desc _('cli.desc')
|
13
19
|
version Bebox::VERSION
|
14
20
|
|
15
21
|
if inside_project?
|
@@ -8,9 +8,9 @@ module Bebox
|
|
8
8
|
def get_environment(options)
|
9
9
|
environment = options[:environment]
|
10
10
|
# Ask for environment of node if flag environment not set
|
11
|
-
environment ||= choose_option(Environment.list(project_root), '
|
11
|
+
environment ||= choose_option(Environment.list(project_root), _('cli.choose_environment'))
|
12
12
|
# Check environment existence
|
13
|
-
Bebox::Environment.environment_exists?(project_root, environment) ? (return environment) : exit_now!(error(
|
13
|
+
Bebox::Environment.environment_exists?(project_root, environment) ? (return environment) : exit_now!(error(_('cli.not_exist_environment')%{environment: environment}))
|
14
14
|
end
|
15
15
|
|
16
16
|
# Obtain the default environment for a project
|
@@ -8,11 +8,11 @@ module Bebox
|
|
8
8
|
|
9
9
|
def load_commands
|
10
10
|
# Environment management phase commands
|
11
|
-
desc '
|
11
|
+
desc _('cli.environment.desc')
|
12
12
|
command :environment do |environment_command|
|
13
13
|
environment_list_command(environment_command)
|
14
|
-
generate_environment_command(environment_command, :new, :create_new_environment, '
|
15
|
-
generate_environment_command(environment_command, :remove, :remove_environment, '
|
14
|
+
generate_environment_command(environment_command, :new, :create_new_environment, _('cli.environment.new.desc'))
|
15
|
+
generate_environment_command(environment_command, :remove, :remove_environment, _('cli.environment.remove.desc'))
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -21,7 +21,7 @@ module Bebox
|
|
21
21
|
environment_command.arg_name "[environment]"
|
22
22
|
environment_command.command command do |generated_command|
|
23
23
|
generated_command.action do |global_options,options,args|
|
24
|
-
help_now!(error('
|
24
|
+
help_now!(error(_('cli.environment.name_arg_missing'))) if args.count == 0
|
25
25
|
Bebox::EnvironmentWizard.new.send(send_command, project_root, args.first)
|
26
26
|
end
|
27
27
|
end
|
@@ -33,9 +33,9 @@ module Bebox
|
|
33
33
|
environment_command.command :list do |environment_list_command|
|
34
34
|
environment_list_command.action do |global_options,options,args|
|
35
35
|
environments = Bebox::Environment.list(project_root)
|
36
|
-
title '
|
36
|
+
title _('cli.environment.list.current_envs')
|
37
37
|
environments.map{|environment| msg(environment)}
|
38
|
-
warn('
|
38
|
+
warn(_('cli.environment.list.no_envs')) if environments.empty?
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -7,14 +7,14 @@ module Bebox
|
|
7
7
|
|
8
8
|
def load_commands
|
9
9
|
# Project creation phase command
|
10
|
-
desc '
|
10
|
+
desc _('cli.project.new.desc')
|
11
11
|
arg_name '[project_name]'
|
12
12
|
command :new do |project_command|
|
13
13
|
project_command.action do |global_options,options,args|
|
14
14
|
if args.count > 0
|
15
15
|
Bebox::ProjectWizard.new.create_new_project("bebox-#{args.first}")
|
16
16
|
else
|
17
|
-
help_now!(error('
|
17
|
+
help_now!(error(_('cli.project.new.name_arg_missing')))
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -8,31 +8,26 @@ module Bebox
|
|
8
8
|
|
9
9
|
def load_commands
|
10
10
|
# Nodes management phase commands
|
11
|
-
desc '
|
11
|
+
desc _('cli.node.desc')
|
12
12
|
command :node do |node_command|
|
13
13
|
node_list_command(node_command)
|
14
|
-
generate_node_command(node_command, :new, :create_new_node, '
|
14
|
+
generate_node_command(node_command, :new, :create_new_node, _('cli.node.new.desc'))
|
15
15
|
node_remove_command(node_command)
|
16
16
|
# These commands are available if there is at least one role and one node
|
17
|
-
generate_node_command(node_command, :set_role, :set_role, '
|
17
|
+
generate_node_command(node_command, :set_role, :set_role, _('cli.node.set_role.desc')) if (Bebox::Role.roles_count(project_root) > 0 && Bebox::Node.count_all_nodes_by_type(project_root, 'nodes') > 0)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
def node_list_command(node_command)
|
22
22
|
# Node list command
|
23
|
-
node_command.flag :environment, desc: '
|
24
|
-
node_command.desc 'list
|
23
|
+
node_command.flag :environment, desc: _('cli.node.list.env_flag_desc'), default_value: default_environment
|
24
|
+
node_command.desc _('cli.node.list.desc')
|
25
25
|
node_command.command :list do |node_list_command|
|
26
26
|
node_list_command.switch :all
|
27
27
|
node_list_command.action do |global_options,options,args|
|
28
28
|
# Call to list nodes
|
29
29
|
environments = options[:all] ? Bebox::Environment.list(project_root) : [get_environment(options)]
|
30
|
-
environments
|
31
|
-
nodes = Node.list(project_root, environment, 'nodes')
|
32
|
-
title "Nodes for '#{environment}' environment:"
|
33
|
-
nodes.map{|node| msg("#{node} (#{Bebox::Node.node_provision_state(project_root, environment, node)})")}
|
34
|
-
warn('There are not nodes yet in the environment. You can create a new one with: \'bebox node new\' command.') if nodes.empty?
|
35
|
-
end
|
30
|
+
list_environments(environments)
|
36
31
|
linebreak
|
37
32
|
end
|
38
33
|
end
|
@@ -44,21 +39,30 @@ module Bebox
|
|
44
39
|
node_command.command command do |generated_command|
|
45
40
|
generated_command.action do |global_options,options,args|
|
46
41
|
environment = get_environment(options)
|
47
|
-
info
|
42
|
+
info _('cli.current_environment')%{environment: environment}
|
48
43
|
Bebox::NodeWizard.new.send(send_command, project_root, environment)
|
49
44
|
end
|
50
45
|
end
|
51
46
|
end
|
52
47
|
|
53
48
|
def node_remove_command(node_command)
|
54
|
-
node_command.desc
|
49
|
+
node_command.desc _('cli.node.remove.desc')
|
55
50
|
node_command.command :remove do |node_remove_command|
|
56
51
|
node_remove_command.action do |global_options,options,args|
|
57
52
|
environment = get_environment(options)
|
58
|
-
info
|
53
|
+
info _('cli.current_environment')%{environment: environment}
|
59
54
|
Bebox::NodeWizard.new.remove_node(project_root, environment, args.first)
|
60
55
|
end
|
61
56
|
end
|
62
57
|
end
|
58
|
+
|
59
|
+
def list_environments(environments)
|
60
|
+
environments.each do |environment|
|
61
|
+
nodes = Node.list(project_root, environment, 'nodes')
|
62
|
+
title _('cli.node.list.env_nodes_title')%{environment: environment}
|
63
|
+
nodes.map{|node| msg("#{node} (#{Bebox::Node.node_provision_state(project_root, environment, node)})")}
|
64
|
+
warn(_('cli.node.list.no_nodes')) if nodes.empty?
|
65
|
+
end
|
66
|
+
end
|
63
67
|
end
|
64
68
|
end
|
@@ -7,43 +7,46 @@ module Bebox
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def load_commands
|
10
|
-
|
11
|
-
|
10
|
+
load_prepare_command
|
11
|
+
# These commands are available if there are at least one node in the vagrant environment
|
12
|
+
(Bebox::Node.list(project_root, 'vagrant', 'prepared_nodes').count > 0) ? load_vagrant_commands : return
|
13
|
+
end
|
14
|
+
|
15
|
+
def load_prepare_command
|
16
|
+
desc _('cli.prepare.desc')
|
12
17
|
command :prepare do |prepare_command|
|
13
|
-
prepare_command.flag :environment, :desc => '
|
18
|
+
prepare_command.flag :environment, :desc => _('cli.prepare.env_flag_desc'), default_value: default_environment
|
14
19
|
prepare_command.action do |global_options,options,args|
|
15
20
|
environment = get_environment(options)
|
16
21
|
# Check if vagrant is installed
|
17
|
-
return error('
|
18
|
-
title
|
22
|
+
return error(_('cli.prepare.not_vagrant')) unless Bebox::CommandsHelper.vagrant_installed?
|
23
|
+
title _('cli.current_environment')%{environment: environment}
|
19
24
|
Bebox::NodeWizard.new.prepare(project_root, environment)
|
20
25
|
end
|
21
26
|
end
|
22
|
-
# These commands are available if there are at least one node in the vagrant environment
|
23
|
-
(Bebox::Node.list(project_root, 'vagrant', 'prepared_nodes').count > 0) ? load_vagrant_commands : return
|
24
27
|
end
|
25
28
|
|
26
29
|
def load_vagrant_commands
|
27
|
-
desc '
|
30
|
+
desc _('cli.prepare.vagrant_halt.desc')
|
28
31
|
command :vagrant_halt do |vagrant_halt_command|
|
29
32
|
vagrant_halt_command.action do |global_options,options,args|
|
30
|
-
vagrant_command(:halt_vagrant_nodes, '
|
33
|
+
vagrant_command(:halt_vagrant_nodes, _('cli.prepare.vagrant_halt.halt_title'))
|
31
34
|
end
|
32
35
|
end
|
33
|
-
desc '
|
36
|
+
desc _('cli.prepare.vagrant_up.desc')
|
34
37
|
command :vagrant_up do |vagrant_up_command|
|
35
38
|
vagrant_up_command.action do |global_options,options,args|
|
36
|
-
vagrant_command(:up_vagrant_nodes, '
|
39
|
+
vagrant_command(:up_vagrant_nodes, _('cli.prepare.vagrant_up.up_title'))
|
37
40
|
end
|
38
41
|
end
|
39
42
|
end
|
40
43
|
|
41
44
|
def vagrant_command(command, message)
|
42
45
|
# Check if vagrant is installed
|
43
|
-
return error('
|
46
|
+
return error(_('cli.prepare.not_vagrant')) unless Bebox::CommandsHelper.vagrant_installed?
|
44
47
|
nodes = Bebox::Node.nodes_in_environment(project_root, 'vagrant', 'nodes')
|
45
|
-
environment
|
46
|
-
title
|
48
|
+
title _('cli.current_environment')%{environment: 'vagrant'}
|
49
|
+
title message
|
47
50
|
nodes.each{|node| msg(node.hostname)}
|
48
51
|
linebreak
|
49
52
|
Bebox::VagrantHelper.send(command, project_root)
|
@@ -7,7 +7,7 @@ module Bebox
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def load_commands
|
10
|
-
desc '
|
10
|
+
desc _('cli.profile.desc')
|
11
11
|
command :profile do |profile_command|
|
12
12
|
profile_new_command(profile_command)
|
13
13
|
profile_remove_command(profile_command)
|
@@ -17,13 +17,13 @@ module Bebox
|
|
17
17
|
|
18
18
|
# Profile new command
|
19
19
|
def profile_new_command(profile_command)
|
20
|
-
profile_command.desc '
|
20
|
+
profile_command.desc _('cli.profile.new.desc')
|
21
21
|
profile_command.arg_name "[name]"
|
22
22
|
profile_command.command :new do |profile_new_command|
|
23
|
-
profile_new_command.flag :p, :arg_name => 'path', :desc => '
|
23
|
+
profile_new_command.flag :p, :arg_name => 'path', :desc => _('cli.profile.new.path_flag_desc')
|
24
24
|
profile_new_command.action do |global_options,options,args|
|
25
25
|
path = options[:p] || ''
|
26
|
-
help_now!(error('
|
26
|
+
help_now!(error(_('cli.profile.new.name_arg_missing'))) if args.count == 0
|
27
27
|
Bebox::ProfileWizard.new.create_new_profile(project_root, args.first, path)
|
28
28
|
end
|
29
29
|
end
|
@@ -31,7 +31,7 @@ module Bebox
|
|
31
31
|
|
32
32
|
# Profile remove command
|
33
33
|
def profile_remove_command(profile_command)
|
34
|
-
profile_command.desc
|
34
|
+
profile_command.desc _('cli.profile.remove.desc')
|
35
35
|
profile_command.command :remove do |profile_remove_command|
|
36
36
|
profile_remove_command.action do |global_options,options,args|
|
37
37
|
Bebox::ProfileWizard.new.remove_profile(project_root)
|
@@ -41,13 +41,13 @@ module Bebox
|
|
41
41
|
|
42
42
|
# Profile list command
|
43
43
|
def profile_list_command(profile_command)
|
44
|
-
profile_command.desc '
|
44
|
+
profile_command.desc _('cli.profile.list.desc')
|
45
45
|
profile_command.command :list do |profile_list_command|
|
46
46
|
profile_list_command.action do |global_options,options,args|
|
47
47
|
profiles = Bebox::ProfileWizard.new.list_profiles(project_root)
|
48
|
-
title '
|
48
|
+
title _('cli.profile.list.current_profiles')
|
49
49
|
profiles.map{|profile| msg(profile)}
|
50
|
-
warn('
|
50
|
+
warn(_('cli.profile.list.no_profiles')) if profiles.empty?
|
51
51
|
linebreak
|
52
52
|
end
|
53
53
|
end
|
@@ -11,21 +11,21 @@ module Bebox
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def load_provision_commands
|
14
|
-
desc '
|
14
|
+
desc _('cli.provision.desc')
|
15
15
|
arg_name "[step]"
|
16
16
|
command :apply do |apply_command|
|
17
|
-
apply_command.switch :all, :desc => '
|
18
|
-
apply_command.flag :environment, :desc => '
|
17
|
+
apply_command.switch :all, :desc => _('cli.provision.all_switch_desc'), :negatable => false
|
18
|
+
apply_command.flag :environment, :desc => _('cli.provision.env_flag_desc'), default_value: default_environment
|
19
19
|
apply_command.action do |global_options,options,args|
|
20
20
|
environment = get_environment(options)
|
21
|
-
title
|
21
|
+
title _('cli.current_environment')%{environment: environment}
|
22
22
|
options[:all] ? apply_all(environment) : apply(environment, args)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
def apply_all(environment)
|
28
|
-
title
|
28
|
+
title _('cli.provision.title')
|
29
29
|
Bebox::PROVISION_STEPS.each do |step|
|
30
30
|
Bebox::ProvisionWizard.new.apply_step(project_root, environment, step)
|
31
31
|
end
|
@@ -33,8 +33,8 @@ module Bebox
|
|
33
33
|
|
34
34
|
def apply(environment, args)
|
35
35
|
step = args.first
|
36
|
-
help_now!(error('
|
37
|
-
help_now!(error('
|
36
|
+
help_now!(error(_('cli.provision.name_missing'))) if args.count == 0
|
37
|
+
help_now!(error(_('cli.provision.name_invalid'))) unless Bebox::CommandsHelper.valid_step?(step)
|
38
38
|
Bebox::ProvisionWizard.new.apply_step(project_root, environment, step)
|
39
39
|
end
|
40
40
|
end
|
@@ -7,10 +7,10 @@ module Bebox
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def load_commands
|
10
|
-
desc '
|
10
|
+
desc _('cli.role.desc')
|
11
11
|
command :role do |role_command|
|
12
12
|
role_new_command(role_command)
|
13
|
-
generate_role_command(role_command, :remove, :remove_role, '
|
13
|
+
generate_role_command(role_command, :remove, :remove_role, _('cli.role.remove.desc'))
|
14
14
|
role_list_command(role_command)
|
15
15
|
# These commands are available if there are at least one role and one profile
|
16
16
|
load_role_profile_commands(role_command) if (Bebox::Role.roles_count(project_root) > 0 && Bebox::Profile.profiles_count(project_root) > 0)
|
@@ -19,13 +19,13 @@ module Bebox
|
|
19
19
|
|
20
20
|
# Role list command
|
21
21
|
def role_list_command(role_command)
|
22
|
-
role_command.desc '
|
22
|
+
role_command.desc _('cli.role.list.desc')
|
23
23
|
role_command.command :list do |role_list_command|
|
24
24
|
role_list_command.action do |global_options,options,args|
|
25
25
|
roles = Bebox::Role.list(project_root)
|
26
|
-
title '
|
26
|
+
title _('cli.role.list.current_roles')
|
27
27
|
roles.map{|role| msg(role)}
|
28
|
-
warn('
|
28
|
+
warn(_('cli.role.list.no_roles')) if roles.empty?
|
29
29
|
linebreak
|
30
30
|
end
|
31
31
|
end
|
@@ -33,19 +33,19 @@ module Bebox
|
|
33
33
|
|
34
34
|
# Role new command
|
35
35
|
def role_new_command(role_command)
|
36
|
-
role_command.desc '
|
36
|
+
role_command.desc _('cli.role.new.desc')
|
37
37
|
role_command.arg_name "[name]"
|
38
38
|
role_command.command :new do |role_new_command|
|
39
39
|
role_new_command.action do |global_options,options,args|
|
40
|
-
help_now!(error('
|
40
|
+
help_now!(error(_('cli.role.new.name_arg_missing'))) if args.count == 0
|
41
41
|
Bebox::RoleWizard.new.create_new_role(project_root, args.first)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
def load_role_profile_commands(role_command)
|
47
|
-
generate_role_command(role_command, :add_profile, :add_profile, '
|
48
|
-
generate_role_command(role_command, :remove_profile, :remove_profile, '
|
47
|
+
generate_role_command(role_command, :add_profile, :add_profile, _('cli.role.add_profile.desc'))
|
48
|
+
generate_role_command(role_command, :remove_profile, :remove_profile, _('cli.role.remove_profile.desc'))
|
49
49
|
role_list_profiles_command(role_command)
|
50
50
|
end
|
51
51
|
|
@@ -61,22 +61,22 @@ module Bebox
|
|
61
61
|
|
62
62
|
# Role list profiles command
|
63
63
|
def role_list_profiles_command(role_command)
|
64
|
-
role_command.desc '
|
64
|
+
role_command.desc _('cli.role.list_profiles.desc')
|
65
65
|
role_command.arg_name "[role_name]"
|
66
66
|
role_command.command :list_profiles do |list_profiles_command|
|
67
67
|
list_profiles_command.action do |global_options,options,args|
|
68
|
-
help_now!(error('
|
68
|
+
help_now!(error(_('cli.role.list_profiles.name_arg_missing'))) if args.count == 0
|
69
69
|
role = args.first
|
70
|
-
exit_now!(error("The '#{role}' role does not exist.")) unless Bebox::RoleWizard.new.role_exists?(project_root, role)
|
71
70
|
print_profiles(role, Bebox::Role.list_profiles(project_root, role))
|
72
71
|
end
|
73
72
|
end
|
74
73
|
end
|
75
74
|
|
76
75
|
def print_profiles(role, profiles)
|
77
|
-
|
76
|
+
exit_now!(error(_('cli.role.list_profiles.name_not_exist')%{role: role})) unless Bebox::RoleWizard.new.role_exists?(project_root, role)
|
77
|
+
title _('cli.role.list_profiles.current_profiles')%{role: role}
|
78
78
|
profiles.map{|profile| msg(profile)}
|
79
|
-
warn(
|
79
|
+
warn(_('cli.role.list_profiles.no_profiles')%{role: role}) if profiles.empty?
|
80
80
|
linebreak
|
81
81
|
end
|
82
82
|
end
|