Class: Gusteau::Bureau
Instance Method Summary collapse
- #generate!(init = true) ⇒ Object
-
#initialize(name) ⇒ Bureau
constructor
A new instance of Bureau.
Methods included from ERB
Constructor Details
#initialize(name) ⇒ Bureau
Returns a new instance of Bureau.
10 11 12 13 14 15 16 17 18 |
# File 'lib/gusteau/bureau.rb', line 10 def initialize(name) @name = name @template_path = File.('../../../template', __FILE__) @login = Etc.getlogin @ssh_key = File.read(File. '~/.ssh/id_rsa.pub').chomp rescue 'Your SSH key' abort "Directory #{name} already exists" if File.exists?(name) end |
Instance Method Details
#generate!(init = true) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/gusteau/bureau.rb', line 20 def generate!(init = true) FileUtils.cp_r(@template_path, @name) template '.gusteau.yml' template 'README.md' template 'spec/example-box/platform_spec.rb' template "data_bags/users/#{@login}.json", "data_bags/users/user.json.erb" Dir.chdir(@name) { exec "bash ./init.sh #{@name} ; rm ./init.sh" } if(init) end |