procemon 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -17,44 +17,44 @@ short lazy doc
17
17
 
18
18
  in Str2duck
19
19
 
20
- # convert string object to something what is it looks to be as duck type mean to do
21
- # useful for RESTfull aps when data sent as string
20
+ convert string object to something what is it looks to be as duck type mean to do
21
+ useful for RESTfull aps when data sent as string
22
22
  duck
23
23
 
24
24
 
25
25
  in Tmp_dir
26
26
 
27
- # init a tmpdir in the OS tmp folder with the application name
28
- # (by default this is the root folder name)
27
+ init a tmpdir in the OS tmp folder with the application name
28
+ (by default this is the root folder name)
29
29
  tmpdir_init
30
30
 
31
31
 
32
32
  in Name
33
33
 
34
- # what it looks to be
34
+ what it looks to be
35
35
  set_app_name_by_root_folder
36
36
 
37
37
 
38
38
  in Argv
39
39
 
40
- # what it looks to be
40
+ what it looks to be
41
41
  process_parameters
42
42
 
43
43
 
44
44
  in Daemon
45
45
 
46
- # Checks to see if the current process is the child process and if not
47
- # will update the pid file with the child pid.
46
+ Checks to see if the current process is the child process and if not
47
+ will update the pid file with the child pid.
48
48
  self.start pid, pidfile, outfile, errfile
49
49
 
50
- # Attempts to write the pid of the forked process to the pid file.
50
+ Attempts to write the pid of the forked process to the pid file.
51
51
  self.write pid, pidfile
52
52
 
53
- # Try and read the existing pid from the pid file and signal the
54
- # process. Returns true for a non blocking status.
53
+ Try and read the existing pid from the pid file and signal the
54
+ process. Returns true for a non blocking status.
55
55
  self.kill(pidfile)
56
56
 
57
- # Send stdout and stderr to log files for the child process
57
+ Send stdout and stderr to log files for the child process
58
58
  self.redirect outfile, errfile
59
59
  self.daemonize
60
60
  self.kill_with_pid
@@ -66,65 +66,65 @@ self.init
66
66
 
67
67
  in Inject_methods
68
68
 
69
- # this will inject a code block to a target instance method
70
- # by default the before or after sym is not required
71
- # default => before
72
- #
73
- # Test.inject_singleton_method :hello do |*args|
74
- # puts "singleton extra, so#{args[0]}"
75
- # end
76
- #
69
+ this will inject a code block to a target instance method
70
+ by default the before or after sym is not required
71
+ default => before
72
+
73
+ Test.inject_singleton_method :hello do |*args|
74
+ puts "singleton extra, so{args[0]}"
75
+ end
76
+
77
77
  inject_singleton_method(method,options=:before,&block)
78
78
 
79
- #Singleton.methods[self.object_id]= self.method(method)
80
- # this will inject a code block to a target singleton method
81
- # by default the before or after sym is not required
82
- # default => before
83
- #
84
- # Test.inject_instance_method :hello, :before do |*args|
85
- # puts "singleton on a instance method and "+args[0]
86
- # end
87
- #
79
+ Singleton.methods[self.object_id]= self.method(method)
80
+ this will inject a code block to a target singleton method
81
+ by default the before or after sym is not required
82
+ default => before
83
+
84
+ Test.inject_instance_method :hello, :before do |*args|
85
+ puts "singleton on a instance method and "+args[0]
86
+ end
87
+
88
88
  inject_instance_method(method,options=:before,&block)
89
89
 
90
90
 
91
91
  in Require
92
92
 
93
- # load meta-s
93
+ load meta-s
94
94
  meta_load(app_folder= Dir.pwd)
95
95
 
96
- # find elements
96
+ find elements
97
97
  get_meta_config(app_folder= Dir.pwd)
98
98
 
99
- # defaults
100
- # find elements
101
- # defaults
102
- # processing
103
- # return data
104
- # mount libs
99
+ defaults
100
+ find elements
101
+ defaults
102
+ processing
103
+ return data
104
+ mount libs
105
105
  mount_libs(app_folder= Dir.pwd)
106
106
 
107
- # load lib files
108
- # Offline repo activate
107
+ load lib files
108
+ Offline repo activate
109
109
  mount_modules(app_folder= Dir.pwd)
110
110
 
111
- #Return File_name => File_path
111
+ Return File_name => File_path
112
112
  get_files(folder)
