class Suspenders::RunnerGenerator
Public Instance Methods
copy_sample_env()
click to toggle source
# 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
procfile()
click to toggle source
# File lib/suspenders/generators/runner_generator.rb, line 5 def procfile copy_file "Procfile", "Procfile" end
sample_env()
click to toggle source
# File lib/suspenders/generators/runner_generator.rb, line 9 def sample_env copy_file "sample_env", ".sample.env" end
update_readme()
click to toggle source
# File lib/suspenders/generators/runner_generator.rb, line 34 def update_readme append_template_to_file "README.md", "partials/runner_readme.md" end
Private Instance Methods
bin_setup_is_ruby?()
click to toggle source
# File lib/suspenders/generators/runner_generator.rb, line 40 def bin_setup_is_ruby? File.read("bin/setup", 20).match?(%r{#!/usr/bin/env ruby}) end
bin_setup_mentions_ci?()
click to toggle source
# File lib/suspenders/generators/runner_generator.rb, line 44 def bin_setup_mentions_ci? File.read("bin/setup").match?(/if \[ -z "\$CI" \]/) end