Class: Catfish::CLI::Init
- Inherits:
-
Object
- Object
- Catfish::CLI::Init
- Defined in:
- lib/catfish/cli/init.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#thor ⇒ Object
readonly
Returns the value of attribute thor.
Instance Method Summary collapse
-
#initialize(options, thor) ⇒ Init
constructor
A new instance of Init.
- #run ⇒ Object
Constructor Details
#initialize(options, thor) ⇒ Init
Returns a new instance of Init.
6 7 8 9 |
# File 'lib/catfish/cli/init.rb', line 6 def initialize(, thor) @options = @thor = thor end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/catfish/cli/init.rb', line 4 def @options end |
#thor ⇒ Object (readonly)
Returns the value of attribute thor.
4 5 6 |
# File 'lib/catfish/cli/init.rb', line 4 def thor @thor end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/catfish/cli/init.rb', line 11 def run p 'Initializing Catfish repository' templates = { 'Catfishfile.tt' => 'Catfishfile', 'Vagrantfile.tt' => 'Vagrantfile' } opts = { ssh_username: ['ssh-username'] || '{{YOUR_SSH_USERNAME}}', ssh_private_key_path: ['ssh-private-key-path'] || '{{PATH_TO_YOUR_SSH_PRIVATE_KEY}}', provisioners: [:provisioners] || [], shell_paths: ['shell-paths'] || ['{{PATH_TO_YOUR_SCRIPT}}'] } templates.each do |src, dst| thor.template(src, dst, opts) end p 'Repository initialized. Remember to:' p ' - Check your Vagrantfile and replace any placeholders' p ' - Edit your Catfish file and list target servers' p ' - Run catfish resolve' end |