opskeleton 0.5.3 → 0.6.0

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: 49845072d32dfeca817fda79d08e58b8b6aed707
4
- data.tar.gz: 422e0d8d2077cd3758bb6f7fd594b7d1548db994
3
+ metadata.gz: f22aa1a6e4da0ef0342fcbf5cfc332dd528aa20d
4
+ data.tar.gz: 999a1edd0c9c0b45462081f30cf79a4b7d1d1333
5
5
  SHA512:
6
- metadata.gz: ae9b800a90e235e32afc7909a18a8864f9c1601ed8a5351ec847c3023a8bf36dbf86ff59c4b3f2da22f8540710d507ecc681b5caada781e5c91b14f3f5d5e94f
7
- data.tar.gz: 191fd195d0881ef38fd312f533c44eff64d7c448eed4ceb1b0e1b164b60ccb1647d80b525e82acc49e00a88114a265651ecece69df458a0e3fe9e2dcc19d93ce
6
+ metadata.gz: 76d68f79fd1539252aa4a9d43e65788425200fd6fc3f1436489882ccb4cb3d07d1e4792a9504c54e3c2d067c5b1a099d0c66836e71971b4c2d18d52305955186
7
+ data.tar.gz: 2d5b8ed6ee33b1eff82b63c0d695d7be0d971dd7677e487336a0da63828d235556ad3c22431717c16cce151c5b4c2fdfa3ce191b471504163d4e411656fde0b4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- opskeleton (0.5.3)
4
+ opskeleton (0.6.0)
5
5
  bintray_deploy
6
6
  thor
7
7
 
data/RELEASE-NOTES.md ADDED
@@ -0,0 +1,7 @@
1
+ # Celestial 0.6.0 (06/08/14):
2
+
3
+ ## Fixes:
4
+ * Changing opsk yml extension to yaml (matching proper extension name).
5
+
6
+ ## New Features:
7
+ * opsk.yaml inclues section, this section specifies which files/folder will be packaged upon running opsk package.
data/bin/opsk CHANGED
@@ -7,6 +7,11 @@ require 'thor/runner'
7
7
  require 'thor/group'
8
8
  require 'opskeleton'
9
9
 
10
+ if(File.exists?('opks.yml'))
11
+ error 'opsk.yml found please rename to opsk.yaml'
12
+ exit 1
13
+ end
14
+
10
15
  module Opsk
11
16
  class Root < Thor
12
17
 
@@ -5,13 +5,13 @@ module Opsk
5
5
  argument :version, :type => :string, :desc => 'new version number'
6
6
 
7
7
  def meta
8
- OpenStruct.new(YAML.load_file('opsk.yml'))
8
+ OpenStruct.new(YAML.load_file('opsk.yaml'))
9
9
  end
10
10
 
11
11
  def bump
12
12
  new_meta = meta
13
13
  new_meta.version = version
14
- File.open('opsk.yml', 'w') {|f| f.write(new_meta.marshal_dump.to_yaml)}
14
+ File.open('opsk.yaml', 'w') {|f| f.write(new_meta.marshal_dump.to_yaml)}
15
15
  end
16
16
 
17
17
  end
@@ -3,7 +3,7 @@ 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.yaml'))
7
7
  end
8
8
 
9
9
  def name
@@ -27,7 +27,7 @@ module Opsk
27
27
  end
28
28
 
29
29
  def create_version
30
- template('templates/opsk.yml', "#{path}/opsk.yml")
30
+ template('templates/chef/opsk.yaml', "#{path}/opsk.yaml")
31
31
  end
32
32
 
33
33
  def create_rvmrc
@@ -32,7 +32,7 @@ module Opsk
32
32
  end
33
33
 
34
34
  def create_version
35
- template('templates/opsk.yml', "#{path}/opsk.yml")
35
+ template('templates/puppet/opsk.yaml', "#{path}/opsk.yaml")
36
36
  end
37
37
 
38
38
  def create_rvmrc
@@ -3,7 +3,7 @@ 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.yaml'))
7
7
  end
