Class: Opsk::GeneratePuppet
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Opsk::GeneratePuppet
show all
- Includes:
- Thorable, Thor::Actions
- Defined in:
- lib/opskeleton/generate_puppet.rb
Instance Method Summary
collapse
Methods included from Thorable
#artifact, #artifact_path, #check_root, included, #machines, #meta, #name, #type_of
Instance Method Details
#create_gemfile ⇒ Object
28
29
30
|
# File 'lib/opskeleton/generate_puppet.rb', line 28
def create_gemfile
template('templates/puppet/Gemfile.erb', "#{path}/Gemfile")
end
|
#create_heira ⇒ Object
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/opskeleton/generate_puppet.rb', line 57
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
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/opskeleton/generate_puppet.rb', line 46
def create_puppet_base
empty_directory("#{path}/static-modules/")
empty_directory("#{path}/manifests/")
template('templates/puppetfile.erb', "#{path}/Puppetfile")
copy_file('templates/puppet/default.pp', "#{path}/manifests/default.pp")
copy_file('templates/puppet/run.sh', "#{path}/run.sh")
template('templates/puppet/boot.erb', "#{path}/boot.sh")
chmod("#{path}/run.sh", 0755)
chmod("#{path}/boot.sh", 0755)
end
|
#create_rakefile ⇒ Object
32
33
34
|
# File 'lib/opskeleton/generate_puppet.rb', line 32
def create_rakefile
template('templates/puppet/Rakefile.erb', "#{path}/Rakefile")
end
|
#create_rvmrc ⇒ Object
40
41
42
43
44
|
# File 'lib/opskeleton/generate_puppet.rb', line 40
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
18
19
20
21
22
23
24
25
26
|
# File 'lib/opskeleton/generate_puppet.rb', line 18
def create_vagrant_file
empty_directory(path)
case options['os_type']
when 'bsd'
template('templates/puppet/vagrant_bsd.erb', "#{path}/Vagrantfile")
else
template('templates/puppet/vagrant.erb', "#{path}/Vagrantfile")
end
end
|
#create_version ⇒ Object
36
37
38
|
# File 'lib/opskeleton/generate_puppet.rb', line 36
def create_version
template('templates/puppet/opsk.yaml', "#{path}/opsk.yaml")
end
|
#git ⇒ Object
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/opskeleton/generate_puppet.rb', line 84
def git
if(!File.exists?("#{path}/.git"))
copy_file('templates/gitignore', "#{path}/.gitignore")
inside(path) do
run('git init .', :verbose => false, :catpure => true)
run('git add -A', :verbose => false, :catpure => true)
run("git commit -m 'initial sandbox import'", :verbose => false, :catpure => true)
end
end
end
|
#path ⇒ Object
14
15
16
|
# File 'lib/opskeleton/generate_puppet.rb', line 14
def path
"#{name}-sandbox"
end
|
#readme ⇒ Object
68
69
70
71
|
# File 'lib/opskeleton/generate_puppet.rb', line 68
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
77
78
79
80
81
|
# File 'lib/opskeleton/generate_puppet.rb', line 77
def server_spec
empty_directory("#{path}/spec")
template('templates/parent/spec/spec_helper.erb', "#{path}/spec/spec_helper.rb")
directory('templates/parent/spec/default', "#{path}/spec/default")
end
|
#travis ⇒ Object
73
74
75
|
# File 'lib/opskeleton/generate_puppet.rb', line 73
def travis
template('templates/parent/travis.erb', "#{path}/.travis.yml")
end
|