opskeleton 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 686cf3d0a07e85e00ab8aec8f5bb60090b536770
4
- data.tar.gz: d5b8464c039cf0034e947f10f334d4d54343058f
3
+ metadata.gz: d95a0b8e5bde4b613a48c45caa8b4cf85b1388f8
4
+ data.tar.gz: e4c76e9287363d91b0c514e7d757558d0f999293
5
5
  SHA512:
6
- metadata.gz: dc71a15222e5fa3fa5500028b4a82acde1ad9801a604e0927bf4889f76bbbac1badf31891854c98307224e5e543a12e50152a1c7c390c8bba76e1dd46f97fafa
7
- data.tar.gz: 881a929134d97a0c275db42d507e07f22db9713ce62c0b4e58cd9124a0be86caceec5a50bd3a640a4a0da706e5b2fffdc382938bb1b051286763e97a128f2e57
6
+ metadata.gz: 4bbe0984a5e2b88da758154e0e642baae5c1331445faef19b7b863542d204917f2ab565881803403252814601af99ca07d8b77ab0b0ab562216398929b7afa8d
7
+ data.tar.gz: 6aad045195cc81798c27802cc97ef4111c814602c5c22504e0dcbcd1edb252417ee3b470ab20a4047c4ca2ec73ef37df23eff590b3ab3393119e091925ddb2da
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- opskeleton (0.5.1)
4
+ opskeleton (0.5.2)
5
5
  bintray_deploy
6
6
  thor
7
7
 
@@ -23,7 +23,7 @@ module Opsk
23
23
  end
24
24
 
25
25
  def create_rakefile
26
- copy_file('templates/Rakefile', "#{path}/Rakefile")
26
+ copy_file('templates/chef/Rakefile', "#{path}/Rakefile")
27
27
  end
28
28
 
29
29
  def create_version
@@ -44,7 +44,7 @@ module Opsk
44
44
  template('templates/chef/dna.json.erb', "#{path}/dna.json")
45
45
  copy_file('templates/chef/run.sh', "#{path}/run.sh")
46
46
  copy_file('templates/chef/solo.rb', "#{path}/solo.rb")
47
- copy_file('templates/boot.sh', "#{path}/boot.sh")
47
+ copy_file('templates/chef/boot.sh', "#{path}/boot.sh")
48
48
  chmod("#{path}/run.sh", 0755)
49
49
  chmod("#{path}/boot.sh", 0755)
50
50
  end
@@ -28,7 +28,7 @@ module Opsk
28
28
  end
29
29
 
30
30
  def create_rakefile
31
- copy_file('templates/Rakefile', "#{path}/Rakefile")
31
+ copy_file('templates/puppet/Rakefile', "#{path}/Rakefile")
32
32
  end
33
33
 
34
34
  def create_version
@@ -46,8 +46,8 @@ module Opsk
46
46
  empty_directory("#{path}/manifests/")
47
47
  template('templates/puppetfile.erb', "#{path}/Puppetfile")
48
48
  template('templates/puppet/default.erb', "#{path}/manifests/default.pp")
49
- copy_file('templates/run.sh', "#{path}/run.sh")
50
- copy_file('templates/boot.sh', "#{path}/boot.sh")
49
+ copy_file('templates/puppet/run.sh', "#{path}/run.sh")
50
+ copy_file('templates/puppet/boot.sh', "#{path}/boot.sh")
51
51
  chmod("#{path}/run.sh", 0755)
52
52
  chmod("#{path}/boot.sh", 0755)
53
53
  end
@@ -3,35 +3,44 @@ module Opsk
3
3
  include Thorable, Thor::Actions
4
4
 
5
5
  def meta
6
- OpenStruct.new(YAML.load_file('opsk.yml'))
6
+ OpenStruct.new(YAML.load_file('opsk.yml'))
7
7
  end
8
8
 
9
9
  def name
10
- File.basename(Dir.getwd)
10
+ File.basename(Dir.getwd)
11
11
  end
12
12
 
13
13
  def artifact
14
- "#{name}-#{meta.version}"
14
+ "#{name}-#{meta.version}"
15
15
  end
16
16
 
17
17
  def artifact_path
18
- "pkg/#{name}-#{meta.version}"
18
+ "pkg/#{name}-#{meta.version}"
19
19
  end
20
20
 
21
21
  def create_build
22
22
  empty_directory(artifact_path)
23
- path = Dir.getwd
23
+ path = Dir.getwd
24
24
  directory path, artifact_path, :verbose => false
25
- empty_directory("#{artifact_path}/scripts")
26
- %w(lookup.rb run.sh).each do |s|
27
- template("templates/scripts/#{s}", "#{artifact_path}/scripts/#{s}")
28
- chmod("#{artifact_path}/scripts/#{s}", 0755)
29
- end
30
25
  unless(File.exists?("#{artifact_path}/manifests/site.pp"))
31
26
  template('templates/puppet/site.erb', "#{artifact_path}/manifests/site.pp")
