Class: Opsk::Generate
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Opsk::Generate
- Includes:
- Thorable, Thor::Actions
- Defined in:
- lib/opskeleton/generate.rb
Instance Method Summary collapse
- #create_gemfile ⇒ Object
- #create_heira ⇒ Object
- #create_puppet_base ⇒ 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_gemfile ⇒ Object
20 21 22 |
# File 'lib/opskeleton/generate.rb', line 20 def create_gemfile copy_file('templates/gemfile', "#{path}/Gemfile") end |
#create_heira ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/opskeleton/generate.rb', line 47 def create_heira hieradata = "#{path}/hieradata/" empty_directory(hieradata) %w(common virtualbox physical).each do |env| copy_file('templates/clean.yaml', "#{hieradata}/#{env}.yaml") end copy_file('templates/hiera.yaml', "#{path}/hiera.yaml") copy_file('templates/hiera_vagrant.yaml', "#{path}/hiera_vagrant.yaml") end |
#create_puppet_base ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/opskeleton/generate.rb', line 38 def create_puppet_base empty_directory("#{path}/static-modules/") empty_directory("#{path}/manifests/") template('templates/puppetfile.erb', "#{path}/Puppetfile") template('templates/puppet/default.erb', "#{path}/manifests/default.pp") copy_file('templates/run.sh', "#{path}/run.sh") chmod("#{path}/run.sh", 0755) end |
#create_rakefile ⇒ Object
24 25 26 |
# File 'lib/opskeleton/generate.rb', line 24 def create_rakefile copy_file('templates/Rakefile', "#{path}/Rakefile") end |
#create_rvmrc ⇒ Object
32 33 34 35 36 |
# File 'lib/opskeleton/generate.rb', line 32 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
15 16 17 18 |
# File 'lib/opskeleton/generate.rb', line 15 def create_vagrant_file empty_directory(path) template('templates/vagrant.erb', "#{path}/Vagrantfile") end |
#create_version ⇒ Object
28 29 30 |
# File 'lib/opskeleton/generate.rb', line 28 def create_version template('templates/opsk.yml', "#{path}/opsk.yml") end |
#git ⇒ Object
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/opskeleton/generate.rb', line 67 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
11 12 13 |
# File 'lib/opskeleton/generate.rb', line 11 def path "#{name}-sandbox" end |
#readme ⇒ Object
58 59 60 61 |
# File 'lib/opskeleton/generate.rb', line 58 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
78 79 80 |
# File 'lib/opskeleton/generate.rb', line 78 def server_spec directory('templates/parent/spec', "#{path}/spec") end |
#travis ⇒ Object
63 64 65 |
# File 'lib/opskeleton/generate.rb', line 63 def travis template('templates/parent/travis.erb', "#{path}/.travis.yml") end |