Sha256: 7d349d06e0d99b09057612df6a07f865b157b38cfffe3ca8d667b4a477ce92d8

Contents?: true

Size: 528 Bytes

Versions: 17

Compression:

Stored size: 528 Bytes

Contents

class ForgeCLI::AbilityInstaller
  class << self
    def install_abilities!(app, ability_class)
      @app = app
      @ability_class = ability_class
      new_content = File.read(ability_file).gsub(
        /  end\nend\z/,
        "    #{ability_invocation}\n  end\nend"
      )
      File.open(ability_file, "w") do |f|
        f.puts new_content
      end
    end

    def ability_file
      File.join(@app, 'app', 'models', 'ability.rb')
    end

    def ability_invocation
      "#{@ability_class}.new(u)"
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
forge-cli-0.1.10 lib/forge-cli/ability_installer.rb
forge-cli-0.1.9 lib/forge-cli/ability_installer.rb
forge-cli-0.1.8 lib/forge-cli/ability_installer.rb
forge-cli-0.1.7 lib/forge-cli/ability_installer.rb
forge-cli-0.1.6 lib/forge-cli/ability_installer.rb
forge-cli-0.1.5 lib/forge-cli/ability_installer.rb
forge-cli-0.1.4 lib/forge-cli/ability_installer.rb
forge-cli-0.1.3 lib/forge-cli/ability_installer.rb
forge-cli-0.1.2 lib/forge-cli/ability_installer.rb
forge-cli-0.1.1 lib/forge-cli/ability_installer.rb
forge-cli-0.1.0 lib/forge-cli/ability_installer.rb
forge-cli-0.0.18 lib/forge-cli/ability_installer.rb
forge-cli-0.0.17 lib/forge-cli/ability_installer.rb
forge-cli-0.0.16 lib/forge-cli/ability_installer.rb
forge-cli-0.0.15 lib/forge-cli/ability_installer.rb
forge-cli-0.0.14 lib/forge-cli/ability_installer.rb
forge-cli-0.0.13 lib/forge-cli/ability_installer.rb