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
 
| 
         @@ -7,19 +7,13 @@ module Bebox 
     | 
|
| 
       7 
7 
     | 
    
         
             
                # Create a new role
         
     | 
| 
       8 
8 
     | 
    
         
             
                def create_new_role(project_root, role_name)
         
     | 
| 
       9 
9 
     | 
    
         
             
                  # Check if the role name is valid
         
     | 
| 
       10 
     | 
    
         
            -
                  return error  
     | 
| 
       11 
     | 
    
         
            -
                  \n* Lowercase letters
         
     | 
| 
       12 
     | 
    
         
            -
                  \n* Numbers
         
     | 
| 
       13 
     | 
    
         
            -
                  \n* Underscores
         
     | 
| 
       14 
     | 
    
         
            -
                  \n* Must begin with an Lowercase letter
         
     | 
| 
       15 
     | 
    
         
            -
                  \n* Can not be any of: #{Bebox::RESERVED_WORDS.join(', ')}
         
     | 
| 
       16 
     | 
    
         
            -
                  \n\nNo changes were made." unless valid_puppet_class_name?(role_name)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  return error _('wizard.role.invalid_name')%{words: Bebox::RESERVED_WORDS.join(', ')} unless valid_puppet_class_name?(role_name)
         
     | 
| 
       17 
11 
     | 
    
         
             
                  # Check if the role exist
         
     | 
