process_lock 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -17,30 +17,8 @@ test/tmp
17
17
  test/version_tmp
18
18
  tmp
19
19
 
20
- ## RUBYMINE
21
- .idea/
22
-
23
- ## MAC OS
24
- .DS_Store
25
-
26
- ## TEXTMATE
27
- *.tmproj
28
- tmtags
29
-
30
- ## EMACS
31
- *~
32
- \#*
33
- .\#*
34
-
35
- ## VIM
36
- *.swp
37
- *~
38
-
39
20
  ## PROJECT::SPECIFIC
40
21
  tmp/pids/example*
41
- ,*
42
22
 
43
- # Local ruby version config
44
- .rbenv-version
45
- .ruby-version
46
- .rvmrc
23
+ # See: https://gist.github.com/ianheggie/9327010
24
+ # for Global git ignore for OS/IDE/temp/backup files
@@ -12,11 +12,10 @@ rvm:
12
12
  - 1.8.7
13
13
  - 1.9.3
14
14
  - 2.0.0
15
- - 2.1.0
15
+ - 2.1.2
16
16
  - jruby-19mode
17
- - rbx
17
+ - rbx-2.2.6
18
18
 
19
19
  matrix:
20
20
  allow_failures:
21
- - rvm: rbx
22
21
 
data/README.md CHANGED
@@ -78,11 +78,11 @@ example.tmp will contain the pid of the leader process
78
78
  2. Create your feature branch (`git checkout -b my-new-feature`)
79
79
  3. Commit your changes (`git commit -am 'Add some feature'`)
80
80
  4. Push to the branch (`git push origin my-new-feature`)
81
- 5. Create new Pull Request
81
+ 5. Create new Pull Request (Tests appreciated)
82
82
 
83
83
  ## License and contributions
84
84
 
85
85
  * Copyright (c) 2008 Simon Engledew, released under the MIT license: https://github.com/simon-engledew/ruby-process-lock .
86
- * Subsequent work by Ian Heggie: packaged into a gem, added tests and acquire method, fixed some bugs.
86
+ * Subsequent work by Ian Heggie: enhanced library and packaged into a gem, added tests and acquire method, fixed some bugs.
87
87
  * See git log for other contributers
88
88
 
@@ -1,3 +1,3 @@
1
1
  class ProcessLock
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -40,365 +40,3 @@ EOF
40
40
  wait
41
41
 
42
42
  exit
