Class: Subspace::Commands::Override
- Defined in:
- lib/subspace/commands/override.rb
Instance Method Summary collapse
-
#initialize(args, options) ⇒ Override
constructor
A new instance of Override.
- #run ⇒ Object
Methods inherited from Base
#confirm_overwrite, #copy, #dest_dir, #gem_path, #inventory, #pass_through_params, #playbook_dir, #project_name, #project_path, #require_configuration, #set_subspace_version, #template, #template!, #template_dir
Methods included from Ansible
#ansible_command, #ansible_playbook
Constructor Details
#initialize(args, options) ⇒ Override
Returns a new instance of Override.
3 4 5 6 |
# File 'lib/subspace/commands/override.rb', line 3 def initialize(args, ) @role = args.first run end |
Instance Method Details
#run ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/subspace/commands/override.rb', line 8 def run role_src = File.join gem_path, "ansible", "roles", @role if !File.exist? role_src say "Error, no such role #{@role}" exit end dest = File.join dest_dir, 'roles', @role if File.exist? dest say "Error, cowardly refusing to overwrite #{dest} - file exists" exit end FileUtils.cp_r role_src, dest end |