class Cardio::Generators::Deck::DeckGenerator

Create new Decks (Decko Applications)

Public Class Methods

banner() click to toggle source

Public Instance Methods

config() click to toggle source
# File lib/generators/deck/deck_generator.rb, line 76
def config
  inside "config" do
    erb_template "application.rb"
    erb_template "routes.rb"
    erb_template "environment.rb"
    erb_template "boot.rb"

    template "databases/#{options[:database]}.yml", "database.yml"
    template "cucumber.yml"
    template "storage.yml"
    template "puma.rb"
    # template "initializers/cypress.rb" if platypus?
  end
end
core_files() click to toggle source

Generator works its way through each public method below

# File lib/generators/deck/deck_generator.rb, line 54
def core_files
  erb_template "config.ru"
  erb_template "Gemfile"
  erb_template "Rakefile"

  # return unless platypus?
  #
  # erb_template "cypress.json"
  # template "package.json"
end
dotfiles() click to toggle source
# File lib/generators/deck/deck_generator.rb, line 69
def dotfiles
  copy_file "pryrc", ".pryrc"
  copy_file "gitignore", ".gitignore"
  template "rspec.erb", ".rspec"
  template "simplecov.rb.erb", ".simplecov"
end
empty_dirs() click to toggle source
# File lib/generators/deck/deck_generator.rb, line 65
def empty_dirs
  %w[mod log files tmp].each { |dirname| empty_directory_with_keep_file dirname }
end
public() click to toggle source
# File lib/generators/deck/deck_generator.rb, line 91
def public
  inside "public" do
    template "robots.txt"
    inside("files") { template "htaccess", ".htaccess" }
  end
end
script() click to toggle source
# File lib/generators/deck/deck_generator.rb, line 102
def script
  directory("script") { |content| "#{shebang}\n" + content }
  chmod "script", 0o755 & ~File.umask, verbose: false
end
seed_data() click to toggle source
# File lib/generators/deck/deck_generator.rb, line 120
  def seed_data
    if options["interactive"]
      Interactive.new(destination_root, (monkey? || platypus?)).run
    else
      prefix = "bundle exec " if options["platypus"]
      puts "Now:
1. Run `cd #{File.basename(destination_root)}` to enter your new deck directory
2. Run `#{prefix}decko setup` to seed your database (see config/database.yml).
3. Run `#{prefix}decko server` to start your server"
    end
  end
spec() click to toggle source
# File lib/generators/deck/deck_generator.rb, line 107
def spec
  inside "spec" do
    if platypus?
      jasmine_yml :decko
    else
      jasmine_yml :deck
      template "spec_helper.rb"
    end
  end
end
spring() click to toggle source
# File lib/generators/deck/deck_generator.rb, line 98
def spring
  inside("bin") { erb_template "spring" }
end

Protected Instance Methods

database_gemfile_entry() click to toggle source
# File lib/generators/deck/deck_generator.rb, line 134
def database_gemfile_entry
  return [] if options[:skip_active_record]

  gem_name, gem_version = gem_for_database
  msg = "Use #{options[:database]} as the database for Active Record"
  GemfileEntry.version gem_name, gem_version, msg
end