Class: DiceBag::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/dice_bag/project.rb

Constant Summary collapse

DEFAULT_NAME =
"project"
DEFAULT_BUNDLE_PATH =
"vendor/bundle"

Class Method Summary collapse

Class Method Details

.config_files(filename) ⇒ Object



17
18
19
# File 'lib/dice_bag/project.rb', line 17

def self.config_files(filename)
  File.join(root, filename)
end

.nameObject

TODO: how to find the name of the project in non Rails apps?



10
11
12
13
14
15
# File 'lib/dice_bag/project.rb', line 10

def self.name
  return DEFAULT_NAME unless defined?(Rails)

  parent_name_method = Module.respond_to?(:module_parent_name) ? :module_parent_name : :parent_name
  Rails.application.class.send(parent_name_method).downcase
end

.rootObject



21
22
23
# File 'lib/dice_bag/project.rb', line 21

def self.root
  Dir.pwd
end

.templates_to_generateObject



25
26
27
28
29
30
# File 'lib/dice_bag/project.rb', line 25

def self.templates_to_generate
  bundle_path = (defined?(Bundler) && Bundler.settings[:path]) || DEFAULT_BUNDLE_PATH
  FileList.new("**/*.dice") do |fl|
    fl.exclude(File.join(bundle_path, "/**/*"))
  end
end