soloist 0.0.1
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.
- data/.gitignore +3 -0
 - data/Gemfile +4 -0
 - data/README.markdown +1 -0
 - data/Rakefile +2 -0
 - data/bin/soloist +58 -0
 - data/lib/soloist/version.rb +3 -0
 - data/lib/soloist.rb +3 -0
 - data/soloist.gemspec +24 -0
 - metadata +106 -0
 
    
        data/.gitignore
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/README.markdown
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Nothing to see here, yet.
         
     | 
    
        data/Rakefile
    ADDED
    
    
    
        data/bin/soloist
    ADDED
    
    | 
         @@ -0,0 +1,58 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require "json"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'fileutils'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'yaml'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'tempfile'
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            def fileify(contents)
         
     | 
| 
      
 9 
     | 
    
         
            +
              file = Tempfile.new("sololist")
         
     | 
| 
      
 10 
     | 
    
         
            +
              file << contents
         
     | 
| 
      
 11 
     | 
    
         
            +
              file.flush
         
     | 
| 
      
 12 
     | 
    
         
            +
              file
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            class Array
         
     | 
| 
      
 16 
     | 
    
         
            +
              def to_array_string
         
     | 
| 
      
 17 
     | 
    
         
            +
                "[\"#{self.join("\", \"")}\"]"
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            def walk_up_and_find_file(filenames)
         
     | 
| 
      
 22 
     | 
    
         
            +
              pwd = FileUtils.pwd
         
     | 
| 
      
 23 
     | 
    
         
            +
              file = nil
         
     | 
| 
      
 24 
     | 
    
         
            +
              path_to_file = ""
         
     | 
| 
      
 25 
     | 
    
         
            +
              while !file && FileUtils.pwd != '/'
         
     | 
| 
      
 26 
     | 
    
         
            +
                file = filenames.detect { |f| Dir.glob("*").include?(f) }
         
     | 
| 
      
 27 
     | 
    
         
            +
                FileUtils.cd("..")
         
     | 
| 
      
 28 
     | 
    
         
            +
                path_to_file << "../" unless file
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
              FileUtils.cd(pwd)
         
     | 
| 
      
 31 
     | 
    
         
            +
              File.read(path_to_file + file) if file
         
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            log_level = ENV['LOG_LEVEL'] || "info"
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            soloistrc = YAML.load(walk_up_and_find_file(["soloistrc"]))
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            json_contents = {
         
     | 
| 
      
 39 
     | 
    
         
            +
              :recipes => soloistrc["Recipes"]
         
     | 
| 
      
 40 
     | 
    
         
            +
            }
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            solo_rb_contents = "cookbook_path #{soloistrc["Cookbook_Paths"].to_array_string}"
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            # if ARGV.length >= 1
         
     | 
| 
      
 45 
     | 
    
         
            +
            #   json_config = JSON.parse(File.read(json_file))
         
     | 
| 
      
 46 
     | 
    
         
            +
            #   json_config["recipes"] = ARGV
         
     | 
| 
      
 47 
     | 
    
         
            +
            #   json_file = "/tmp/#{File.basename(json_file)}"
         
     | 
| 
      
 48 
     | 
    
         
            +
            #   puts "OVERRIDING RECIPES: running [#{json_config["recipes"].join(", ")}].  Temp json config file: #{json_file}"
         
     | 
| 
      
 49 
     | 
    
         
            +
            #   File.open(json_file, "w+"){|f| f<<JSON.pretty_generate(json_config) }
         
     | 
| 
      
 50 
     | 
    
         
            +
            # end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            solo_rb = fileify(solo_rb_contents)
         
     | 
| 
      
 53 
     | 
    
         
            +
            metadata_json = fileify(json_contents.to_json)
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            command = "sudo bash -c 'RAILS_ENV=$RAILS_ENV chef-solo -j #{metadata_json.path} -c #{solo_rb.path} -l #{log_level}'"
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            puts "running chef: " + command
         
     | 
