Class: Suspenders::RunnerGenerator

Inherits:
Generators::Base show all
Defined in:
lib/suspenders/generators/runner_generator.rb

Instance Method Summary collapse

Methods inherited from Generators::Base

default_source_root, inherited

Methods included from Actions

#action_mailer_asset_host, #action_mailer_host, #configure_environment, #expand_json, #replace_in_file

Instance Method Details

#copy_sample_envObject


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/suspenders/generators/runner_generator.rb', line 13

def copy_sample_env
  if bin_setup_is_ruby?
    inject_template_into_file(
      "bin/setup",
      "partials/runner_setup.rb",
      before: %(  puts "\\n== Preparing database ==")
    )
  elsif bin_setup_mentions_ci?
    inject_into_file(
      "bin/setup",
      %(  cp -i .sample.env .env\n),
      after: %(if [ -z "$CI" ]; then\n)
    )
  else
    append_to_file(
      "bin/setup",
      %(\nif [ -z "$CI" ]; then\n  cp -i .sample.env .env\nfi)
    )
  end
end

#procfileObject


5
6
7
# File 'lib/suspenders/generators/runner_generator.rb', line 5

def procfile
  copy_file "Procfile", "Procfile"
end

#sample_envObject


9
10
11
# File 'lib/suspenders/generators/runner_generator.rb', line 9

def sample_env
  copy_file "sample_env", ".sample.env"
end

#update_readmeObject


34
35
36
# File 'lib/suspenders/generators/runner_generator.rb', line 34

def update_readme
  append_template_to_file "README.md", "partials/runner_readme.md"
end