spec/lib/bolt_spec/project.rb
# Creates the project directory structure with config and inventory
# files. Yields the path to the project.
#
Creates the project directory structure with config and inventory
files. Yields the path to the project.
Creates the project directory structure with config and inventory files . Yields the path to the project .
def with_project_directory(name = 'project', config: nil, inventory: nil, boltdir: false)
      Dir.mktmpdir(nil, Dir.pwd) do |tmpdir|
        tmpdir         = Pathname.new(tmpdir).expand_path
        project_path   = boltdir ? (tmpdir + name + 'Boltdir') : (tmpdir + name)
        config_path    = project_path + 'bolt-project.yaml'
        inventory_path = project_path + 'inventory.yaml'
        cfg = { 'name' => name }
        cfg.merge!(config) if config
        FileUtils.mkdir_p(project_path)
        File.write(config_path, cfg.to_yaml)
        File.write(inventory_path, inventory.to_yaml) unless inventory.nil?
        yield(project_path, cfg)
      end
    end
def with_project_directory ( name = 'project' , config : nil , inventory : nil , boltdir : false ) Dir . mktmpdir ( nil , Dir . pwd ) do | tmpdir | tmpdir = Pathname . new ( tmpdir ) . expand_path project_path = boltdir ? ( tmpdir + name + 'Boltdir' ) : ( tmpdir + name ) config_path = project_path + 'bolt-project.yaml' inventory_path = project_path + 'inventory.yaml' cfg = { 'name' => name } cfg . merge! ( config ) if config FileUtils . mkdir_p ( project_path ) File . write ( config_path , cfg . to_yaml ) File . write ( inventory_path , inventory . to_yaml ) unless inventory . nil? yield ( project_path , cfg ) end end
Creates the project directory structure with config and inventory
files.
Creates the project directory structure with config and inventory files .
# Build project paths # Set default config and inventory if not provided # Create project directory and files
name
<not_specific>
config
<not_specific>
inventory
<not_specific>
boltdir
<not_specific>