opskeleton 0.9.8 → 0.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +67 -151
- data/README.md +3 -3
- data/autocomplete/_opsk +11 -0
- data/bin/opsk +3 -3
- data/docs/doc.adoc +27 -135
- data/lib/opskeleton.rb +2 -2
- data/lib/opskeleton/analyze.rb +18 -0
- data/lib/opskeleton/clean.rb +0 -8
- data/lib/opskeleton/package.rb +4 -18
- data/lib/opskeleton/thorable.rb +1 -2
- data/lib/opskeleton/update.rb +27 -0
- data/lib/opskeleton/version.rb +1 -1
- data/opskeleton.gemspec +6 -8
- data/test/test_helper.rb +0 -1
- metadata +20 -61
- data/lib/opskeleton/dockerize.rb +0 -29
- data/lib/opskeleton/generate_chef.rb +0 -85
- data/templates/chef/Cheffile +0 -3
- data/templates/chef/Gemfile.erb +0 -21
- data/templates/chef/Rakefile.erb +0 -76
- data/templates/chef/boot.sh +0 -4
- data/templates/chef/dna.json.erb +0 -5
- data/templates/chef/environments/dev.rb +0 -4
- data/templates/chef/gitignore +0 -5
- data/templates/chef/opsk.yaml +0 -18
- data/templates/chef/roles.erb +0 -2
- data/templates/chef/run.sh +0 -1
- data/templates/chef/solo.rb +0 -6
- data/templates/chef/ubuntu_docker.erb +0 -15
- data/templates/chef/vagrant.erb +0 -28
- data/templates/fig.yml.erb +0 -5
- data/test/chef_package_test.rb +0 -41
    
        data/templates/chef/Cheffile
    DELETED
    
    
    
        data/templates/chef/Gemfile.erb
    DELETED
    
    | @@ -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 | 
            -
             | 
    
        data/templates/chef/Rakefile.erb
    DELETED
    
    | @@ -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 %>
         | 
    
        data/templates/chef/boot.sh
    DELETED
    
    
    
        data/templates/chef/dna.json.erb
    DELETED
    
    
    
        data/templates/chef/gitignore
    DELETED
    
    
    
        data/templates/chef/opsk.yaml
    DELETED
    
    | @@ -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 | 
            -
             | 
    
        data/templates/chef/roles.erb
    DELETED
    
    
    
        data/templates/chef/run.sh
    DELETED
    
    | @@ -1 +0,0 @@ | |
| 1 | 
            -
            chef-solo -c solo.rb -j dna.json -E $1
         | 
    
        data/templates/chef/solo.rb
    DELETED
    
    
| @@ -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
         | 
    
        data/templates/chef/vagrant.erb
    DELETED
    
    | @@ -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
         | 
    
        data/templates/fig.yml.erb
    DELETED
    
    
    
        data/test/chef_package_test.rb
    DELETED
    
    | @@ -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
         |