Module: Copypasta

Defined in:
lib/copypasta.rb,
lib/copypasta/plan.rb,
lib/copypasta/version.rb,
lib/copypasta/contents.rb,
lib/copypasta/settings.rb,
lib/copypasta/entry/erb.rb,
lib/copypasta/entry/base.rb,
lib/copypasta/entry/copy.rb,
lib/copypasta/contents_dsl.rb,
lib/copypasta/settings_dsl.rb,
lib/copypasta/entry/literal.rb,
lib/copypasta/entry/download.rb,
lib/copypasta/parameter_definition.rb

Defined Under Namespace

Modules: Entry Classes: Contents, ContentsDSL, ParameterDefinition, Plan, Settings, SettingsDSL

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.apply(plan_directory:, destination_directory:, parameters:, interactive: false, force: false) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/copypasta.rb', line 6

def self.apply(plan_directory:, destination_directory:,
               parameters:,
               interactive: false,
               force: false)
  plan_directory = File.expand_path(plan_directory)
  destination_directory = File.expand_path(destination_directory)

  plan = Copypasta::Plan.from_directory(plan_directory)

  full_parameters =
    if interactive
      plan.interrogate(parameters)
    else
      parameters
    end

  plan.apply(full_parameters, destination_directory, force: force)
end