linecook 1.2.1 → 2.0.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.
- data/{History → History.rdoc} +3 -2
- data/README.rdoc +93 -0
- data/bin/linecook +32 -56
- data/bin/linecook_run +19 -6
- data/bin/linecook_scp +12 -4
- data/doc/vm_setup.rdoc +75 -0
- data/lib/linecook.rb +3 -2
- data/lib/linecook/attributes.rb +33 -8
- data/lib/linecook/command.rb +61 -0
- data/lib/linecook/command_set.rb +85 -0
- data/lib/linecook/command_utils.rb +20 -0
- data/lib/linecook/commands/build.rb +108 -57
- data/lib/linecook/commands/compile.rb +181 -0
- data/lib/linecook/commands/{helper.rb → compile_helper.rb} +123 -94
- data/lib/linecook/commands/run.rb +43 -39
- data/lib/linecook/commands/snapshot.rb +24 -24
- data/lib/linecook/commands/ssh.rb +7 -7
- data/lib/linecook/commands/start.rb +10 -10
- data/lib/linecook/commands/state.rb +7 -7
- data/lib/linecook/commands/stop.rb +3 -3
- data/lib/linecook/commands/{vbox_command.rb → virtual_box_command.rb} +31 -29
- data/lib/linecook/cookbook.rb +149 -131
- data/lib/linecook/executable.rb +28 -0
- data/lib/linecook/package.rb +177 -361
- data/lib/linecook/proxy.rb +4 -10
- data/lib/linecook/recipe.rb +289 -369
- data/lib/linecook/test.rb +114 -98
- data/lib/linecook/utils.rb +31 -41
- data/lib/linecook/version.rb +2 -6
- metadata +120 -68
- data/HowTo/Control Virtual Machines +0 -106
- data/HowTo/Generate Scripts +0 -268
- data/HowTo/Run Scripts +0 -87
- data/HowTo/Setup Virtual Machines +0 -76
- data/README +0 -117
- data/lib/linecook/commands.rb +0 -11
- data/lib/linecook/commands/command.rb +0 -58
- data/lib/linecook/commands/command_error.rb +0 -12
- data/lib/linecook/commands/env.rb +0 -89
- data/lib/linecook/commands/init.rb +0 -86
- data/lib/linecook/commands/package.rb +0 -57
- data/lib/linecook/template.rb +0 -17
- data/lib/linecook/test/command_parser.rb +0 -75
- data/lib/linecook/test/file_test.rb +0 -197
- data/lib/linecook/test/regexp_escape.rb +0 -86
- data/lib/linecook/test/shell_test.rb +0 -177
- data/lib/linecook/test/shim.rb +0 -71
- data/templates/Gemfile +0 -3
- data/templates/Rakefile +0 -146
- data/templates/_gitignore +0 -4
- data/templates/attributes/project_name.rb +0 -3
- data/templates/config/ssh +0 -14
- data/templates/cookbook +0 -10
- data/templates/files/example.txt +0 -1
- data/templates/helpers/project_name/echo.erb +0 -4
- data/templates/packages/abox.yml +0 -2
- data/templates/project_name.gemspec +0 -30
- data/templates/recipes/abox.rb +0 -16
- data/templates/templates/example.erb +0 -1
- data/templates/test/project_name_test.rb +0 -24
- data/templates/test/test_helper.rb +0 -14
    
        data/lib/linecook/test.rb
    CHANGED
    
    | @@ -1,47 +1,38 @@ | |
| 1 | 
            -
            require ' | 
| 2 | 
            -
            require 'linecook/ | 
| 3 | 
            -
            require ' | 
| 1 | 
            +
            require 'shell_test'
         | 
| 2 | 
            +
            require 'linecook/recipe'
         | 
| 3 | 
            +
            require 'pty'
         | 
| 4 4 |  | 
| 5 5 | 
             
            module Linecook
         | 
| 6 6 | 
             
              module Test
         | 
| 7 7 | 
             
                module ClassMethods
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  # Nil host ends up falling through to the default as configured
         | 
| 10 | 
            +
                  # in config/ssh
         | 
| 8 11 | 
             
                  def host
         | 
| 9 12 | 
             
                    @host ||= ENV['LINECOOK_TEST_HOST'] || name
         | 
| 10 13 | 
             
                  end
         | 
| 11 | 
            -
             | 
| 14 | 
            +
             | 
| 12 15 | 
             
                  def use_host(host)
         | 
| 13 16 | 
             
                    @host = host
         | 
| 14 17 | 
             
                  end
         | 
| 15 | 
            -
                  
         | 
| 16 | 
            -
                  def only_hosts(*patterns)
         | 
| 17 | 
            -
                    patterns.collect! do |pattern|
         | 
| 18 | 
            -
                      pattern.kind_of?(Regexp) ? pattern : /\A#{pattern}\z/
         | 
| 19 | 
            -
                    end
         | 
| 20 | 
            -
                    
         | 
| 21 | 
            -
                    unless patterns.any? {|pattern| host =~ pattern }
         | 
| 22 | 
            -
                      skip_test "not for host (#{host})"
         | 
| 23 | 
            -
                    end
         | 
| 24 | 
            -
                  end
         | 
| 25 18 | 
             
                end
         | 
