diy 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +3 -0
- data/Manifest.txt +53 -0
- data/README.txt +148 -0
- data/Rakefile +17 -0
- data/lib/diy.rb +249 -0
- data/test/diy_test.rb +482 -0
- data/test/files/broken_construction.yml +7 -0
- data/test/files/cat/cat.rb +4 -0
- data/test/files/cat/extra_conflict.yml +5 -0
- data/test/files/cat/heritage.rb +2 -0
- data/test/files/cat/needs_input.yml +3 -0
- data/test/files/cat/the_cat_lineage.rb +1 -0
- data/test/files/dog/dog_model.rb +4 -0
- data/test/files/dog/dog_presenter.rb +4 -0
- data/test/files/dog/dog_view.rb +2 -0
- data/test/files/dog/file_resolver.rb +2 -0
- data/test/files/dog/other_thing.rb +2 -0
- data/test/files/dog/simple.yml +11 -0
- data/test/files/donkey/foo.rb +8 -0
- data/test/files/donkey/foo/bar/qux.rb +7 -0
- data/test/files/fud/objects.yml +13 -0
- data/test/files/fud/toy.rb +15 -0
- data/test/files/gnu/objects.yml +14 -0
- data/test/files/gnu/thinger.rb +8 -0
- data/test/files/goat/base.rb +8 -0
- data/test/files/goat/can.rb +6 -0
- data/test/files/goat/goat.rb +6 -0
- data/test/files/goat/objects.yml +12 -0
- data/test/files/goat/paper.rb +6 -0
- data/test/files/goat/plane.rb +8 -0
- data/test/files/goat/shirt.rb +6 -0
- data/test/files/goat/wings.rb +8 -0
- data/test/files/horse/holder_thing.rb +4 -0
- data/test/files/horse/objects.yml +7 -0
- data/test/files/non_singleton/air.rb +2 -0
- data/test/files/non_singleton/fat_cat.rb +4 -0
- data/test/files/non_singleton/objects.yml +19 -0
- data/test/files/non_singleton/pig.rb +4 -0
- data/test/files/non_singleton/thread_spinner.rb +4 -0
- data/test/files/non_singleton/tick.rb +4 -0
- data/test/files/non_singleton/yard.rb +2 -0
- data/test/files/yak/core_model.rb +4 -0
- data/test/files/yak/core_presenter.rb +4 -0
- data/test/files/yak/core_view.rb +1 -0
- data/test/files/yak/data_source.rb +1 -0
- data/test/files/yak/fringe_model.rb +4 -0
- data/test/files/yak/fringe_presenter.rb +4 -0
- data/test/files/yak/fringe_view.rb +1 -0
- data/test/files/yak/giant_squid.rb +4 -0
- data/test/files/yak/krill.rb +2 -0
- data/test/files/yak/my_objects.yml +21 -0
- data/test/files/yak/sub_sub_context_test.yml +27 -0
- data/test/test_helper.rb +38 -0
- metadata +118 -0
@@ -0,0 +1 @@
|
|
1
|
+
class TheCatLineage; end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'constructor'
|
2
|
+
|
3
|
+
class Toy
|
4
|
+
constructor :widget, :trinket, :accessors => true, :strict => true
|
5
|
+
end
|
6
|
+
|
7
|
+
class Widget
|
8
|
+
end
|
9
|
+
|
10
|
+
class ThingAmaJack
|
11
|
+
end
|
12
|
+
|
13
|
+
class Trinket
|
14
|
+
constructor :thing_ama_jack, :accessors => true, :strict => true
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
air:
|
2
|
+
|
3
|
+
thread_spinner:
|
4
|
+
compose: air
|
5
|
+
singleton: false
|
6
|
+
|
7
|
+
yard:
|
8
|
+
|
9
|
+
pig:
|
10
|
+
compose: thread_spinner, yard
|
11
|
+
|
12
|
+
+inner_sanctum:
|
13
|
+
tick:
|
14
|
+
compose: thread_spinner
|
15
|
+
singleton: false
|
16
|
+
|
17
|
+
fat_cat:
|
18
|
+
compose: thread_spinner, tick, yard
|
19
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
class CoreView; end
|
@@ -0,0 +1 @@
|
|
1
|
+
class DataSource; end
|
@@ -0,0 +1 @@
|
|
1
|
+
class FringeView; end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
core_model:
|
3
|
+
compose: data_source
|
4
|
+
|
5
|
+
core_view:
|
6
|
+
|
7
|
+
core_presenter:
|
8
|
+
model: core_model
|
9
|
+
view: core_view
|
10
|
+
|
11
|
+
data_source:
|
12
|
+
|
13
|
+
+fringe_context:
|
14
|
+
|
15
|
+
fringe_model:
|
16
|
+
connected: core_model
|
17
|
+
|
18
|
+
fringe_view:
|
19
|
+
|
20
|
+
fringe_presenter:
|
21
|
+
compose: fringe_model, fringe_view
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
core_model:
|
3
|
+
compose: data_source
|
4
|
+
|
5
|
+
core_view:
|
6
|
+
|
7
|
+
core_presenter:
|
8
|
+
model: core_model
|
9
|
+
view: core_view
|
10
|
+
|
11
|
+
data_source:
|
12
|
+
|
13
|
+
+fringe_context:
|
14
|
+
|
15
|
+
fringe_model:
|
16
|
+
connected: core_model
|
17
|
+
|
18
|
+
fringe_view:
|
19
|
+
|
20
|
+
fringe_presenter:
|
21
|
+
compose: fringe_model, fringe_view
|
22
|
+
|
23
|
+
+deep_context:
|
24
|
+
krill:
|
25
|
+
|
26
|
+
giant_squid:
|
27
|
+
compose: fringe_view, core_model, krill
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
here = File.expand_path(File.dirname(__FILE__))
|
2
|
+
PROJ_ROOT = File.expand_path("#{here}/..")
|
3
|
+
$: << "#{PROJ_ROOT}/lib"
|
4
|
+
require 'test/unit'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'find'
|
7
|
+
require 'yaml'
|
8
|
+
require 'ostruct'
|
9
|
+
|
10
|
+
class Test::Unit::TestCase
|
11
|
+
include FileUtils
|
12
|
+
|
13
|
+
def path_to(file)
|
14
|
+
File.expand_path(File.dirname(__FILE__)) + file
|
15
|
+
end
|
16
|
+
|
17
|
+
def not_done
|
18
|
+
flunk "IMPLEMENT ME"
|
19
|
+
end
|
20
|
+
alias :implement_me :not_done
|
21
|
+
|
22
|
+
def poll(time_limit)
|
23
|
+
(time_limit * 10).to_i.times do
|
24
|
+
return true if yield
|
25
|
+
sleep 0.1
|
26
|
+
end
|
27
|
+
return false
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.method_added(msym)
|
31
|
+
# Prevent duplicate test methods
|
32
|
+
if msym.to_s =~ /^test_/
|
33
|
+
@_tracked_tests ||= {}
|
34
|
+
raise "Duplicate test #{msym}" if @_tracked_tests[msym]
|
35
|
+
@_tracked_tests[msym] = true
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.0
|
3
|
+
specification_version: 1
|
4
|
+
name: diy
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 1.0.0
|
7
|
+
date: 2007-11-20 00:00:00 -05:00
|
8
|
+
summary: Constructor-based dependency injection container using YAML input.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: dev@atomicobject.com
|
12
|
+
homepage:
|
13
|
+
rubyforge_project: atomicobjectrb
|
14
|
+
description: "== DESCRIPTION: DIY (Dependency Injection in Yaml) is a simple dependency injection library which focuses on declarative composition of objects through constructor injection. Currently, all objects that get components put into them must have a constructor that gets a hash with symbols as keys. Best used with constructor.rb Auto-naming and auto-library support is done."
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- Atomic Object
|
31
|
+
files:
|
32
|
+
- History.txt
|
33
|
+
- Manifest.txt
|
34
|
+
- README.txt
|
35
|
+
- Rakefile
|
36
|
+
- lib/diy.rb
|
37
|
+
- test/diy_test.rb
|
38
|
+
- test/files/broken_construction.yml
|
39
|
+
- test/files/cat/cat.rb
|
40
|
+
- test/files/cat/extra_conflict.yml
|
41
|
+
- test/files/cat/heritage.rb
|
42
|
+
- test/files/cat/needs_input.yml
|
43
|
+
- test/files/cat/the_cat_lineage.rb
|
44
|
+
- test/files/dog/dog_model.rb
|
45
|
+
- test/files/dog/dog_presenter.rb
|
46
|
+
- test/files/dog/dog_view.rb
|
47
|
+
- test/files/dog/file_resolver.rb
|
48
|
+
- test/files/dog/other_thing.rb
|
49
|
+
- test/files/dog/simple.yml
|
50
|
+
- test/files/donkey/foo.rb
|
51
|
+
- test/files/donkey/foo/bar/qux.rb
|
52
|
+
- test/files/fud/objects.yml
|
53
|
+
- test/files/fud/toy.rb
|
54
|
+
- test/files/gnu/objects.yml
|
55
|
+
- test/files/gnu/thinger.rb
|
56
|
+
- test/files/goat/base.rb
|
57
|
+
- test/files/goat/can.rb
|
58
|
+
- test/files/goat/goat.rb
|
59
|
+
- test/files/goat/objects.yml
|
60
|
+
- test/files/goat/paper.rb
|
61
|
+
- test/files/goat/plane.rb
|
62
|
+
- test/files/goat/shirt.rb
|
63
|
+
- test/files/goat/wings.rb
|
64
|
+
- test/files/horse/holder_thing.rb
|
65
|
+
- test/files/horse/objects.yml
|
66
|
+
- test/files/non_singleton/air.rb
|
67
|
+
- test/files/non_singleton/fat_cat.rb
|
68
|
+
- test/files/non_singleton/objects.yml
|
69
|
+
- test/files/non_singleton/pig.rb
|
70
|
+
- test/files/non_singleton/thread_spinner.rb
|
71
|
+
- test/files/non_singleton/tick.rb
|
72
|
+
- test/files/non_singleton/yard.rb
|
73
|
+
- test/files/yak/core_model.rb
|
74
|
+
- test/files/yak/core_presenter.rb
|
75
|
+
- test/files/yak/core_view.rb
|
76
|
+
- test/files/yak/data_source.rb
|
77
|
+
- test/files/yak/fringe_model.rb
|
78
|
+
- test/files/yak/fringe_presenter.rb
|
79
|
+
- test/files/yak/fringe_view.rb
|
80
|
+
- test/files/yak/giant_squid.rb
|
81
|
+
- test/files/yak/krill.rb
|
82
|
+
- test/files/yak/my_objects.yml
|
83
|
+
- test/files/yak/sub_sub_context_test.yml
|
84
|
+
- test/test_helper.rb
|
85
|
+
test_files:
|
86
|
+
- test/diy_test.rb
|
87
|
+
rdoc_options:
|
88
|
+
- --main
|
89
|
+
- README.txt
|
90
|
+
extra_rdoc_files:
|
91
|
+
- History.txt
|
92
|
+
- Manifest.txt
|
93
|
+
- README.txt
|
94
|
+
executables: []
|
95
|
+
|
96
|
+
extensions: []
|
97
|
+
|
98
|
+
requirements: []
|
99
|
+
|
100
|
+
dependencies:
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: constructor
|
103
|
+
version_requirement:
|
104
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 1.0.0
|
109
|
+
version:
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: hoe
|
112
|
+
version_requirement:
|
113
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.3.0
|
118
|
+
version:
|