Class: StartGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/start_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_base_filesObject



8
9
10
11
12
# File 'lib/generators/start_generator.rb', line 8

def create_base_files
	generate(:scaffold, "page --skip-template-engine --no-view-specs --no-jbuilder --no-stylesheets" )
	rails_command("db:migrate")
	route "root 'pages#index'"
end

#create_registrationObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/generators/start_generator.rb', line 22

def create_registration
	copy_file "registration.jsx", "client/app/registration.jsx"
	copy_file "Index.jsx", "client/app/Index.jsx"
	copy_file "App.jsx", "client/app/App.jsx"
	copy_file "reducers/index.js", "client/app/reducers/index.js"
	copy_file "package.json", "client/package.json", force: true
	copy_file "webpack.config.js", "client/webpack.config.js", force: true
	system("gem install foreman")
	system("bundle && npm install")
end

#delete_bundles_folderObject



4
5
6
# File 'lib/generators/start_generator.rb', line 4

def delete_bundles_folder
	system("rm -rf client/app/bundles")
end

#install_viewsObject



14
15
16
17
18
19
20
# File 'lib/generators/start_generator.rb', line 14

def install_views
	create_file "app/views/pages/index.html.erb", "<%= react_component('Index', {prerender: false}) %>"
	create_file "app/assets/stylesheets/App.scss",
".App {
text-align: center
}"
end

#start_serverObject



33
34
35
# File 'lib/generators/start_generator.rb', line 33

def start_server
	system("foreman start -f Procfile.dev")
end