dronejob 1.2.5 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a65362e28162761f9e1634f03102011dd5d0aef0
4
- data.tar.gz: 5556e1f1eedca9b8d4fd6ce651557b31e6b47882
3
+ metadata.gz: 57e55da2deb1f0420ab6ea93b7812d61c5c26ed9
4
+ data.tar.gz: ed3d1cf01b2187da443ec31bf9901506098ceb2b
5
5
  SHA512:
6
- metadata.gz: 54778d7a24c202bd96cac46ebaf05619cf13f40733173c7e4c6e3b8f130a97d3bbef6ff3a98897a100b45600cfd82ad177594a0164cf6e5a48ddf08e85d117ac
7
- data.tar.gz: 9bc0090e79d14bb41552ca99c82c9302ae9550f251114466538343b4370c998691608484ee303da0690970929a7ca36c68efdda89e8d8a6ae66b92720ca5dd9e
6
+ metadata.gz: 1393f73c798ca97090f1a64c156b43197e0f126b3e937ce6d921aa961b458e0be36421f8e510f834c8ec5edb67ddecb3ad597f098c779b94c8f661fe845e94f8
7
+ data.tar.gz: 08330299e5a45b88b5887d35099f81b1d7bd9a4dd955f237baa0154906b0b19a24fffbdf7dfdbf69240a26f17e5eb397aa4d4aad6c1d94447f913396e289f493
data/Gemfile.lock CHANGED
@@ -1,10 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dronejob (1.2.5)
4
+ dronejob (1.2.6)
5
+ actionpack (>= 4.0)
5
6
  activejob (~> 4.2)
6
7
  bundler (>= 1.3.0, < 2.0)
7
8
  git (~> 1.2)
9
+ google-cloud-storage (~> 0.21)
8
10
  haml (~> 4.0)
9
11
  open_uri_redirections (~> 0.2)
10
12
  rubyzip (~> 1.1)
@@ -16,6 +18,19 @@ PATH
16
18
  GEM
17
19
  remote: http://rubygems.org/
18
20
  specs:
21
+ actionpack (4.2.7.1)
22
+ actionview (= 4.2.7.1)
23
+ activesupport (= 4.2.7.1)
24
+ rack (~> 1.6)
25
+ rack-test (~> 0.6.2)
26
+ rails-dom-testing (~> 1.0, >= 1.0.5)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
+ actionview (4.2.7.1)
29
+ activesupport (= 4.2.7.1)
30
+ builder (~> 3.1)
31
+ erubis (~> 2.7.0)
32
+ rails-dom-testing (~> 1.0, >= 1.0.5)
33
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
19
34
  activejob (4.2.7.1)
20
35
  activesupport (= 4.2.7.1)
21
36
  globalid (>= 0.3.0)
@@ -25,31 +40,94 @@ GEM
25
40
  minitest (~> 5.1)
26
41
  thread_safe (~> 0.3, >= 0.3.4)
27
42
  tzinfo (~> 1.1)
43
+ addressable (2.5.0)
44
+ public_suffix (~> 2.0, >= 2.0.2)
45
+ builder (3.2.2)
28
46
  coderay (1.1.1)
29
47
  concurrent-ruby (1.0.2)
30
48
  connection_pool (2.2.1)
31
49
  diff-lcs (1.2.5)
32
- ethon (0.9.1)
50
+ digest-crc (0.4.1)
51
+ erubis (2.7.0)
52
+ ethon (0.10.1)
33
53
  ffi (>= 1.3.0)
54
+ faraday (0.10.0)
55
+ multipart-post (>= 1.2, < 3)
34
56
  ffi (1.9.14)
35
57
  git (1.3.0)
36
58
  globalid (0.3.7)
37
59
  activesupport (>= 4.1.0)
60
+ google-api-client (0.9.20)
61
+ addressable (~> 2.3)
62
+ googleauth (~> 0.5)
63
+ httpclient (~> 2.7)
64
+ hurley (~> 0.1)
65
+ memoist (~> 0.11)
66
+ mime-types (>= 1.6)
67
+ representable (~> 2.3.0)
68
+ retriable (~> 2.0)
69
+ google-cloud-core (0.21.1)
70
+ googleauth (~> 0.5.1)
71
+ google-cloud-storage (0.21.0)
72
+ digest-crc (~> 0.4)
73
+ google-api-client (~> 0.9.11)
74
+ google-cloud-core (~> 0.21.0)
75
+ googleauth (0.5.1)
76
+ faraday (~> 0.9)
77
+ jwt (~> 1.4)
78
+ logging (~> 2.0)
79
+ memoist (~> 0.12)
80
+ multi_json (~> 1.11)
81
+ os (~> 0.9)
82
+ signet (~> 0.7)
38
83
  haml (4.0.7)