113
113
 
114
- # Validation
115
- # Check that does the folder is absolute or not
116
- # Get Files list
117
- # Return file_name:folder
118
- # require by absolute path directory's files
114
+ Validation
115
+ Check that does the folder is absolute or not
116
+ Get Files list
117
+ Return file_name:folder
118
+ require by absolute path directory's files
119
119
  require_directory(folder)
120
120
 
121
- # require sender relative directory's files
121
+ require sender relative directory's files
122
122
  require_relative_directory(folder)
123
123
 
124
- # generate config from yaml (default is app_root/config folder)
124
+ generate config from yaml (default is app_root/config folder)
125
125
  generate_config(target_config_hash= Application.config,app_folder= Dir.pwd)
126
126
 
127
- # try load all the ruby files marked with "generate" in they name from app_root/docs
127
+ try load all the ruby files marked with "generate" in they name from app_root/docs
128
128
  generate_documentation(boolean= false,keyword= "generate",app_folder= Dir.pwd)
129
129
 
130
130
 
@@ -136,21 +136,21 @@ port_open?(port,host="0.0.0.0")
136
136
 
137
137
  in Eval
138
138
 
139
- # NOT working yet, need to rework the exclude method
140
- # safe_eval(string [, binding [, filename [,lineno]]] *allowed_class/module_names ) -> obj
141
- #
142
- # Evaluates the Ruby expression(s) in <em>string</em>. If
143
- # <em>binding</em> is given, which must be a <code>Binding</code>
144
- # object, the evaluation is performed in its context. If the
145
- # optional <em>filename</em> and <em>lineno</em> parameters are
146
- # present, they will be used when reporting syntax errors.
147
- #
148
- # def get_binding(str)
149
- # return binding
150
- # end
151
- # str = "hello"
152
- # safe_eval "str + ' Fred'" ,Kernel#=> "hello Fred"
153
- # safe_eval "str + ' Fred'", get_binding("bye") ,Kernel#=> "bye Fred"
139
+ NOT working yet, need to rework the exclude method
140
+ safe_eval(string [, binding [, filename [,lineno]]] *allowed_class/module_names ) -> obj
141
+
142
+ Evaluates the Ruby expression(s) in <em>string</em>. If
143
+ <em>binding</em> is given, which must be a <code>Binding</code>
144
+ object, the evaluation is performed in its context. If the
145
+ optional <em>filename</em> and <em>lineno</em> parameters are
146
+ present, they will be used when reporting syntax errors.
147
+
148
+ def get_binding(str)
149
+ return binding
150
+ end
151
+ str = "hello"
152
+ safe_eval "str + ' Fred'" ,Kernel#=> "hello Fred"
153
+ safe_eval "str + ' Fred'", get_binding("bye") ,Kernel#=> "bye Fred"
154
154
  safe_eval(*args)
155
155
 
156
156
 
@@ -162,27 +162,27 @@ self.stop
162
162
 
163
163
  in String
164
164
 
165
- # Find string in othere string
165
+ Find string in othere string
166
166
  positions(oth_string)
167
167
 
168
- # return value
169
- # Standard in rails. See official documentation
170
- # [http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/String/Inflections.html]
168
+ return value
169
+ Standard in rails. See official documentation
170
+ [http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/String/Inflections.html]
171
171
  camelize(first_letter = :upper)
172
172
 
173
- # Standard in rails. See official documentation
174
- # [http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/String/Inflections.html]
173
+ Standard in rails. See official documentation
174
+ [http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/String/Inflections.html]
175
175
  dasherize
176
176
 
177
- # Standard in rails. See official documentation
178
- # [http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/String/Inflections.html]
177
+ Standard in rails. See official documentation
178
+ [http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/String/Inflections.html]
179
179
  demodulize
180
180
 
181
- # Standard in rails. See official documentation
182
- # [http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/String/Inflections.html]
181
+ Standard in rails. See official documentation
182
+ [http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/String/Inflections.html]
183
183
  underscore
184
184
 
185
- # Check that instance of String is start with an upper case or not
185
+ Check that instance of String is start with an upper case or not
186
186
  capitalized?
187
187
 
188
188
 
@@ -195,59 +195,59 @@ self.load_file(file_path)
195
195
 
196
196
  in Object
197
197
 