| 
      
 58 
     | 
    
         
            +
            system(command) || exit(1)
         
     | 
    
        data/lib/soloist.rb
    ADDED
    
    
    
        data/soloist.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- encoding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
            $:.push File.expand_path("../lib", __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            require "soloist/version"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Gem::Specification.new do |s|
         
     | 
| 
      
 6 
     | 
    
         
            +
              s.name        = "soloist"
         
     | 
| 
      
 7 
     | 
    
         
            +
              s.version     = Soloist::VERSION
         
     | 
| 
      
 8 
     | 
    
         
            +
              s.platform    = Gem::Platform::RUBY
         
     | 
| 
      
 9 
     | 
    
         
            +
              s.authors     = ["Matthew Kocher"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              s.email       = ["kocher@gmail.com"]
         
     | 
| 
      
 11 
     | 
    
         
            +
              s.homepage    = "http://rubygems.org/gems/soloist"
         
     | 
| 
      
 12 
     | 
    
         
            +
              s.summary     = %q{Soloist is a simple way of running chef-solo}
         
     | 
| 
      
 13 
     | 
    
         
            +
              s.description = %q{Soloist is an easy way of running chef solo, but it's not doing much.}
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              s.rubyforge_project = "soloist"
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              s.files         = `git ls-files`.split("\n")
         
     | 
| 
      
 18 
     | 
    
         
            +
              s.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
         
     | 
| 
      
 19 
     | 
    
         
            +
              s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         
     | 
| 
      
 20 
     | 
    
         
            +
              s.require_paths = ["lib"]
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              s.add_dependency('chef', '0.9.12')
         
     | 
| 
      
 23 
     | 
    
         
            +
              s.add_dependency('json', '1.4.6')
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,106 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification 
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: soloist
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version 
         
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 29
         
     | 
| 
      
 5 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 6 
     | 
    
         
            +
              segments: 
         
     | 
| 
      
 7 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 8 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 9 
     | 
    
         
            +
              - 1
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.0.1
         
     | 
| 
      
 11 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 12 
     | 
    
         
            +
            authors: 
         
     | 
| 
      
 13 
     | 
    
         
            +
            - Matthew Kocher
         
     | 
| 
      
 14 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 15 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 16 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2010-11-15 00:00:00 -08:00
         
     | 
| 
      
 19 
     | 
    
         
            +
            default_executable: 
         
     | 
| 
      
 20 
     | 
    
         
            +
            dependencies: 
         
     | 
| 
      
 21 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 22 
     | 
    
         
            +
              name: chef
         
     | 
| 
      
 23 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 24 
     | 
    
         
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 25 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 26 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 27 
     | 
    
         
            +
                - - "="
         
     | 
| 
      
 28 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 29 
     | 
    
         
            +
                    hash: 35
         
     | 
| 
      
 30 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 31 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 32 
     | 
    
         
            +
                    - 9
         
     | 
| 
      
 33 
     | 
    
         
            +
                    - 12
         
     | 
| 
      
 34 
     | 
    
         
            +
                    version: 0.9.12
         
     | 
| 
      
 35 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: *id001
         
     | 
| 
      
 37 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 38 
     | 
    
         
            +
              name: json
         
     | 
| 
      
 39 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 40 
     | 
    
         
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 41 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 42 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 43 
     | 
    
         
            +
                - - "="
         
     | 
| 
      
 44 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 45 
     | 
    
         
            +
                    hash: 11
         
     | 
| 
      
 46 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 47 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 48 
     | 
    
         
            +
                    - 4
         
     | 
| 
      
 49 
     | 
    
         
            +
                    - 6
         
     | 
| 
      
 50 
     | 
    
         
            +
                    version: 1.4.6
         
     | 
| 
      
 51 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 52 
     | 
    
         
            +
              version_requirements: *id002
         
     | 
| 
      
 53 
     | 
    
         
            +
            description: Soloist is an easy way of running chef solo, but it's not doing much.
         
     | 
| 
      
 54 
     | 
    
         
            +
            email: 
         
     | 
| 
      
 55 
     | 
    
         
            +
            - kocher@gmail.com
         
     | 
| 
      
 56 
     | 
    
         
            +
            executables: 
         
     | 
| 
      
 57 
     | 
    
         
            +
            - soloist
         
     | 
| 
      
 58 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
            files: 
         
     | 
| 
      
 63 
     | 
    
         
            +
            - .gitignore
         
     | 
| 
      
 64 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 65 
     | 
    
         
            +
            - README.markdown
         
     | 
| 
      
 66 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 67 
     | 
    
         
            +
            - bin/soloist
         
     | 
| 
      
 68 
     | 
    
         
            +
            - lib/soloist.rb
         
     | 
| 
      
 69 
     | 
    
         
            +
            - lib/soloist/version.rb
         
     | 
| 
      
 70 
     | 
    
         
            +
            - soloist.gemspec
         
     | 
| 
      
 71 
     | 
    
         
            +
            has_rdoc: true
         
     | 
| 
      
 72 
     | 
    
         
            +
            homepage: http://rubygems.org/gems/soloist
         
     | 
| 
      
 73 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 76 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
      
 79 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 80 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 81 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 82 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 83 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 84 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 85 
     | 
    
         
            +
                  hash: 3
         
     | 
| 
      
 86 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 87 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 88 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 89 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 90 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 91 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 92 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 93 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 94 
     | 
    
         
            +
                  hash: 3
         
     | 
| 
      
 95 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 96 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 97 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 98 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
            rubyforge_project: soloist
         
     | 
| 
      
 101 
     | 
    
         
            +
            rubygems_version: 1.3.7
         
     | 
| 
      
 102 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 103 
     | 
    
         
            +
            specification_version: 3
         
     | 
| 
      
 104 
     | 
    
         
            +
            summary: Soloist is a simple way of running chef-solo
         
     | 
| 
      
 105 
     | 
    
         
            +
            test_files: []
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     |