kitchen-appbundle-updater 0.0.4 → 0.1.0
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
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 7488673b66cb66cadc310881c0456274b1210085
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 92f3263f36250ece0b18642158b678c88f9eb897
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 32fed6540a8bbd24dd7f28c3f55d72547029e59a2aa396e27bf59cce4ee52803659fa788db403e388f438ab3da86f384d8fb3054fbb643d87f06226f79474d2a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a00282633f1960b67dbbe2014f673d22825ecf8811a3c2ccff8330d9f33cd27f21529be260e19d3d7c6daac81d39ef43f248d8b6fc955cab2b9660fc65717fdd
         
     | 
| 
         @@ -1,5 +1,4 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'kitchen/provisioner/chef_zero'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'kitchen-appbundle-updater/helpers'
         
     | 
| 
       3 
2 
     | 
    
         | 
| 
       4 
3 
     | 
    
         
             
            module Kitchen
         
     | 
| 
       5 
4 
     | 
    
         
             
              module Provisioner
         
     | 
| 
         @@ -8,50 +7,33 @@ module Kitchen 
     | 
|
| 
       8 
7 
     | 
    
         
             
                  default_config :github_owner, "chef"
         
     | 
| 
       9 
8 
     | 
    
         
             
                  default_config :github_repo, "chef"
         
     | 
| 
       10 
9 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                  def create_sandbox
         
     | 
| 
       12 
     | 
    
         
            -
                    super
         
     | 
| 
       13 
     | 
    
         
            -
                    dna = {
         
     | 
| 
       14 
     | 
    
         
            -
                      chef_appbundle_updater: {
         
     | 
| 
       15 
     | 
    
         
            -
                        github_org: config[:github_owner],
         
     | 
| 
       16 
     | 
    
         
            -
                        github_repo: config[:github_repo],
         
     | 
| 
       17 
     | 
    
         
            -
                        refname: config[:refname]
         
     | 
| 
       18 
     | 
    
         
            -
                      }
         
     | 
| 
       19 
     | 
    
         
            -
                    }
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                    File.open(File.join(sandbox_path, 'dna_updater.json'), "wb") do |f|
         
     | 
| 
       22 
     | 
    
         
            -
                      f.write(dna.to_json)
         
     | 
| 
       23 
     | 
    
         
            -
                    end
         
     | 
| 
       24 
     | 
    
         
            -
                  end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                  def latest_chef_appbundle_updater
         
     | 
| 
       27 
     | 
    
         
            -
                    url = "https://api.github.com/repos/jaym/chef-appbundle-updater/releases/latest"
         
     | 
| 
       28 
     | 
    
         
            -
                    url += "?access_token=#{config[:github_access_token]}" if config[:github_access_token]
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                    @cookbook_url ||= open(url) do |r|
         
     | 
| 
       31 
     | 
    
         
            -
                      j = JSON.parse(r.read)
         
     | 
| 
       32 
     | 
    
         
            -
                      j["assets"][0]["browser_download_url"]
         
     | 
| 
       33 
     | 
    
         
            -
                    end
         
     | 
| 
       34 
     | 
    
         
            -
                  end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
10 
     | 
    
         
             
                  def prepare_command
         
     | 