198
- # The hidden singleton lurks behind everyone
198
+ The hidden singleton lurks behind everyone
199
199
  metaclass; class << self; self; end; end
200
200
 
201
- # extend the metaclass with an instance eval
201
+ extend the metaclass with an instance eval
202
202
  meta_eval &blk; metaclass.instance_eval &blk; end
203
203
 
204
- # Adds methods to a metaclass
204
+ Adds methods to a metaclass
205
205
  meta_name, &blk
206
206
 
207
- # Defines an instance method within a class
207
+ Defines an instance method within a class
208
208
  class_name, &blk
209
209
 
210
- # constantize object
210
+ constantize object
211
211
  constantize
212
212
 
213
- # find and replace object in object
213
+ find and replace object in object
214
214
  find_and_replace(input,*params)
215
215
 
216
- # it was made only for fun to make same each to array and hash and everything
216
+ it was made only for fun to make same each to array and hash and everything
217
217
  each_universal(&block)
218
218
 
219
- # map an object => experiment
219
+ map an object => experiment
220
220
  map_object(symbol_key="$type")
221
221
 
222
- # is class?
222
+ is class?
223
223
  class?
224
224
 
225
- # convert class instance instance variables into a hash object
225
+ convert class instance instance variables into a hash object
226
226
  convert_to_hash
227
227
 
228
- # this will check that the class is
229
- # defined or not in the runtime memory
228
+ this will check that the class is
229
+ defined or not in the runtime memory
230
230
  class_exists?
231
231
 
232
- # This will convert a symbol or string and format to be a valid
233
- # constant name and create from it a class with instance attribute accessors
234
- # Best use is when you get raw data in string from external source
235
- # and you want make them class objects
236
- #
237
- # :hello_world.to_class(:test)
238
- # HelloWorld.to_class(:sup)
239
- # hw_var = HelloWorld.new
240
- # hw_var.sup = "Fine thanks!"
241
- # hw_var.test = 5
242
- #
243
- # puts hw_var.test
244
- #
245
- #> produce 5 :Integer
246
- #
247
- # you can also use this formats
248
- # :HelloWorld , "hello.world",
249
- # "hello/world", "Hello::World",
250
- # "hello:world"...
232
+ This will convert a symbol or string and format to be a valid
233
+ constant name and create from it a class with instance attribute accessors
234
+ Best use is when you get raw data in string from external source
235
+ and you want make them class objects
236
+
237
+ :hello_world.to_class(:test)
238
+ HelloWorld.to_class(:sup)
239
+ hw_var = HelloWorld.new
240
+ hw_var.sup = "Fine thanks!"
241
+ hw_var.test = 5
242
+
243
+ puts hw_var.test
244
+
245
+ > produce 5 :Integer
246
+
247
+ you can also use this formats
248
+ :HelloWorld , "hello.world",
249
+ "hello/world", "Hello::World",
250
+ "hello:world"...
251
251
  to_class(*attributes)
252
252
  or
253
253
  create_attributes(*attributes)
@@ -259,63 +259,63 @@ self.create(route_name ,filemod="w",string_data=String.new)
259
259
 
260
260
  in Array
261
261
 
262
- # remove arguments or array of
263
- # parameters from the main array
262
+ remove arguments or array of
263
+ parameters from the main array
264
264
  trim(*args)
265
265
 
266
- # return index of the target element
266
+ return index of the target element
267
267
  index_of(target_element)
268
268
 
269
- # remove n. element from the end
270
- # and return a new object
269
+ remove n. element from the end
270
+ and return a new object
271
271
  pinch n=1
272
272
 
273
- # remove n. element from the end
274
- # and return the original object
273
+ remove n. element from the end
274
+ and return the original object
275
275
  pinch! n=1
276
276
 
277
- # return boolean by other array
278
- # all element included or
279
- # not in the target array
277
+ return boolean by other array
278
+ all element included or
279
+ not in the target array
280
280
  contain?(oth_array)#anothere array
281
281
 
282
- # do safe transpose
282
+ do safe transpose
283
283
  safe_transpose
284
284
 
285
285
 
286
286
  in Class
287
287
 
288
- # get singleton methods to target class without super class methods
288
+ get singleton methods to target class without super class methods
289
289
  class_methods
290
290
 
291
- # bind a singleton method to a class object
291
+ bind a singleton method to a class object
292
292
  create_class_method(method,&block)
