Class: DeckoGenerator
- Inherits:
-
Rails::Generators::AppBase
- Object
- Rails::Generators::AppBase
- DeckoGenerator
- Defined in:
- lib/decko/generators/decko/decko_generator.rb,
lib/decko/generators/decko/decko_generator/interactive.rb
Defined Under Namespace
Classes: Interactive
Class Method Summary collapse
Instance Method Summary collapse
- #config ⇒ Object
- #configru ⇒ Object
- #database_gemfile_entry ⇒ Object
-
#dev_setup ⇒ Object
should probably eventually use rails-like AppBuilder approach, but this is a first step.
- #files ⇒ Object
- #gemfile ⇒ Object
- #gitignore ⇒ Object
- #log ⇒ Object
-
#mod ⇒ Object
def readme copy_file “README”, “README.rdoc” end.
- #public ⇒ Object
- #rakefile ⇒ Object
- #script ⇒ Object
- #seed_data ⇒ Object
- #tmp ⇒ Object
Class Method Details
.banner ⇒ Object
135 136 137 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 135 def self. "decko new #{arguments.map(&:usage).join(' ')} [options]" end |
Instance Method Details
#config ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 81 def config empty_directory "config" inside "config" do template "application.rb" template "routes.erb", "routes.rb" template "environment.rb" template "boot.rb" template "databases/#{[:database]}.yml", "database.yml" template "cucumber.yml" if ["core-dev"] template "initializers/cypress_on_rails.rb" if ["core-dev"] end end |
#configru ⇒ Object
73 74 75 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 73 def configru template "config.ru" end |
#database_gemfile_entry ⇒ Object
128 129 130 131 132 133 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 128 def database_gemfile_entry return [] if [:skip_active_record] gem_name, gem_version = gem_for_database msg = "Use #{[:database]} as the database for Active Record" GemfileEntry.version gem_name, gem_version, msg end |
#dev_setup ⇒ Object
should probably eventually use rails-like AppBuilder approach, but this is a first step.
35 36 37 38 39 40 41 42 43 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 35 def dev_setup determine_gemfile_gem_path @include_jasmine_engine = false if ["core-dev"] core_dev_setup elsif ["mod-dev"] mod_dev_setup end end |
#files ⇒ Object
61 62 63 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 61 def files empty_directory_with_keep_file "files" end |
#gemfile ⇒ Object
69 70 71 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 69 def gemfile template "Gemfile" end |
#gitignore ⇒ Object
77 78 79 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 77 def gitignore copy_file "gitignore", ".gitignore" end |
#log ⇒ Object
57 58 59 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 57 def log empty_directory_with_keep_file "log" end |
#mod ⇒ Object
def readme
copy_file "README", "README.rdoc"
end
53 54 55 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 53 def mod empty_directory_with_keep_file "mod" end |
#public ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 95 def public empty_directory "public" inside "public" do template "robots.txt" empty_directory "files" inside "files" do template "htaccess", ".htaccess" end end end |
#rakefile ⇒ Object
45 46 47 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 45 def rakefile template "Rakefile" end |
#script ⇒ Object
108 109 110 111 112 113 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 108 def script directory "script" do |content| "#{shebang}\n" + content end chmod "script", 0755 & ~File.umask, verbose: false end |
#seed_data ⇒ Object
117 118 119 120 121 122 123 124 125 126 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 117 def seed_data if ["interactive"] Interactive.new(, destination_root).run else puts "Now: 1. Run `cd #{File.basename(destination_root)}` to move your new deck directory 2. Run `decko seed` to seed your database (see db configuration in config/database.yml). 3. Run `decko server` to start your server" end end |
#tmp ⇒ Object
65 66 67 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 65 def tmp empty_directory "tmp" end |