39
84
  tilt
85
+ httpclient (2.8.2.4)
86
+ hurley (0.2)
40
87
  i18n (0.7.0)
41
88
  json (1.8.3)
89
+ jwt (1.5.6)
90
+ little-plugger (1.1.4)
91
+ logging (2.1.0)
92
+ little-plugger (~> 1.1)
93
+ multi_json (~> 1.10)
94
+ loofah (2.0.3)
95
+ nokogiri (>= 1.5.9)
96
+ memoist (0.15.0)
42
97
  method_source (0.8.2)
98
+ mime-types (3.1)
99
+ mime-types-data (~> 3.2015)
100
+ mime-types-data (3.2016.0521)
101
+ mini_portile2 (2.1.0)
43
102
  minitest (5.10.1)
103
+ multi_json (1.12.1)
104
+ multipart-post (2.0.0)
105
+ nokogiri (1.6.8.1)
106
+ mini_portile2 (~> 2.1.0)
44
107
  open_uri_redirections (0.2.1)
108
+ os (0.9.6)
45
109
  pry (0.10.3)
46
110
  coderay (~> 1.1.0)
47
111
  method_source (~> 0.8.1)
48
112
  slop (~> 3.4)
49
- rack (2.0.1)
113
+ public_suffix (2.0.4)
114
+ rack (1.6.5)
50
115
  rack-protection (1.5.3)
51
116
  rack
117
+ rack-test (0.6.3)
118
+ rack (>= 1.0)
119
+ rails-deprecated_sanitizer (1.0.3)
120
+ activesupport (>= 4.2.0.alpha)
121
+ rails-dom-testing (1.0.7)
122
+ activesupport (>= 4.2.0.beta, < 5.0)
123
+ nokogiri (~> 1.6.0)
124
+ rails-deprecated_sanitizer (>= 1.0.1)
125
+ rails-html-sanitizer (1.0.3)
126
+ loofah (~> 2.0)
52
127
  redis (3.3.2)
128
+ representable (2.3.0)
129
+ uber (~> 0.0.7)
130
+ retriable (2.1.0)
53
131
  rspec (3.4.0)
54
132
  rspec-core (~> 3.4.0)
55
133
  rspec-expectations (~> 3.4.0)
@@ -71,14 +149,20 @@ GEM
71
149
  redis (~> 3.2, >= 3.2.1)
72
150
  sidekiq-status (0.6.0)
73
151
  sidekiq (>= 2.7)
152
+ signet (0.7.3)
153
+ addressable (~> 2.3)
154
+ faraday (~> 0.9)
155
+ jwt (~> 1.5)
156
+ multi_json (~> 1.10)
74
157
  slop (3.6.0)
75
158
  thor (0.19.4)
76
159
  thread_safe (0.3.5)
77
160
  tilt (2.0.5)
78
- typhoeus (1.1.0)
161
+ typhoeus (1.1.2)
79
162
  ethon (>= 0.9.0)
80
163
  tzinfo (1.2.2)
81
164
  thread_safe (~> 0.1)
165
+ uber (0.0.15)
82
166
 
83
167
  PLATFORMS
84
168
  ruby
data/dronejob.gemspec CHANGED
@@ -23,7 +23,9 @@ Gem::Specification.new do |s|
23
23
  s.add_runtime_dependency "rubyzip", "~> 1.1"
24
24
  s.add_runtime_dependency "activejob", "~> 4.2"
25
25
  s.add_runtime_dependency "typhoeus", "~> 1.0"
26
+ s.add_runtime_dependency "actionpack", ">= 4.0"
26
27
  s.add_runtime_dependency "open_uri_redirections", "~> 0.2"
28
+ s.add_runtime_dependency "google-cloud-storage", "~> 0.21"
27
29
  s.add_development_dependency "rspec", "~> 3.3"
28
30
  s.add_development_dependency "pry", "~> 0.10"
29
31
  s.files = `git ls-files`.split("\n")
@@ -1,3 +1,3 @@
1
1
  module Dronejob
2
- VERSION = "1.2.5"
2
+ VERSION = "1.2.6"
3
3
  end
@@ -31,11 +31,23 @@ module Dronejob
31
31
  def copy(target_dir)
32
32
  target_dir.parent_dir.create if !target_dir.parent_dir.exists?
