Class: Cardio::Generators::Deck::DeckGenerator
- Inherits:
-
Rails::Generators::AppBase
- Object
- Rails::Generators::AppBase
- Cardio::Generators::Deck::DeckGenerator
- Includes:
- Cardio::Generators::DeckHelper, RailsOverrides
- Defined in:
- lib/generators/deck/deck_generator.rb
Overview
Create new Decks (Decko Applications)
Class Method Summary collapse
Instance Method Summary collapse
- #config ⇒ Object
-
#core_files ⇒ Object
Generator works its way through each public method below.
- #dotfiles ⇒ Object
- #empty_dirs ⇒ Object
- #public ⇒ Object
- #script ⇒ Object
- #seed_data ⇒ Object
- #spec ⇒ Object
- #spring ⇒ Object
Class Method Details
.banner ⇒ Object
45 46 47 |
# File 'lib/generators/deck/deck_generator.rb', line 45 def self. "decko new #{arguments.map(&:usage).join(' ')} [options]" end |
Instance Method Details
#config ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/generators/deck/deck_generator.rb', line 73 def config inside "config" do erb_template "application.rb" erb_template "routes.rb" erb_template "environment.rb" erb_template "boot.rb" template "databases/#{[:database]}.yml", "database.yml" template "cucumber.yml" template "storage.yml" template "puma.rb" # template "initializers/cypress.rb" if platypus? end end |
#core_files ⇒ Object
Generator works its way through each public method below
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/generators/deck/deck_generator.rb', line 51 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 ⇒ Object
66 67 68 69 70 71 |
# File 'lib/generators/deck/deck_generator.rb', line 66 def dotfiles copy_file "pryrc", ".pryrc" copy_file "gitignore", ".gitignore" template "rspec.erb", ".rspec" template "simplecov.rb.erb", ".simplecov" end |
#empty_dirs ⇒ Object
62 63 64 |
# File 'lib/generators/deck/deck_generator.rb', line 62 def empty_dirs %w[mod log files tmp].each { |dirname| empty_directory_with_keep_file dirname } end |
#public ⇒ Object
88 89 90 91 92 93 |
# File 'lib/generators/deck/deck_generator.rb', line 88 def public inside "public" do template "robots.txt" inside("files") { template "htaccess", ".htaccess" } end end |
#script ⇒ Object
99 100 101 102 |
# File 'lib/generators/deck/deck_generator.rb', line 99 def script directory("script") { |content| "#{shebang}\n" + content } chmod "script", 0o755 & ~File.umask, verbose: false end |
#seed_data ⇒ Object
117 118 119 120 121 122 123 124 125 126 |
# File 'lib/generators/deck/deck_generator.rb', line 117 def seed_data if ["interactive"] Interactive.new(destination_root, (monkey? || platypus?)).run else puts "Now: 1. Run `cd #{File.basename(destination_root)}` to enter your new deck directory 2. Run `decko seed` to seed your database (see config/database.yml). 3. Run `decko server` to start your server" end end |
#spec ⇒ Object
104 105 106 107 108 109 110 111 112 113 |
# File 'lib/generators/deck/deck_generator.rb', line 104 def spec inside "spec" do if platypus? jasmine_yml :decko else jasmine_yml :deck template "spec_helper.rb" end end end |
#spring ⇒ Object
95 96 97 |
# File 'lib/generators/deck/deck_generator.rb', line 95 def spring inside("bin") { erb_template "spring" } end |