Class: DaSuspenders::Create
- Inherits:
-
Object
- Object
- DaSuspenders::Create
- Defined in:
- lib/create.rb
Instance Attribute Summary collapse
-
#project_path ⇒ Object
Returns the value of attribute project_path.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#with_mongoid ⇒ Object
Returns the value of attribute with_mongoid.
Class Method Summary collapse
Instance Method Summary collapse
- #create_project! ⇒ Object
-
#initialize(project_path, with_mongoid, repo) ⇒ Create
constructor
A new instance of Create.
Constructor Details
#initialize(project_path, with_mongoid, repo) ⇒ Create
Returns a new instance of Create.
15 16 17 18 19 20 21 22 |
# File 'lib/create.rb', line 15 def initialize(project_path, with_mongoid, repo) self.project_path = project_path self.with_mongoid = with_mongoid self.repo = repo validate_project_path validate_project_name check_for_mongod_process if with_mongoid end |
Instance Attribute Details
#project_path ⇒ Object
Returns the value of attribute project_path.
8 9 10 |
# File 'lib/create.rb', line 8 def project_path @project_path end |
#repo ⇒ Object
Returns the value of attribute repo.
8 9 10 |
# File 'lib/create.rb', line 8 def repo @repo end |
#with_mongoid ⇒ Object
Returns the value of attribute with_mongoid.
8 9 10 |
# File 'lib/create.rb', line 8 def with_mongoid @with_mongoid end |
Class Method Details
.run!(project_path, with_mongoid, repo) ⇒ Object
10 11 12 13 |
# File 'lib/create.rb', line 10 def self.run!(project_path, with_mongoid, repo) creator = self.new(project_path, with_mongoid == "--with-mongoid", repo) creator.create_project! end |
Instance Method Details
#create_project! ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/create.rb', line 24 def create_project! command = <<-COMMAND rails new #{project_path} \ --template="#{template}" \ --database=mysql \ --skip-test-unit \ #{'--skip-active-record' if with_mongoid} COMMAND ENV["REPO"] = repo if repo ENV["WITH_MONGOID"] = "1" if with_mongoid exec(command) end |