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
144 145 146 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 144 def self. "decko new #{arguments.map(&:usage).join(' ')} [options]" end |
Instance Method Details
#config ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 91 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"] end end |
#configru ⇒ Object
83 84 85 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 83 def configru template "config.ru" end |
#database_gemfile_entry ⇒ Object
137 138 139 140 141 142 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 137 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 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 35 def dev_setup # TODO: rename or split, gem_path points to the source repo, # card and decko gems are subdirs @gemfile_gem_path = @gem_path = ["gem-path"] env_gem_path = ENV["DECKO_GEM_PATH"] if env_gem_path.present? @gemfile_gem_path = %q(#{ENV['DECKO_GEM_PATH']}) @gem_path = env_gem_path end @include_jasmine_engine = false if ["core-dev"] core_dev_setup shared_dev_setup elsif ["mod-dev"] mod_dev_setup shared_dev_setup end end |
#files ⇒ Object
71 72 73 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 71 def files empty_directory_with_keep_file "files" end |
#gemfile ⇒ Object
79 80 81 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 79 def gemfile template "Gemfile" end |
#gitignore ⇒ Object
87 88 89 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 87 def gitignore copy_file "gitignore", ".gitignore" end |
#log ⇒ Object
67 68 69 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 67 def log empty_directory_with_keep_file "log" end |
#mod ⇒ Object
def readme
copy_file "README", "README.rdoc"
end
63 64 65 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 63 def mod empty_directory_with_keep_file "mod" end |
#public ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 104 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
55 56 57 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 55 def rakefile template "Rakefile" end |
#script ⇒ Object
117 118 119 120 121 122 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 117 def script directory "script" do |content| "#{shebang}\n" + content end chmod "script", 0755 & ~File.umask, verbose: false end |
#seed_data ⇒ Object
126 127 128 129 130 131 132 133 134 135 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 126 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
75 76 77 |
# File 'lib/decko/generators/decko/decko_generator.rb', line 75 def tmp empty_directory "tmp" end |