| 
       18 
     | 
    
         
            -
                  return error( 
     | 
| 
      
 12 
     | 
    
         
            +
                  return error(_('wizard.role.name_exist')%{role: role_name}) if role_exists?(project_root, role_name)
         
     | 
| 
       19 
13 
     | 
    
         
             
                  # Role creation
         
     | 
| 
       20 
14 
     | 
    
         
             
                  role = Bebox::Role.new(role_name, project_root)
         
     | 
| 
       21 
15 
     | 
    
         
             
                  output = role.create
         
     | 
| 
       22 
     | 
    
         
            -
                  ok ' 
     | 
| 
      
 16 
     | 
    
         
            +
                  ok _('wizard.role.creation_success')
         
     | 
| 
       23 
17 
     | 
    
         
             
                  return output
         
     | 
| 
       24 
18 
     | 
    
         
             
                end
         
     | 
| 
       25 
19 
     | 
    
         | 
| 
         @@ -29,16 +23,16 @@ module Bebox 
     | 
|
| 
       29 
23 
     | 
    
         
             
                  roles = Bebox::Role.list(project_root)
         
     | 
| 
       30 
24 
     | 
    
         
             
                  # Get a role if exist.
         
     | 
| 
       31 
25 
     | 
    
         
             
                  if roles.count > 0
         
     | 
| 
       32 
     | 
    
         
            -
                    role_name = choose_option(roles, ' 
     | 
| 
      
 26 
     | 
    
         
            +
                    role_name = choose_option(roles, _('wizard.role.choose_deletion_role'))
         
     | 
| 
       33 
27 
     | 
    
         
             
                  else
         
     | 
| 
       34 
     | 
    
         
            -
                    return error  
     | 
| 
      
 28 
     | 
    
         
            +
                    return error _('wizard.role.no_deletion_roles')
         
     | 
| 
       35 
29 
     | 
    
         
             
                  end
         
     | 
| 
       36 
30 
     | 
    
         
             
                  # Ask for deletion confirmation
         
     | 
| 
       37 
     | 
    
         
            -
                  return warn(' 
     | 
| 
      
 31 
     | 
    
         
            +
                  return warn(_('wizard.no_changes')) unless confirm_action?(_('wizard.role.confirm_deletion'))
         
     | 
| 
       38 
32 
     | 
    
         
             
                  # Role deletion
         
     | 
| 
       39 
33 
     | 
    
         
             
                  role = Bebox::Role.new(role_name, project_root)
         
     | 
| 
       40 
34 
     | 
    
         
             
                  output = role.remove
         
     | 
| 
       41 
     | 
    
         
            -
                  ok ' 
     | 
| 
      
 35 
     | 
    
         
            +
                  ok _('wizard.role.deletion_success')
         
     | 
| 
       42 
36 
     | 
    
         
             
                  return output
         
     | 
| 
       43 
37 
     | 
    
         
             
                end
         
     | 
| 
       44 
38 
     | 
    
         | 
| 
         @@ -46,14 +40,14 @@ module Bebox 
     | 
|
| 
       46 
40 
     | 
    
         
             
                def add_profile(project_root)
         
     | 
| 
       47 
41 
     | 
    
         
             
                  roles = Bebox::Role.list(project_root)
         
     | 
| 
       48 
42 
     | 
    
         
             
                  profiles = Bebox::Profile.list(project_root)
         
     | 
| 
       49 
     | 
    
         
            -
                  role = choose_option(roles, ' 
     | 
| 
       50 
     | 
    
         
            -
                  profile = choose_option(profiles, ' 
     | 
| 
      
 43 
     | 
    
         
            +
                  role = choose_option(roles, _('wizard.choose_role'))
         
     | 
| 
      
 44 
     | 
    
         
            +
                  profile = choose_option(profiles, _('wizard.role.choose_add_profile'))
         
     | 
| 
       51 
45 
     | 
    
         
             
                  if Bebox::Role.profile_in_role?(project_root, role, profile)
         
     | 
| 
       52 
     | 
    
         
            -
                    warn  
     | 
| 
      
 46 
     | 
    
         
            +
                    warn _('wizard.role.profile_exist')%{profile: profile, role: role}
         
     | 
| 
       53 
47 
     | 
    
         
             
                    output = false
         
     | 
| 
       54 
48 
     | 
    
         
             
                  else
         
     | 
| 
       55 
49 
     | 
    
         
             
                    output = Bebox::Role.add_profile(project_root, role, profile)
         
     | 
| 
       56 
     | 
    
         
            -
                    ok  
     | 
| 
      
 50 
     | 
    
         
            +
                    ok _('wizard.role.add_profile_success')%{profile: profile, role: role}
         
     | 
| 
       57 
51 
     | 
    
         
             
                  end
         
     | 
| 
       58 
52 
     | 
    
         
             
                  return output
         
     | 
| 
       59 
53 
     | 
    
         
             
                end
         
     | 
| 
         @@ -62,13 +56,13 @@ module Bebox 
     | 
|
| 
       62 
56 
     | 
    
         
             
                def remove_profile(project_root)
         
     | 
| 
       63 
57 
     | 
    
         
             
                  roles = Bebox::Role.list(project_root)
         
     | 
| 
       64 
58 
     | 
    
         
             
                  profiles = Bebox::Profile.list(project_root)
         
     | 
| 
       65 
     | 
    
         
            -
                  role = choose_option(roles, ' 
     | 
| 
       66 
     | 
    
         
            -
                  profile = choose_option(profiles, ' 
     | 
| 
      
 59 
     | 
    
         
            +
                  role = choose_option(roles, _('wizard.choose_role'))
         
     | 
| 
      
 60 
     | 
    
         
            +
                  profile = choose_option(profiles, _('wizard.choose_remove_profile'))
         
     | 
| 
       67 
61 
     | 
    
         
             
                  if Bebox::Role.profile_in_role?(project_root, role, profile)
         
     | 
| 
       68 
62 
     | 
    
         
             
                    output = Bebox::Role.remove_profile(project_root, role, profile)
         
     | 
| 
       69 
     | 
    
         
            -
                    ok  
     | 
| 
      
 63 
     | 
    
         
            +
                    ok _('wizard.role.remove_profile_success')%{profile: profile, role: role}
         
     | 
| 
       70 
64 
     | 
    
         
             
                  else
         
     | 
| 
       71 
     | 
    
         
            -
                    warn  
     | 
| 
      
 65 
     | 
    
         
            +
                    warn _('wizard.role.profile_not_exist')%{profile: profile, role: role}
         
     | 
| 
       72 
66 
     | 
    
         
             
                    output = false
         
     | 
| 
       73 
67 
     | 
    
         
             
                  end
         
     | 
| 
       74 
68 
     | 
    
         
             
                  return output
         
     | 
    
        data/lib/i18n/en.yml
    ADDED
    
    | 
         @@ -0,0 +1,198 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            en:
         
     | 
| 
      
 2 
     | 
    
         
            +
              cli:
         
     | 
| 
      
 3 
     | 
    
         
            +
                desc:                               'Create basic provisioning of remote servers.'
         
     | 
| 
      
 4 
     | 
    
         
            +
                current_environment:                "Environment: %{environment}"
         
     | 
| 
      
 5 
     | 
    
         
            +
                choose_environment:                 'Choose an existing environment:'
         
     | 
| 
      
 6 
     | 
    
         
            +
                not_exist_environment:              "The '%{environment}' environment does not exist."
         
     | 
| 
      
 7 
     | 
    
         
            +
                project:
         
     | 
| 
      
 8 
     | 
    
         
            +
                  new:
         
     | 
| 
      
 9 
     | 
    
         
            +
                    desc:                           'Create a new bebox project through a simple wizard.'
         
     | 
| 
      
 10 
     | 
    
         
            +
                    name_arg_missing:               'You did not supply a project name.'
         
     | 
| 
      
 11 
     | 
    
         
            +
                environment:
         
     | 
| 
      
 12 
     | 
    
         
            +
                  desc:                             "Manage environments for the project. The 'vagrant', 'production' and 'staging' environments are present by default."
         
     | 
| 
      
 13 
     | 
    
         
            +
                  name_arg_missing:                 'You did not supply an environment'
         
     | 
| 
      
 14 
     | 
    
         
            +
                  new:
         
     | 
| 
      
 15 
     | 
    
         
            +
                    desc:                           'Add a remote environment to the project'
         
     | 
| 
      
 16 
     | 
    
         
            +
                  remove:
         
     | 
| 
      
 17 
     | 
    
         
            +
                    desc:                           'Remove a remote environment in the project'
         
     | 
| 
      
 18 
     | 
    
         
            +
                  list:
         
     | 
| 
      
 19 
     | 
    
         
            +
                    desc:                           'List the remote environments in the project'
         
     | 
| 
      
 20 
     | 
    
         
            +
                    current_envs:                   'Current environments:'
         
     | 
| 
      
 21 
     | 
    
         
            +
                    no_envs:                        "There are not environments yet. You can create a new one with: 'bebox environment new' command."
         
     | 
| 
      
 22 
     | 
    
         
            +
                node:
         
     | 
| 
      
 23 
     | 
    
         
            +
                  desc:                             'Manage nodes for a environment in the project.'
         
     | 
| 
      
 24 
     | 
    
         
            +
                  new:
         
     | 
| 
      
 25 
     | 
    
         
            +
                    desc:                           'Add a node to a environment'
         
     | 
| 
      
 26 
     | 
    
         
            +
                  remove:
         
     | 
| 
      
 27 
     | 
    
         
            +
                    desc:                           'Remove a node in a environment'
         
     | 
| 
      
 28 
     | 
    
         
            +
                  set_role:
         
     | 
| 
      
 29 
     | 
    
         
            +
                    desc:                           'Associate a node with a role in a environment'
         
     | 
| 
      
 30 
     | 
    
         
            +
                  list:
         
     | 
| 
      
 31 
     | 
    
         
            +
                    env_flag_desc:                  'Set the environment for nodes'
         
     | 
| 
      
 32 
     | 
    
         
            +
                    desc:                           'list the nodes in a environment'
         
     | 
| 
      
 33 
     | 
    
         
            +
                    env_nodes_title:                "Nodes for '%{environment}' environment:"
         
     | 
| 
      
 34 
     | 
    
         
            +
                    no_nodes:                       "There are not nodes yet in the environment. You can create a new one with: 'bebox node new' command."
         
     | 
| 
      
 35 
     | 
    
         
            +
                role:
         
     | 
| 
      
 36 
     | 
    
         
            +
                  desc:                             'Manage roles for the node provisioning phase.'
         
     | 
| 
      
 37 
     | 
    
         
            +
                  new:
         
     | 
| 
      
 38 
     | 
    
         
            +
                    desc:                           'Add a role to the project'
         
     | 
| 
      
 39 
     | 
    
         
            +
                    name_arg_missing:               'You did not supply a name'
         
     | 
| 
      
 40 
     | 
    
         
            +
                  remove:
         
     | 
| 
      
 41 
     | 
    
         
            +
                    desc:                           'Remove a role from the project'
         
     | 
| 
      
 42 
     | 
    
         
            +
                  list:
         
     | 
| 
      
 43 
     | 
    
         
            +
                    desc:                           'List the roles in the project'
         
     | 
| 
      
 44 
     | 
    
         
            +
                    current_roles:                  'Current roles:'
         
     | 
| 
      
 45 
     | 
    
         
            +
                    no_roles:                       "There are not roles yet. You can create a new one with: 'bebox role new' command."
         
     | 
| 
      
 46 
     | 
    
         
            +
                  add_profile:
         
     | 
| 
      
 47 
     | 
    
         
            +
                    desc:                           'Add a profile to a role'
         
     | 
| 
      
 48 
     | 
    
         
            +
                  remove_profile:
         
     | 
| 
      
 49 
     | 
    
         
            +
                    desc:                           'Remove a profile from a role'
         
     | 
| 
      
 50 
     | 
    
         
            +
                  list_profiles:
         
     | 
| 
      
 51 
     | 
    
         
            +
                    desc:                           'List the profiles in a role'
         
     | 
| 
      
 52 
     | 
    
         
            +
                    name_arg_missing:               'You did not supply a role name.'
         
     | 
| 
      
 53 
     | 
    
         
            +
                    name_not_exist:                 "The '%{role}' role does not exist."
         
     | 
| 
      
 54 
     | 
    
         
            +
                    current_profiles:               "Current profiles in '%{role}' role:"
         
     | 
| 
      
 55 
     | 
    
         
            +
                    no_profiles:                    "There are not profiles in role '%{role}'. You can add a new one with: 'bebox role add_profile' command."
         
     | 
| 
      
 56 
     | 
    
         
            +
                profile:
         
     | 
| 
      
 57 
     | 
    
         
            +
                  desc:                             'Manage profiles for the node provisioning phase.'
         
     | 
| 
      
 58 
     | 
    
         
            +
                  new:
         
     | 
| 
      
 59 
     | 
    
         
            +
                    desc:                           'Add a profile to the project'
         
     | 
| 
      
 60 
     | 
    
         
            +
                    path_flag_desc:                 'A relative path of the category folders tree to store the profile. Ex. basic/security/iptables'
         
     | 
| 
      
 61 
     | 
    
         
            +
                    name_arg_missing:               'You did not supply a name'
         
     | 
| 
      
 62 
     | 
    
         
            +
                  remove:
         
     | 
| 
      
 63 
     | 
    
         
            +
                    desc:                           'Remove a profile from the project'
         
     | 
| 
      
 64 
     | 
    
         
            +
                  list:
         
     | 
| 
      
 65 
     | 
    
         
            +
                    desc:                           'List the profiles in the project'
         
     | 
| 
      
 66 
     | 
    
         
            +
                    current_profiles:               'Current profiles:'
         
     | 
| 
      
 67 
     | 
    
         
            +
                    no_profiles:                    "There are not profiles yet. You can create a new one with: 'bebox profile new' command."
         
     | 
| 
      
 68 
     | 
    
         
            +
                prepare:
         
     | 
| 
      
 69 
     | 
    
         
            +
                  desc:                             'Prepare the nodes for the environment.'
         
     | 
| 
      
 70 
     | 
    
         
            +
                  env_flag_desc:                    'Set the environment of node'
         
     | 
| 
      
 71 
     | 
    
         
            +
                  not_vagrant:                      'Vagrant is not installed in the system. No changes were made.'
         
     | 
| 
      
 72 
     | 
    
         
            +
                  vagrant_halt:
         
     | 
| 
      
 73 
     | 
    
         
            +
                    desc:                           'Halt the nodes for vagrant environment.'
         
     | 
| 
      
 74 
     | 
    
         
            +
                    halt_title:                     'Halting nodes:'
         
     | 
| 
      
 75 
     | 
    
         
            +
                  vagrant_up:
         
     | 
| 
      
 76 
     | 
    
         
            +
                    desc:                           'Up the nodes for vagrant environment.'
         
     | 
| 
      
 77 
     | 
    
         
            +
                    up_title:                       'Running up nodes:'
         
     | 
| 
      
 78 
     | 
    
         
            +
                provision:
         
     | 
| 
      
 79 
     | 
    
         
            +
                  desc:                             'Apply the Puppet step for the nodes in a environment. (step-0: Fundamental, step-1: User layer, step-2: Service layer, step-3: Security layer)'
         
     | 
| 
      
 80 
     | 
    
         
            +
                  all_switch_desc:                  'Apply all steps in sequence.'
         
     | 
| 
      
 81 
     | 
    
         
            +
                  env_flag_desc:                    'Set the environment of nodes'
         
     | 
| 
      
 82 
     | 
    
         
            +
                  title:                            'Provisioning all steps...'
         
     | 
| 
      
 83 
     | 
    
         
            +
                  name_missing:                     'You did not specify an step'
         
     | 
| 
      
 84 
     | 
    
         
            +
                  name_invalid:                     'You did not specify a valid step'
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
              wizard:
         
     | 
| 
      
 87 
     | 
    
         
            +
                no_changes:                         'No changes were made.'
         
     | 
| 
      
 88 
     | 
    
         
            +
                choose_node:                        'Choose an existing node:'
         
     | 
| 
      
 89 
     | 
    
         
            +
                choose_role:                        'Choose an existing role:'
         
     | 
| 
      
 90 
     | 
    
         
            +
                choose_remove_profile:              'Choose the profile to remove:'
         
     | 
| 
      
 91 
     | 
    
         
            +
                project:
         
     | 
| 
      
 92 
     | 
    
         
            +
                  name_exist:                       'Project not created. There is already a project with that name in the current directory.'
         
     | 
| 
      
 93 
     | 
    
         
            +
                  choose_box_provider:              'Choose the vagrant box provider'
         
     | 
| 
      
 94 
     | 
    
         
            +
                  creation_success:                 |
         
     | 
| 
      
 95 
     | 
    
         
            +
                                                    Project '%{project_name}' created!.
         
     | 
| 
      
 96 
     | 
    
         
            +
                                                    Make: cd %{project_name}
         
     | 
| 
      
 97 
     | 
    
         
            +
                                                    Now you can add new environments or new nodes to your project.
         
     | 
| 
      
 98 
     | 
    
         
            +
                                                    See bebox help.
         
     | 
| 
      
 99 
     | 
    
         
            +
                  box_exist:                        'There is already a box with that name, do you want to overwrite it?'
         
     | 
| 
      
 100 
     | 
    
         
            +
                  ask_box_uri:                      'Write the URI (http, local_path) for the vagrant box to be used in the project:'
         
     | 
| 
      
 101 
     | 
    
         
            +
                  default_http_box:                 'http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box'
         
     | 
| 
      
 102 
     | 
    
         
            +
                  downloading_box:                  'Downloading box ...'
         
     | 
| 
      
 103 
     | 
    
         
            +
                  no_redirections:                  'Redirections not supported.'
         
     | 
| 
      
 104 
     | 
    
         
            +
                  not_valid_link:                   'Download link not valid!.'
         
     | 
| 
      
 105 
     | 
    
         
            +
                  not_exist_file:                   'File path not exist!.'
         
     | 
| 
      
 106 
     | 
    
         
            +
                  download_select_box:              'Download/Select a new box'
         
     | 
| 
      
 107 
     | 
    
         
            +
                  choose_box:                       'Choose an existing box or download/select a new box'
         
     | 
| 
      
 108 
     | 
    
         
            +
                environment:
         
     | 
| 
      
 109 
     | 
    
         
            +
                  name_exist:                       "The '%{environment}' environment already exist!."
         
     | 
| 
      
 110 
     | 
    
         
            +
                  creation_success:                 'Environment created!.'
         
     | 
| 
      
 111 
     | 
    
         
            +
                  name_not_exist:                   "The '%{environment}' environment do not exist!."
         
     | 
| 
      
 112 
     | 
    
         
            +
                  confirm_deletion:                 'Are you sure that want to delete the environment?'
         
     | 
| 
      
 113 
     | 
    
         
            +
                  deletion_success:                 'Environment removed!.'
         
     | 
| 
      
 114 
     | 
    
         
            +
                node:
         
     | 
| 
      
 115 
     | 
    
         
            +
                  creation_success:                 'Node created!.'
         
     | 
| 
      
 116 
     | 
    
         
            +
                  choose_node:                      'Choose the node to remove:'
         
     | 
| 
      
 117 
     | 
    
         
            +
                  no_nodes:                         "There are no nodes in the '%{environment}' environment to remove. No changes were made."
         
     | 
| 
      
 118 
     | 
    
         
            +
                  confirm_deletion:                 'Are you sure that you want to delete the node?'
         
     | 
| 
      
 119 
     | 
    
         
            +
                  deletion_success:                 'Node removed!.'
         
     | 
| 
      
 120 
     | 
    
         
            +
                  role_set_success:                 'Role associated to node!.'
         
     | 
| 
      
 121 
     | 
    
         
            +
                  prepare_title:                    'Preparing nodes:'
         
     | 
| 
      
 122 
     | 
    
         
            +
                  preparation_success:              'Node prepared!.'
         
     | 
| 
      
 123 
     | 
    
         
            +
                  no_prepare_nodes:                 'There are no nodes to prepare. No changes were made.'
         
     | 
| 
      
 124 
     | 
    
         
            +
                  confirm_preparation:              |
         
     | 
| 
      
 125 
     | 
    
         
            +
                                                    The node '%{hostname}' was already prepared (start: %{start} - end: %{end}).
         
     | 
| 
      
 126 
     | 
    
         
            +
                                                    Do you want to re-prepare it?
         
     | 
| 
      
 127 
     | 
    
         
            +
                  hostname_exist:                   'A hostname with that name already exist. Try a new one.'
         
     | 
| 
      
 128 
     | 
    
         
            +
                  ask_hostname:                     'Write the hostname for the node:'
         
     | 
| 
      
 129 
     | 
    
         
            +
                  valid_hostname:                   'Enter valid hostname. Ex. host.server1.com'
         
     | 
| 
      
 130 
     | 
    
         
            +
                  ask_ip:                           'Write the IP address for the node:'
         
     | 
| 
      
 131 
     | 
    
         
            +
                  valid_ip:                         'Enter a valid IP address. Ex. 192.168.0.50'
         
     | 
| 
      
 132 
     | 
    
         
            +
                  non_free_ip:                      'The IP address is not free. Try a new one.'
         
     | 
| 
      
 133 
     | 
    
         
            +
                role:
         
     | 
| 
      
 134 
     | 
    
         
            +
                  invalid_name:                     |
         
     | 
| 
      
 135 
     | 
    
         
            +
                                                    The role name can only contain:
         
     | 
| 
      
 136 
     | 
    
         
            +
                                                    * Lowercase letters
         
     | 
| 
      
 137 
     | 
    
         
            +
                                                    * Numbers
         
     | 
| 
      
 138 
     | 
    
         
            +
                                                    * Underscores
         
     | 
| 
      
 139 
     | 
    
         
            +
                                                    * Must begin with an Lowercase letter
         
     | 
| 
      
 140 
     | 
    
         
            +
                                                    * Can not be any of: %{words}
         
     | 
| 
      
 141 
     | 
    
         
            +
                                                    No changes were made.
         
     | 
| 
      
 142 
     | 
    
         
            +
                  name_exist:                       "The '%{role}' role already exist. No changes were made."
         
     | 
| 
      
 143 
     | 
    
         
            +
                  creation_success:                 'Role created!.'
         
     | 
| 
      
 144 
     | 
    
         
            +
                  choose_deletion_role:             'Choose the role to remove:'
         
     | 
| 
      
 145 
     | 
    
         
            +
                  no_deletion_roles:                'There are no roles to remove. No changes were made.'
         
     | 
| 
      
 146 
     | 
    
         
            +
                  confirm_deletion:                 'Are you sure that you want to delete the role?'
         
     | 
| 
      
 147 
     | 
    
         
            +
                  deletion_success:                 'Role removed!.'
         
     | 
| 
      
 148 
     | 
    
         
            +
                  choose_add_profile:               'Choose the profile to add:'
         
     | 
| 
      
 149 
     | 
    
         
            +
                  profile_exist:                    "Profile '%{profile}' already in the Role '%{role}'. No changes were made."
         
     | 
| 
      
 150 
     | 
    
         
            +
                  add_profile_success:              "Profile '%{profile}' added to Role '%{role}'."
         
     | 
| 
      
 151 
     | 
    
         
            +
                  remove_profile_success:           "Profile '%{profile}' removed from Role '%{role}'."
         
     | 
| 
      
 152 
     | 
    
         
            +
                  profile_not_exist:                "Profile '%{profile}' is not in the Role '%{role}'. No changes were made."
         
     | 
| 
      
 153 
     | 
    
         
            +
                profile:
         
     | 
| 
      
 154 
     | 
    
         
            +
                  invalid_name:                     |
         
     | 
| 
      
 155 
     | 
    
         
            +
                                                    The profile name can only contain:
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
                                                    * Lowercase letters
         
     | 
| 
      
 158 
     | 
    
         
            +
                                                    * Numbers
         
     | 
| 
      
 159 
     | 
    
         
            +
                                                    * Underscores
         
     | 
| 
      
 160 
     | 
    
         
            +
                                                    * Must begin with an Lowercase letter
         
     | 
| 
      
 161 
     | 
    
         
            +
                                                    * Can not be any of: %{words}
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
      
 163 
     | 
    
         
            +
                                                    No changes were made.
         
     | 
| 
      
 164 
     | 
    
         
            +
                  invalid_path:                     |
         
     | 
| 
      
 165 
     | 
    
         
            +
                                                    Each part of the path can only contain:
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
                                                    * Lowercase letters
         
     | 
| 
      
 168 
     | 
    
         
            +
                                                    * Numbers
         
     | 
| 
      
 169 
     | 
    
         
            +
                                                    * Underscores
         
     | 
| 
      
 170 
     | 
    
         
            +
                                                    * Must begin with an Lowercase letter
         
     | 
| 
      
 171 
     | 
    
         
            +
                                                    * Can not be any of: %{words}
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
                                                    No changes were made.
         
     | 
| 
      
 174 
     | 
    
         
            +
                  name_exist:                       "The profile '%{profile}' already exist. No changes were made."
         
     | 
| 
      
 175 
     | 
    
         
            +
                  creation_success:                 "Profile '%{profile}' created!."
         
     | 
| 
      
 176 
     | 
    
         
            +
                  no_deletion_profiles:             'There are no profiles to remove. No changes were made.'
         
     | 
| 
      
 177 
     | 
    
         
            +
                  confirm_deletion:                 'Are you sure that you want to delete the profile?'
         
     | 
| 
      
 178 
     | 
    
         
            +
                  deletion_success:                 'Profile removed!.'
         
     | 
| 
      
 179 
     | 
    
         
            +
                provision:
         
     | 
| 
      
 180 
     | 
    
         
            +
                  ssh_key_advice:                   "Please add a ssh key pair (id_rsa, id_rsa.pub) in config/keys/environments/%{environment} to do this step."
         
     | 
| 
      
 181 
     | 
    
         
            +
                  no_provision_nodes:               "There are no nodes for provision in %{step}. No changes were made."
         
     | 
| 
      
 182 
     | 
    
         
            +
                  title:                            "Provisioning %{step} in node %{hostname}:"
         
     | 
| 
      
 183 
     | 
    
         
            +
                  apply_success:                    "Node '%{hostname}' provisioned to %{step}."
         
     | 
| 
      
 184 
     | 
    
         
            +
                  apply_failure:                    "An error ocurred in the provision of %{step} for node '%{hostname}'"
         
     | 
| 
      
 185 
     | 
    
         
            +
                  confirm_reprovision:              |
         
     | 
| 
      
 186 
     | 
    
         
            +
                                                    The node '%{hostname}' was already provisioned in %{step} (start: %{start} - end: %{end}).
         
     | 
| 
      
 187 
     | 
    
         
            +
                                                    Do you want to re-provision it?
         
     | 
| 
      
 188 
     | 
    
         
            +
                  nodes_title:                      "Nodes for provisioning %{step}:"
         
     | 
| 
      
 189 
     | 
    
         
            +
             
     | 
| 
      
 190 
     | 
    
         
            +
              model:
         
     | 
| 
      
 191 
     | 
    
         
            +
                project:
         
     | 
| 
      
 192 
     | 
    
         
            +
                  bundle:                           'Bundle project ...'
         
     | 
| 
      
 193 
     | 
    
         
            +
                vagrant_helper:
         
     | 
| 
      
 194 
     | 
    
         
            +
                  local_password_advice:            'Please provide your local password, if asked, to configure the local hosts file.'
         
     | 
| 
      
 195 
     | 
    
         
            +
                  add_to_vagrant:                   "Adding server to vagrant: %{node}"
         
     | 
| 
      
 196 
     | 
    
         
            +
                  network_interface_advice:         'Please enter the network interface number if asked, and wait until the machine is up.'
         
     | 
| 
      
 197 
     | 
    
         
            +
                  nodes_halted:                     'Vagrant nodes halted!'
         
     | 
| 
      
 198 
     | 
    
         
            +
                  nodes_running:                    'Vagrant nodes running up!'
         
     | 
    
        data/spec/cli_spec.rb
    CHANGED
    
    | 
         @@ -1,4 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'tilt'
         
     | 
| 
       2 
3 
     | 
    
         
             
            require_relative 'factories/environment.rb'
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative 'factories/node.rb'
         
     | 
| 
       4 
5 
     | 
    
         
             
            require_relative 'factories/profile.rb'
         
     | 
| 
         @@ -6,10 +7,14 @@ require_relative 'factories/role.rb' 
     | 
|
| 
       6 
7 
     | 
    
         | 
| 
       7 
8 
     | 
    
         
             
            describe 'Test 00: Bebox::Cli' do
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
      
 10 
     | 
    
         
            +
              include FastGettext::Translation
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
       9 
12 
     | 
    
         
             
              let(:environment) { build(:environment) }
         
     | 
| 
       10 
13 
     | 
    
         
             
              let(:node) { build(:node) }
         
     | 
| 
       11 
14 
     | 
    
         
             
              let(:profile) { build(:profile) }
         
     | 
| 
       12 
15 
     | 
    
         
             
              let(:role) { build(:role) }
         
     | 
| 
      
 16 
     | 
    
         
            +
              let(:version) { Bebox::VERSION }
         
     | 
| 
      
 17 
     | 
    
         
            +
              let(:program_desc) { _('cli.desc') }
         
     | 
| 
       13 
18 
     | 
    
         | 
| 
       14 
19 
     | 
    
         
             
              before :each do
         
     | 
| 
       15 
20 
     | 
    
         
             
                $stderr.stub(:write)
         
     | 
| 
         @@ -18,7 +23,9 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       18 
23 
     | 
    
         
             
              it 'shows the help for general commands' do
         
     | 
| 
       19 
24 
     | 
    
         
             
                argv = []
         
     | 
| 
       20 
25 
     | 
    
         
             
                output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       21 
     | 
    
         
            -
                 
     | 
| 
      
 26 
     | 
    
         
            +
                new_desc = _('cli.project.new.desc')
         
     | 
| 
      
 27 
     | 
    
         
            +
                command_output_template = Tilt::ERBTemplate.new('spec/fixtures/commands/general_help.erb.test')
         
     | 
| 
      
 28 
     | 
    
         
            +
                expected_content = command_output_template.render(nil, version: version, program_desc: program_desc, new_desc: new_desc).gsub(/\s+/, ' ').strip
         
     | 
| 
       22 
29 
     | 
    
         
             
                expect(output.gsub(/\s+/, ' ').strip).to eq(expected_content)
         
     | 
| 
       23 
30 
     | 
    
         
             
              end
         
     | 
| 
       24 
31 
     | 
    
         | 
| 
         @@ -26,7 +33,7 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       26 
33 
     | 
    
         
             
                it 'shows error for new without project name' do
         
     | 
| 
       27 
34 
     | 
    
         
             
                  argv = ['new']
         
     | 
| 
       28 
35 
     | 
    
         
             
                  output = capture(:stdout) { cli_command(argv, :failure) }
         
     | 
| 
       29 
     | 
    
         
            -
                  expect(output).to match( 
     | 
| 
      
 36 
     | 
    
         
            +
                  expect(output).to match(/#{_('cli.project.new.name_arg_missing')}/)
         
     | 
| 
       30 
37 
     | 
    
         
             
                end
         
     | 
| 
       31 
38 
     | 
    
         | 
| 
       32 
39 
     | 
    
         
             
                it 'executes new project command' do
         
     | 
| 
         @@ -44,9 +51,13 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       44 
51 
     | 
    
         
             
                end
         
     | 
| 
       45 
52 
     | 
    
         | 
| 
       46 
53 
     | 
    
         
             
                it 'shows the help for project commands' do
         
     | 
| 
      
 54 
     | 
    
         
            +
                  Bebox::Environment.stub(:list) {['a', 'b', 'c']}
         
     | 
| 
       47 
55 
     | 
    
         
             
                  argv = []
         
     | 
| 
       48 
56 
     | 
    
         
             
                  output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       49 
     | 
    
         
            -
                   
     | 
| 
      
 57 
     | 
    
         
            +
                  env_desc = _('cli.environment.desc')
         
     | 
| 
      
 58 
     | 
    
         
            +
                  node_desc = _('cli.node.desc')
         
     | 
| 
      
 59 
     | 
    
         
            +
                  command_output_template = Tilt::ERBTemplate.new('spec/fixtures/commands/in_project_help.erb.test')
         
     | 
| 
      
 60 
     | 
    
         
            +
                  expected_content = command_output_template.render(nil, version: version, program_desc: program_desc, env_desc: env_desc, node_desc: node_desc).gsub(/\s+/, ' ').strip
         
     | 
| 
       50 
61 
     | 
    
         
             
                  expect(output.gsub(/\s+/, ' ').strip).to eq(expected_content)
         
     | 
| 
       51 
62 
     | 
    
         
             
                end
         
     | 
| 
       52 
63 
     | 
    
         | 
| 
         @@ -55,7 +66,12 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       55 
66 
     | 
    
         
             
                  it 'shows the help for environment commands' do
         
     | 
| 
       56 
67 
     | 
    
         
             
                    argv = ['help', 'environment']
         
     | 
| 
       57 
68 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       58 
     | 
    
         
            -
                     
     | 
| 
      
 69 
     | 
    
         
            +
                    env_desc = _('cli.environment.desc')
         
     | 
| 
      
 70 
     | 
    
         
            +
                    list_desc = _('cli.environment.list.desc')
         
     | 
| 
      
 71 
     | 
    
         
            +
                    new_desc = _('cli.environment.new.desc')
         
     | 
| 
      
 72 
     | 
    
         
            +
                    remove_desc = _('cli.environment.remove.desc')
         
     | 
| 
      
 73 
     | 
    
         
            +
                    command_output_template = Tilt::ERBTemplate.new('spec/fixtures/commands/environment_help.erb.test')
         
     | 
| 
      
 74 
     | 
    
         
            +
                    expected_content = command_output_template.render(nil, env_desc: env_desc, new_desc: new_desc, list_desc: list_desc, remove_desc: remove_desc).gsub(/\s+/, ' ').strip
         
     | 
| 
       59 
75 
     | 
    
         
             
                    expect(output.gsub(/\s+/, ' ').strip).to eq(expected_content)
         
     | 
| 
       60 
76 
     | 
    
         
             
                  end
         
     | 
| 
       61 
77 
     | 
    
         | 
| 
         @@ -63,21 +79,21 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       63 
79 
     | 
    
         
             
                    Bebox::Environment.stub(:list) { [environment.name] }
         
     | 
| 
       64 
80 
     | 
    
         
             
                    argv = ['environment', 'list']
         
     | 
| 
       65 
81 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       66 
     | 
    
         
            -
                    expect(output).to match( 
     | 
| 
      
 82 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.environment.list.current_envs')}.*?#{environment.name}/im)
         
     | 
| 
       67 
83 
     | 
    
         
             
                  end
         
     | 
| 
       68 
84 
     | 
    
         | 
| 
       69 
85 
     | 
    
         
             
                  it 'not list environments if there are not any' do
         
     | 
| 
       70 
86 
     | 
    
         
             
                    Bebox::Environment.stub(:list) { [] }
         
     | 
| 
       71 
87 
     | 
    
         
             
                    argv = ['environment', 'list']
         
     | 
| 
       72 
88 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       73 
     | 
    
         
            -
                    expect(output).to match( 
     | 
| 
      
 89 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.environment.list.current_envs')}.*?#{_('cli.environment.list.no_envs')}/im)
         
     | 
| 
       74 
90 
     | 
    
         
             
                  end
         
     | 
| 
       75 
91 
     | 
    
         | 
| 
       76 
92 
     | 
    
         
             
                  it 'fails to create a new environment without name' do
         
     | 
| 
       77 
93 
     | 
    
         
             
                    Bebox::EnvironmentWizard.any_instance.stub(:send) { true }
         
     | 
| 
       78 
94 
     | 
    
         
             
                    argv = ['environment', 'new']
         
     | 
| 
       79 
95 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :failure) }
         
     | 
| 
       80 
     | 
    
         
            -
                    expect(output).to match( 
     | 
| 
      
 96 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.environment.name_arg_missing')}/)
         
     | 
| 
       81 
97 
     | 
    
         
             
                  end
         
     | 
| 
       82 
98 
     | 
    
         | 
| 
       83 
99 
     | 
    
         
             
                  it 'creates a new environment with name' do
         
     | 
| 
         @@ -90,7 +106,7 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       90 
106 
     | 
    
         
             
                    Bebox::EnvironmentWizard.any_instance.stub(:send) { true }
         
     | 
| 
       91 
107 
     | 
    
         
             
                    argv = ['environment', 'remove']
         
     | 
| 
       92 
108 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :failure) }
         
     | 
| 
       93 
     | 
    
         
            -
                    expect(output).to match( 
     | 
| 
      
 109 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.environment.name_arg_missing')}/)
         
     | 
| 
       94 
110 
     | 
    
         
             
                  end
         
     | 
| 
       95 
111 
     | 
    
         | 
| 
       96 
112 
     | 
    
         
             
                  it 'removes an environment with name' do
         
     | 
| 
         @@ -109,7 +125,14 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       109 
125 
     | 
    
         
             
                  it 'shows the help for node commands' do
         
     | 
| 
       110 
126 
     | 
    
         
             
                    argv = ['help', 'node']
         
     | 
| 
       111 
127 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       112 
     | 
    
         
            -
                     
     | 
| 
      
 128 
     | 
    
         
            +
                    node_desc = _('cli.node.desc')
         
     | 
| 
      
 129 
     | 
    
         
            +
                    list_desc = _('cli.node.list.desc')
         
     | 
| 
      
 130 
     | 
    
         
            +
                    new_desc = _('cli.node.new.desc')
         
     | 
| 
      
 131 
     | 
    
         
            +
                    remove_desc = _('cli.node.remove.desc')
         
     | 
| 
      
 132 
     | 
    
         
            +
                    env_flag_desc = _('cli.node.list.env_flag_desc')
         
     | 
| 
      
 133 
     | 
    
         
            +
                    command_output_template = Tilt::ERBTemplate.new('spec/fixtures/commands/node_help.erb.test')
         
     | 
| 
      
 134 
     | 
    
         
            +
                    expected_content = command_output_template.render(nil, node_desc: node_desc, new_desc: new_desc,
         
     | 
| 
      
 135 
     | 
    
         
            +
                      list_desc: list_desc, remove_desc: remove_desc, env_flag_desc: env_flag_desc).gsub(/\s+/, ' ').strip
         
     | 
| 
       113 
136 
     | 
    
         
             
                    expect(output.gsub(/\s+/, ' ').strip).to eq(expected_content)
         
     | 
| 
       114 
137 
     | 
    
         
             
                  end
         
     | 
| 
       115 
138 
     | 
    
         | 
| 
         @@ -117,14 +140,14 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       117 
140 
     | 
    
         
             
                    Bebox::Node.stub(:list) { [node.hostname] }
         
     | 
| 
       118 
141 
     | 
    
         
             
                    argv = ['node', 'list']
         
     | 
| 
       119 
142 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       120 
     | 
    
         
            -
                    expect(output).to match( 
     | 
| 
      
 143 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.node.list.env_nodes_title')%{environment: node.environment}}.*?#{node.hostname}/m)
         
     | 
| 
       121 
144 
     | 
    
         
             
                  end
         
     | 
| 
       122 
145 
     | 
    
         | 
| 
       123 
146 
     | 
    
         
             
                  it 'not list nodes if there are not any' do
         
     | 
| 
       124 
147 
     | 
    
         
             
                    Bebox::Node.stub(:list) { [] }
         
     | 
| 
       125 
148 
     | 
    
         
             
                    argv = ['node', 'list']
         
     | 
| 
       126 
149 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       127 
     | 
    
         
            -
                    expect(output).to match( 
     | 
| 
      
 150 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.node.list.env_nodes_title')%{environment: node.environment}}.*?#{_('cli.node.list.no_nodes')}/m)
         
     | 
| 
       128 
151 
     | 
    
         
             
                  end
         
     | 
| 
       129 
152 
     | 
    
         | 
| 
       130 
153 
     | 
    
         
             
                  it 'sets a role for a node' do
         
     | 
| 
         @@ -161,7 +184,7 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       161 
184 
     | 
    
         
             
                    Bebox::CommandsHelper.stub(:vagrant_installed?) { false }
         
     | 
| 
       162 
185 
     | 
    
         
             
                    argv = ['prepare']
         
     | 
| 
       163 
186 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       164 
     | 
    
         
            -
                    expect(output).to match(/ 
     | 
| 
      
 187 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.prepare.not_vagrant')}/m)
         
     | 
| 
       165 
188 
     | 
    
         
             
                  end
         
     | 
| 
       166 
189 
     | 
    
         | 
| 
       167 
190 
     | 
    
         
             
                  it 'prepares a node' do
         
     | 
| 
         @@ -192,7 +215,13 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       192 
215 
     | 
    
         
             
                  it 'shows the help for profile commands' do
         
     | 
| 
       193 
216 
     | 
    
         
             
                    argv = ['help', 'profile']
         
     | 
| 
       194 
217 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       195 
     | 
    
         
            -
                     
     | 
| 
      
 218 
     | 
    
         
            +
                    profile_desc = _('cli.profile.desc')
         
     | 
| 
      
 219 
     | 
    
         
            +
                    list_desc = _('cli.profile.list.desc')
         
     | 
| 
      
 220 
     | 
    
         
            +
                    new_desc = _('cli.profile.new.desc')
         
     | 
| 
      
 221 
     | 
    
         
            +
                    remove_desc = _('cli.profile.remove.desc')
         
     | 
| 
      
 222 
     | 
    
         
            +
                    command_output_template = Tilt::ERBTemplate.new('spec/fixtures/commands/profile_help.erb.test')
         
     | 
| 
      
 223 
     | 
    
         
            +
                    expected_content = command_output_template.render(nil, profile_desc: profile_desc,
         
     | 
| 
      
 224 
     | 
    
         
            +
                      new_desc: new_desc, list_desc: list_desc, remove_desc: remove_desc).gsub(/\s+/, ' ').strip
         
     | 
| 
       196 
225 
     | 
    
         
             
                    expect(output.gsub(/\s+/, ' ').strip).to eq(expected_content)
         
     | 
| 
       197 
226 
     | 
    
         
             
                  end
         
     | 
| 
       198 
227 
     | 
    
         | 
| 
         @@ -200,20 +229,20 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       200 
229 
     | 
    
         
             
                    Bebox::ProfileWizard.any_instance.stub(:list_profiles) { [profile.name] }
         
     | 
| 
       201 
230 
     | 
    
         
             
                    argv = ['profile', 'list']
         
     | 
| 
       202 
231 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       203 
     | 
    
         
            -
                    expect(output).to match( 
     | 
| 
      
 232 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.profile.list.current_profiles')}.*?#{profile.name}/m)
         
     | 
| 
       204 
233 
     | 
    
         
             
                  end
         
     | 
| 
       205 
234 
     | 
    
         | 
| 
       206 
235 
     | 
    
         
             
                  it 'not list profiles if there are not any' do
         
     | 
| 
       207 
236 
     | 
    
         
             
                    Bebox::ProfileWizard.any_instance.stub(:list_profiles) { [] }
         
     | 
| 
       208 
237 
     | 
    
         
             
                    argv = ['profile', 'list']
         
     | 
| 
       209 
238 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       210 
     | 
    
         
            -
                    expect(output).to match( 
     | 
| 
      
 239 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.profile.list.no_profiles')}/m)
         
     | 
| 
       211 
240 
     | 
    
         
             
                  end
         
     | 
| 
       212 
241 
     | 
    
         | 
| 
       213 
242 
     | 
    
         
             
                  it 'can not create a new profile without name' do
         
     | 
| 
       214 
243 
     | 
    
         
             
                    argv = ['profile', 'new']
         
     | 
| 
       215 
244 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :failure) }
         
     | 
| 
       216 
     | 
    
         
            -
                    expect(output).to match(/ 
     | 
| 
      
 245 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.profile.new.name_arg_missing')}/)
         
     | 
| 
       217 
246 
     | 
    
         
             
                  end
         
     | 
| 
       218 
247 
     | 
    
         | 
| 
       219 
248 
     | 
    
         
             
                  it 'creates a new profile with name' do
         
     | 
| 
         @@ -240,7 +269,17 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       240 
269 
     | 
    
         
             
                  it 'shows the help for role commands' do
         
     | 
| 
       241 
270 
     | 
    
         
             
                    argv = ['help', 'role']
         
     | 
| 
       242 
271 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       243 
     | 
    
         
            -
                     
     | 
| 
      
 272 
     | 
    
         
            +
                    role_desc = _('cli.role.desc')
         
     | 
| 
      
 273 
     | 
    
         
            +
                    list_desc = _('cli.role.list.desc')
         
     | 
| 
      
 274 
     | 
    
         
            +
                    new_desc = _('cli.role.new.desc')
         
     | 
| 
      
 275 
     | 
    
         
            +
                    remove_desc = _('cli.role.remove.desc')
         
     | 
| 
      
 276 
     | 
    
         
            +
                    add_profile_desc = _('cli.role.add_profile.desc')
         
     | 
| 
      
 277 
     | 
    
         
            +
                    remove_profile_desc = _('cli.role.remove_profile.desc')
         
     | 
| 
      
 278 
     | 
    
         
            +
                    list_profiles_desc = _('cli.role.list_profiles.desc')
         
     | 
| 
      
 279 
     | 
    
         
            +
                    command_output_template = Tilt::ERBTemplate.new('spec/fixtures/commands/role_help.erb.test')
         
     | 
| 
      
 280 
     | 
    
         
            +
                    expected_content = command_output_template.render(nil, role_desc: role_desc, new_desc: new_desc,
         
     | 
| 
      
 281 
     | 
    
         
            +
                      list_desc: list_desc, remove_desc: remove_desc, add_profile_desc: add_profile_desc,
         
     | 
| 
      
 282 
     | 
    
         
            +
                      remove_profile_desc: remove_profile_desc, list_profiles_desc: list_profiles_desc).gsub(/\s+/, ' ').strip
         
     | 
| 
       244 
283 
     | 
    
         
             
                    expect(output.gsub(/\s+/, ' ').strip).to eq(expected_content)
         
     | 
| 
       245 
284 
     | 
    
         
             
                  end
         
     | 
| 
       246 
285 
     | 
    
         | 
| 
         @@ -248,20 +287,20 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       248 
287 
     | 
    
         
             
                    Bebox::Role.stub(:list) { [role.name] }
         
     | 
| 
       249 
288 
     | 
    
         
             
                    argv = ['role', 'list']
         
     | 
| 
       250 
289 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       251 
     | 
    
         
            -
                    expect(output).to match( 
     | 
| 
      
 290 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.role.list.current_roles')}.*?#{role.name}/m)
         
     | 
| 
       252 
291 
     | 
    
         
             
                  end
         
     | 
| 
       253 
292 
     | 
    
         | 
| 
       254 
293 
     | 
    
         
             
                  it 'not list roles if there are not any' do
         
     | 
| 
       255 
294 
     | 
    
         
             
                    Bebox::Role.stub(:list) { [] }
         
     | 
| 
       256 
295 
     | 
    
         
             
                    argv = ['role', 'list']
         
     | 
| 
       257 
296 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       258 
     | 
    
         
            -
                    expect(output).to match( 
     | 
| 
      
 297 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.role.list.no_roles')}/m)
         
     | 
| 
       259 
298 
     | 
    
         
             
                  end
         
     | 
| 
       260 
299 
     | 
    
         | 
| 
       261 
300 
     | 
    
         
             
                  it 'can not create a new role without name' do
         
     | 
| 
       262 
301 
     | 
    
         
             
                    argv = ['role', 'new']
         
     | 
| 
       263 
302 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :failure) }
         
     | 
| 
       264 
     | 
    
         
            -
                    expect(output).to match(/ 
     | 
| 
      
 303 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.role.new.name_arg_missing')}/)
         
     | 
| 
       265 
304 
     | 
    
         
             
                  end
         
     | 
| 
       266 
305 
     | 
    
         | 
| 
       267 
306 
     | 
    
         
             
                  it 'creates a new role with name' do
         
     | 
| 
         @@ -279,14 +318,15 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       279 
318 
     | 
    
         
             
                  it 'can not list role profiles without a role name' do
         
     | 
| 
       280 
319 
     | 
    
         
             
                    argv = ['role', 'list_profiles']
         
     | 
| 
       281 
320 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :failure) }
         
     | 
| 
       282 
     | 
    
         
            -
                    expect(output).to match(/ 
     | 
| 
      
 321 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.role.list_profiles.name_arg_missing')}/m)
         
     | 
| 
       283 
322 
     | 
    
         
             
                  end
         
     | 
| 
       284 
323 
     | 
    
         | 
| 
       285 
324 
     | 
    
         
             
                  it 'can not list role profiles if role not exist' do
         
     | 
| 
      
 325 
     | 
    
         
            +
                    Bebox::Role.stub(:list_profiles) { [] }
         
     | 
| 
       286 
326 
     | 
    
         
             
                    Bebox::RoleWizard.any_instance.stub(:role_exists?) { false }
         
     | 
| 
       287 
327 
     | 
    
         
             
                    argv = ['role', 'list_profiles', role.name]
         
     | 
| 
       288 
328 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       289 
     | 
    
         
            -
                    expect(output).to match( 
     | 
| 
      
 329 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.role.list_profiles.name_not_exist')%{role: role.name}}/m)
         
     | 
| 
       290 
330 
     | 
    
         
             
                  end
         
     | 
| 
       291 
331 
     | 
    
         | 
| 
       292 
332 
     | 
    
         
             
                  it 'not list role profiles if there are not any' do
         
     | 
| 
         @@ -294,7 +334,7 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       294 
334 
     | 
    
         
             
                    Bebox::Role.stub(:list_profiles) { [] }
         
     | 
| 
       295 
335 
     | 
    
         
             
                    argv = ['role', 'list_profiles', role.name]
         
     | 
| 
       296 
336 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       297 
     | 
    
         
            -
                    expect(output).to match( 
     | 
| 
      
 337 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.role.list_profiles.no_profiles')%{role: role.name}}/m)
         
     | 
| 
       298 
338 
     | 
    
         
             
                  end
         
     | 
| 
       299 
339 
     | 
    
         | 
| 
       300 
340 
     | 
    
         
             
                  it 'list role profiles if there are any' do
         
     | 
| 
         @@ -302,7 +342,7 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       302 
342 
     | 
    
         
             
                    Bebox::Role.stub(:list_profiles) { [profile.name] }
         
     | 
| 
       303 
343 
     | 
    
         
             
                    argv = ['role', 'list_profiles', role.name]
         
     | 
| 
       304 
344 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :success) }
         
     | 
| 
       305 
     | 
    
         
            -
                    expect(output).to match( 
     | 
| 
      
 345 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.role.list_profiles.current_profiles')%{role: role.name}}.*?#{profile.name}/m)
         
     | 
| 
       306 
346 
     | 
    
         
             
                  end
         
     | 
| 
       307 
347 
     | 
    
         
             
                end
         
     | 
| 
       308 
348 
     | 
    
         | 
| 
         @@ -315,13 +355,13 @@ describe 'Test 00: Bebox::Cli' do 
     | 
|
| 
       315 
355 
     | 
    
         
             
                  it 'can not apply provision if the step is not supplied' do
         
     | 
| 
       316 
356 
     | 
    
         
             
                    argv = ['apply']
         
     | 
| 
       317 
357 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :failure) }
         
     | 
| 
       318 
     | 
    
         
            -
                    expect(output).to match(/ 
     | 
| 
      
 358 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.provision.name_missing')}/m)
         
     | 
| 
       319 
359 
     | 
    
         
             
                  end
         
     | 
| 
       320 
360 
     | 
    
         | 
| 
       321 
361 
     | 
    
         
             
                  it 'can not apply provision if the step is not valid' do
         
     | 
| 
       322 
362 
     | 
    
         
             
                    argv = ['apply', 'step']
         
     | 
| 
       323 
363 
     | 
    
         
             
                    output = capture(:stdout) { cli_command(argv, :failure) }
         
     | 
| 
       324 
     | 
    
         
            -
                    expect(output).to match(/ 
     | 
| 
      
 364 
     | 
    
         
            +
                    expect(output).to match(/#{_('cli.provision.name_invalid')}/m)
         
     | 
| 
       325 
365 
     | 
    
         
             
                  end
         
     | 
| 
       326 
366 
     | 
    
         | 
| 
       327 
367 
     | 
    
         
             
                  it 'applies provision if the step is valid' do
         
     |