Sha256: 163d832c53b03183a7c98ec0d576a16ec7d135d61427d619953655f4197c48c7

Contents?: true

Size: 936 Bytes

Versions: 4

Compression:

Stored size: 936 Bytes

Contents

class Lono::Files
  class Builder < Base
    extend Memoist
    include Lono::Builder::Context
    include Lono::Builder::Dsl::Syntax
    # Tricky must define files again to avoid conflict with files from loading the Dsl::Syntax
    attr_reader :files

    def run
      load_context
      if File.directory?(full_path)
        directory(@files)
      else
        template(@files)
      end
    end

    def template(files)
      sequence.send(:set_template_paths, @blueprint.root)
      src = files.path
      dest = files.output_path
      sequence.template(src, dest)
    end

    def directory(files)
      src = files.full_path
      sequence.send(:set_template_paths, src)
      sequence.destination_root = @files.output_path
      sequence.directory(".", verbose: false, force: true, context: binding) # Thor::Action
    end

    def sequence
      Lono::CLI::New::Sequence.new(@options)
    end
    memoize :sequence
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lono-8.0.0.pre.rc6 lib/lono/files/builder.rb
lono-8.0.0.pre.rc5 lib/lono/files/builder.rb
lono-8.0.0.pre.rc4 lib/lono/files/builder.rb
lono-8.0.0.pre.rc3 lib/lono/files/builder.rb