opskeleton 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +0,0 @@
1
- site 'http://community.opscode.com/api/v1'
2
-
3
- cookbook 'apt'
@@ -1,21 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # base
4
- gem 'chef'
5
-
6
- group :testing do
7
- gem 'serverspec', '~> 1.14.0'
8
- gem 'test-kitchen'
9
- end
10
-
11
- group :build do
12
- gem 'rake'
13
- gem 'foodcritic'
14
- gem 'librarian-chef'
15
- gem 'opskeleton'
16
- end
17
-
18
- <% if(@options[:bench_enable]) %>
19
- gem 'gruff', :group => :benchmark
20
- <% end %>
21
-
@@ -1,76 +0,0 @@
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
- desc "Run serverspec to all hosts"
11
- task :spec => 'serverspec:all'
12
-
13
- class ServerspecTask < RSpec::Core::RakeTask
14
-
15
- attr_accessor :target
16
-
17
- def spec_command
18
- cmd = super
19
- "env TARGET_HOST=#{target} #{cmd}"
20
- end
21
-
22
- end
23
-
24
- namespace :serverspec do
25
-
26
- %w(<%=@name%>).each do |profile|
27
- ServerspecTask.new(profile.to_sym) do |t|
28
- t.target = profile
29
- t.pattern = "spec/#{profile}/*_spec.rb"
30
- end
31
- end
32
- end
33
-
34
- <% if(@options[:bench_enable]) %>
35
- require 'gruff'
36
- require 'json'
37
-
38
- PLOTS = 'plots'
39
-
40
- namespace :plot do
41
-
42
- directory PLOTS
43
-
44
- task :hosts => [PLOTS] do
45
- hosts = IO.readlines('benchmark.json').map {|b|
46
- JSON.parse(b,{:symbolize_names => true })
47
- }.group_by {|m|
48
- m[:host]
49
- }
50
-
51
- g = Gruff::Line.new
52
- g.title = 'All Hosts side by side'
53
- g.labels = Hash[hosts.keys.each_with_index.map {|i,h| [h , i]}]
54
- g.labels.each_pair {|i, l|
55
- g.data(l, hosts[l].map {|h| h[:total] })
56
- }
57
- g.write("#{PLOTS}/all_hosts.png")
58
- end
59
-
60
- task :per_host => [PLOTS] do
61
- hosts = IO.readlines('benchmark.json').map {|b|
62
- JSON.parse(b,{:symbolize_names => true })
63
- }.group_by {|m|
64
- m[:host]
65
- }
66
-
67
- hosts.each_pair {|h,data|
68
- g = Gruff::Line.new
69
- g.title = h
70
- g.labels = {0 => h}
71
- g.data(h, data.map {|d| d[:total] })
72
- g.write("#{PLOTS}/#{h}.png")
73
- }
74
- end
75
- end
76
- <% end %>
@@ -1,4 +0,0 @@
1
- gem install bundle
2
- bundle install
3
- librarian-chef install
4
- vagrant up
@@ -1,5 +0,0 @@
1
- {
2
- "run_list": [
3
- "role[<%=name%>]"
4
- ]
5
- }
@@ -1,4 +0,0 @@
1
- name 'dev'
2
- description 'The development environment'
3
- default_attributes '' => { }
4
-
@@ -1,5 +0,0 @@
1
- cookbooks
2
- .vagrant
3
- .librarian
4
- .tmp
5
- pkg
@@ -1,18 +0,0 @@
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
-
@@ -1,2 +0,0 @@
1
-
2
- run_list()
@@ -1 +0,0 @@
1
- chef-solo -c solo.rb -j dna.json -E $1
@@ -1,6 +0,0 @@
1
- file_cache_path "#{Dir.pwd}/chef"
2
- cookbook_path ["#{Dir.pwd}/cookbooks","#{Dir.pwd}/static-cookbooks"]
3
- role_path "#{Dir.pwd}/roles/"
4
- log_level :info
5
- log_location STDOUT
6
- environment_path "#{Dir.pwd}/environments"
@@ -1,15 +0,0 @@
1
- FROM <%=from%>
2
-
3
- RUN locale-gen en_US en_US.UTF-8
4
-
5
- RUN apt-get -q update
6
- RUN apt-mark hold initscripts udev plymouth mountall
7
- RUN apt-get -qy --force-yes dist-upgrade
8
- RUN apt-get install wget -y
9
- RUN wget --no-check-certificate https://gist.githubusercontent.com/narkisr/5e37903f1d1bf386ceb5/raw/4dc04c9d76dc639df2d23ab3cecf3dc1d574c916/chef-preq.sh -P /tmp
10
- RUN chmod +x /tmp/chef-preq.sh
11
- RUN /bin/bash -x /tmp/chef-preq.sh
12
-
13
- ADD <%=artifact_path%> /tmp
14
- RUN chmod +x /tmp/<%=artifact%>/run.sh
15
- RUN cd /tmp/<%=artifact%> && ./run.sh dev
@@ -1,28 +0,0 @@
1
- # -*- mode: ruby -*-
2
- # vi: set ft=ruby :
3
- Vagrant.configure("2") do |config|
4
- config.vm.define :<%=name%> do |node|
5
- bridge = ENV['VAGRANT_BRIDGE']
6
- bridge ||= 'eth0'
7
- env = ENV['CHEF_ENV']
8
- env ||= 'dev'
9
-
10
- node.vm.box = '<%=box%>' <%if(options['box_url']) %>
11
- <%="node.vm.box_url = '#{options['box_url']}'"%> <%end%>
12
- node.vm.network :public_network, :bridge => bridge
13
- node.vm.hostname = '<%=name%>.local'
14
-
15
- node.vm.provider :virtualbox do |vb|
16
- vb.customize ['modifyvm', :id, '--memory', 2048, '--cpus', 2]
17
- end
18
-
19
- node.vm.provision :chef_solo do |chef|
20
- chef.cookbooks_path = ['static-cookbooks', 'cookbooks']
21
- chef.roles_path = 'roles'
22
- chef.add_role('<%=name%>')
23
- chef.environment = env
24
- chef.environments_path = 'environments'
25
- end
26
- end
27
-
28
- end
@@ -1,5 +0,0 @@
1
- <% machines.each do |m| %><%=m%>:
2
- build: dockerfiles/<%=m%>
3
- #ports:
4
- #volumes:
5
- <% end %>
@@ -1,41 +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 ChefPackageTest < MiniTest::Unit::TestCase
8
- include FileUtils
9
-
10
- def setup
11
- Opsk::Root.start ['generate_chef', 'foo', 'bar']
12
- Dir.mkdir('foo-sandbox/cookbooks')
13
- FileUtils.touch('foo-sandbox/cookbooks/1')
14
- FileUtils.touch('foo-sandbox/Gemfile.lock')
15
- end
16
-
17
- def teardown
18
- rm_rf 'foo-sandbox'
19
- end
20
-
21
- def with_cwd(dir)
22
- Dir.chdir dir do
23
- yield
24
- end
25
- end
26
-
27
- def test_build
28
- with_cwd 'foo-sandbox' do
29
- Opsk::Root.start ['package']
30
- end
31
- assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/Cheffile')
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')
34
- assert Dir.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/cookbooks')
35
- assert Dir.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/environments')
36
- assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/dna.json')
37
- assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/environments/dev.rb')
38
- assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1.tar.gz')
39
- end
40
-
41
- end