Class: Frontview::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Frontview::InstallGenerator
- Defined in:
- lib/frontview/install_generator.rb
Instance Method Summary collapse
- #create_assets_contents ⇒ Object
- #create_main_file ⇒ Object
- #create_shared_contents ⇒ Object
- #write_in_other_files ⇒ Object
Instance Method Details
#create_assets_contents ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/frontview/install_generator.rb', line 13 def create_assets_contents tempfile = Down.download("https://phpfront.herokuapp.com/assets/images/banner.jpg") FileUtils.mv(tempfile.path, "app/assets/images/#{tempfile.original_filename}") tempfile = Down.download("https://phpfront.herokuapp.com/assets/images/favicon.png") FileUtils.mv(tempfile.path, "app/assets/images/#{tempfile.original_filename}") end |
#create_main_file ⇒ Object
21 22 23 |
# File 'lib/frontview/install_generator.rb', line 21 def create_main_file file = File.new("app/javascript/packs/main.js", "w+") end |
#create_shared_contents ⇒ Object
25 26 27 28 29 30 |
# File 'lib/frontview/install_generator.rb', line 25 def create_shared_contents Dir.mkdir("app/views/shared") unless File.exists?("app/views/shared") file = File.new("app/views/shared/_alerts.html.erb", "w+") file = File.new("app/views/shared/_footer.html.erb", "w+") file = File.new("app/views/shared/_header.html.erb", "w+") end |
#write_in_other_files ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/frontview/install_generator.rb', line 32 def write_in_other_files puts "Hey 👋 welcome to frontview. This process might take sometime..." system("rails g frontview:contents:index_routes_content") system("rails g frontview:contents:style_content") system("rails g frontview:contents:main_content") system("rails g frontview:contents:application_content") system("rails g frontview:contents:alerts_content") system("rails g frontview:contents:footer_content") system("rails g frontview:contents:header_content") puts "Congrats!!! 🎉 🎊 🎈 frontview installation is a success 👍" end |