43
-
44
- IRB1.9(1) General Commands Manual IRB1.9(1)
45
-
46
-
47
-
48
- NAME
49
- irb1.9.1 - interactive ruby
50
-
51
- SYNOPSIS
52
- irb [options]
53
-
54
- DESCRIPTION
55
- irb stands for `interactive ruby'. irb is a tool to execute interac‐
56
- tively ruby expressions read from stdin. Use of irb is easy if you
57
- know ruby. Executing irb, prompts are displayed as follows. Then,
58
- enter expression of ruby. A input is executed when it is syntacticaly
59
- completed.
60
-
61
- $ irb1.9.1
62
- irb(main):001:0> 1+2
63
- 3
64
- irb(main):002:0> class Foo
65
- irb(main):003:1> def foo
66
- irb(main):004:2> print 1
67
- irb(main):005:2> end
68
- irb(main):006:1> end
69
- nil
70
- irb(main):007:0>
71
-
72
- And, Readline extesion module can be used with irb. Using Readline is
73
- the standard default action if Readline is installed.
74
-
75
- OPTIONS
76
- -f suppress read ~/.irbrc
77
-
78
- -m bc mode (fraction or matrix are available)
79
-
80
- -d set $DEBUG to true (same as `ruby -d')
81
-
82
- -r load-module
83
- same as `ruby -r'
84
-
85
- --inspect
86
- uses `inspect' for output (the default except bc mode)
87
-
88
- --noinspect
89
- doesn't uses inspect for output
90
-
91
- --readline
92
- uses Readline extension module
93
-
94
- --noreadline
95
- doesn't use Readline extension module
96
-
97
- --prompt prompt-mode
98
-
99
- --prompt-mode prompt-mode
100
- switches prompt mode. Pre-defined prompt modes are `default',
101
- `simple', `xmp' and `inf-ruby'
102
-
103
- --inf-ruby-mode
104
- uses prompt appreciate for inf-ruby-mode on emacs. Suppresses
105
- --readline.
106
-
107
- --simple-prompt
108
- simple prompt mode
109
-
110
- --noprompt
111
- no prompt
112
-
113
- --tracer
114
- display trace for each execution of commands.
115
-
116
- --back-trace-limit n
117
- displayes backtrace top n and tail n. The default value is 16.
118
-
119
- --irb_debug n
120
- sets internal debug level to n (It shouldn't be used)
121
-
122
- -v, --version
123
- prints the version of irb
124
-
125
- CONFIGURATIONS
126
- irb reads `~/.irbrc' when it is invoked. If `~/.irbrb' doesn't exist
127
- irb try to read in the order `.irbrc', `irb.rc', `_irbrc' then
128
- `$irbrc'. The following is altanative to the command line option. To
129
- use them type as follows in an irb session.
130
-
131
- IRB.conf[:IRB_NAME]="irb"
132
- IRB.conf[:MATH_MODE]=false
133
- IRB.conf[:USE_TRACER]=false
134
- IRB.conf[:USE_LOADER]=false
135
- IRB.conf[:IGNORE_SIGINT]=true
136
- IRB.conf[:IGNORE_EOF]=false
137
- IRB.conf[:INSPECT_MODE]=nil
138
- IRB.conf[:IRB_RC] = nil
139
- IRB.conf[:BACK_TRACE_LIMIT]=16
140
- IRB.conf[:USE_LOADER] = false
141
- IRB.conf[:USE_READLINE] = nil
142
- IRB.conf[:USE_TRACER] = false
143
- IRB.conf[:IGNORE_SIGINT] = true
144
- IRB.conf[:IGNORE_EOF] = false
145
- IRB.conf[:PROMPT_MODE] = :DEFALUT
146
- IRB.conf[:PROMPT] = {...}
147
- IRB.conf[:DEBUG_LEVEL]=0
148
- IRB.conf[:VERBOSE]=true
149
-
150
- Customizing prompt
151
- To costomize the prompt you set a variable
152
-
153
- IRB.conf[:PROMPT]
154
-
155
- For example, describe as follows in `.irbrc'.
156
-
157
- IRB.conf[:PROMPT][:MY_PROMPT] = { # name of prompt mode
158
- :PROMPT_I => nil, # normal prompt
159
- :PROMPT_S => nil, # prompt for continuated strings
160
- :PROMPT_C => nil, # prompt for continuated statement
161
- :RETURN => " ==>%s\n" # format to return value
162
- }
163
-
164
- Then, invoke irb with the above prompt mode by
165
-
166
- $ irb1.9.1 --prompt my-prompt
167
-
168
- Or add the following in `.irbrc'.
169
-
170
- IRB.conf[:PROMPT_MODE] = :MY_PROMPT
171
-
172
- Constants PROMPT_I, PROMPT_S and PROMPT_C specifies the format. In the
173
- prompt specification, some special strings are available.
174
-
175
- %N command name which is running
176
- %m to_s of main object (self)
177
- %M inspect of main object (self)
178
- %l type of string(", ', /, ]), `]' is inner %w[...]
179
- %NNi indent level. NN is degits and means as same as printf("%NNd").
180
- It can be ommited
181
- %NNn line number.
182
- %% %
183
- For instance, the default prompt mode is defined as follows:
184
- IRB.conf[:PROMPT_MODE][:DEFAULT] = {
185
-
186
- PROMPT_I => "%N(%m):%03n:%i> ",
187
-
188
- PROMPT_S => "%N(%m):%03n:%i%l ",
189
-
190
- PROMPT_C => "%N(%m):%03n:%i* ",
191
-
192
- RETURN => "%s\n"}
193
- RETURN is used to printf.
194
-
195
- Configurating subirb
196
- The command line option or IRB.conf specify the default behavior of
197
- (sub)irb. On the other hand, each conf of in the next sction `6. Com‐
198
- mand' is used to individually configurate (sub)irb. If proc is set to
199
- IRB.conf[:IRB_RC], its subirb will be invoked after execution of that
200
- proc under giving the context of irb as its aregument. By this mecha‐
201
- nism each subirb can be configurated.
202
-
203
- Command
204
- For irb commands, both simple name and `irb_'-prefixed name are pre‐
205
- pared.
206
-
207
- exit, quit, irb_exit
208
- Quits (sub)irb. if you've done cb (see below), exit from the
209
- binding mode.
210
-
211
-
212
- conf, irb_context
213
- Displays current configuration. Modifing the configuration is
214
- achieved by sending message to `conf'.
215
-
216
- conf.back_trace_limit
217
- Sets display lines of backtrace as top n and tail n. The
218
- default value is 16.
219
-
220
- conf.debug_level = N
221
- Sets debug level of irb.
222
-
223
- conf.ignore_eof = true/false
224
- Whether ^D (control-d) will be ignored or not. If false is set,
225
- ^D means quit.
226
-
227
- conf.ignore_sigint= true/false
228
- Whether ^C (control-c) will be ignored or not. If false is set,
229
- ^D means quit. If true,
230
- during input: cancel inputing then return to top level.
231
- during execute: abondon current execution.
232
-
233
- conf.inf_ruby_mode = true/false
234
- Whether inf-ruby-mode or not. The default value is false.
235
-
236
- conf.inspect_mode = true/false/nil
237
- Specifies inspect mode. true: display inspect false: display
238
- to_s nil: inspect mode in non math mode,
239
- non inspect mode in math mode.
240
-
241
- conf.irb_level
242
- The level of cb.
243
-
244
- conf.math_mode
245
- Whether bc mode or not.
246
-
247
- conf.use_loader = true/false
248
- Whether irb's own file reader method is used when load/require
249
- or not. This mode is globaly affected (irb wide).
250
-
251
- conf.prompt_c
252
- prompt for a continuating statement (e.g, immediately after of
253
- `if')
254
-
255
- conf.prompt_i
256
- standard prompt
257
-
258
- conf.prompt_s
259
- prompt for a continuating string
260
-
261
- conf.rc
262
- Whether ~/.irbrc is read or not.
263
-
264
- conf.use_prompt = true/false
265
- Prompting or not.
266
-
267
- conf.use_readline = true/false/nil
268
- Whether readline is used or not. true: uses false: doen't use
269
- nil: intends to use readline except for inf-reuby-mode (default)
270
-
271
- conf.verbose=T/F
272
- Whether verbose messages are display or not.
273
-
274
- cb, irb_change_binding [obj]
275
- Enter new binding which has a distinct scope of local variables.
276
- If obj is given, obj will be self.
277
-
278
- irb [obj]
279
- Invoke subirb. If obj is given, obj will be self.
280
-
281
- jobs, irb_jobs
282
- List of subirb
283
-
284
- fg n, irb_fg n
285
- Switch into specified subirb. The following is candidates of n:
286
- irb number
287
- thhread
288
- irb object
289
- self(obj which is specified of irb obj)
290
-
291
- kill n, irb_kill n
292
- Kill subirb. The means of n is as same as the case of irb_fg.
293
-
294
- System variable
295
- _ The latest value of evaluation (it is local)
296
-
297
- Session Example
298
- $ irb1.9.1
299
- irb(main):001:0> irb # invoke subirb
300
- irb#1(main):001:0> jobs # list of subirbs
301
- #0->irb on main (#<Thread:0x400fb7e4> : stop)
302
- #1->irb#1 on main (#<Thread:0x40125d64> : running)
303
- nil
304
- irb#1(main):002:0> fg 0 # switch job
305
- nil
306
- irb(main):002:0> class Foo;end
307
- nil
308
- irb(main):003:0> irb Foo # invoke subirb which has the
309
- # context of Foo
310
- irb#2(Foo):001:0> def foo # define Foo#foo
311
- irb#2(Foo):002:1> print 1
312
- irb#2(Foo):003:1> end
313
- nil
314
- irb#2(Foo):004:0> fg 0 # switch job
315
- nil
316
- irb(main):004:0> jobs # list of job
317
- #0->irb on main (#<Thread:0x400fb7e4> : running)
318
- #1->irb#1 on main (#<Thread:0x40125d64> : stop)
319
- #2->irb#2 on Foo (#<Thread:0x4011d54c> : stop)
320
- nil
321
- irb(main):005:0> Foo.instance_methods # Foo#foo is defined asurely
322
- ["foo"]
323
- irb(main):006:0> fg 2 # switch job
324
- nil
325
- irb#2(Foo):005:0> def bar # define Foo#bar
326
- irb#2(Foo):006:1> print "bar"
327
- irb#2(Foo):007:1> end
328
- nil
329
- irb#2(Foo):010:0> Foo.instance_methods
330
- ["bar", "foo"]
331
- irb#2(Foo):011:0> fg 0
332
- nil
333
- irb(main):007:0> f = Foo.new
334
- #<Foo:0x4010af3c>
335
- irb(main):008:0> irb f # invoke subirb which has the
336
- # context of f (instance of Foo)
337
- irb#3(#<Foo:0x4010af3c>):001:0> jobs
338
- #0->irb on main (#<Thread:0x400fb7e4> : stop)
339
- #1->irb#1 on main (#<Thread:0x40125d64> : stop)
340
- #2->irb#2 on Foo (#<Thread:0x4011d54c> : stop)
341
- #3->irb#3 on #<Foo:0x4010af3c> (#<Thread:0x4010a1e0> : running)
342
- nil
343
- irb#3(#<Foo:0x4010af3c>):002:0> foo # evaluate f.foo
344
- 1nil
345
- irb#3(#<Foo:0x4010af3c>):003:0> bar # evaluate f.bar
346
- barnil
347
- irb#3(#<Foo:0x4010af3c>):004:0> kill 1, 2, 3# kill job
348
- nil
349
- irb(main):009:0> jobs
350
- #0->irb on main (#<Thread:0x400fb7e4> : running)
351
- nil
352
- irb(main):010:0> exit # exit
353
-
354
- Restrictions
355
- Because irb evaluates the inputs immediately after the imput is syntac‐
356
- tically completed, irb gives slight different result than directly use
357
- ruby. Known difference is pointed out here.
358
-
359
- Declaration of the local variable
360
- The following causes an error in ruby:
361
-
362
- eval "foo = 0"
363
- foo
364
- --
365
- -:2: undefined local variable or method `foo' for #<Object:0x40283118> (NameError)
366
- ---
367
- NameError
368
-
369
- Though, the above will successfully done by irb.
370
-
371
- >> eval "foo = 0"
372
- => 0
373
- >> foo
374
- => 0
375
-
376
- Ruby evaluates a code after reading entire of code and determination of
377
- the scope of local variables. On the other hand, irb do immediately.
378
- More precisely, irb evaluate at first
379
-
380
- evel "foo = 0"
381
-
382
- then foo is defined on this timing. It is because of this incompatibil‐
383
- ity. If you'd like to detect those differences, begin...end can be
384
- used:
385
-
386
- >> begin
387
- ?> eval "foo = 0"
388
- >> foo
389
- >> end
390
- NameError: undefined local variable or method `foo' for #<Object:0x4013d0f0>
391
- (irb):3
392
- (irb_local_binding):1:in `eval'
393
-
394
- Here-document
395
- Implementation of Here-document is incomplete.
396
-
397
- Symbol
398
- Irb can not always recognize a symbol as to be Symbol. Concretely, an
399
- expression have completed, however Irb regard it as continuation line.
400
-
401
-
402
-
403
-
404
- December 2002 IRB1.9(1)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: process_lock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-02-17 00:00:00.000000000 Z
13
+ date: 2014-05-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  requirements: []
104
104
  rubyforge_project:
105
- rubygems_version: 1.8.23
105
+ rubygems_version: 1.8.23.2
106
106
  signing_key:
107
107
  specification_version: 3
108
108
  summary: Use process lock to see if a process is already running or designate a master