langrove 0.0.4.5 → 0.0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. data/.rvmrc +29 -38
  2. data/Gemfile +13 -7
  3. data/Gemfile.lock +35 -32
  4. data/Guardfile +11 -0
  5. data/README.md +34 -0
  6. data/Rakefile +8 -6
  7. data/bin/README.md +3 -0
  8. data/bin/langrove +1 -2
  9. data/langrove.gemspec +35 -0
  10. data/lib/langrove/README.md +82 -0
  11. data/lib/langrove/adaptor/README.md +92 -0
  12. data/lib/langrove/adaptor/adaptor_base.rb +123 -0
  13. data/lib/langrove/adaptor/base.rb +12 -2
  14. data/lib/langrove/adaptor/default.rb +8 -0
  15. data/lib/langrove/adaptor/event_machine_adaptor.rb +152 -0
  16. data/lib/langrove/adaptor/query_adaptor.rb +271 -0
  17. data/lib/langrove/behaviour/README.md +170 -0
  18. data/lib/langrove/behaviour/assessable.rb +63 -0
  19. data/lib/langrove/behaviour/base.rb +16 -0
  20. data/lib/langrove/behaviour/behaviour_base.rb +341 -0
  21. data/lib/langrove/behaviour/enqueueable.rb +104 -0
  22. data/lib/langrove/behaviour/notifiable.rb +48 -0
  23. data/lib/langrove/behaviour/persistable.rb +89 -0
  24. data/lib/langrove/behaviour/preloadable.rb +63 -0
  25. data/lib/langrove/daemon/README.md +7 -0
  26. data/lib/langrove/daemon/base.rb +9 -2
  27. data/lib/langrove/daemon/daemon_base.rb +330 -0
  28. data/lib/langrove/daemon/default.rb +3 -0
  29. data/lib/langrove/ext/README.md +48 -0
  30. data/lib/langrove/ext/class_loader.rb +9 -66
  31. data/lib/langrove/ext/config_item.rb +31 -23
  32. data/lib/langrove/ext/config_loader.rb +42 -8
  33. data/lib/langrove/ext/fake_config.rb +121 -0
  34. data/lib/langrove/ext/fake_logger.rb +50 -7
  35. data/lib/langrove/ext/fake_root.rb +38 -0
  36. data/lib/langrove/ext/hash.rb +56 -0
  37. data/lib/langrove/ext/i.rb +43 -0
  38. data/lib/langrove/ext/log_monitor.rb +272 -0
  39. data/lib/langrove/ext/module_loader.rb +52 -0
  40. data/lib/langrove/ext/recursive_string.rb +94 -0
  41. data/lib/langrove/ext/spec_helper.rb +84 -0
  42. data/lib/langrove/ext.rb +8 -2
  43. data/lib/langrove/handler/README.md +161 -0
  44. data/lib/langrove/handler/base.rb +29 -2
  45. data/lib/langrove/handler/default.rb +4 -0
  46. data/lib/langrove/handler/deferred.rb +105 -0
  47. data/lib/langrove/handler/handler_base.rb +242 -0
  48. data/lib/langrove/handler/http_servlet.rb +58 -0
  49. data/lib/langrove/handler/socket.rb +21 -0
  50. data/lib/langrove/handler/socket_base.rb +127 -0
  51. data/lib/langrove/handler/socket_multiplexer.rb +438 -0
  52. data/lib/langrove/handler/web_socket.rb +41 -0
  53. data/lib/langrove/plugin/README.md +76 -0
  54. data/lib/langrove/plugin/assessor.rb +363 -0
  55. data/lib/langrove/plugin/base.rb +18 -0
  56. data/lib/langrove/plugin/buffered_persistor.rb +97 -0
  57. data/lib/langrove/plugin/enqueuer.rb +186 -0
  58. data/lib/langrove/plugin/notifier.rb +144 -0
  59. data/lib/langrove/plugin/persistor.rb +360 -0
  60. data/lib/langrove/plugin/plugin_base.rb +79 -0
  61. data/lib/langrove/plugin/yaml_file.md +5 -0
  62. data/lib/langrove/plugin/yaml_file.rb +261 -0
  63. data/lib/langrove/protocol/README.md +102 -0
  64. data/lib/langrove/protocol/base.rb +10 -2
  65. data/lib/langrove/protocol/default.rb +3 -0
  66. data/lib/langrove/protocol/protocol_base.rb +60 -0
  67. data/lib/langrove/protocol/syslog.rb +34 -27
  68. data/lib/langrove/root/README.md +17 -0
  69. data/lib/langrove/root/base.rb +11 -0
  70. data/lib/langrove/root/config.rb +163 -0
  71. data/lib/langrove/root/root_base.rb +259 -0
  72. data/lib/langrove/server/README.md +7 -0
  73. data/lib/langrove/server/base.rb +9 -0
  74. data/lib/langrove/server/default.rb +3 -0
  75. data/lib/langrove/server/server_base.rb +301 -0
  76. data/lib/langrove/version.rb +3 -1
  77. data/lib/langrove.rb +44 -1
  78. data/spec/langrove/adaptor/adaptor_base_spec.rb +33 -0
  79. data/spec/langrove/adaptor/event_machine_adaptor_spec.rb +62 -0
  80. data/spec/langrove/adaptor/query_adaptor_spec.rb +94 -0
  81. data/spec/langrove/behaviour/assessable_spec.rb +42 -0
  82. data/spec/langrove/behaviour/behaviour_base_spec.rb +396 -0
  83. data/spec/langrove/behaviour/enqueueable_spec.rb +19 -0
  84. data/spec/langrove/behaviour/notifiable_spec.rb +6 -0
  85. data/spec/langrove/behaviour/persistable_spec.rb +19 -0
  86. data/spec/langrove/behaviour/preloadable_spec.rb +19 -0
  87. data/spec/langrove/daemon/base_spec.rb +6 -0
  88. data/spec/langrove/daemon/daemon_base_spec.rb +253 -0
  89. data/spec/langrove/ext/class_loader_spec.rb +9 -12
  90. data/spec/langrove/ext/fake_config_spec.rb +50 -0
  91. data/spec/langrove/ext/fake_logger_spec.rb +12 -0
  92. data/spec/langrove/ext/fake_root_spec.rb +19 -0
  93. data/spec/langrove/ext/hash_spec.rb +54 -0
  94. data/spec/langrove/ext/i_spec.rb +11 -0
  95. data/spec/langrove/ext/log_monitor_spec.rb +254 -0
  96. data/spec/langrove/ext/module_loader_spec.rb +70 -0
  97. data/spec/langrove/ext/recursive_string_spec.rb +132 -0
  98. data/{functional/config/environments/development.rb → spec/langrove/ext/spec_helper_spec.rb} +0 -0
  99. data/spec/langrove/handler/deferred_spec.rb +9 -0
  100. data/spec/langrove/handler/handler_base_spec.rb +134 -0
  101. data/spec/langrove/handler/socket_base_spec.rb +76 -0
  102. data/spec/langrove/handler/socket_multiplexer_spec.rb +480 -0
  103. data/spec/langrove/handler/socket_spec.rb +6 -0
  104. data/spec/langrove/handler/web_socket_spec.rb +19 -0
  105. data/spec/langrove/plugin/assessor_spec.rb +278 -0
  106. data/spec/langrove/plugin/buffered_persistor_spec.rb +94 -0
  107. data/spec/langrove/plugin/enqueuer_spec.rb +136 -0
  108. data/spec/langrove/plugin/notifier_spec.rb +107 -0
  109. data/spec/langrove/plugin/persistor_spec.rb +300 -0
  110. data/spec/langrove/plugin/plugin_base_spec.rb +86 -0
  111. data/spec/langrove/plugin/yaml_file_spec.rb +348 -0
  112. data/spec/langrove/protocol/protocol_base_spec.rb +19 -0
  113. data/spec/langrove/protocol/syslog_spec.rb +5 -2
  114. data/spec/langrove/root/config_spec.rb +103 -0
  115. data/spec/langrove/root/root_base_spec.rb +93 -0
  116. data/spec/langrove/server/server_base_spec.rb +414 -0
  117. data/spec/spec_helper.rb +38 -0
  118. metadata +157 -92
  119. data/.watchr +0 -27
  120. data/functional/config/boot.rb +0 -64
  121. data/functional/config/daemons.yml +0 -13
  122. data/functional/config/environment.rb +0 -28
  123. data/functional/config/environments/production.rb +0 -0
  124. data/functional/config/environments/test.rb +0 -0
  125. data/functional/lib/client/socket_to_file.rb +0 -47
  126. data/functional/lib/daemon/datagram.rb +0 -21
  127. data/functional/lib/protocol/socket_to_file.rb +0 -55
  128. data/functional/libexec/daemon.rb +0 -68
  129. data/functional/tmp/README +0 -1
  130. data/lib/langrove/_base.rb +0 -28
  131. data/lib/langrove/adaptor_base.rb +0 -116
  132. data/lib/langrove/client/base.rb +0 -2
  133. data/lib/langrove/client/datagram.rb +0 -25
  134. data/lib/langrove/client_base.rb +0 -92
  135. data/lib/langrove/daemon_base.rb +0 -281
  136. data/lib/langrove/ext/find.rb +0 -90
  137. data/lib/langrove/ext/persistable.rb +0 -103
  138. data/lib/langrove/handler_base.rb +0 -148
  139. data/lib/langrove/job/base.rb +0 -1
  140. data/lib/langrove/job_base.rb +0 -24
  141. data/lib/langrove/protocol_base.rb +0 -32
  142. data/spec/functional/daemon/datagram_spec.rb +0 -121
  143. data/spec/langrove/adaptor_base_spec.rb +0 -63
  144. data/spec/langrove/client/datagram_spec.rb +0 -1
  145. data/spec/langrove/client_base_spec.rb +0 -5
  146. data/spec/langrove/daemon_base_spec.rb +0 -154
  147. data/spec/langrove/ext/find_spec.rb +0 -53
  148. data/spec/langrove/ext/persistable_spec.rb +0 -117
  149. data/spec/langrove/handler_base_spec.rb +0 -103
  150. data/spec/langrove/job_base_spec.rb +0 -28
  151. data/spec/langrove/protocol_base_spec.rb +0 -6
  152. data/spec/todo_spec.rb +0 -12
  153. data/tmp/README +0 -2