32
27
  end
33
28
  end
34
29
 
30
+ def scripts
31
+ type = :puppet if File.exists?("#{artifact_path}/Puppetfile")
32
+ type = :chef if File.exists?("#{artifact_path}/Cheffile")
33
+ raise Exception.new('not matching provisoner type found') if type.nil?
34
+ empty_directory("#{artifact_path}/scripts")
35
+ files = {:puppet => %w(lookup.rb run.sh) , :chef => [] }
36
+ files[type].each do |s|
37
+ unless(File.exists?("#{artifact_path}/scripts/#{s}"))
38
+ template("templates/#{type}/scripts/#{s}", "#{artifact_path}/scripts/#{s}")
39
+ chmod("#{artifact_path}/scripts/#{s}", 0755)
40
+ end
41
+ end
42
+ end
43
+
35
44
  def create_pkg
36
45
  empty_directory('pkg')
37
46
  end
@@ -1,3 +1,3 @@
1
1
  module Opskeleton
2
- VERSION = '0.5.1'
2
+ VERSION = '0.5.2'
3
3
  end
@@ -0,0 +1,20 @@
1
+ require 'rake'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec) do |t|
5
+ t.pattern = 'spec/*/*_spec.rb'
6
+ end
7
+
8
+ task :default => :spec
9
+
10
+ task :modspec do
11
+ FileList["static-modules/**/Rakefile"].each do |project|
12
+ Rake::Task.clear
13
+ load project
14
+ dir = project.pathmap("%d")
15
+ Dir.chdir(dir) do
16
+ spec_task = Rake::Task[:spec]
17
+ spec_task.invoke()
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,4 @@
1
+ gem install bundle
2
+ bundle install
3
+ librarian-chef install
4
+ vagrant up
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -30,6 +30,7 @@ class ChefPackageTest < MiniTest::Unit::TestCase
30
30
  end
31
31
  assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/Cheffile')
32
32
  assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/roles/foo.rb')
33
+ assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/boot.sh')
33
34
  assert Dir.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/cookbooks')
34
35
  assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/dna.json')
35
36
  assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1.tar.gz')
@@ -22,13 +22,23 @@ class PuppetPackageTest < MiniTest::Unit::TestCase
22
22
  end
23
23
 
24
24
  def test_build
25
- with_cwd 'foo-sandbox' do
26
- Opsk::Root.start ['package']
27
- end
28
- assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/Puppetfile')
29
- assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/manifests/site.pp')
30
- assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/scripts/run.sh')
31
- assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1.tar.gz')
25
+ with_cwd 'foo-sandbox' do
26
+ Opsk::Root.start ['package']
27
+ end
28
+ assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/Puppetfile')
29
+ assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/manifests/site.pp')
30
+ assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/scripts/run.sh')
31
+ assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1.tar.gz')
32
32
  end
33
33
 
34
+ def test_script_override
35
+ Dir.mkdir('foo-sandbox/scripts/')
36
+ File.open('foo-sandbox/scripts/run.sh', 'w') { |f| f.write('my script') }
37
+ with_cwd 'foo-sandbox' do
38
+ Opsk::Root.start ['package']
39
+ end
40
+ File.open('foo-sandbox/pkg/foo-sandbox-0.0.1/scripts/run.sh', 'r') { |f|
41
+ assert_equal(f.read , 'my script')
42
+ }
43
+ end
34
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opskeleton
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - narkisr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-15 00:00:00.000000000 Z
11
+ date: 2014-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -142,9 +142,9 @@ files:
142
142
  - opskeleton.gemspec
143
143
  - templates/LICENSE-2.0.txt
144
144
  - templates/README.erb
145
- - templates/Rakefile
146
- - templates/boot.sh
147
145
  - templates/chef/Cheffile
146
+ - templates/chef/Rakefile
147
+ - templates/chef/boot.sh
148
148
  - templates/chef/dna.json.erb
149
149
  - templates/chef/gemfile
150
150
  - templates/chef/gitignore
@@ -163,14 +163,16 @@ files:
163
163
  - templates/parent/spec/default/httpd_spec.rb
164
164
  - templates/parent/spec/spec_helper.rb
165
165
  - templates/parent/travis.erb
166
+ - templates/puppet/Rakefile
167
+ - templates/puppet/boot.sh
166
168
  - templates/puppet/default.erb
169
+ - templates/puppet/run.sh
170
+ - templates/puppet/scripts/lookup.rb
171
+ - templates/puppet/scripts/run.sh
167
172
  - templates/puppet/site.erb
168
173
  - templates/puppetfile.erb
169
174
  - templates/ruby-gemset.erb
170
175
  - templates/ruby-version.erb
171
- - templates/run.sh
172
- - templates/scripts/lookup.rb
173
- - templates/scripts/run.sh
174
176
  - templates/spec.erb
175
177
  - templates/vagrant.erb
176
178
  - templates/vagrant_bsd.erb