| 26 | 
            -
             | 
| 19 | 
            +
             | 
| 27 20 | 
             
                module ModuleMethods
         | 
| 28 21 | 
             
                  module_function
         | 
| 29 | 
            -
             | 
| 22 | 
            +
             | 
| 30 23 | 
             
                  def included(base)
         | 
| 31 24 | 
             
                    base.extend ClassMethods
         | 
| 32 25 | 
             
                    base.extend ModuleMethods unless base.kind_of?(Class)
         | 
| 33 26 | 
             
                    super
         | 
| 34 27 | 
             
                  end
         | 
| 35 28 | 
             
                end
         | 
| 36 | 
            -
             | 
| 29 | 
            +
             | 
| 37 30 | 
             
                extend ModuleMethods
         | 
| 38 | 
            -
                
         | 
| 39 | 
            -
                include FileTest
         | 
| 40 31 | 
             
                include ShellTest
         | 
| 41 | 
            -
             | 
| 32 | 
            +
             | 
| 42 33 | 
             
                LINECOOK_DIR = File.expand_path('../../..', __FILE__)
         | 
| 43 34 | 
             
                LINECOOK = File.join(LINECOOK_DIR, 'bin/linecook')
         | 
| 44 | 
            -
             | 
| 35 | 
            +
             | 
| 45 36 | 
             
                def method_dir
         | 
| 46 37 | 
             
                  @host_method_dir ||= begin
         | 
| 47 38 | 
             
                    if test_host = ENV['LINECOOK_TEST_HOST']
         | 
| @@ -51,147 +42,172 @@ module Linecook | |
| 51 42 | 
             
                    end
         | 
| 52 43 | 
             
                  end
         | 
| 53 44 | 
             
                end
         | 
| 54 | 
            -
             | 
| 45 | 
            +
             | 
| 55 46 | 
             
                def remote_dir
         | 
| 56 47 | 
             
                  method_dir[(user_dir.length + 1)..-1]
         | 
| 57 48 | 
             
                end
         | 
| 58 | 
            -
             | 
| 49 | 
            +
             | 
| 59 50 | 
             
                def ssh_config_file
         | 
| 60 51 | 
             
                  method_ssh_config_file = path('config/ssh')
         | 
| 61 52 | 
             
                  File.file?(method_ssh_config_file) ? method_ssh_config_file : 'config/ssh'
         | 
| 62 53 | 
             
                end
         | 
| 63 | 
            -
             | 
