Class: Gembrew::Adder
- Inherits:
-
Object
- Object
- Gembrew::Adder
- Defined in:
- lib/gembrew/adder.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, project_path: Pathname.pwd) ⇒ Adder
constructor
A new instance of Adder.
Constructor Details
#initialize(gem_name, project_path: Pathname.pwd) ⇒ Adder
Returns a new instance of Adder.
10 11 12 13 |
# File 'lib/gembrew/adder.rb', line 10 def initialize(gem_name, 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.
8 9 10 |
# File 'lib/gembrew/adder.rb', line 8 def gem_name @gem_name end |
#project_path ⇒ Object (readonly)
Returns the value of attribute project_path.
8 9 10 |
# File 'lib/gembrew/adder.rb', line 8 def project_path @project_path end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gembrew/adder.rb', line 15 def call Config.validate_name! gem_name unless formula_path.directory? raise Error, "Directory is not a Homebrew tap: #{project_path} (Formula/ does not exist)" end config_directory.mkpath raise Error, "Gem configuration already exists: #{config_path}" if config_path.exist? config_path.write render config_path end |