@@ -1,103 +0,0 @@
1
- require 'resque'
2
- require 'yaml'
3
-
4
- # require 'updated_puppet_state'
5
-
6
- module LanGrove class Persistable
7
-
8
- def initialize( notifies = [] )
9
-
10
- @notifies = notifies
11
-
12
- @notifies.each do |worker|
13
-
14
- Object.const_set(
15
-
16
- worker.camelize, Class.new
17
-
18
- ) ### ??unless defined already??
19
-
20
- end
21
-
22
- end
23
-
24
- def load_hash( hash_instance, from_file )
25
- #
26
- # <hash_instance> as String (name of) variable storing the Hash
27
- #
28
-
29
- @logger.debug "loading from: #{from_file}" if @logger
30
-
31
- #
32
- # get the instance variable (late bind)
33
- #
34
- hash = self.instance_variable_get( hash_instance.to_sym )
35
- hash ||= {}
36
-
37
- begin
38
-
39
- #
40
- # load file contents, merge into hash and
41
- # store it at the instance variable
42
- #
43
- persisted = YAML.load_file( from_file )
44
- hash.merge!( persisted ) if persisted.is_a?( Hash )
45
- self.instance_variable_set( hash_instance.to_sym, hash )
46
-
47
- #
48
- # set flag to 'already in storage'
49
- #
50
- @stored = true
51
-
52
- rescue Exception => e
53
- @logger.error "FAILED loading from #{from_file} #{e}" if @logger
54
-
55
- end
56
- end
57
-
58
-
59
- def store_hash( hash_instance, to_file )
60
- #
61
- # <hash_instance> as String (name of) variable storing the Hash
62
- #
63
-
64
- if @stored != nil && @stored
65
-
66
- @logger.debug "storing to: #{to_file} skipped - no change"
67
- return
68
-
69
- end
70
-
71
- @logger.debug "storing to: #{to_file}"
72
-
73
- #
74
- # get the instance variable (late bind)
75
- #
76
- hash = self.instance_variable_get( hash_instance.to_sym )
77
-
78
- begin
79
-
80
- File.open(to_file, 'w') do |f|
81
-
82
- YAML::dump( hash, f )
83
- @stored = true
84
-
85
- end
86
-
87
- #@notifies.each do |worker|
88
- #
89
- # Resque.enqueue(
90
- #
91
- # Object.const_get( worker.camelize ), to_file
92
- #
93
- # )
94
- #
95
- #end
96
-
97
- rescue Exception => e
98
- @logger.error "FAILED storing to: #{to_file} #{e}" if @logger
99
- @stored = false
100
-
101
- end
102
- end
103
- end; end
@@ -1,148 +0,0 @@
1
- require 'langrove'
2
-
3
- module LanGrove::Handler class Base
4
-
5
- #
6
- # One handler exists in the daemon with
7
- # the primary purpose of housing through
8
- # an addressable Hash the set of connected
9
- # clients,
10
- #
11
- # In this:
12
- #
13
- # but, NOT YET
14
- #
15
- attr_writer :clients
16
-
17
- #
18
- # The protocol defininition per the config is
19
- # loaded by this Handler, but not instanciated.
20
- #
21
- # This definition is then exposed,
22
- #
23
- # By this:
24
- #
25
- attr_reader :protocol
26
-
27
- def start_daemon
28
-
29
- #
30
- # OVERRIDE
31
- #
32
- # To prepare the Handler in any necessary
33
- # ways before the thread is handed over to
34
- # the socket listener, (or thing),
35
- #
36
- # The daemon has just started.
37
- #
38
-
39
- end
40
-
41
- def stop_daemon
42
-
43
- #
44
- # OVERRIDE
45
- #
46
- # To perfom any necessties before process
47
- # termination,
48
- #
49
- # The daemon has received a signal to stop.
50
- #
51
-
52
- end
53
-
54
- def periodic
55
-
56
- #
57
- # Call periodic on all clients
58
- # in the collection
59
- #
60
-
61
- @clients.each do |key, value|
62
-
63
- if value == 1 then
64
-
65
- key.periodic
66
-
67
- next
68
-
69
- end
70
-
71
- value.periodic
72
-
73
- end
74
-
75
- end
76
-
77
- def connect( client )
78
-
79
- #
80
- # A client has connected at the Adaptor
81
- #
82
- # It should be inserted into the collection
83
- # of clients maintained here.
84
- #
85
- @logger.debug "Client::#{client} registers with Handler#{self}"
86
-
87
- if client.respond_to?( :unique_key ) then
88
-
89
- @clients[ client.unique_key ] = client
90
- return
91
-
92
- end
93
-
94
- @clients[ client ] = 1
95
-
96
- end
97
-
98
- def disconnect( client )
99
-
100
- #
101
- # A client has disconnected
102
- #
103
- # It should be removed from the collection.
104
- #
105
-
106
- #
107
- # TODO: There will likely be a callback
108
- # in the EM::Connection superclass
109
- # that can be used here.
110
- #
111
- # Client::Base extends EM::Connection
112
- #
113
-
114
- @logger.info( "TODO: implement #{self.classname}disconnect()" )
115
-
116
- end
117
-
118
- def initialize( config_hash, daemon_name, logger )
119
-
120
- @config = config_hash
121
- @daemon_name = daemon_name
122
- @logger = logger
123
-
124
- @clients = {}
125
-
126
- begin
127
-
128
- @logger.info "TODO: fall back to default Handler::Base"
129
-
130
- @my_config = @config[ :daemons ][ @daemon_name ][ :handler ]
131
-
132
- rescue
133
-
134
- error = "Missing config item for daemon: #{@daemon_name}"
135
-
136
- @logger.error "EXIT: #{error}"
137
-
138
- raise LanGrove::DaemonConfigException.new(
139
-
140
- "Missing config item for daemon: #{@daemon_name}"
141
-
142
- )
143
-
144
- end
145
-
146
- end
147
-
148
- end; end
@@ -1 +0,0 @@
1
- require 'langrove/job_base'
@@ -1,24 +0,0 @@
1
- #
2
- # no spec
3
- #
4
- module LanGrove
5
-
6
- module Job
7
-
8
- class Base
9
-
10
- def initialize( config, queue_name, logger)
11
-
12
- logger.info ( "starting unimplemented queuer") unless logger.nil?
13
-
14
- end
15
-
16
- def method_missing( symbol, *args, &block )
17
- puts "#{self}.#{symbol}( #{args} )" unless @parameter == :silent
18
- end
19
-
20
- end
21
-
22
- end
23
-
24
- end
@@ -1,32 +0,0 @@
1
- require 'langrove'
2
-
3
- module LanGrove::Protocol
4
-
5
- class Base
6
-
7
- def initialize( place_mark_protocol_config, logger )
8
-
9
- @logger = logger
10
-
11
- end
12
-
13
- def decode( data )
14
-
15
- #
16
- # OVERRIDE
17
- #
18
- # To decode the data ahead of passing it
19
- # into the <Handler>.receive() function.
20
- #
21
-
22
- {
23
-
24
- :data => data
25
-
26
- }
27
-
28
- end
29
-
30
- end
31
-
32
- end
@@ -1,121 +0,0 @@
1
- require 'langrove'
2
-
3
- describe 'A daemon' do
4
-
5
- #
6
- # HINT: tail -f functional/log/development.log
7
- #
8
- # To see this test in action.
9
- #
10
-
11
- #
12
- # Use the demos in ./functional dir for integration tests
13
- #
14
- # Note: This uses the init.d style start|stop functionality
15
- # as provided by DaemonKit
16
- #
17
- # Therefore, bugs that may exist in DaemonKit could be
18
- # exposed here.
19
- #
20
- # I have not directly ovbserved any thus far.
21
- #
22
-
23
- before :all do
24
-
25
- @daemon_name = 'datagram'
26
-
27
- #
28
- # cd - to get the rvm environment up
29
- #
30
- @daemon_root = File.expand_path("../../../../functional", __FILE__)
31
- @daemon_stub = "./bin/#{@daemon_name}"
32
-
33
- #
34
- # Daemon is configured with Handler::SocketToFile
35
- #
36
- # The test sends a message to the daemon and then
37
- # verifies the presence of the file.
38
- #
39
- @file = "#{@daemon_root}/tmp/datagram.txt"
40
- @mesg = "Hello Datagram To File"
41
-
42
- #
43
- # remove the file ahead of testing
44
- #
45
- `rm -f #{@file}`
46
-
47
- #
48
- # call shell to start daemon
49
- #
50
-
51
- `cd #{@daemon_root} && #{@daemon_stub} start`
52
-
53
- #
54
- # give it a moment to start
55
- #
56
- sleep 1
57
-
58
- end
59
-
60
- after :all do
61
-
62
- #
63
- # call shell to stop daemon
64
- #
65
- `cd #{@daemon_root} && #{@daemon_stub} stop`
66
-
67
- end
68
-
69
- context 'running a server' do
70
-
71
- it 'receives a message' do
72
-
73
- require "eventmachine"
74
-
75
- class Sender < EventMachine::Connection
76
-
77
- def send( data )
78
-
79
- send_datagram( data, '127.0.0.1', 12701 )
80
-
81
- end
82
-
83
- end
84
-
85
- EM.run do
86
-
87
- sender = nil
88
-
89
- EM.add_periodic_timer(1) do
90
-
91
- sender.send( "#{@file}|#{@mesg}" )
92
- EM.stop
93
-
94
- end
95
-
96
- EM.open_datagram_socket "127.0.0.1", 0, Sender do |connected|
97
-
98
- sender = connected
99
-
100
- end
101
-
102
- end
103
-
104
- #
105
- # Give the daemon a moment to write the file
106
- #
107
- sleep 1
108
-
109
- File.file?( @file ).should == true
110
-
111
- File.open( @file, 'r' ).each_line do |line|
112
-
113
- line.should == @mesg
114
-
115
- end
116
-
117
- end
118
-
119
- end
120
-
121
- end
@@ -1,63 +0,0 @@
1
- require 'langrove'
2
-
3
- describe LanGrove::Adaptor::Base do
4
-
5
- before :each do
6
-
7
- @logger = LanGrove::FakeLogger.new
8
-
9
- @extendhandler = 'ExtendedHandler'
10
-
11
- @config = {
12
-
13
- :iface => '111.111.111.111',
14
-
15
- :port => 11111,
16
-
17
- :connector => @extendhandler,
18
-
19
- :transport => 'udp'
20
- }
21
-
22
- end
23
-
24
-
25
-
26
- it 'assigns the session layer protocol as udp' do
27
-
28
- subject = LanGrove::Adaptor::Base.new( @config, @logger )
29
- subject.instance_variable_get( :@em_server_call ).should == :open_datagram_socket
30
-
31
- end
32
-
33
- it 'assigns the session layer protocol as tcp by default' do
34
-
35
- @config.delete :transport
36
-
37
- subject = LanGrove::Adaptor::Base.new( @config, @logger )
38
-
39
- subject.instance_variable_get( :@em_server_call ).should == :start_server
40
-
41
- end
42
-
43
- pending 'may need to override default connection handler' do
44
-
45
- LanGrove::Adaptor.const_set( @extendhandler, Class.new )
46
-
47
- subject = LanGrove::Adaptor::Base.new( @config, @logger )
48
- connector = subject.instance_variable_get( :@handler )
49
-
50
- connector.should == LanGrove::Adaptor.const_get( @extendhandler )
51
-
52
- end
53
-
54
- pending 'assigns defaults' do
55
-
56
- subject = LanGrove::Adaptor::Base.new( {}, @logger )
57
- connector = subject.instance_variable_get( :@connector )
58
-
59
- connector.should == LanGrove::Adaptor::SocketHandler
60
-
61
- end
62
-
63
- end
@@ -1 +0,0 @@
1
- require 'langrove/client/datagram'
@@ -1,5 +0,0 @@
1
- require 'langrove'
2
-
3
- describe LanGrove::Client::Base do
4
-
5
- end
@@ -1,154 +0,0 @@
1
- require 'langrove'
2
-
3
- describe LanGrove::Daemon::Base do
4
-
5
- before :each do
6
-
7
- @logger = LanGrove::FakeLogger.new :silent
8
-
9
- @daemon_name = 'pretend_daemon'
10
-
11
- @adaptor_class = 'MyEventMachineServer'
12
- @collection_class = 'Base'
13
- @client_class = 'Base'
14
- @protocol_class = 'Base'
15
-
16
- @config = {
17
-
18
- :daemons => {
19
-
20
- @daemon_name => {
21
-
22
- :server => false,
23
-
24
- :adaptor => {
25
-
26
- # Test default
27
-
28
- },
29
-
30
- :client => {
31
-
32
- :class => @client_class
33
-
34
- },
35
-
36
- :protocol => {
37
-
38
- :class => @protocol_class
39
-
40
- },
41
-
42
- :handler => {
43
-
44
- :collection => @collection_class
45
-
46
- }
47
- }
48
- }
49
- }
50
-
51
- end
52
-
53
- subject do
54
-
55
- LanGrove::Daemon::Base.new( @config, @daemon_name, @logger )
56
-
57
- end
58
-
59
- it 'requires a logger' do
60
-
61
- expect {
62
-
63
- LanGrove::Daemon::Base.new( @config, @daemon_name, nil )
64
-
65
- }.to raise_error( LanGrove::DaemonConfigException,
66
-
67
- /Requires a logger/
68
-
69
- )
70
-
71
- end
72
-
73
- it 'requires a configuration' do
74
-
75
- expect {
76
-
77
- LanGrove::Daemon::Base.new( {}, @daemon_name, @logger )
78
-
79
- }.to raise_error( LanGrove::DaemonConfigException,
80
-
81
- /Missing config item/
82
-
83
- )
84
-
85
- end
86
-
87
- it 'attempts to latebind an adaptor by config' do
88
-
89
- @config[ :daemons ][ @daemon_name ][ :adaptor ][ :class ] = @adaptor_class
90
-
91
- expect {
92
-
93
- LanGrove::Daemon::Base.new( @config, @daemon_name, @logger )
94
-
95
- }.to raise_error( LanGrove::ClassLoaderException,
96
-
97
-
98
- "no such file to load -- adaptor/my_event_machine_server.rb"
99
-
100
- )
101
-
102
- end
103
-
104
- it 'defaults to Adaptor::Base' do
105
-
106
-
107
- adaptor = subject.instance_variable_get( :@adaptor )
108
- adaptor.should be_a( LanGrove::Adaptor::Base )
109
-
110
- end
111
-
112
- it 'latebinds a handler by config' do
113
-
114
- handler = subject.instance_variable_get( :@handler )
115
-
116
- handler.should be_a( LanGrove::Handler.const_get( @collection_class ) )
117
-
118
- end
119
-
120
- it 'loads the client defininition by config' do
121
-
122
- client = subject.instance_variable_get( :@client )
123
-
124
- client.should == LanGrove::Client::Base
125
-
126
- end
127
-
128
- it 'does not instanciate the client' do
129
-
130
- client = subject.instance_variable_get( :@client )
131
-
132
- client.should_not be_a(LanGrove::Client::Base)
133
-
134
- end
135
-
136
- it 'loads the protocol defininition by config' do
137
-
138
- protocol = subject.instance_variable_get( :@protocol )
139
-
140
- protocol.should == LanGrove::Protocol::Base
141
-
142
- end
143
-
144
- it 'does not instanciate the protocol' do
145
-
146
- protocol = subject.instance_variable_get( :@protocol )
147
-
148
- protocol.should_not be_a(LanGrove::Protocol::Base)
149
-
150
- end
151
-
152
- it 'it schedules periodics'
153
-
154
- end
@@ -1,53 +0,0 @@
1
- require 'langrove/ext/find'
2
-
3
- describe LanGrove::Find do
4
-
5
- before :each do
6
-
7
-
8
- @path = File.expand_path('../../../../bin', __FILE__ )
9
-
10
- end
11
-
12
- it 'searches finds' do
13
-
14
- test = []
15
-
16
- LanGrove::Find.with(
17
-
18
- :type => :file,
19
- :path => @path,
20
- :relative => true
21
-
22
- ) do |found|
23
-
24
- test << found
25
-
26
- end
27
-
28
- test.length.should == 1
29
- test[0].should == 'langrove'
30
-
31
- end
32
-
33
- it 'searches filters' do
34
-
35
- test = []
36
-
37
- LanGrove::Find.with(
38
-
39
- :type => :file,
40
- :path => @path,
41
- :include => 'scotch mist'
42
-
43
- ) do |found|
44
-
45
- test << found
46
-
47
- end
48
-
49
- test.length.should == 0
50
-
51
- end
52
-
53
- end