293
293
 
294
- # create an instance method
294
+ create an instance method
295
295
  create_instance_method(method,&block)
296
296
 
297
- # Iterates over all subclasses (direct and indirect)
297
+ Iterates over all subclasses (direct and indirect)
298
298
  each_subclass
299
299
 
300
- # Returns an Array of subclasses (direct and indirect)
300
+ Returns an Array of subclasses (direct and indirect)
301
301
  subclasses
302
302
 
303
- # Returns an Array of direct subclasses
303
+ Returns an Array of direct subclasses
304
304
  direct_subclasses
305
305
 
306
- # create singleton attribute
306
+ create singleton attribute
307
307
  class_attr_accessor(name)
308
308
 
309
- # GET
310
- # SET
311
- # create class instance attribute
309
+ GET
310
+ SET
311
+ create class instance attribute
312
312
  instance_attr_accessor(name)
313
313
 
314
314
 
315
315
  in Integer
316
316
 
317
- # because for i in integer/fixnum not working,
318
- # here is a little patch
317
+ because for i in integer/fixnum not working,
318
+ here is a little patch
319
319
  each &block
320
320
 
321
321
 
@@ -336,37 +336,37 @@ datetime from = Time.at(1114924812), to = Time.now
336
336
 
337
337
  in Hash
338
338
 
339
- # remove elements by keys,
340
- # array of keys,
341
- # hashTags,
342
- # strings
339
+ remove elements by keys,
340
+ array of keys,
341
+ hashTags,
342
+ strings
343
343
  trim(*args)
344
344
 
345
- #pass single or array of keys, which will be removed, returning the remaining hash
345
+ pass single or array of keys, which will be removed, returning the remaining hash
346
346
  remove!(*keys)
347
347
 
348
- #non-destructive version
348
+ non-destructive version
349
349
  remove(*keys)
350
350
 
351
- # Returns a new hash with +self+ and +other_hash+ merged recursively.
352
- #
353
- # h1 = {:x => {:y => [4,5,6]}, :z => [7,8,9]}
354
- # h2 = {:x => {:y => [7,8,9]}, :z => "xyz"}
351
+ Returns a new hash with +self+ and +other_hash+ merged recursively.
352
+
353
+ h1 = {:x => {:y => [4,5,6]}, :z => [7,8,9]}
354
+ h2 = {:x => {:y => [7,8,9]}, :z => "xyz"}
355
355
  #
