Class: Opsk::GenerateChef
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Opsk::GenerateChef
- Includes:
- Thorable, Thor::Actions
- Defined in:
- lib/opskeleton/generate_chef.rb
Instance Method Summary collapse
- #create_chef_base ⇒ Object
- #create_environment ⇒ Object
- #create_gemfile ⇒ Object
- #create_rakefile ⇒ Object
- #create_rvmrc ⇒ Object
- #create_vagrant_file ⇒ Object
- #create_version ⇒ Object
- #git ⇒ Object
- #path ⇒ Object
- #readme ⇒ Object
- #server_spec ⇒ Object
- #travis ⇒ Object
Methods included from Thorable
Instance Method Details
#create_chef_base ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/opskeleton/generate_chef.rb', line 44 def create_chef_base empty_directory("#{path}/static-cookbooks/") copy_file('templates/chef/Cheffile', "#{path}/Cheffile") empty_directory("#{path}/roles/") template('templates/chef/roles.erb', "#{path}/roles/#{name}.rb") template('templates/chef/dna.json.erb', "#{path}/dna.json") copy_file('templates/chef/run.sh', "#{path}/run.sh") copy_file('templates/chef/solo.rb', "#{path}/solo.rb") copy_file('templates/chef/boot.sh', "#{path}/boot.sh") chmod("#{path}/run.sh", 0755) chmod("#{path}/boot.sh", 0755) end |
#create_environment ⇒ Object
39 40 41 42 |
# File 'lib/opskeleton/generate_chef.rb', line 39 def create_environment empty_directory("#{path}/environments") copy_file('templates/chef/environments/dev.rb', "#{path}/environments/dev.rb") end |
#create_gemfile ⇒ Object
21 22 23 |
# File 'lib/opskeleton/generate_chef.rb', line 21 def create_gemfile copy_file('templates/chef/gemfile', "#{path}/Gemfile") end |
#create_rakefile ⇒ Object
25 26 27 |
# File 'lib/opskeleton/generate_chef.rb', line 25 def create_rakefile copy_file('templates/chef/Rakefile', "#{path}/Rakefile") end |
#create_rvmrc ⇒ Object
33 34 35 36 37 |
# File 'lib/opskeleton/generate_chef.rb', line 33 def create_rvmrc remove_file("#{path}/.rvmrc") template('templates/ruby-gemset.erb', "#{path}/.ruby-gemset") template('templates/ruby-version.erb', "#{path}/.ruby-version") end |
#create_vagrant_file ⇒ Object
16 17 18 19 |
# File 'lib/opskeleton/generate_chef.rb', line 16 def create_vagrant_file empty_directory(path) template('templates/chef/vagrant.erb', "#{path}/Vagrantfile") end |
#create_version ⇒ Object
29 30 31 |
# File 'lib/opskeleton/generate_chef.rb', line 29 def create_version template('templates/opsk.yml', "#{path}/opsk.yml") end |
#git ⇒ Object
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/opskeleton/generate_chef.rb', line 70 def git if(!File.exists?("#{path}/.git")) copy_file('templates/gitignore', "#{path}/.gitignore") inside(path) do run('git init .') run('git add -A') run("git commit -m 'initial sandbox import'") end end end |
#path ⇒ Object
12 13 14 |
# File 'lib/opskeleton/generate_chef.rb', line 12 def path "#{name}-sandbox" end |
#readme ⇒ Object
57 58 59 60 |
# File 'lib/opskeleton/generate_chef.rb', line 57 def readme template('templates/README.erb', "#{path}/README.md") copy_file('templates/LICENSE-2.0.txt',"#{path}/LICENSE-2.0.txt") end |
#server_spec ⇒ Object
66 67 68 |
# File 'lib/opskeleton/generate_chef.rb', line 66 def server_spec directory('templates/parent/spec', "#{path}/spec") end |
#travis ⇒ Object
62 63 64 |
# File 'lib/opskeleton/generate_chef.rb', line 62 def travis template('templates/parent/travis.erb', "#{path}/.travis.yml") end |