freightrain 0.6.10 → 0.7.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/README.rdoc CHANGED
@@ -19,7 +19,8 @@ When you're done with that you can install freightrain with:
19
19
 
20
20
 
21
21
  == HOW DO I USE IT?
22
- There are small examples in the /examples repository folder
22
+ There are small examples in the /examples repository folder. There is also a tutorial (under construction, by Eric Cunningham) here : http://sites.google.com/site/freightrainlib
23
+
23
24
  An up to date larger example : http://github.com/bolthar/intersect
24
25
  Note that the project is currently in ALPHA state. Use it in production at your own risk :-)
25
26
 
@@ -49,5 +50,5 @@ Would also be very appreciated:
49
50
  For his help with the qtruby bindings
50
51
 
51
52
  == Eric Cunningham
52
- For bug reports and fixing the instructions
53
+ For bug reports, fixing the instructions, troubleshooting and building the tutorial at http://sites.google.com/site/freightrainlib
53
54
 
data/Rakefile CHANGED
@@ -9,9 +9,8 @@ require 'rake/testtask'
9
9
 
10
10
  spec = Gem::Specification.new do |s|
11
11
  s.name = 'freightrain'
12
- s.version = '0.6.10'
12
+ s.version = '0.7.0'
13
13
  s.add_dependency('require_all', '>= 1.1.0')
14
- s.add_dependency('needle', '>= 1.3.0')
15
14
  s.has_rdoc = false
16
15
  s.homepage = "http://github.com/bolthar/freightrain"
17
16
  s.executables = ['ftrain']
@@ -22,9 +22,9 @@ module Freightrain
22
22
  @cache = value
23
23
  end
24
24
  rescue Exception => ex #TODO: logger...
25
- p "#{@widget.name} - update"
26
- p ex.message
27
- p @path
25
+ # p "#{@widget.name} - update"
26
+ # p ex.message
27
+ # p @path
28
28
  end
29
29
  end
30
30
 
@@ -1,21 +1,21 @@
1
1
 
2
2
  module Freightrain
3
3
 
4
- def configure_container!(registry = Needle::Registry.new)
4
+ def configure_container!(registry = Freightrain::Registry.new)
5
5
 
6
6
  @registry = registry
7
7
 
8
8
  ContainerHookable.classes.each do |klass|
9
9
  klass.subclasses.each do |subclass|
10
10
  @registry.register(
11
- subclass.name.to_convention_sym, subclass.container_options) { subclass.new }
11
+ subclass, subclass.container_options)
12
12
  end
13
13
  end
14
14
 
15
15
  end
16
16
 
17
17
  def [](class_name)
18
- return @registry.send(class_name)
18
+ return @registry.resolve(class_name)
19
19
  end
20
20
 
21
21
  end
@@ -0,0 +1,22 @@
1
+
2
+ module Freightrain
3
+
4
+ class Registry
5
+
6
+ def initialize
7
+ @classes = {}
8
+ @cache = {}
9
+ end
10
+
11
+ def register(klass, options)
12
+ @classes[klass.name.to_convention_sym] = klass
13
+ @cache[klass.name.to_convention_sym] = klass.new if options[:model] == :singleton
14
+ end
15
+
16
+ def resolve(class_name)
17
+ return @cache[class_name] || @classes[class_name].new
18
+ end
19
+
20
+ end
21
+
22
+ end
@@ -9,11 +9,11 @@ class CallbackWrapper
9
9
  end
10
10
 
11
11
  def target
12
- return @method.name.split("_on_")[0]
12
+ return @method.name.to_s.split("_on_")[0]
13
13
  end
14
14
 
15
15
  def event
16
- return @method.name.split("_on_")[1].gsub("_", "-")
16
+ return @method.name.to_s.split("_on_")[1].gsub("_", "-")
17
17
  end
18
18
 
19
19
  end
data/lib/freightrain.rb CHANGED
@@ -1,7 +1,6 @@
1
1
 
2
2
  require 'rubygems'
3
3
 
4
- require 'needle'
5
4
  require 'require_all'
6
5
  require 'tmpdir'
7
6
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freightrain
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 6
9
- - 10
10
- version: 0.6.10
8
+ - 7
9
+ - 0
10
+ version: 0.7.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrea Dallera
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-19 00:00:00 +02:00
18
+ date: 2010-10-21 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -34,22 +34,6 @@ dependencies:
34
34
  version: 1.1.0
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: needle
39
- prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 27
46
- segments:
47
- - 1
48
- - 3
49
- - 0
50
- version: 1.3.0
51
- type: :runtime
52
- version_requirements: *id002
53
37
  description: ruby desktop development made easy
54
38
  email: andrea@andreadallera.com
55
39
  executables:
@@ -104,6 +88,7 @@ files:
104
88
  - lib/scaffolding/templates/viewmodel_toplevel.ftt
105
89
  - lib/freightrain.rb
106
90
  - lib/freightrain/ioc/container.rb
91
+ - lib/freightrain/ioc/registry.rb
107
92
  - lib/freightrain/ioc/container_hookable.rb
108
93
  - lib/freightrain/viewmodels/dialog_extension.rb
109
94
  - lib/freightrain/viewmodels/freight_view_model.rb