| 64 | 
            -
                def setup_cookbook( | 
| 65 | 
            -
                   | 
| 66 | 
            -
                  @cookbook = Cookbook.setup(configs, project_dir)
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                def setup_cookbook(project_dir=method_dir, *additional_project_dirs)
         | 
| 56 | 
            +
                  @cookbook = Cookbook.new(project_dir, *additional_project_dirs)
         | 
| 67 57 | 
             
                end
         | 
| 68 | 
            -
             | 
| 58 | 
            +
             | 
| 69 59 | 
             
                def cookbook
         | 
| 70 60 | 
             
                  @cookbook ||= setup_cookbook
         | 
| 71 61 | 
             
                end
         | 
| 72 | 
            -
             | 
| 62 | 
            +
             | 
| 73 63 | 
             
                def setup_package(env={})
         | 
| 74 | 
            -
                  @package = Package. | 
| 64 | 
            +
                  @package = Package.new(env)
         | 
| 75 65 | 
             
                end
         | 
| 76 | 
            -
             | 
| 66 | 
            +
             | 
| 77 67 | 
             
                def package
         | 
| 78 68 | 
             
                  @package ||= setup_package
         | 
| 79 69 | 
             
                end
         | 
| 80 | 
            -
             | 
| 70 | 
            +
             | 
| 81 71 | 
             
                def use_helpers(*helpers)
         | 
| 82 72 | 
             
                  @helpers = helpers
         | 
| 83 73 | 
             
                end
         | 
| 84 | 
            -
             | 
| 74 | 
            +
             | 
| 85 75 | 
             
                def helpers
         | 
| 86 76 | 
             
                  @helpers ||= []
         | 
| 87 77 | 
             
                end
         | 
| 88 | 
            -
             | 
| 78 | 
            +
             | 
| 89 79 | 
             
                def use_host(host)
         | 
| 90 80 | 
             
                  @host = host
         | 
| 91 81 | 
             
                end
         | 
| 92 | 
            -
             | 
| 82 | 
            +
             | 
| 93 83 | 
             
                def host
         | 
| 94 84 | 
             
                  @host ||= self.class.host
         | 
| 95 85 | 
             
                end
         | 
| 96 | 
            -
             | 
| 86 | 
            +
             | 
| 87 | 
            +
                def recipe
         | 
| 88 | 
            +
                  @recipe ||= setup_recipe
         | 
| 89 | 
            +
                end
         | 
| 90 | 
            +
             | 
| 91 | 
            +
                def recipes
         | 
| 92 | 
            +
                  @recipes ||= []
         | 
| 93 | 
            +
                end
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                def resources
         | 
| 96 | 
            +
                  recipes
         | 
| 97 | 
            +
                end
         | 
| 98 | 
            +
             | 
| 97 99 | 
             
                def runlist
         | 
| 98 | 
            -
                   | 
| 100 | 
            +
                  recipes.map {|recipe| recipe._package_path_ }.join(',')
         | 
| 99 101 | 
             
                end
         | 
| 100 | 
            -
             | 
| 101 | 
            -
                def setup_recipe( | 
| 102 | 
            -
                  recipe =  | 
| 103 | 
            -
                   | 
| 104 | 
            -
                  
         | 
| 102 | 
            +
             | 
| 103 | 
            +
                def setup_recipe(package_path=package.next_path('recipe'), options={:mode => 0744}, &block)
         | 
| 104 | 
            +
                  recipe = Recipe.new(package, cookbook)
         | 
| 105 | 
            +
                  recipe.helpers(*helpers)
         | 
| 105 106 | 
             
                  recipe.instance_eval(&block) if block_given?
         | 
| 106 | 
            -
                   | 
| 107 | 
            -
             | 
| 107 | 
            +
                  recipe.register_as(package_path, options)
         | 
| 108 | 
            +
             | 
| 109 | 
            +
                  recipes << recipe
         | 
| 108 110 | 
             
                  @recipe = recipe
         | 
| 109 111 | 
             
                end
         | 
| 110 | 
            -
             | 
| 111 | 
            -
                def recipe
         | 
| 112 | 
            -
                  @recipe ||= setup_recipe
         | 
| 113 | 
            -
                end
         | 
| 114 | 
            -
                
         | 
| 112 | 
            +
             | 
| 115 113 | 
             
                def assert_recipe(expected, recipe=setup_recipe, &block)
         | 
| 116 114 | 
             
                  recipe.instance_eval(&block) if block_given?
         | 
| 117 | 
            -
                  recipe. | 
| 118 | 
            -
                  
         | 
| 119 | 
            -
                  assert_output_equal expected, recipe.result
         | 
| 115 | 
            +
                  assert_str_equal expected, recipe.to_s
         | 
| 120 116 | 
             
                  recipe
         | 
| 121 117 | 
             
                end
         | 
| 122 | 
            -
             | 
| 118 | 
            +
             | 
| 123 119 | 
             
                def assert_recipe_matches(expected, recipe=setup_recipe, &block)
         | 
| 124 120 | 
             
                  recipe.instance_eval(&block) if block_given?
         | 
| 125 | 
            -
                  recipe. | 
| 126 | 
            -
                  
         | 
| 127 | 
            -
                  assert_alike expected, recipe.result
         | 
| 121 | 
            +
                  assert_str_match expected, recipe.to_s
         | 
| 128 122 | 
             
                  recipe
         | 
| 129 123 | 
             
                end
         | 
| 130 | 
            -
             | 
| 131 | 
            -
                def  | 
| 124 | 
            +
             | 
| 125 | 
            +
                def export_package(host=self.host)
         | 
| 126 | 
            +
                  resources.each {|resource| resource.register_to(package) }
         | 
| 132 127 | 
             
                  package_dir = path("packages/#{host}")
         | 
| 133 | 
            -
                  
         | 
| 134 | 
            -
                  package.build
         | 
| 135 128 | 
             
                  package.export package_dir
         | 
| 136 | 
            -
                  
         | 
| 137 129 | 
             
                  package_dir
         | 
| 138 130 | 
             
                end
         | 
| 139 | 
            -
             | 
| 140 | 
            -
                def run_package(options={}, host=self.host)
         | 
| 141 | 
            -
                  options[' | 
| 142 | 
            -
                  
         | 
| 143 | 
            -
                  build_package host
         | 
| 144 | 
            -
                  run_project options, host
         | 
| 131 | 
            +
             | 
| 132 | 
            +
                def run_package(options={}, host=self.host, &block)
         | 
| 133 | 
            +
                  options['S'] ||= runlist
         | 
| 134 | 
            +
                  run_project options, export_package(host), &block
         | 
| 145 135 | 
             
                end
         | 
| 146 | 
            -
             | 
| 136 | 
            +
             | 
| 147 137 | 
             
                def build_project(options={})
         | 
| 148 138 | 
             
                  options = {
         | 
| 149 | 
            -
                    ' | 
| 150 | 
            -
                    ' | 
| 139 | 
            +
                    'L' => 'helpers',
         | 
| 140 | 
            +
                    'C' => method_dir,
         | 
| 141 | 
            +
                    'i' => path('packages'),
         | 
| 142 | 
            +
                    'o' => path('packages'),
         | 
| 143 | 
            +
                    :max_run_time => 3
         | 
| 151 144 | 
             
                  }.merge(options)
         | 
| 152 | 
            -
             | 
| 153 | 
            -
                   | 
| 145 | 
            +
             | 
| 146 | 
            +
                  Dir.chdir method_dir do
         | 
| 147 | 
            +
                    linecook('build', options, *glob('recipes/*.rb'))
         | 
| 148 | 
            +
                  end
         | 
| 154 149 | 
             
                end
         | 
| 155 | 
            -
             | 
| 156 | 
            -
                 | 
| 157 | 
            -
             | 
| 150 | 
            +
             | 
| 151 | 
            +
                def run_project(options={}, *package_dirs, &block)
         | 
| 152 | 
            +
                  if package_dirs.empty?
         | 
| 153 | 
            +
                    package_dirs = glob('packages/*').select {|path| File.directory?(path) }
         | 
| 154 | 
            +
                  end
         | 
| 155 | 
            +
             | 
| 158 156 | 
             
                  options = {
         | 
| 159 | 
            -
                    ' | 
| 160 | 
            -
                    ' | 
| 161 | 
            -
                    ' | 
| 162 | 
            -
                     | 
| 157 | 
            +
                    'F' => ssh_config_file,
         | 
| 158 | 
            +
                    'D' => remote_dir,
         | 
| 159 | 
            +
                    'q' => true,
         | 
| 160 | 
            +
                    :max_run_time => 3
         | 
| 163 161 | 
             
                  }.merge(options)
         | 
| 164 | 
            -
             | 
| 165 | 
            -
                  linecook('run', options, * | 
| 166 | 
            -
                end
         | 
| 167 | 
            -
             | 
| 168 | 
            -
                def  | 
| 169 | 
            -
                   | 
| 170 | 
            -
             | 
| 171 | 
            -
                  
         | 
| 172 | 
            -
             | 
| 173 | 
            -
                   | 
| 174 | 
            -
             | 
| 175 | 
            -
             | 
| 176 | 
            -
             | 
| 177 | 
            -
             | 
| 162 | 
            +
             | 
| 163 | 
            +
                  linecook('run', options, *package_dirs, &block)
         | 
| 164 | 
            +
                end
         | 
| 165 | 
            +
             | 
| 166 | 
            +
                def run_project_cmd(options={}, *package_dirs, &block)
         | 
| 167 | 
            +
                  if package_dirs.empty?
         | 
| 168 | 
            +
                    package_dirs = glob('packages/*').select {|path| File.directory?(path) }
         | 
| 169 | 
            +
                  end
         | 
| 170 | 
            +
             | 
| 171 | 
            +
                  options = {
         | 
| 172 | 
            +
                    'F' => ssh_config_file,
         | 
| 173 | 
            +
                    'D' => remote_dir,
         | 
| 174 | 
            +
                    'q' => true,
         | 
| 175 | 
            +
                    :max_run_time => 3
         | 
| 176 | 
            +
                  }.merge(options)
         | 
| 177 | 
            +
             | 
| 178 | 
            +
                  linecook_cmd('run', options, *package_dirs, &block)
         | 
| 179 | 
            +
                end
         | 
| 180 | 
            +
             | 
| 181 | 
            +
                def linecook(cmd, options={}, *args, &block)
         | 
| 182 | 
            +
                  command = linecook_cmd(cmd, options, *args)
         | 
| 183 | 
            +
                  session = Session.new(options)
         | 
| 184 | 
            +
                  session.on :PS1, "#{command}\n"
         | 
| 185 | 
            +
                  session.on :PS1, "exit\n"
         | 
| 186 | 
            +
                  session.run
         | 
| 187 | 
            +
             | 
| 188 | 
            +
                  log = session.log
         | 
| 189 | 
            +
                  [log[2].chomp(session.ps1), log.join]
         | 
| 190 | 
            +
                end
         | 
| 191 | 
            +
             | 
| 178 192 | 
             
                def linecook_cmd(cmd, options={}, *args)
         | 
| 179 193 | 
             
                  opts = []
         | 
| 180 194 | 
             
                  options.each_pair do |key, value|
         | 
| 181 | 
            -
                     | 
| 195 | 
            +
                    next unless key.kind_of?(String)
         | 
| 196 | 
            +
             | 
| 197 | 
            +
                    key = key.gsub('_', '-')
         | 
| 182 198 | 
             
                    key = key.length == 1 ? "-#{key}" : "--#{key}"
         | 
| 183 | 
            -
             | 
| 199 | 
            +
             | 
| 184 200 | 
             
                    case value
         | 
| 185 201 | 
             
                    when true
         | 
| 186 202 | 
             
                      opts << key
         | 
| 187 203 | 
             
                    when nil, false
         | 
| 188 | 
            -
                    else | 
| 204 | 
            +
                    else
         | 
| 189 205 | 
             
                      opts << "#{key} '#{value}'"
         | 
| 190 206 | 
             
                    end
         | 
| 191 207 | 
             
                  end
         | 
| 192 | 
            -
             | 
| 208 | 
            +
             | 
| 193 209 | 
             
                  args = args.collect! {|arg| "'#{arg}'" }
         | 
| 194 | 
            -
             | 
| 210 | 
            +
             | 
| 195 211 | 
             
                  cmd = [LINECOOK, cmd] + opts.sort + args
         | 
| 196 212 | 
             
                  cmd.join(' ')
         | 
| 197 213 | 
             
                end
         | 
    
        data/lib/linecook/utils.rb
    CHANGED
    
    | @@ -1,54 +1,24 @@ | |
| 1 | 
            -
            require 'yaml'
         | 
| 2 | 
            -
             | 
| 3 1 | 
             
            module Linecook
         | 
| 4 2 | 
             
              module Utils
         | 
| 5 3 | 
             
                module_function
         | 
| 6 | 
            -
             | 
| 7 | 
            -
                def load_config(path)
         | 
| 8 | 
            -
                  (path && File.exists?(path) ? YAML.load_file(path) : nil) || {}
         | 
| 9 | 
            -
                end
         | 
| 10 | 
            -
                
         | 
| 11 | 
            -
                def arrayify(obj)
         | 
| 12 | 
            -
                  case obj
         | 
| 13 | 
            -
                  when nil    then []
         | 
| 14 | 
            -
                  when String then obj.split(':')
         | 
| 15 | 
            -
                  else obj
         | 
| 16 | 
            -
                  end
         | 
| 17 | 
            -
                end
         | 
| 18 | 
            -
                
         | 
| 19 | 
            -
                def hashify(obj)
         | 
| 20 | 
            -
                  case obj
         | 
| 21 | 
            -
                  when Hash then obj
         | 
| 22 | 
            -
                  when nil  then {}
         | 
| 23 | 
            -
                  when Array
         | 
| 24 | 
            -
                    hash = {}
         | 
| 25 | 
            -
                    obj.each {|entry| hash[entry] = entry }
         | 
| 26 | 
            -
                    hash
         | 
| 27 | 
            -
                  
         | 
| 28 | 
            -
                  when String 
         | 
| 29 | 
            -
                    hashify obj.split(':')
         | 
| 30 | 
            -
                  
         | 
| 31 | 
            -
                  else nil
         | 
| 32 | 
            -
                  end
         | 
| 33 | 
            -
                end
         | 
| 34 | 
            -
                
         | 
| 4 | 
            +
             | 
| 35 5 | 
             
                def deep_merge(a, b)
         | 
| 36 6 | 
             
                  b.each_pair do |key, current|
         | 
| 37 7 | 
             
                    previous = a[key]
         | 
| 38 8 | 
             
                    a[key] = deep_merge?(previous, current) ? deep_merge(previous, current) : current
         | 
| 39 9 | 
             
                  end
         | 
| 40 | 
            -
             | 
| 10 | 
            +
             | 
| 41 11 | 
             
                  a
         | 
| 42 12 | 
             
                end
         | 
| 43 | 
            -
             | 
| 13 | 
            +
             | 
| 44 14 | 
             
                def deep_merge?(previous, current)
         | 
| 45 15 | 
             
                  current.kind_of?(Hash) && previous.kind_of?(Hash)
         | 
| 46 16 | 
             
                end
         | 
| 47 | 
            -
             | 
| 17 | 
            +
             | 
| 48 18 | 
             
                def camelize(str)
         | 
| 49 19 | 
             
                  str.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
         | 
| 50 20 | 
             
                end
         | 
| 51 | 
            -
             | 
| 21 | 
            +
             | 
| 52 22 | 
             
                def underscore(str)
         | 
| 53 23 | 
             
                  str.gsub(/::/, '/').
         | 
| 54 24 | 
             
                  gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
         | 
| @@ -56,15 +26,35 @@ module Linecook | |
| 56 26 | 
             
                  tr("-", "_").
         | 
| 57 27 | 
             
                  downcase
         | 
| 58 28 | 
             
                end
         | 
| 59 | 
            -
             | 
| 60 | 
            -
                 | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 29 | 
            +
             | 
| 30 | 
            +
                # Looks up the specified constant. A block may be given to look up missing
         | 
| 31 | 
            +
                # constants; the last existing const and any non-existant constant names
         | 
| 32 | 
            +
                # are yielded to the block, which is expected to return the desired
         | 
| 33 | 
            +
                # constant.  For instance:
         | 
| 34 | 
            +
                #
         | 
| 35 | 
            +
                #   module ConstName; end
         | 
| 36 | 
            +
                #   Constant.constantize('ConstName')                     # => ConstName
         | 
| 37 | 
            +
                #   Constant.constantize('Non::Existant') { ConstName }   # => ConstName
         | 
| 38 | 
            +
                #
         | 
| 39 | 
            +
                # Raises a NameError for invalid/missing constants.
         | 
| 40 | 
            +
                def constantize(const_name) # :yields: const, missing_const_names
         | 
| 41 | 
            +
                  unless  /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ const_name
         | 
| 42 | 
            +
                    raise NameError, "#{const_name.inspect} is not a valid constant name!"
         | 
| 43 | 
            +
                  end
         | 
| 44 | 
            +
             | 
| 63 45 | 
             
                  const = Object
         | 
| 46 | 
            +
                  constants = $1.split(/::/)
         | 
| 47 | 
            +
             | 
| 64 48 | 
             
                  while name = constants.shift
         | 
| 65 | 
            -
                     | 
| 49 | 
            +
                    begin
         | 
| 50 | 
            +
                      const = const.const_get(name)
         | 
| 51 | 
            +
                    rescue NameError
         | 
| 52 | 
            +
                      raise $! unless block_given?
         | 
| 53 | 
            +
                      constants.unshift(name)
         | 
| 54 | 
            +
                      return yield(const, constants)
         | 
| 55 | 
            +
                    end
         | 
| 66 56 | 
             
                  end
         | 
| 67 | 
            -
             | 
| 57 | 
            +
             | 
| 68 58 | 
             
                  const
         | 
| 69 59 | 
             
                end
         | 
| 70 60 | 
             
              end
         | 
    
        data/lib/linecook/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: linecook
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 5 | 
            -
              prerelease:  | 
| 4 | 
            +
              hash: 15
         | 
| 5 | 
            +
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 | 
            -
              - 1
         | 
| 8 7 | 
             
              - 2
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
               | 
| 8 | 
            +
              - 0
         | 
| 9 | 
            +
              - 0
         | 
| 10 | 
            +
              version: 2.0.0
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Simon Chiang
         | 
| @@ -15,45 +15,90 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date:  | 
| 18 | 
            +
            date: 2012-01-06 00:00:00 -07:00
         | 
| 19 19 | 
             
            default_executable: 
         | 
| 20 20 | 
             
            dependencies: 
         | 
| 21 21 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 22 | 
            -
              name: rake
         | 
| 23 22 | 
             
              prerelease: false
         | 
| 24 23 | 
             
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 25 24 | 
             
                none: false
         | 
| 26 25 | 
             
                requirements: 
         | 
| 27 26 | 
             
                - - ~>
         | 
| 28 27 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 29 | 
            -
                    hash:  | 
| 28 | 
            +
                    hash: 1
         | 
| 30 29 | 
             
                    segments: 
         | 
| 31 30 | 
             
                    - 0
         | 
| 32 | 
            -
                    -  | 
| 33 | 
            -
                    -  | 
| 34 | 
            -
                    version: 0. | 
| 31 | 
            +
                    - 5
         | 
| 32 | 
            +
                    - 5
         | 
| 33 | 
            +
                    version: 0.5.5
         | 
| 35 34 | 
             
              type: :runtime
         | 
| 35 | 
            +
              name: config_parser
         | 
| 36 36 | 
             
              version_requirements: *id001
         | 
| 37 37 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 38 | 
            -
              name: configurable
         | 
| 39 38 | 
             
              prerelease: false
         | 
| 40 39 | 
             
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 41 40 | 
             
                none: false
         | 
| 42 41 | 
             
                requirements: 
         | 
| 43 42 | 
             
                - - ~>
         | 
| 44 43 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 45 | 
            -
                    hash:  | 
| 44 | 
            +
                    hash: 15
         | 
| 46 45 | 
             
                    segments: 
         | 
| 46 | 
            +
                    - 1
         | 
| 47 47 | 
             
                    - 0
         | 
| 48 | 
            -
                     | 
| 49 | 
            -
                    - 0
         | 
| 50 | 
            -
                    version: 0.7.0
         | 
| 48 | 
            +
                    version: "1.0"
         | 
| 51 49 | 
             
              type: :runtime
         | 
| 50 | 
            +
              name: configurable
         | 
| 52 51 | 
             
              version_requirements: *id002
         | 
| 53 52 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 54 | 
            -
              name: bundler
         | 
| 55 53 | 
             
              prerelease: false
         | 
| 56 54 | 
             
              requirement: &id003 !ruby/object:Gem::Requirement 
         | 
| 55 | 
            +
                none: false
         | 
| 56 | 
            +
                requirements: 
         | 
| 57 | 
            +
                - - ~>
         | 
| 58 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 59 | 
            +
                    hash: 9
         | 
| 60 | 
            +
                    segments: 
         | 
| 61 | 
            +
                    - 1
         | 
| 62 | 
            +
                    - 3
         | 
| 63 | 
            +
                    version: "1.3"
         | 
| 64 | 
            +
              type: :runtime
         | 
| 65 | 
            +
              name: tilt
         | 
| 66 | 
            +
              version_requirements: *id003
         | 
| 67 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 68 | 
            +
              prerelease: false
         | 
| 69 | 
            +
              requirement: &id004 !ruby/object:Gem::Requirement 
         | 
| 70 | 
            +
                none: false
         | 
| 71 | 
            +
                requirements: 
         | 
| 72 | 
            +
                - - ~>
         | 
| 73 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 74 | 
            +
                    hash: 11
         | 
| 75 | 
            +
                    segments: 
         | 
| 76 | 
            +
                    - 0
         | 
| 77 | 
            +
                    - 5
         | 
| 78 | 
            +
                    - 0
         | 
| 79 | 
            +
                    version: 0.5.0
         | 
| 80 | 
            +
              type: :runtime
         | 
| 81 | 
            +
              name: shell_test
         | 
| 82 | 
            +
              version_requirements: *id004
         | 
| 83 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 84 | 
            +
              prerelease: false
         | 
| 85 | 
            +
              requirement: &id005 !ruby/object:Gem::Requirement 
         | 
| 86 | 
            +
                none: false
         | 
| 87 | 
            +
                requirements: 
         | 
| 88 | 
            +
                - - ~>
         | 
| 89 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 90 | 
            +
                    hash: 63
         | 
| 91 | 
            +
                    segments: 
         | 
| 92 | 
            +
                    - 0
         | 
| 93 | 
            +
                    - 9
         | 
| 94 | 
            +
                    - 2
         | 
| 95 | 
            +
                    version: 0.9.2
         | 
| 96 | 
            +
              type: :development
         | 
| 97 | 
            +
              name: rake
         | 
| 98 | 
            +
              version_requirements: *id005
         | 
| 99 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 100 | 
            +
              prerelease: false
         | 
| 101 | 
            +
              requirement: &id006 !ruby/object:Gem::Requirement 
         | 
| 57 102 | 
             
                none: false
         | 
| 58 103 | 
             
                requirements: 
         | 
| 59 104 | 
             
                - - ~>
         | 
| @@ -63,77 +108,82 @@ dependencies: | |
| 63 108 | 
             
                    - 1
         | 
| 64 109 | 
             
                    - 0
         | 
| 65 110 | 
             
                    version: "1.0"
         | 
| 66 | 
            -
              type: : | 
| 67 | 
            -
               | 
| 111 | 
            +
              type: :development
         | 
| 112 | 
            +
              name: bundler
         | 
| 113 | 
            +
              version_requirements: *id006
         | 
| 114 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 115 | 
            +
              prerelease: false
         | 
| 116 | 
            +
              requirement: &id007 !ruby/object:Gem::Requirement 
         | 
| 117 | 
            +
                none: false
         | 
| 118 | 
            +
                requirements: 
         | 
| 119 | 
            +
                - - ~>
         | 
| 120 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 121 | 
            +
                    hash: 25
         | 
| 122 | 
            +
                    segments: 
         | 
| 123 | 
            +
                    - 0
         | 
| 124 | 
            +
                    - 9
         | 
| 125 | 
            +
                    version: "0.9"
         | 
| 126 | 
            +
              type: :development
         | 
| 127 | 
            +
              name: rcov
         | 
| 128 | 
            +
              version_requirements: *id007
         | 
| 129 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 130 | 
            +
              prerelease: false
         | 
| 131 | 
            +
              requirement: &id008 !ruby/object:Gem::Requirement 
         | 
| 132 | 
            +
                none: false
         | 
| 133 | 
            +
                requirements: 
         | 
| 134 | 
            +
                - - ~>
         | 
| 135 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 136 | 
            +
                    hash: 21
         | 
| 137 | 
            +
                    segments: 
         | 
| 138 | 
            +
                    - 3
         | 
| 139 | 
            +
                    - 9
         | 
| 140 | 
            +
                    version: "3.9"
         | 
| 141 | 
            +
              type: :development
         | 
| 142 | 
            +
              name: rdoc
         | 
| 143 | 
            +
              version_requirements: *id008
         | 
| 68 144 | 
             
            description: Linecook generates shell scripts using an extensible set of ERB helpers. The shell scripts and associated resources (files, subscripts, etc) make up packages that can be used, for example, to provision servers.
         | 
| 69 | 
            -
            email:  | 
| 145 | 
            +
            email: 
         | 
| 146 | 
            +
            - simon.a.chiang@gmail.com
         | 
| 70 147 | 
             
            executables: 
         | 
| 71 148 | 
             
            - linecook
         | 
| 72 149 | 
             
            extensions: []
         | 
| 73 150 |  | 
| 74 151 | 
             
            extra_rdoc_files: 
         | 
| 75 | 
            -
            - History
         | 
| 76 | 
            -
            - README
         | 
| 152 | 
            +
            - History.rdoc
         | 
| 153 | 
            +
            - README.rdoc
         | 
| 77 154 | 
             
            - License.txt
         | 
| 78 | 
            -
            -  | 
| 79 | 
            -
            - HowTo/Generate Scripts
         | 
| 80 | 
            -
            - HowTo/Run Scripts
         | 
| 81 | 
            -
            - HowTo/Setup Virtual Machines
         | 
| 155 | 
            +
            - doc/vm_setup.rdoc
         | 
| 82 156 | 
             
            files: 
         | 
| 83 157 | 
             
            - bin/linecook_run
         | 
| 84 158 | 
             
            - bin/linecook_scp
         | 
| 85 159 | 
             
            - lib/linecook.rb
         | 
| 86 160 | 
             
            - lib/linecook/attributes.rb
         | 
| 87 | 
            -
            - lib/linecook/ | 
| 161 | 
            +
            - lib/linecook/command.rb
         | 
| 162 | 
            +
            - lib/linecook/command_set.rb
         | 
| 163 | 
            +
            - lib/linecook/command_utils.rb
         | 
| 88 164 | 
             
            - lib/linecook/commands/build.rb
         | 
| 89 | 
            -
            - lib/linecook/commands/ | 
| 90 | 
            -
            - lib/linecook/commands/ | 
| 91 | 
            -
            - lib/linecook/commands/env.rb
         | 
| 92 | 
            -
            - lib/linecook/commands/helper.rb
         | 
| 93 | 
            -
            - lib/linecook/commands/init.rb
         | 
| 94 | 
            -
            - lib/linecook/commands/package.rb
         | 
| 165 | 
            +
            - lib/linecook/commands/compile.rb
         | 
| 166 | 
            +
            - lib/linecook/commands/compile_helper.rb
         | 
| 95 167 | 
             
            - lib/linecook/commands/run.rb
         | 
| 96 168 | 
             
            - lib/linecook/commands/snapshot.rb
         | 
| 97 169 | 
             
            - lib/linecook/commands/ssh.rb
         | 
| 98 170 | 
             
            - lib/linecook/commands/start.rb
         | 
| 99 171 | 
             
            - lib/linecook/commands/state.rb
         | 
| 100 172 | 
             
            - lib/linecook/commands/stop.rb
         | 
| 101 | 
            -
            - lib/linecook/commands/ | 
| 173 | 
            +
            - lib/linecook/commands/virtual_box_command.rb
         | 
| 102 174 | 
             
            - lib/linecook/cookbook.rb
         | 
| 175 | 
            +
            - lib/linecook/executable.rb
         | 
| 103 176 | 
             
            - lib/linecook/package.rb
         | 
| 104 177 | 
             
            - lib/linecook/proxy.rb
         | 
| 105 178 | 
             
            - lib/linecook/recipe.rb
         | 
| 106 | 
            -
            - lib/linecook/template.rb
         | 
| 107 179 | 
             
            - lib/linecook/test.rb
         | 
| 108 | 
            -
            - lib/linecook/test/command_parser.rb
         | 
| 109 | 
            -
            - lib/linecook/test/file_test.rb
         | 
| 110 | 
            -
            - lib/linecook/test/regexp_escape.rb
         | 
| 111 | 
            -
            - lib/linecook/test/shell_test.rb
         | 
| 112 | 
            -
            - lib/linecook/test/shim.rb
         | 
| 113 180 | 
             
            - lib/linecook/utils.rb
         | 
| 114 181 | 
             
            - lib/linecook/version.rb
         | 
| 115 | 
            -
            -  | 
| 116 | 
            -
            -  | 
| 117 | 
            -
            - templates/_gitignore
         | 
| 118 | 
            -
            - templates/attributes/project_name.rb
         | 
| 119 | 
            -
            - templates/config/ssh
         | 
| 120 | 
            -
            - templates/cookbook
         | 
| 121 | 
            -
            - templates/files/example.txt
         | 
| 122 | 
            -
            - templates/helpers/project_name/echo.erb
         | 
| 123 | 
            -
            - templates/packages/abox.yml
         | 
| 124 | 
            -
            - templates/project_name.gemspec
         | 
| 125 | 
            -
            - templates/recipes/abox.rb
         | 
| 126 | 
            -
            - templates/templates/example.erb
         | 
| 127 | 
            -
            - templates/test/project_name_test.rb
         | 
| 128 | 
            -
            - templates/test/test_helper.rb
         | 
| 129 | 
            -
            - bin/linecook
         | 
| 130 | 
            -
            - History
         | 
| 131 | 
            -
            - README
         | 
| 182 | 
            +
            - History.rdoc
         | 
| 183 | 
            +
            - README.rdoc
         | 
| 132 184 | 
             
            - License.txt
         | 
| 133 | 
            -
            -  | 
| 134 | 
            -
            -  | 
| 135 | 
            -
            - HowTo/Run Scripts
         | 
| 136 | 
            -
            - HowTo/Setup Virtual Machines
         | 
| 185 | 
            +
            - doc/vm_setup.rdoc
         | 
| 186 | 
            +
            - bin/linecook
         | 
| 137 187 | 
             
            has_rdoc: true
         | 
| 138 188 | 
             
            homepage: http://github.com/pinnacol/linecook
         | 
| 139 189 | 
             
            licenses: []
         | 
| @@ -141,7 +191,7 @@ licenses: [] | |
| 141 191 | 
             
            post_install_message: 
         | 
| 142 192 | 
             
            rdoc_options: 
         | 
| 143 193 | 
             
            - --main
         | 
| 144 | 
            -
            - README
         | 
| 194 | 
            +
            - README.rdoc
         | 
| 145 195 | 
             
            - -S
         | 
| 146 196 | 
             
            - -N
         | 
| 147 197 | 
             
            - --title
         | 
| @@ -151,12 +201,14 @@ require_paths: | |
| 151 201 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 152 202 | 
             
              none: false
         | 
| 153 203 | 
             
              requirements: 
         | 
| 154 | 
            -
              - -  | 
| 204 | 
            +
              - - ~>
         | 
| 155 205 | 
             
                - !ruby/object:Gem::Version 
         | 
| 156 | 
            -
                  hash:  | 
| 206 | 
            +
                  hash: 55
         | 
| 157 207 | 
             
                  segments: 
         | 
| 158 | 
            -
                  -  | 
| 159 | 
            -
                   | 
| 208 | 
            +
                  - 1
         | 
| 209 | 
            +
                  - 9
         | 
| 210 | 
            +
                  - 2
         | 
| 211 | 
            +
                  version: 1.9.2
         | 
| 160 212 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 161 213 | 
             
              none: false
         | 
| 162 214 | 
             
              requirements: 
         | 
| @@ -168,8 +220,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 168 220 | 
             
                  version: "0"
         | 
| 169 221 | 
             
            requirements: []
         | 
| 170 222 |  | 
| 171 | 
            -
            rubyforge_project: 
         | 
| 172 | 
            -
            rubygems_version: 1. | 
| 223 | 
            +
            rubyforge_project: linecook
         | 
| 224 | 
            +
            rubygems_version: 1.6.2
         | 
| 173 225 | 
             
            signing_key: 
         | 
| 174 226 | 
             
            specification_version: 3
         | 
| 175 227 | 
             
            summary: A shell script generator.
         |