just_one_lock 0.0.6 → 0.0.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5ead92d2c5b11ae4f8ded3ff721845d01be9f21
4
- data.tar.gz: 392e09fdb1417daef4117c958427476c54fbc590
3
+ metadata.gz: ff06780a3d6507b4b2f79e19564adaa3d3923a17
4
+ data.tar.gz: 570ed416dcaef7a911c0ff06a2c80b11229b6e68
5
5
  SHA512:
6
- metadata.gz: b66633a0ee704226a188fc7867e6343d46d21301c2f0df7c1c58a41922c2389aa5e83fdbe05396d74e756594bcc141663b33e038fcf2a7a999dedcf5570c5937
7
- data.tar.gz: e9a232b5fbf2041a8aa5d6ec14553fdd7ce11ffb5b06714589c7515e5c2775d48197e6c750fc0edaf3cce93d896f44571f9fb98783f60c5e9b1c9b4340a428e1
6
+ metadata.gz: cefe9659c8e7321a8aac0942956650d7d479a952f82b62f38bcb2c0fcf87a546049a8fd29c384f03cedee0c5f19804a750c3195afcbaf917b75d9b83acec17b9
7
+ data.tar.gz: 4630eefb5bb70bdc234495330ca49412b2ec535a85713d1d1252d83318416a5121b37bc9b7ed5544742f0ec4d9532021396eaa267338f1f65a5428c46e3bea36
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- just_one_lock (0.0.5)
4
+ just_one_lock (0.0.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/bin/just_one_lock ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'gli'
4
+ require_relative '../lib/just_one_lock'
5
+
6
+ include GLI::App
7
+
8
+ @subcommand_option_handling_strategy = :normal
9
+
10
+ program_desc 'Just one lock runner'
11
+ version JustOneLock::VERSION
12
+
13
+ flag [:l,:lock_dir], default_value: '/tmp'
14
+ flag [:s,:scope]
15
+
16
+ pre do |global_options, command, options, args|
17
+ $lock_dir = global_options[:lock_dir]
18
+ $scope = global_options[:scope]
19
+ $command_to_run = args.first
20
+ end
21
+
22
+ command :blocking do |c|
23
+ c.desc 'Execute system command using blocking lock'
24
+ c.flag [:t,:timeout], desc: 'Timeout in seconds'
25
+
26
+ c.action do |global_options, options, args|
27
+ timeout = options[:timeout]
28
+ timeout = timeout.to_i if timeout
29
+
30
+ JustOneLock::Blocking.prevent_multiple_executions(
31
+ $lock_dir,
32
+ $scope,
33
+ output: $stdout,
34
+ timeout: timeout
35
+ ) do
36
+ system $command_to_run
37
+ end
38
+ end
39
+ end
40
+
41
+ command :non_blocking do |c|
42
+ c.desc 'Execute system command'
43
+
44
+ c.action do |global_options, options, args|
45
+ JustOneLock::NonBlocking.prevent_multiple_executions($lock_dir, $scope, output: $stdout) do
46
+ system $command_to_run
47
+ end
48
+ end
49
+ end
50
+
51
+ default_command :non_blocking
52
+
53
+ exit run(ARGV)
54
+
@@ -6,7 +6,7 @@ require 'just_one_lock/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "just_one_lock"
8
8
  spec.version = JustOneLock::VERSION
9
- spec.authors = ["Adam Stankiewicz, Yury Kotov"]
9
+ spec.authors = ["Yury Kotov"]
10
10
  spec.email = ["bairkan@gmail.com"]
11
11
  spec.description = %q{Simple solution to prevent multiple executions using flock}
12
12
  spec.summary = %q{Simple solution to prevent multiple executions using flock}
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake", '~> 10.3'
23
23
  spec.add_development_dependency "rspec", '~> 3.0'
24
+ spec.add_dependency 'gli', '~> 2.11'
24
25
  end
@@ -1,3 +1,3 @@
1
1
  module JustOneLock
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: just_one_lock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
- - Adam Stankiewicz, Yury Kotov
7
+ - Yury Kotov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-29 00:00:00.000000000 Z
11
+ date: 2014-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,10 +52,25 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: gli
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.11'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.11'
55
69
  description: Simple solution to prevent multiple executions using flock
56
70
  email:
57
71
  - bairkan@gmail.com
58
- executables: []
72
+ executables:
73
+ - just_one_lock
59
74
  extensions: []
60
75
  extra_rdoc_files: []
61
76
  files:
@@ -67,6 +82,7 @@ files:
67
82
  - LICENSE
68
83
  - README.md
69
84
  - Rakefile
85
+ - bin/just_one_lock
70
86
  - just_one_lock.gemspec
71
87
  - lib/just_one_lock.rb
72
88
  - lib/just_one_lock/blocking.rb