Module: Rg::Helper

Constant Summary collapse

JS_PATH =
'app/assets/javascripts'
APP_PATH =
JS_PATH + '/angular'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



36
37
38
# File 'lib/rg/helper.rb', line 36

def self.included(base)
  base.source_root File.dirname(__FILE__) + '/../generators/rg/templates'
end

Instance Method Details

#app_nameObject



14
15
16
# File 'lib/rg/helper.rb', line 14

def app_name
  @app_name ||= appName.underscore
end

#appNameObject



18
19
20
# File 'lib/rg/helper.rb', line 18

def appName
  @appName ||= bowerName || railsName
end

#bowerNameObject



26
27
28
29
30
31
32
33
34
# File 'lib/rg/helper.rb', line 26

def bowerName
  JSON.parse(
    File.read(
      Rails.root + 'bower.json'
    )
  )["name"]
rescue
  nil
end

#camelizeLower(name) ⇒ Object



10
11
12
# File 'lib/rg/helper.rb', line 10

def camelizeLower(name)
  name.camelize.sub(/./){ |c| c.downcase }
end

#railsNameObject



22
23
24
# File 'lib/rg/helper.rb', line 22

def railsName
  camelizeLower(Rails.application.class.parent_name)
end