Class: ForgeCLI::ForgeAddonRequirer
- Inherits:
-
Object
- Object
- ForgeCLI::ForgeAddonRequirer
- Defined in:
- lib/forge-cli/forge_addon_requirer.rb
Instance Method Summary collapse
-
#initialize(app) ⇒ ForgeAddonRequirer
constructor
A new instance of ForgeAddonRequirer.
- #require_addon(addon) ⇒ Object
Constructor Details
#initialize(app) ⇒ ForgeAddonRequirer
Returns a new instance of ForgeAddonRequirer.
2 3 4 |
# File 'lib/forge-cli/forge_addon_requirer.rb', line 2 def initialize(app) @app = app end |
Instance Method Details
#require_addon(addon) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/forge-cli/forge_addon_requirer.rb', line 6 def require_addon(addon) file = File.join(@app, 'config', 'initializers', 'forge.rb') content = File.read(file) new_content = content.gsub("require 'forge.rb'", "require 'forge.rb'\nrequire 'forge/config/#{addon}.rb'") File.open(file, 'w') do |f| f.puts new_content end end |