8
8
 
9
9
  def name
@@ -18,33 +18,40 @@ module Opsk
18
18
  "pkg/#{name}-#{meta.version}"
19
19
  end
20
20
 
21
+ def type_of
22
+ return :puppet if meta.includes.include?('Puppetfile')
23
+ return :chef if meta.includes.include?('Cheffile')
24
+ raise Exception.new('no matching provisoner type found, make sure to include Cheffile or Pupppetfile in opsk.yaml')
25
+ end
26
+
21
27
  def create_build
22
28
  empty_directory(artifact_path)
23
29
  path = Dir.getwd
24
- directory path, artifact_path, :verbose => false
30
+ meta.includes.each {|f|
31
+ if(File.directory?("#{path}/#{f}"))
32
+ directory "#{path}/#{f}", "#{artifact_path}/#{f}", :verbose => false
33
+ elsif(File.exists?("#{path}/#{f}"))
34
+ copy_file "#{path}/#{f}", "#{artifact_path}/#{f}"
35
+ else
36
+ raise Exception.new("#{f} not found please validate opks.yaml includes section")
37
+ end
38
+ }
25
39
  unless(File.exists?("#{artifact_path}/manifests/site.pp"))
26
40
  template('templates/puppet/site.erb', "#{artifact_path}/manifests/site.pp")
27
41
  end
28
42
  end
29
43
 
30
44
  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
45
  empty_directory("#{artifact_path}/scripts")
35
- files = {:puppet => %w(lookup.rb run.sh) , :chef => [] }
36
- files[type].each do |s|
46
+ files = {:puppet => %w(lookup.rb run.sh) , :chef => [] }
47
+ files[type_of].each do |s|
37
48
  unless(File.exists?("#{artifact_path}/scripts/#{s}"))
38
- template("templates/#{type}/scripts/#{s}", "#{artifact_path}/scripts/#{s}")
49
+ template("templates/#{type_of}/scripts/#{s}", "#{artifact_path}/scripts/#{s}")
39
50
  chmod("#{artifact_path}/scripts/#{s}", 0755)
40
51
  end
41
52
  end
42
53
  end
43
54
 
44
- def create_pkg
45
- empty_directory('pkg')
46
- end
47
-
48
55
  def package
49
56
  ignored = IO.readlines('.gitignore').map(&:chomp)
50
57
  ignored.delete('modules')
@@ -1,3 +1,3 @@
1
1
  module Opskeleton
2
- VERSION = '0.5.3'
2
+ VERSION = '0.6.0'
3
3
  end
@@ -0,0 +1,18 @@
1
+ ---
2
+ version: '0.0.1'
3
+ name: <%= name %>
4
+ includes:
5
+ - Cheffile
6
+ - cookbooks
7
+ - static-cookbooks
8
+ - dna.json
9
+ - environments
10
+ - Gemfile
11
+ - Gemfile.lock
12
+ - opsk.yaml
13
+ - roles
14
+ - LICENSE-2.0.txt
15
+ - run.sh
16
+ - boot.sh
17
+ - solo.rb
18
+
@@ -0,0 +1,14 @@
1
+ ---
2
+ version: '0.0.1'
3
+ name: <%= name %>
4
+ includes:
5
+ - Puppetfile
6
+ - modules
7
+ - static-modules
8
+ - Gemfile
9
+ - Gemfile.lock
10
+ - opsk.yaml
11
+ - LICENSE-2.0.txt
12
+ - run.sh
13
+ - boot.sh
14
+
@@ -11,7 +11,7 @@ class ChefPackageTest < MiniTest::Unit::TestCase
11
11
  Opsk::Root.start ['generate_chef', 'foo', 'bar']
12
12
  Dir.mkdir('foo-sandbox/cookbooks')
13
13
  FileUtils.touch('foo-sandbox/cookbooks/1')
14
-
14
+ FileUtils.touch('foo-sandbox/Gemfile.lock')
15
15
  end
16
16
 
