Module: Coppola

Extended by:
Syntax, Forwardable
Defined in:
lib/coppola.rb,
lib/coppola/actor.rb,
lib/coppola/scene.rb,
lib/coppola/reload.rb,
lib/coppola/syntax.rb,
lib/coppola/version.rb,
lib/coppola/registry.rb,
lib/coppola/configuration.rb,
lib/coppola/find_definitions.rb

Defined Under Namespace

Modules: Syntax Classes: Actor, Configuration, Registry, Scene

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Syntax

define

Class Attribute Details

.definition_file_pathsObject

An Array of strings specifying locations that should be searched for factory definitions. By default, factory_girl will attempt to require “factories,” “test/factories,” and “spec/factories.” Only the first existing file will be loaded.



7
8
9
# File 'lib/coppola/find_definitions.rb', line 7

def definition_file_paths
  @definition_file_paths
end

Class Method Details

.actor_by_name(name) ⇒ Object



51
52
53
# File 'lib/coppola.rb', line 51

def self.actor_by_name(name)
  actors.find(name)
end

.configurationObject



15
16
17
# File 'lib/coppola.rb', line 15

def self.configuration
  @configuration ||= Configuration.new
end

.find_definitionsObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/coppola/find_definitions.rb', line 12

def self.find_definitions
  absolute_definition_file_paths = definition_file_paths.map {|path| File.expand_path(path) }

  absolute_definition_file_paths.uniq.each do |path|
    load("#{path}.rb") if File.exists?("#{path}.rb")

    if File.directory? path
      Dir[File.join(path, '**', '*.rb')].sort.each do |file|
        load file
      end
    end
  end
end

.register_actor(actor) ⇒ Object



46
47
48
49
# File 'lib/coppola.rb', line 46

def self.register_actor(actor)
  actors.register(actor.name, actor)
  actor
end

.register_scenario(scenario) ⇒ Object



28
29
30
31
# File 'lib/coppola.rb', line 28

def self.register_scenario(scenario)
  scenarii.register(scenario.name, scenario)
  scenario
end

.register_scene(scene) ⇒ Object



37
38
39
40
# File 'lib/coppola.rb', line 37

def self.register_scene(scene)
  scenes.register(scene.name, scene)
  scene
end

.reloadObject



2
3
4
5
# File 'lib/coppola/reload.rb', line 2

def self.reload
  reset_configuration
  find_definitions
end

.reset_configurationObject



19
20
21
# File 'lib/coppola.rb', line 19

def self.reset_configuration
  @configuration = nil
end

.scenario_by_name(name) ⇒ Object



33
34
35
# File 'lib/coppola.rb', line 33

def self.scenario_by_name(name)
  scenarii.find(name)
end

.scene_by_name(name) ⇒ Object



42
43
44
# File 'lib/coppola.rb', line 42

def self.scene_by_name(name)
  scenes.find(name)
end