Class: Susply::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/susply/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#billable_entityObject



12
13
14
# File 'lib/generators/susply/install_generator.rb', line 12

def billable_entity
  @subscription_owner_model.downcase
end

#copy_localesObject



26
27
28
29
# File 'lib/generators/susply/install_generator.rb', line 26

def copy_locales
  copy_file "../../../config/locales/susply.en.yml",
    "config/locales/susply.en.yml"
end

#installObject



16
17
18
19
20
21
22
23
24
# File 'lib/generators/susply/install_generator.rb', line 16

def install
  template "config/initializers/susply.rb"

  inject_into_class "app/models/#{subscription_owner_model.downcase}.rb", 
    subscription_owner_model.downcase.camelize.constantize,
    "# Added by Susply\n  include Susply::OwnerMethods  \n\n"

  copy_locales
end

#subscription_owner_modelObject



8
9
10
# File 'lib/generators/susply/install_generator.rb', line 8

def subscription_owner_model
  @subscription_owner_model.capitalize
end