17
17
  def teardown
@@ -9,6 +9,8 @@ class PuppetPackageTest < MiniTest::Unit::TestCase
9
9
 
10
10
  def setup
11
11
  Opsk::Root.start ['generate_puppet', 'foo', 'bar']
12
+ FileUtils.touch('foo-sandbox/Gemfile.lock')
13
+ FileUtils.mkdir('foo-sandbox/modules')
12
14
  end
13
15
 
14
16
  def teardown
@@ -32,6 +34,9 @@ class PuppetPackageTest < MiniTest::Unit::TestCase
32
34
  end
33
35
 
34
36
  def test_script_override
37
+ File.open('foo-sandbox/opsk.yaml', 'a') do |file|
38
+ file.puts ' - scripts'
39
+ end
35
40
  Dir.mkdir('foo-sandbox/scripts/')
36
41
  File.open('foo-sandbox/scripts/run.sh', 'w') { |f| f.write('my script') }
37
42
  with_cwd 'foo-sandbox' do
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.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - narkisr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-05 00:00:00.000000000 Z
11
+ date: 2014-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -125,6 +125,7 @@ files:
125
125
  - Gemfile.lock
126
126
  - LICENSE-2.0.txt
127
127
  - README.md
128
+ - RELEASE-NOTES.md
128
129
  - Rakefile
129
130
  - TODOS
130
131
  - autocomplete/opsk_bash_completion
@@ -149,6 +150,7 @@ files:
149
150
  - templates/chef/environments/dev.rb
150
151
  - templates/chef/gemfile
151
152
  - templates/chef/gitignore
153
+ - templates/chef/opsk.yaml
152
154
  - templates/chef/roles.erb
153
155
  - templates/chef/run.sh
154
156
  - templates/chef/solo.rb
@@ -160,13 +162,13 @@ files:
160
162
  - templates/hiera_vagrant.yaml
161
163
  - templates/module/Rakefile.erb
162
164
  - templates/module/spec_helper.rb
163
- - templates/opsk.yml
164
165
  - templates/parent/spec/default/httpd_spec.rb
165
166
  - templates/parent/spec/spec_helper.rb
166
167
  - templates/parent/travis.erb
167
168
  - templates/puppet/Rakefile
168
169
  - templates/puppet/boot.sh
169
170
  - templates/puppet/default.erb
171
+ - templates/puppet/opsk.yaml
170
172
  - templates/puppet/run.sh
171
173
  - templates/puppet/scripts/lookup.rb
172
174
  - templates/puppet/scripts/run.sh
@@ -178,7 +180,6 @@ files:
178
180
  - templates/vagrant.erb
179
181
  - templates/vagrant_bsd.erb
180
182
  - test/chef_package_test.rb
181
- - test/generate_test.rb
182
183
  - test/puppet_package_test.rb
183
184
  - test/test_helper.rb
184
185
  homepage: https://github.com/narkisr/opskeleton
@@ -206,6 +207,5 @@ specification_version: 4
206
207
  summary: A generator for ops projects that include vagrant puppet and fpm
207
208
  test_files:
208
209
  - test/chef_package_test.rb
209
- - test/generate_test.rb
210
210
  - test/puppet_package_test.rb
211
211
  - test/test_helper.rb
data/templates/opsk.yml DELETED
@@ -1,3 +0,0 @@
1
- ---
2
- version: '0.0.1'
3
- name: <%= name %>
@@ -1,22 +0,0 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
2
-
3
- require 'minitest/autorun'
4
- require_relative 'test_helper'
5
- require 'fileutils'
6
-
7
- class GenerateTest< MiniTest::Unit::TestCase
8
- include FileUtils
9
-
10
- def setup
11
- Opsk::Root.start ['generate_puppet', 'foo', 'bar']
12
- end
13
-
14
- def teardown
15
- rm_rf 'foo-sandbox'
16
- end
17
-
18
- def test_version
19
- assert File.exists?('foo-sandbox/opsk.yml')
20
- end
21
-
22
- end