Module: Biogem::Naming

Included in:
Jeweler::Generator
Defined in:
lib/bio-gem/mod/biogem.rb

Instance Method Summary collapse

Instance Method Details

#engine_dirsObject



61
62
63
# File 'lib/bio-gem/mod/biogem.rb', line 61

def engine_dirs
  %w{app app/controllers app/views app/helpers config app/views/foos}
end

#engine_filenameObject



69
70
71
# File 'lib/bio-gem/mod/biogem.rb', line 69

def engine_filename
  "#{engine_name}.rb"
end

#engine_module_nameObject



73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/bio-gem/mod/biogem.rb', line 73

def engine_module_name
  module_name = project_name.split('-').map{|module_sub_name| module_sub_name.capitalize}.join
  module_name.instance_eval do
    # Handle underscore in routing template
    def underscore
      self.gsub(/::/, '/').
      gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
      gsub(/([a-z\d])([A-Z])/,'\1_\2').
      tr("-", "_").
      downcase
    end
  end
  module_name
end

#engine_nameObject



65
66
67
# File 'lib/bio-gem/mod/biogem.rb', line 65

def engine_name
  "#{project_name}-engine"
end

#engine_name_prefixObject



88
89
90
# File 'lib/bio-gem/mod/biogem.rb', line 88

def engine_name_prefix
  project_name.split('-').gsub(/-/,'_')<<'_'
end

#engine_namespaceObject



92
93
94
# File 'lib/bio-gem/mod/biogem.rb', line 92

def engine_namespace
  "/#{options[:biogem_engine]}"
end

#lib_sub_moduleObject



100
101
102
# File 'lib/bio-gem/mod/biogem.rb', line 100

def lib_sub_module
  path(lib_dir,"bio",sub_module.downcase)
end

#sub_moduleObject



96
97
98
# File 'lib/bio-gem/mod/biogem.rb', line 96

def sub_module
  project_name.split('-')[1..-1].map{|x| x.capitalize}.join
end