pushfile 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/pushfile/data.rb +4 -3
- data/lib/pushfile/upload.rb +4 -0
- data/pushfile.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b640190bce1efb45bbf88de4cad12f28d615a176
|
4
|
+
data.tar.gz: f252b01349bdddc9cbba41a6d70fd56047df1acf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e6db594a7f266de5084682de0715501eeb03ca1305a2c7c0e1b89fb04aa2cfe1d7631ebe4c8bf2ae50f144304dbd3eac11bf387ad694297f7e68ef0169de2ec
|
7
|
+
data.tar.gz: dcef9f976bc09062d367f46c50165c382786133a8352e72ce2c99fcd91e0176cc68f9c3b9a5e1776f8c2ed63c43389c55127b29c5854f11d3f68c0bb2a6d8128
|
data/CHANGELOG.md
CHANGED
data/lib/pushfile/data.rb
CHANGED
@@ -16,7 +16,6 @@ module Pushfile
|
|
16
16
|
# Do Froala or Dropzone file uploads
|
17
17
|
elsif @options[:file] || @options[:datafile]
|
18
18
|
file_upload
|
19
|
-
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
@@ -52,11 +51,13 @@ module Pushfile
|
|
52
51
|
def url_upload
|
53
52
|
url = @options[:url].strip
|
54
53
|
|
54
|
+
content = RestClient.get(url) rescue nil
|
55
|
+
|
55
56
|
file = Tempfile.new('tmp').tap do |file|
|
56
57
|
file.binmode # must be in binary mode
|
57
|
-
file.write
|
58
|
+
file.write(content)
|
58
59
|
file.rewind
|
59
|
-
end
|
60
|
+
end if content
|
60
61
|
|
61
62
|
# Extract the file name from the URL
|
62
63
|
filename = url.split('/').last
|
data/lib/pushfile/upload.rb
CHANGED
@@ -51,6 +51,10 @@ module Pushfile
|
|
51
51
|
# Create upload
|
52
52
|
def create
|
53
53
|
@file = @data.is_a?(String) ? File.open(@data) : @data[:tempfile]
|
54
|
+
|
55
|
+
# Return error if no file
|
56
|
+
return (@status = {:error => 'upload_file_not_found'}) unless @file
|
57
|
+
|
54
58
|
@name = filename(@data.is_a?(String) ? @data : @data[:filename])
|
55
59
|
|
56
60
|
# Check if it's more than max or return error
|
data/pushfile.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'pushfile'
|
3
|
-
s.version = '0.1.
|
4
|
-
s.date = '2017-
|
3
|
+
s.version = '0.1.2'
|
4
|
+
s.date = '2017-03-09'
|
5
5
|
s.summary = "Pushfile Cloud File Uploader"
|
6
6
|
s.description = "Upload files to Rackspace Cloud or Amazon S3 by URL or file with automatic image resizing."
|
7
7
|
s.authors = ["Fugroup Limited"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pushfile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fugroup Limited
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
193
|
rubyforge_project:
|
194
|
-
rubygems_version: 2.6.
|
194
|
+
rubygems_version: 2.6.10
|
195
195
|
signing_key:
|
196
196
|
specification_version: 4
|
197
197
|
summary: Pushfile Cloud File Uploader
|