dronejob 1.2.9 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +52 -51
- data/app.rb +5 -1
- data/dronejob.gemspec +1 -1
- data/lib/dronejob/modules/core.rb +1 -1
- data/lib/dronejob/modules/params.rb +19 -1
- data/lib/dronejob/modules/queue.rb +16 -4
- data/lib/dronejob/version.rb +1 -1
- data/lib/dronejob.rb +0 -13
- metadata +16 -17
- data/lib/dronejob/banner.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f5e9e2f89bca4a32b5c4d2e22355dd8119a1e35
|
4
|
+
data.tar.gz: efe88d06655a102c61f49ed16e14c9f93372753b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb7465f7d2a81c1a8c515164bcb0a7588f3edd9d91ac594b13b31a1579c1e5f02dee99f729639024feda35b07844a75abe6611b0faa951dd2b26100bc358e807
|
7
|
+
data.tar.gz: 60f63fd603c97fbfd8122c6179f4959f87cdd910c16acc2aa411bd753d50e1d158f2f17c663f580581a5b96727d11ff9eb91e76556456963f633261b214dd4e8
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dronejob (1.
|
4
|
+
dronejob (1.3.0)
|
5
5
|
actionpack (>= 4.0)
|
6
6
|
activejob (~> 4.2)
|
7
7
|
bundler (>= 1.3.0, < 2.0)
|
@@ -10,85 +10,83 @@ PATH
|
|
10
10
|
google-cloud-storage (~> 0.23)
|
11
11
|
haml (~> 4.0)
|
12
12
|
open_uri_redirections (~> 0.2)
|
13
|
+
pusher (~> 1.3)
|
13
14
|
rubyzip (~> 1.1)
|
14
15
|
sidekiq (~> 4.1)
|
15
|
-
sidekiq-status (~> 0.6)
|
16
16
|
thor (~> 0.19)
|
17
17
|
typhoeus (~> 1.0)
|
18
18
|
|
19
19
|
GEM
|
20
20
|
remote: http://rubygems.org/
|
21
21
|
specs:
|
22
|
-
actionpack (4.2.
|
23
|
-
actionview (= 4.2.
|
24
|
-
activesupport (= 4.2.
|
22
|
+
actionpack (4.2.8)
|
23
|
+
actionview (= 4.2.8)
|
24
|
+
activesupport (= 4.2.8)
|
25
25
|
rack (~> 1.6)
|
26
26
|
rack-test (~> 0.6.2)
|
27
27
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
28
28
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
29
|
-
actionview (4.2.
|
30
|
-
activesupport (= 4.2.
|
29
|
+
actionview (4.2.8)
|
30
|
+
activesupport (= 4.2.8)
|
31
31
|
builder (~> 3.1)
|
32
32
|
erubis (~> 2.7.0)
|
33
33
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
34
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
35
|
-
activejob (4.2.
|
36
|
-
activesupport (= 4.2.
|
34
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
35
|
+
activejob (4.2.8)
|
36
|
+
activesupport (= 4.2.8)
|
37
37
|
globalid (>= 0.3.0)
|
38
|
-
activesupport (4.2.
|
38
|
+
activesupport (4.2.8)
|
39
39
|
i18n (~> 0.7)
|
40
|
-
json (~> 1.7, >= 1.7.7)
|
41
40
|
minitest (~> 5.1)
|
42
41
|
thread_safe (~> 0.3, >= 0.3.4)
|
43
42
|
tzinfo (~> 1.1)
|
44
|
-
addressable (2.5.
|
43
|
+
addressable (2.5.1)
|
45
44
|
public_suffix (~> 2.0, >= 2.0.2)
|
46
45
|
builder (3.2.3)
|
47
46
|
coderay (1.1.1)
|
48
|
-
concurrent-ruby (1.0.
|
47
|
+
concurrent-ruby (1.0.5)
|
49
48
|
connection_pool (2.2.1)
|
49
|
+
declarative (0.0.9)
|
50
|
+
declarative-option (0.1.0)
|
50
51
|
diff-lcs (1.2.5)
|
51
52
|
digest-crc (0.4.1)
|
52
53
|
erubis (2.7.0)
|
53
54
|
ethon (0.10.1)
|
54
55
|
ffi (>= 1.3.0)
|
55
|
-
faraday (0.
|
56
|
+
faraday (0.12.1)
|
56
57
|
multipart-post (>= 1.2, < 3)
|
57
|
-
ffi (1.9.
|
58
|
+
ffi (1.9.18)
|
58
59
|
git (1.3.0)
|
59
|
-
globalid (0.
|
60
|
-
activesupport (>= 4.
|
61
|
-
google-api-client (0.
|
60
|
+
globalid (0.4.0)
|
61
|
+
activesupport (>= 4.2.0)
|
62
|
+
google-api-client (0.10.2)
|
62
63
|
addressable (~> 2.3)
|
63
64
|
googleauth (~> 0.5)
|
64
65
|
httpclient (~> 2.7)
|
65
66
|
hurley (~> 0.1)
|
66
67
|
memoist (~> 0.11)
|
67
68
|
mime-types (>= 1.6)
|
68
|
-
representable (~>
|
69
|
-
retriable (
|
69
|
+
representable (~> 3.0)
|
70
|
+
retriable (>= 2.0, < 4.0)
|
70
71
|
google-cloud-core (0.21.1)
|
71
72
|
googleauth (~> 0.5.1)
|
72
|
-
google-cloud-logging (0.
|
73
|
+
google-cloud-logging (0.24.2)
|
73
74
|
google-cloud-core (~> 0.21.1)
|
74
|
-
google-gax (~> 0.
|
75
|
-
google-protobuf (~> 3.0)
|
76
|
-
googleapis-common-protos (~> 1.3)
|
77
|
-
grpc (~> 1.0)
|
78
|
-
orderedhash (= 0.0.6)
|
75
|
+
google-gax (~> 0.8.0)
|
79
76
|
stackdriver-core (~> 0.21.0)
|
80
|
-
google-cloud-storage (0.
|
77
|
+
google-cloud-storage (0.24.0)
|
81
78
|
digest-crc (~> 0.4)
|
82
|
-
google-api-client (~> 0.
|
79
|
+
google-api-client (~> 0.10.0)
|
83
80
|
google-cloud-core (~> 0.21.0)
|
84
|
-
google-gax (0.
|
85
|
-
|
81
|
+
google-gax (0.8.2)
|
82
|
+
google-protobuf (~> 3.2)
|
83
|
+
googleapis-common-protos (~> 1.3.5)
|
86
84
|
googleauth (~> 0.5.1)
|
87
85
|
grpc (~> 1.0)
|
88
86
|
rly (~> 0.2.3)
|
89
|
-
google-protobuf (3.2.0)
|
90
|
-
googleapis-common-protos (1.3.
|
91
|
-
google-protobuf (~> 3.
|
87
|
+
google-protobuf (3.2.0.2-universal-darwin)
|
88
|
+
googleapis-common-protos (1.3.5)
|
89
|
+
google-protobuf (~> 3.2)
|
92
90
|
grpc (~> 1.0)
|
93
91
|
googleauth (0.5.1)
|
94
92
|
faraday (~> 0.9)
|
@@ -98,18 +96,17 @@ GEM
|
|
98
96
|
multi_json (~> 1.11)
|
99
97
|
os (~> 0.9)
|
100
98
|
signet (~> 0.7)
|
101
|
-
grpc (1.
|
99
|
+
grpc (1.2.5-universal-darwin)
|
102
100
|
google-protobuf (~> 3.1)
|
103
101
|
googleauth (~> 0.5.1)
|
104
102
|
haml (4.0.7)
|
105
103
|
tilt
|
106
104
|
httpclient (2.8.3)
|
107
105
|
hurley (0.2)
|
108
|
-
i18n (0.8.
|
109
|
-
json (1.8.6)
|
106
|
+
i18n (0.8.1)
|
110
107
|
jwt (1.5.6)
|
111
108
|
little-plugger (1.1.4)
|
112
|
-
logging (2.
|
109
|
+
logging (2.2.2)
|
113
110
|
little-plugger (~> 1.1)
|
114
111
|
multi_json (~> 1.10)
|
115
112
|
loofah (2.0.3)
|
@@ -123,16 +120,20 @@ GEM
|
|
123
120
|
minitest (5.10.1)
|
124
121
|
multi_json (1.12.1)
|
125
122
|
multipart-post (2.0.0)
|
126
|
-
nokogiri (1.7.
|
123
|
+
nokogiri (1.7.1)
|
127
124
|
mini_portile2 (~> 2.1.0)
|
128
125
|
open_uri_redirections (0.2.1)
|
129
|
-
orderedhash (0.0.6)
|
130
126
|
os (0.9.6)
|
131
127
|
pry (0.10.3)
|
132
128
|
coderay (~> 1.1.0)
|
133
129
|
method_source (~> 0.8.1)
|
134
130
|
slop (~> 3.4)
|
135
131
|
public_suffix (2.0.5)
|
132
|
+
pusher (1.3.1)
|
133
|
+
httpclient (~> 2.7)
|
134
|
+
multi_json (~> 1.0)
|
135
|
+
pusher-signature (~> 0.1.8)
|
136
|
+
pusher-signature (0.1.8)
|
136
137
|
rack (1.6.5)
|
137
138
|
rack-protection (1.5.3)
|
138
139
|
rack
|
@@ -147,9 +148,11 @@ GEM
|
|
147
148
|
rails-html-sanitizer (1.0.3)
|
148
149
|
loofah (~> 2.0)
|
149
150
|
redis (3.3.3)
|
150
|
-
representable (
|
151
|
-
|
152
|
-
|
151
|
+
representable (3.0.4)
|
152
|
+
declarative (< 0.1.0)
|
153
|
+
declarative-option (< 0.2.0)
|
154
|
+
uber (< 0.2.0)
|
155
|
+
retriable (3.0.1)
|
153
156
|
rly (0.2.3)
|
154
157
|
rspec (3.4.0)
|
155
158
|
rspec-core (~> 3.4.0)
|
@@ -165,13 +168,11 @@ GEM
|
|
165
168
|
rspec-support (~> 3.4.0)
|
166
169
|
rspec-support (3.4.1)
|
167
170
|
rubyzip (1.2.1)
|
168
|
-
sidekiq (4.2.
|
171
|
+
sidekiq (4.2.10)
|
169
172
|
concurrent-ruby (~> 1.0)
|
170
173
|
connection_pool (~> 2.2, >= 2.2.0)
|
171
174
|
rack-protection (>= 1.5.0)
|
172
175
|
redis (~> 3.2, >= 3.2.1)
|
173
|
-
sidekiq-status (0.6.0)
|
174
|
-
sidekiq (>= 2.7)
|
175
176
|
signet (0.7.3)
|
176
177
|
addressable (~> 2.3)
|
177
178
|
faraday (~> 0.9)
|
@@ -180,13 +181,13 @@ GEM
|
|
180
181
|
slop (3.6.0)
|
181
182
|
stackdriver-core (0.21.0)
|
182
183
|
thor (0.19.4)
|
183
|
-
thread_safe (0.3.
|
184
|
-
tilt (2.0.
|
184
|
+
thread_safe (0.3.6)
|
185
|
+
tilt (2.0.7)
|
185
186
|
typhoeus (1.1.2)
|
186
187
|
ethon (>= 0.9.0)
|
187
|
-
tzinfo (1.2.
|
188
|
+
tzinfo (1.2.3)
|
188
189
|
thread_safe (~> 0.1)
|
189
|
-
uber (0.0
|
190
|
+
uber (0.1.0)
|
190
191
|
|
191
192
|
PLATFORMS
|
192
193
|
ruby
|
@@ -197,4 +198,4 @@ DEPENDENCIES
|
|
197
198
|
rspec (~> 3.3)
|
198
199
|
|
199
200
|
BUNDLED WITH
|
200
|
-
1.
|
201
|
+
1.14.6
|
data/app.rb
CHANGED
data/dronejob.gemspec
CHANGED
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_runtime_dependency "thor", "~> 0.19"
|
20
20
|
s.add_runtime_dependency "haml", "~> 4.0"
|
21
21
|
s.add_runtime_dependency "sidekiq", "~> 4.1"
|
22
|
-
s.add_runtime_dependency "sidekiq-status", "~> 0.6"
|
23
22
|
s.add_runtime_dependency "rubyzip", "~> 1.1"
|
24
23
|
s.add_runtime_dependency "activejob", "~> 4.2"
|
25
24
|
s.add_runtime_dependency "typhoeus", "~> 1.0"
|
@@ -27,6 +26,7 @@ Gem::Specification.new do |s|
|
|
27
26
|
s.add_runtime_dependency "open_uri_redirections", "~> 0.2"
|
28
27
|
s.add_runtime_dependency "google-cloud-storage", "~> 0.23"
|
29
28
|
s.add_runtime_dependency "google-cloud-logging", "~> 0.23"
|
29
|
+
s.add_runtime_dependency "pusher", "~> 1.3"
|
30
30
|
s.add_development_dependency "rspec", "~> 3.3"
|
31
31
|
s.add_development_dependency "pry", "~> 0.10"
|
32
32
|
s.files = `git ls-files`.split("\n")
|
@@ -22,7 +22,7 @@ module Dronejob
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
25
|
+
def params=(params)
|
26
26
|
@params = params.map{|name, value| [name, transform_parameter(name, value)]}.to_h
|
27
27
|
end
|
28
28
|
|
@@ -30,6 +30,14 @@ module Dronejob
|
|
30
30
|
if config = self.class.param_config(name)
|
31
31
|
return Base64.strict_decode64(value) if config[:type] == :base64
|
32
32
|
return JSON.parse(Base64.strict_decode64(value)) if config[:type] == :json64
|
33
|
+
if config[:type] === :numeric
|
34
|
+
return Integer(value) if Integer(value) rescue false
|
35
|
+
return Float(value) if Float(value) rescue false
|
36
|
+
end
|
37
|
+
if config[:type] === :boolean
|
38
|
+
return true if value === "true"
|
39
|
+
return false if value === "false"
|
40
|
+
end
|
33
41
|
end
|
34
42
|
value
|
35
43
|
end
|
@@ -39,6 +47,16 @@ module Dronejob
|
|
39
47
|
@params[key.to_s]
|
40
48
|
end
|
41
49
|
|
50
|
+
def convert_param(value, config)
|
51
|
+
return nil if value.nil?
|
52
|
+
|
53
|
+
return value
|
54
|
+
end
|
55
|
+
|
56
|
+
def params
|
57
|
+
@params
|
58
|
+
end
|
59
|
+
|
42
60
|
def validate_parameters!
|
43
61
|
# Fill default parameters
|
44
62
|
self.class.params.each do |param_name, param_config|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require "pusher"
|
1
2
|
module Dronejob
|
2
3
|
module Modules
|
3
4
|
module Queue
|
@@ -20,19 +21,30 @@ module Dronejob
|
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
23
|
-
def
|
24
|
+
def pusher_client
|
25
|
+
@pusher_client ||= Pusher::Client.new(
|
26
|
+
app_id: option(:pusher_app_id),
|
27
|
+
key: option(:pusher_key),
|
28
|
+
secret: option(:pusher_secret),
|
29
|
+
cluster: option(:pusher_cluster),
|
30
|
+
encrypted: true
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
def publish_status(data={}, status="working")
|
24
35
|
data[:action] = "update_process"
|
25
36
|
data[:user_id] = param(:user_id)
|
26
37
|
data[:jid] = job_id
|
27
38
|
data[:worker] = Loader.identifier_for(self)
|
28
39
|
data[:timestamp] = Time.now.to_i
|
29
40
|
data[:status] = status
|
30
|
-
|
31
|
-
|
41
|
+
queue = option(:dronejob_queue)
|
42
|
+
return false if data[:user_id].nil?
|
43
|
+
pusher_client.trigger("private-#{data[:user_id]}", "process", data)
|
32
44
|
end
|
33
45
|
|
34
46
|
def publish_error(e)
|
35
|
-
publish_status({title: self.title, description: e.message, phase: @phase,
|
47
|
+
publish_status({title: self.title, description: e.message, phase: @phase, progress: 100}, "failed") if should_notify?
|
36
48
|
end
|
37
49
|
|
38
50
|
def notify_before_phase
|
data/lib/dronejob/version.rb
CHANGED
data/lib/dronejob.rb
CHANGED
@@ -10,17 +10,4 @@ module Dronejob
|
|
10
10
|
extend ActiveSupport::Autoload
|
11
11
|
autoload :Base
|
12
12
|
autoload :Loader
|
13
|
-
|
14
|
-
def self.start
|
15
|
-
require "dronejob/banner"
|
16
|
-
require "sidekiq-status"
|
17
|
-
Loader.load
|
18
|
-
Dronejob::Base.queue_adapter = "sidekiq"
|
19
|
-
Sidekiq.configure_server do |config|
|
20
|
-
config.redis = { url: Dronejob::Base.options.redis_url }
|
21
|
-
config.server_middleware do |chain|
|
22
|
-
chain.add Sidekiq::Status::ServerMiddleware
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dronejob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Strebitzer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,20 +86,6 @@ dependencies:
|
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '4.1'
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: sidekiq-status
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '0.6'
|
96
|
-
type: :runtime
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0.6'
|
103
89
|
- !ruby/object:Gem::Dependency
|
104
90
|
name: rubyzip
|
105
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,6 +184,20 @@ dependencies:
|
|
198
184
|
- - "~>"
|
199
185
|
- !ruby/object:Gem::Version
|
200
186
|
version: '0.23'
|
187
|
+
- !ruby/object:Gem::Dependency
|
188
|
+
name: pusher
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - "~>"
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '1.3'
|
194
|
+
type: :runtime
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - "~>"
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '1.3'
|
201
201
|
- !ruby/object:Gem::Dependency
|
202
202
|
name: rspec
|
203
203
|
requirement: !ruby/object:Gem::Requirement
|
@@ -242,7 +242,6 @@ files:
|
|
242
242
|
- bin/dronejob
|
243
243
|
- dronejob.gemspec
|
244
244
|
- lib/dronejob.rb
|
245
|
-
- lib/dronejob/banner.rb
|
246
245
|
- lib/dronejob/base.rb
|
247
246
|
- lib/dronejob/command.rb
|
248
247
|
- lib/dronejob/loader.rb
|
data/lib/dronejob/banner.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
module Sidekiq
|
2
|
-
class CLI
|
3
|
-
def self.banner
|
4
|
-
' ___ _ _ ' + "\n" +
|
5
|
-
' | \ _ _ ___ _ _ ___ _ | | ___ | |__ ' + "\n" +
|
6
|
-
' | |) | | `_| / _ \ | ` \ / -_) | || | / _ \ | `_ \ ' + "\n" +
|
7
|
-
' |___/ _|_|_ \___/ |_||_| \___| _\__/ \___/ |_.__/ ' + "\n" +
|
8
|
-
' _|=====|_|=====|_|=====|_|=====|_|=====|_|=====|_|=====|_|=====| ' + "\n" +
|
9
|
-
' =`-0-0-`=`-0-0-`=`-0-0-`=`-0-0-`=`-0-0-`=`-0-0-`=`-0-0-`=`-0-0-` '
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|