33
33
  FileUtils.cp_r(to_s, target_dir.to_s)
34
+ self
35
+ end
36
+
37
+ def move(target_dir)
38
+ target_dir.parent_dir.create unless target_dir.parent_dir.exists?
39
+ FileUtils.mv(to_s, target_dir.to_s)
40
+ self
34
41
  end
35
42
 
36
43
  def delete!
37
44
  FileUtils.rm_rf(to_s)
38
45
  end
46
+
47
+ def reset!
48
+ delete!
49
+ create
50
+ end
39
51
 
40
52
  def file(file_path)
41
53
  WorkspaceFile.new(@workspace, File.join(@path, file_path))
@@ -53,10 +65,10 @@ module Dronejob
53
65
  root_dir.dir(File.expand_path("..", @path))
54
66
  end
55
67
 
56
- def children
68
+ def children(glob="*")
57
69
  entries = []
58
70
  Dir.chdir(to_s) do
59
- Dir["*"].each do |path|
71
+ Dir[glob].each do |path|
60
72
  entries.push(dir(path))
61
73
  end
62
74
  end
@@ -7,6 +7,18 @@ module Dronejob
7
7
  module Net
8
8
  extend ActiveSupport::Concern
9
9
 
10
+ def cdn_upload(key, options={})
11
+ options = {
12
+ project_id: Dronejob::Base.option(:google_cloud_project_id),
13
+ bucket: Dronejob::Base.option(:cdn_bucket),
14
+ content_type: mimetype
15
+ }.merge(options)
16
+ require "google/cloud/storage"
17
+ storage = Google::Cloud::Storage.new(project: options[:project_id], keyfile: File.expand_path("~/gcloud-service-account.json"))
18
+ bucket = storage.bucket(options[:bucket])
19
+ bucket.create_file(to_s, key, acl: "public", content_type: options[:content_type])
20
+ end
21
+
10
22
  def cdn_download(key)
11
23
  download("#{Dronejob::Base.option(:cdn_scheme)}://#{Dronejob::Base.option(:cdn_bucket)}/#{key}")
12
24
  end
@@ -1,3 +1,4 @@
1
+ require "action_dispatch/http/mime_type"
1
2
  require 'dronejob/workspace_file/archive'
2
3
  require 'dronejob/workspace_file/media'
3
4
  require 'dronejob/workspace_file/net'
@@ -30,7 +31,7 @@ module Dronejob
30
31
  contents.gsub!(key, value)
31
32
  self
32
33
  end
33
-
34
+
34
35
  def write(data=nil)
35
36
  data ||= @contents
36
37
  dir.create if !dir.exists?
@@ -50,6 +51,10 @@ module Dronejob
50
51
  def relative_path
51
52
  @path.gsub(/^\//, "")
52
53
  end
54
+
55
+ def absolute_path
56
+ File.absolute_path(to_s)
57
+ end
53
58
 
54
59
  def exists?
55
60
  File.exists?(to_s)
@@ -74,6 +79,10 @@ module Dronejob
74
79
  def extension
75
80
  File.extname(to_s).gsub(/^\./, "")
76
81
  end
82
+
83
+ def mimetype
84
+ Mime::Type.lookup_by_extension(extension).to_s
85
+ end
77
86
 
78
87
  def rename!(filename)
79
88
  FileUtils.mv(to_s, dir.file(filename).to_s) if exists?
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.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Strebitzer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-03 00:00:00.000000000 Z
11
+ date: 2016-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -142,6 +142,20 @@ dependencies:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
144
  version: '1.0'
145
+ - !ruby/object:Gem::Dependency
146
+ name: actionpack
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '4.0'
152
+ type: :runtime
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '4.0'
145
159
  - !ruby/object:Gem::Dependency
146
160
  name: open_uri_redirections
147
161
  requirement: !ruby/object:Gem::Requirement
@@ -156,6 +170,20 @@ dependencies:
156
170
  - - "~>"
157
171
  - !ruby/object:Gem::Version
158
172
  version: '0.2'
173
+ - !ruby/object:Gem::Dependency
174
+ name: google-cloud-storage
175
+ requirement: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - "~>"
178
+ - !ruby/object:Gem::Version
179
+ version: '0.21'
180
+ type: :runtime
181
+ prerelease: false
182
+ version_requirements: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - "~>"
185
+ - !ruby/object:Gem::Version
186
+ version: '0.21'
159
187
  - !ruby/object:Gem::Dependency
160
188
  name: rspec
161
189
  requirement: !ruby/object:Gem::Requirement