| 
       37 
     | 
    
         
            -
                    [
         
     | 
| 
       38 
     | 
    
         
            -
                       
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
      
 11 
     | 
    
         
            +
                    gem_bin = remote_path_join(config[:ruby_bindir], "gem").
         
     | 
| 
      
 12 
     | 
    
         
            +
                      tap { |path| path.concat(".bat") if windows_os? }
         
     | 
| 
      
 13 
     | 
    
         
            +
                    appbundle_updater_bin = remote_path_join(config[:ruby_bindir], "appbundle-updater").
         
     | 
| 
      
 14 
     | 
    
         
            +
                      tap { |path| path.concat(".bat") if windows_os? }
         
     | 
| 
      
 15 
     | 
    
         
            +
                    vars = [
         
     | 
| 
      
 16 
     | 
    
         
            +
                      shell_var("refname", config[:refname]),
         
     | 
| 
      
 17 
     | 
    
         
            +
                      shell_var("github_owner", config[:github_owner]),
         
     | 
| 
      
 18 
     | 
    
         
            +
                      shell_var("github_repo", config[:github_repo]),
         
     | 
| 
      
 19 
     | 
    
         
            +
                      shell_var("gem", sudo(gem_bin)),
         
     | 
| 
      
 20 
     | 
    
         
            +
                      shell_var("appbundle_updater", sudo(appbundle_updater_bin)),
         
     | 
| 
      
 21 
     | 
    
         
            +
                    ].join("\n").concat("\n")
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                    my_shell_code_from_file(vars, "chef_base_updater")
         
     | 
| 
       41 
24 
     | 
    
         
             
                  end
         
     | 
| 
       42 
25 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
                   
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
      
 26 
     | 
    
         
            +
                  private
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                  # need to override and use __FILE__ relative to this plugin
         
     | 
| 
      
 29 
     | 
    
         
            +
                  def my_shell_code_from_file(vars, file)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    src_file = File.join(
         
     | 
| 
      
 31 
     | 
    
         
            +
                      File.dirname(__FILE__),
         
     | 
| 
      
 32 
     | 
    
         
            +
                      %w[.. .. .. support],
         
     | 
| 
      
 33 
     | 
    
         
            +
                      file + (powershell_shell? ? ".ps1" : ".sh")
         
     | 
| 
      
 34 
     | 
    
         
            +
                    )
         
     | 
| 
       49 
35 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
                     
     | 
| 
       51 
     | 
    
         
            -
                      vars.join("\n")
         
     | 
| 
       52 
     | 
    
         
            -
                    else
         
     | 
| 
       53 
     | 
    
         
            -
                      vars.join(";\n")
         
     | 
| 
       54 
     | 
    
         
            -
                    end
         
     | 
| 
      
 36 
     | 
    
         
            +
                    wrap_shell_code([vars, "", IO.read(src_file)].join("\n"))
         
     | 
| 
       55 
37 
     | 
    
         
             
                  end
         
     | 
| 
       56 
38 
     | 
    
         | 
| 
       57 
39 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,8 +1,4 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            $ErrorActionPreference = "Stop";
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            Log "Finding cookbook to update chef"
         
     | 
| 
       6 
     | 
    
         
            -
            $env:Path = $env:Path + ";$chef_omnibus_root\bin\"
         
     | 
| 
       7 
     | 
    
         
            -
            Log "Running chef-client with recipe chef-appbundle-updater::default from $cookbook_url"
         
     | 
| 
       8 
     | 
    
         
            -
            & "$chef_omnibus_root\bin\chef-client.bat" -z --recipe-url "$cookbook_url" -j "$json" -o "recipe[chef-appbundle-updater::default]"
         
     | 
| 
      
 3 
     | 
    
         
            +
            & "$gem" install appbundle-updater
         
     | 
| 
      
 4 
     | 
    
         
            +
            & "$appbundle_updater" chef chef "$refname" --tarball --github "$github_owner/$github_repo"
         
     | 
| 
         @@ -1,12 +1,4 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            set -e
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              sudo "$chef_omnibus_root/bin/chef-client" -z --recipe-url "$cookbook_url" -j "$json" -o "recipe[chef-appbundle-updater::default]"
         
     | 
| 
       6 
     | 
    
         
            -
            }
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            # augment path in an attempt to find a download program
         
     | 
| 
       9 
     | 
    
         
            -
            PATH="${PATH}:/opt/local/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/sfw/bin";
         
     | 
| 
       10 
     | 
    
         
            -
            export PATH;
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            main
         
     | 
| 
      
 3 
     | 
    
         
            +
            $gem install appbundle-updater
         
     | 
| 
      
 4 
     | 
    
         
            +
            $appbundle_updater chef chef $refname --tarball --github $github_owner/$github_repo
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: kitchen-appbundle-updater
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Jay Mundrawala
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-09-28 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -98,7 +98,6 @@ files: 
     | 
|
| 
       98 
98 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       99 
99 
     | 
    
         
             
            - kitchen-appbundle-updater.gemspec
         
     | 
| 
       100 
100 
     | 
    
         
             
            - lib/kitchen-appbundle-updater.rb
         
     | 
| 
       101 
     | 
    
         
            -
            - lib/kitchen-appbundle-updater/helpers.rb
         
     | 
| 
       102 
101 
     | 
    
         
             
            - lib/kitchen-appbundle-updater/version.rb
         
     | 
| 
       103 
102 
     | 
    
         
             
            - lib/kitchen/provisioner/chef_github.rb
         
     | 
| 
       104 
103 
     | 
    
         
             
            - support/chef_base_updater.ps1
         
     | 
| 
         @@ -123,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       123 
122 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       124 
123 
     | 
    
         
             
            requirements: []
         
     | 
| 
       125 
124 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       126 
     | 
    
         
            -
            rubygems_version: 2.4. 
     | 
| 
      
 125 
     | 
    
         
            +
            rubygems_version: 2.4.3
         
     | 
| 
       127 
126 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       128 
127 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       129 
128 
     | 
    
         
             
            summary: A Test Kitchen Driver for Appbundle-updater
         
     |