Class: Aetherg::Generator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Aetherg::Generator
- Includes:
- Thor::Actions
- Defined in:
- lib/aetherg/aetherg.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_app ⇒ Object
- #create_assets_config ⇒ Object
- #create_config_with_boot ⇒ Object
- #create_db_config ⇒ Object
-
#create_empty_directories ⇒ Object
Create empty directories.
- #create_gemfile ⇒ Object
- #create_gitignore ⇒ Object
- #create_gitkeep ⇒ Object
- #create_initializers ⇒ Object
- #create_rakefile ⇒ Object
- #create_readme ⇒ Object
- #create_redis_config_and_initializer ⇒ Object
- #create_server_config ⇒ Object
- #create_settings_config ⇒ Object
-
#setup ⇒ Object
Creates instance variables from options passed to Aether.
Class Method Details
.source_root ⇒ Object
21 22 23 |
# File 'lib/aetherg/aetherg.rb', line 21 def self.source_root File.(File.join(File.dirname(__FILE__), "..", "templates")) end |
Instance Method Details
#create_app ⇒ Object
36 37 38 39 |
# File 'lib/aetherg/aetherg.rb', line 36 def create_app template "application.rb", File.join(@app_path, "application.rb") template "app/routes/welcome.rb", File.join(@app_path, "/app/routes/welcome.rb") end |
#create_assets_config ⇒ Object
89 90 91 92 93 |
# File 'lib/aetherg/aetherg.rb', line 89 def create_assets_config unless @no_views template("config/initializers/assets.rb", File.join(@app_path, "config/initializers/assets.rb")) end end |
#create_config_with_boot ⇒ Object
41 42 43 44 |
# File 'lib/aetherg/aetherg.rb', line 41 def create_config_with_boot template "config.ru", File.join(@app_path, "config.ru") template "boot.rb", File.join(@app_path, "boot.rb") end |
#create_db_config ⇒ Object
62 63 64 65 |
# File 'lib/aetherg/aetherg.rb', line 62 def create_db_config template("config/database.yml", File.join(@app_path, "config/database.example.yml")) unless @no_database template("config/database.yml", File.join(@app_path, "config/database.yml")) unless @no_database end |
#create_empty_directories ⇒ Object
Create empty directories
26 27 28 29 30 31 32 33 34 |
# File 'lib/aetherg/aetherg.rb', line 26 def create_empty_directories %w{app/models app/helpers app/routes config/initializers db/migrate lib log tmp}.each do |dir| empty_directory File.join(@app_path, dir) end %w{app/assets app/assets/images app/assets/javascripts app/assets/stylesheets app/assets/fonts app/views public}.each do |dir| empty_directory File.join(@app_path, dir) end unless @no_views end |
#create_gemfile ⇒ Object
46 47 48 |
# File 'lib/aetherg/aetherg.rb', line 46 def create_gemfile template "Gemfile", File.join(@app_path, "Gemfile") end |
#create_gitignore ⇒ Object
72 73 74 |
# File 'lib/aetherg/aetherg.rb', line 72 def create_gitignore copy_file "gitignore", File.join(@app_path, ".gitignore") end |
#create_gitkeep ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/aetherg/aetherg.rb', line 95 def create_gitkeep create_file File.join(@app_path, "app", "assets", "images", ".keep") unless @no_views create_file File.join(@app_path, "app", "assets", "stylesheets", ".keep") unless @no_views create_file File.join(@app_path, "app", "assets", "javascripts", ".keep") unless @no_views create_file File.join(@app_path, "app", "assets", "fonts", ".keep") unless @no_views create_file File.join(@app_path, "app", "models", ".keep") create_file File.join(@app_path, "app", "routes", ".keep") create_file File.join(@app_path, "log", ".keep") create_file File.join(@app_path, "tmp", ".keep") create_file File.join(@app_path, "app", "views", ".keep") create_file File.join(@app_path, "lib", ".keep") create_file File.join(@app_path, "db", "migrate", ".keep") create_file File.join(@app_path, "public", ".keep") unless @no_views end |
#create_initializers ⇒ Object
76 77 78 79 80 |
# File 'lib/aetherg/aetherg.rb', line 76 def create_initializers template("config/initializers/connection.rb", File.join(@app_path, "config/initializers/connection.rb")) unless @no_database template("config/initializers/environment.rb", File.join(@app_path, "config/initializers/environment.rb")) template("config/initializer.rb", File.join(@app_path, "config/initializer.rb")) end |
#create_rakefile ⇒ Object
50 51 52 |
# File 'lib/aetherg/aetherg.rb', line 50 def create_rakefile template "Rakefile", File.join(@app_path, "Rakefile") end |
#create_readme ⇒ Object
54 55 56 |
# File 'lib/aetherg/aetherg.rb', line 54 def create_readme template "README.md", File.join(@app_path, "README.md") end |
#create_redis_config_and_initializer ⇒ Object
82 83 84 85 86 87 |
# File 'lib/aetherg/aetherg.rb', line 82 def create_redis_config_and_initializer if @redis copy_file("config/redis.yml", File.join(@app_path, "config/redis.yml")) template("config/initializers/redis.rb", File.join(@app_path, "config/initializers/redis.rb")) end end |
#create_server_config ⇒ Object
58 59 60 |
# File 'lib/aetherg/aetherg.rb', line 58 def create_server_config copy_file "config/puma.rb", File.join(@app_path, "config/puma.example.rb") end |
#create_settings_config ⇒ Object
67 68 69 70 |
# File 'lib/aetherg/aetherg.rb', line 67 def create_settings_config template("config/settings.yml", File.join(@app_path, "config/settings.example.yml")) template("config/settings.yml", File.join(@app_path, "config/settings.yml")) end |
#setup ⇒ Object
Creates instance variables from options passed to Aether
14 15 16 17 18 19 |
# File 'lib/aetherg/aetherg.rb', line 14 def setup @name = @app_path = name.filename .each do |key, value| instance_variable_set "@#{key.to_s}".to_sym, value end end |