356
- # h1.deep_merge(h2#=> { :x => {:y => [7, 8, 9]}, :z => "xyz" }
357
- # h2.deep_merge(h1#=> { :x => {:y => [4, 5, 6]}, :z => [7, 8, 9] }
356
+ h1.deep_merge(h2#=> { :x => {:y => [7, 8, 9]}, :z => "xyz" }
357
+ h2.deep_merge(h1#=> { :x => {:y => [4, 5, 6]}, :z => [7, 8, 9] }
358
358
  deep_merge(other_hash)
359
359
 
360
- # Same as +deep_merge+, but modifies +self+.
360
+ Same as +deep_merge+, but modifies +self+.
361
361
  deep_merge!(other_hash)
362
362
 
363
- # return bool that does the sub hash all element include the hash who call this or not
363
+ return bool that does the sub hash all element include the hash who call this or not
364
364
  deep_include?(sub_hash)
365
365
 
366
366
 
367
367
  in Kernel
368
368
 
369
- # eats puts like formated printf method
370
- # just use an integer what will be the distance
371
- # between elements and the elements next to it
369
+ eats puts like formated printf method
370
+ just use an integer what will be the distance
371
+ between elements and the elements next to it
372
372
  putsf(integer,*args)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -13,8 +13,8 @@ module Application
13
13
  :config_file,
14
14
  :create_documentation
15
15
  end
16
- self.config= Hash.new()
17
- self.environment= String.new()
16
+ self.config ||= Hash.new()
17
+ self.environment ||= String.new()
18
18
  end
19
19
 
20
20
  App= Application unless defined?(App)
@@ -0,0 +1,13 @@
1
+ class Object
2
+ def get_binding
3
+ return binding
4
+ end
5
+ end
6
+
7
+ class Array
8
+ def debug binding
9
+ self.each do |arg|
10
+ puts "arg = #{eval(arg, binding).inspect}"
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ class Proc
2
+
3
+ def call_with_binding(bind, *args)
4
+ LookupStack.new([bind]).run_proc(self, *args)
5
+ end
6
+
7
+ def call_with_obj(obj, *args)
8
+ m = nil
9
+ p = self
10
+ Object.class_eval do
11
+ define_method :a_temp_method_name, &p
12
+ m = instance_method :a_temp_method_name; remove_method :a_temp_method_name
13
+ end
14
+ m.bind(obj).call(*args)
15
+ end
16
+
17
+ end
@@ -0,0 +1,57 @@
1
+ class LookupStack
2
+
3
+ def initialize(bindings = [])
4
+ @bindings = bindings
5
+ end
6
+
7
+ def method_missing(m, *args)
8
+ @bindings.reverse_each do |bind|
9
+ begin
10
+ method = eval("method(%s)" % m.inspect, bind)
11
+ rescue NameError
12
+ else
13
+ return method.call(*args)
14
+ end
15
+ begin
16
+ value = eval(m.to_s, bind)
17
+ return value
18
+ rescue NameError
19
+ end
20
+ end
21
+ raise NoMethodError, "No such variable or method: %s" % m
22
+ end
23
+
24
+ def pop_binding
25
+ @bindings.pop
26
+ end
27
+
28
+ def push_binding(bind)
29
+ @bindings.push bind
30
+ end
31
+
32
+ def push_instance(obj)
33
+ @bindings.push obj.instance_eval { binding }
34
+ end
35
+
36
+ def push_hash(vars)
37
+ push_instance Struct.new(*vars.keys).new(*vars.values)
38
+ end
39
+
40
+ def get_binding
41
+ instance_eval { binding }
42
+ end
43
+
44
+ def run_proc(p, *args)
45
+ instance_exec(*args, &p)
46
+ end
47
+
48
+ def push_method(name, p, obj=nil)
49
+ x = Object.new
50
+ singleton = class << x; self; end
51
+ singleton.send(:define_method, name, lambda { |*args|
52
+ obj.instance_exec(*args, &p)
53
+ })
54
+ push_instance x
55
+ end
56
+
57
+ end
@@ -21,14 +21,14 @@ class Class
21
21
 
22
22
  when options == :before
23
23
  begin
24
- block.call *arguments
24
+ block.call_with_binding self.get_binding, *arguments
25
25
  original_method.call *arguments
26
26
  end
27
27
 
28
28
  when options == :after
29
29
  begin
30
30
  original_method.call *arguments
31
- block.call *arguments
31
+ block.call_with_binding self.get_binding, *arguments
32
32
  end
33
33
 
34
34
  end
@@ -55,14 +55,14 @@ class Class
55
55
 
56
56
  when options == :before
57
57
  begin
58
- block.call *args
58
+ block.call_with_binding self.get_binding, *args
59
59
  self.__send__ :"old_#{method.to_s}", *args
60
60
  end
61
61
 
62
62
  when options == :after
63
63
  begin
64
64
  self.__send__ :"old_#{method.to_s}", *args
65
- block.call *args
65
+ block.call_with_binding self.get_binding, *args
66
66
  end
67
67
 
68
68
  end
File without changes
@@ -1,16 +1,18 @@
1
1
  module Kernel
2
2
 
3
3
  # load meta-s
4
- def meta_load(app_folder= Dir.pwd)
4
+ def meta_load(target_folder= File.join(Dir.pwd,"lib","**","meta") )
5
+
5
6
  # find elements
6
7
  begin
7
- Dir.glob( File.join(app_folder, "lib", "**","meta" ,"*.{rb,ru}") ).each do |one_rb_file|
8
+ Dir.glob( File.join(target_folder,"*.{rb,ru}") ).each do |one_rb_file|
8
9
  require one_rb_file
9
10
  end
10
11
  end
12
+
11
13
  end
12
14
 
13
- def get_meta_config(app_folder= Dir.pwd)
15
+ def get_meta_config(target_folder= File.join(Dir.pwd,"lib","**","meta") )
14
16
 
15
17
  # defaults
16
18
  begin
@@ -21,7 +23,7 @@ module Kernel
21
23
  # find elements
22
24
  begin
23
25
 
24
- Dir.glob(File.join(app_folder, "lib", "**","meta" ,"*.{yaml,yml}")).each do |config_object|
26
+ Dir.glob(File.join(target_folder,"*.{yaml,yml}")).each do |config_object|
25
27
 
26
28
  # defaults
27
29
  begin
@@ -54,24 +56,24 @@ module Kernel
54
56
  end
55
57
 
56
58
  # mount libs
57
- def mount_libs(app_folder= Dir.pwd)
59
+ def mount_libs(target_folder= File.join(Dir.pwd, "lib") )
58
60
 
59
61
  # load lib files
60
62
  begin
61
- Dir.glob(File.join(app_folder, "lib","*.{rb,ru}")).uniq.each do |one_rb_file|
63
+ Dir.glob(File.join(target_folder,"*.{rb,ru}")).uniq.each do |one_rb_file|
62
64
  require one_rb_file
63
65
  end
64
66
  end
65
67
 
66
68
  end
67
69
 
68
- # Offline repo activate
69
- def mount_modules(app_folder= Dir.pwd)
70
+ alias :require_folder :mount_libs
70
71
 
71
- Dir.glob(File.join(app_folder, "{module,modules}","{gem,gems}","**","lib")).select{|f| File.directory?(f)}.each do |one_path|
72
+ # Offline repo activate
73
+ def mount_modules(target_folder= File.join(Dir.pwd,"{module,modules}","{gem,gems}") )
74
+ Dir.glob(File.join(target_folder,"**","lib")).select{|f| File.directory?(f)}.each do |one_path|
72
75
  $LOAD_PATH << one_path
73
76
  end
74
-
75
77
  end
76
78
 
77
79
  # #Return File_name:File_path
@@ -106,7 +108,6 @@ module Kernel
106
108
  # require by absolute path directory's files
107
109
  def require_directory(folder)
108
110
  get_files(folder).each do |file_name,file_path|
109
- puts "file will be loaded: #{file_name} from\n\t#{file_path}" if $DEBUG
110
111
  if file_path.split('.').last == 'rb'
111
112
  load file_path
112
113
  end
@@ -119,7 +120,7 @@ module Kernel
119
120
  # pre format
120
121
  begin
121
122
 
122
- path= caller[0].split('.rb:').first.split(File::SEPARATOR)
123
+ path= caller[0].split('.{rb,ru}:').first.split(File::SEPARATOR)
123
124
  path= path[0..(path.count-2)]
124
125
 
125
126
  if !File.directory?(path.join(File::SEPARATOR))
@@ -158,7 +159,8 @@ module Kernel
158
159
  end
159
160
 
160
161
  # generate config from yaml
161
- def generate_config(target_config_hash= Application.config,app_folder= Dir.pwd)
162
+ def generate_config(target_folder= File.join(Dir.pwd,"lib", "**","meta"),
163
+ target_config_hash= Application.config)
162
164
 
163
165
  # defaults
164
166
  begin
@@ -171,7 +173,7 @@ module Kernel
171
173
  # find elements
172
174
  begin
173
175
 
174
- Dir.glob(File.join(app_folder, "lib", "**","meta" ,"*.{yaml,yml}")).each do |config_object|
176
+ Dir.glob(File.join(target_folder,"*.{yaml,yml}")).each do |config_object|
175
177
 
176
178
  # defaults
177
179
  begin
@@ -202,7 +204,7 @@ module Kernel
202
204
  # get config files
203
205
  begin
204
206
  config_yaml_paths= Array.new()
205
- Dir.glob(File.join(app_folder, "{config,conf}","*.{yaml,yml}")).uniq.each do |one_path|
207
+ Dir.glob(File.join(target_folder, "{config,conf}","*.{yaml,yml}")).uniq.each do |one_path|
206
208
 
207
209
  case true
208
210
 
@@ -259,12 +261,12 @@ module Kernel
259
261
 
260
262
  end
261
263
 
262
- def generate_documentation(boolean= false,keyword= "generate",app_folder= Dir.pwd)
264
+ def generate_documentation(target_folder= File.join(Dir.pwd,"docs"), boolean= false,keyword= "generate")
263
265
  boolean= false if boolean.nil?
264
266
  if boolean == true
265
267
 
266
268
  document_generators= Array.new
267
- tmp_path_container= Dir.glob(File.join(app_folder, "docs", "**", "*.{rb,ru}"))
269
+ tmp_path_container= Dir.glob(File.join(target_folder, "**", "*.{rb,ru}"))
268
270
  tmp_path_container.each do |one_path|
269
271
  if one_path.include? keyword
270
272
  document_generators.push one_path
@@ -279,4 +281,4 @@ module Kernel
279
281
  end
280
282
  end
281
283
 
282
- end
284
+ end
data/test/bump/test2.rb CHANGED
@@ -1 +1,2 @@
1
- puts "hello world"
1
+ puts "hello world"
2
+
data/test/test.rb CHANGED
@@ -1,20 +1,90 @@
1
- #number_at = 0
2
- #loop do
1
+ require_relative "../lib/procemon.rb"
2
+ require "debugger"
3
+
4
+
5
+ require_relative_directory "bump"
6
+
7
+
8
+
9
+ #class Hello
3
10
  #
4
- # number_at += 1
5
- # break if number_at > 100
11
+ # def world arg
12
+ # puts arg
13
+ # end
14
+ #
15
+ # def hello
16
+ # puts "this is hello, hy!"
17
+ # end
18
+ #
19
+ #end
20
+ #
21
+ #class Proc
22
+ #
23
+ # def source_code
24
+ # puts self.source_location.inspect
25
+ #
26
+ # end
27
+ #
28
+ #end
29
+ #
30
+ #
31
+ #
32
+ ##.to_proc.source_code
33
+ #TestProc= Proc.new do
34
+ # puts "hello world!"
35
+ #end
6
36
  #
7
- # if number_at % 3 == 0 && number_at % 5
8
- # puts "FizzBuzz #{number_at}"
9
- # next
10
- # elsif number_at % 3 == 0
11
- # puts "Fizz #{number_at}"
12
- # next
13
- # elsif number_at % 5
14
- # puts "Buzz #{number_at}"
15
- # next
16
- # else
17
- # puts number_at
37
+ #SecurityProc = Proc.new{ |*args|
38
+ # puts "hello world!"
39
+ #}
40
+ #
41
+ #class Test
42
+ #
43
+ #
44
+ # attr_accessor :test1
45
+ # Test= Proc.new do
46
+ # puts "hello world"
47
+ # end
48
+ #
49
+ # class << self
50
+ # attr_accessor :test2
51
+ # end
52
+ #
53
+ # def hello *args
54
+ # puts self.test1.inspect
18
55
  # end
19
56
  #
57
+ # def self.hello *args
58
+ # puts self.test2.inspect
59
+ # end
60
+ #
61
+ # def security_proc *args
62
+ # self.class::Test.call *args
63
+ # end
64
+ #
65
+ #
20
66
  #end
67
+ #
68
+ ##test= Test.new
69
+ ##test.security_proc
70
+ #
71
+ ##require "sourcify"
72
+ ##require "debugger"
73
+ ##debugger
74
+ #
75
+ #puts SecurityProc.source_location.inspect
76
+ #puts Test.method(:hello).to_proc.source_location.inspect
77
+ #puts TestProc.source_location.inspect
78
+
79
+
80
+
81
+
82
+
83
+
84
+ #method(:world).get_binding
85
+
86
+ #puts test.get_binding
87
+ #puts test.get_binding2
88
+ #puts test.get_binding
89
+
90
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: procemon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-20 00:00:00.000000000 Z
12
+ date: 2013-10-22 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'This is a collection of my Ruby Procs in the adventure of becoming
15
15
  the best! In short this provides extra tools in Application configs, argumens processing,daemonise,
@@ -36,7 +36,11 @@ files:
36
36
  - lib/procemon/function/daemon.rb
37
37
  - lib/procemon/function/documentation.rb
38
38
  - lib/procemon/function/eval.rb
39
+ - lib/procemon/function/meta/binding/binding.rb
40
+ - lib/procemon/function/meta/binding/proc.rb
41
+ - lib/procemon/function/meta/binding/stack.rb
39
42
  - lib/procemon/function/meta/inject_methods.rb
43
+ - lib/procemon/function/meta/source.rb
40
44
  - lib/procemon/function/name.rb
41
45
  - lib/procemon/function/port.rb
42
46
  - lib/procemon/function/require.rb
@@ -75,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
79
  version: '0'
76
80
  segments:
77
81
  - 0
78
- hash: -3727777530014269830
82
+ hash: -1829539115237829577
79
83
  required_rubygems_version: !ruby/object:Gem::Requirement
80
84
  none: false
81
85
  requirements: