Class: Gembrew::Initializer
- Inherits:
-
Object
- Object
- Gembrew::Initializer
- Defined in:
- lib/gembrew/initializer.rb
Instance Attribute Summary collapse
-
#gem_name ⇒ Object
readonly
Returns the value of attribute gem_name.
-
#project_path ⇒ Object
readonly
Returns the value of attribute project_path.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(gem_name = nil, project_path: Pathname.pwd) ⇒ Initializer
constructor
A new instance of Initializer.
Constructor Details
#initialize(gem_name = nil, project_path: Pathname.pwd) ⇒ Initializer
Returns a new instance of Initializer.
11 12 13 14 |
# File 'lib/gembrew/initializer.rb', line 11 def initialize(gem_name = nil, project_path: Pathname.pwd) @gem_name = gem_name @project_path = Pathname(project_path). end |
Instance Attribute Details
#gem_name ⇒ Object (readonly)
Returns the value of attribute gem_name.
9 10 11 |
# File 'lib/gembrew/initializer.rb', line 9 def gem_name @gem_name end |
#project_path ⇒ Object (readonly)
Returns the value of attribute project_path.
9 10 11 |
# File 'lib/gembrew/initializer.rb', line 9 def project_path @project_path end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gembrew/initializer.rb', line 16 def call Config.validate_name! gem_name if gem_name validate_project formula_path.mkpath config_directory.mkpath readme_path.write render_readme unless readme_path.exist? workflow_path.dirname.mkpath workflow_path.write workflow_template.read unless workflow_path.exist? Adder.new(gem_name, project_path: project_path).call if gem_name project_path end |