Class: Gaku::DockerGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Gaku::DockerGenerator
- Defined in:
- lib/generators/gaku/docker/docker_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_route ⇒ Object
- #copy_database_yml ⇒ Object
- #copy_wait_bin ⇒ Object
- #install_migrations ⇒ Object
- #setup_assets ⇒ Object
Class Method Details
.source_paths ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/generators/gaku/docker/docker_generator.rb', line 13 def self.source_paths paths = superclass.source_paths paths << File.('../templates', "../../#{__FILE__}") paths << File.('../templates', "../#{__FILE__}") paths << File.('../templates', __FILE__) paths.flatten end |
Instance Method Details
#add_route ⇒ Object
30 31 32 |
# File 'lib/generators/gaku/docker/docker_generator.rb', line 30 def add_route route "mount Gaku::Core::Engine, at: '/'" end |
#copy_database_yml ⇒ Object
21 22 23 |
# File 'lib/generators/gaku/docker/docker_generator.rb', line 21 def copy_database_yml copy_file 'config/database.yml', 'config/database.yml' end |
#copy_wait_bin ⇒ Object
25 26 27 28 |
# File 'lib/generators/gaku/docker/docker_generator.rb', line 25 def copy_wait_bin copy_file 'bin/check_postgres.sh', 'bin/check_postgres.sh' chmod "bin/check_postgres.sh", 0755 end |
#install_migrations ⇒ Object
34 35 36 37 |
# File 'lib/generators/gaku/docker/docker_generator.rb', line 34 def install_migrations say_status :copying, 'migrations' rake 'gaku:install:migrations' end |
#setup_assets ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/generators/gaku/docker/docker_generator.rb', line 39 def setup_assets @lib_name = 'gaku' %w( javascripts stylesheets images ).each do |path| empty_directory "app/assets/#{path}/gaku/frontend" if defined? Gaku::Frontend || Rails.env.test? empty_directory "app/assets/#{path}/gaku/admin" if defined? Gaku::Admin || Rails.env.test? end if defined? Gaku::Frontend || Rails.env.test? template 'app/assets/javascripts/gaku/frontend/all.js' template 'app/assets/stylesheets/gaku/frontend/all.css' end if defined? Gaku::Admin || Rails.env.test? template 'app/assets/javascripts/gaku/admin/all.js' template 'app/assets/stylesheets/gaku/admin/all.css' end end |