Class: CreateProj::Creator::RailsCreator
- Inherits:
-
RubyCreator
- Object
- CreateProj::Creator
- RubyCreator
- CreateProj::Creator::RailsCreator
- Defined in:
- lib/createproj/creator/rails.rb
Overview
Class for creating Rails project
Instance Method Summary collapse
-
#create_directory(name) ⇒ Object
Create a new directory using rails create.
-
#initialize(*args) ⇒ RailsCreator
constructor
A new instance of RailsCreator.
-
#install_dependencies ⇒ Object
Installs dependencies in the new sandbox - appends to rails gemfile.
Methods inherited from RubyCreator
#gemset_name, #install_sandbox, #write_rvm_files
Constructor Details
#initialize(*args) ⇒ RailsCreator
Returns a new instance of RailsCreator.
5 6 7 8 9 |
# File 'lib/createproj/creator/rails.rb', line 5 def initialize(*args) super(*args) @precommit_template = 'lint-pre-commit' = { linter: 'rubocop', file_ext: '.rb' } end |
Instance Method Details
#create_directory(name) ⇒ Object
Create a new directory using rails create
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/createproj/creator/rails.rb', line 19 def create_directory(name) = [:database] database = "--database=#{options_db}" unless .nil? # -T skip test # -B skip bundle install rails_args = "-B -T #{database}" system("rails new #{name} #{rails_args}") name end |
#install_dependencies ⇒ Object
Installs dependencies in the new sandbox - appends to rails gemfile
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/createproj/creator/rails.rb', line 37 def install_dependencies # append to the gem file File.open('Gemfile', 'a') do |f| @gems_to_install.each do |k, v| f.write("gem '#{k}', '~> #{v}'\n") end end command = 'Enter the directory and run bundle install.' puts command end |