dropscreen 0.0.4 → 0.0.6
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 +4 -4
- data/README.md +15 -9
- data/lib/dropscreen.rb +10 -8
- data/lib/dropscreen/version.rb +1 -1
- data/spec/dropscreen_spec.rb +11 -8
- 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: 437a9d10c65002b91c15b7973218a002d0567c7c
|
4
|
+
data.tar.gz: 58611be10dae4e2aaf5c28f9892fb83009b8cf6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c7e626b1bed9b67f1e3ad62fca1146b355b860a0f37cd07982089584ea291f26e23e1281d5db376596ca38a54d238621eaeb912bac6e554c326a68e185473c2
|
7
|
+
data.tar.gz: 215ca97213a1be5f7fe15e5994a4bdb2f16189033db2acf30f9e10b772f26cb5824acbc83fa3b77a20bb173107b2c16055237ba6975ee804024f914c3898b0c3
|
data/README.md
CHANGED
@@ -1,20 +1,19 @@
|
|
1
1
|
# Dropscreen
|
2
|
-
|
3
2
|
A gem to sync screenshot files with Dropbox
|
4
3
|
|
5
4
|
## Installation
|
6
5
|
|
7
6
|
Add this line to your application's Gemfile:
|
8
7
|
|
9
|
-
|
8
|
+
`gem 'dropscreen'`
|
10
9
|
|
11
10
|
And then execute:
|
12
11
|
|
13
|
-
|
12
|
+
`$ bundle`
|
14
13
|
|
15
14
|
Or install it yourself as:
|
16
15
|
|
17
|
-
|
16
|
+
`$ gem install dropscreen`
|
18
17
|
|
19
18
|
|
20
19
|
## Authentication
|
@@ -25,34 +24,41 @@ https://www.dropbox.com/developers/core/start/ruby
|
|
25
24
|
## Usage
|
26
25
|
|
27
26
|
export the dropbox access token as an environment variable:
|
28
|
-
|
27
|
+
|
28
|
+
`export DROPBOX_ACCESS_TOKEN=**insert dropbox access token here**`
|
29
29
|
|
30
30
|
### In your code
|
31
|
-
require 'dropscreen'
|
31
|
+
`require 'dropscreen'`
|
32
32
|
|
33
33
|
This uses the token from the environment variable and sets the root dir local and remote to be the local app dir and the permitted dropbox dir respectively.
|
34
|
-
|
34
|
+
|
35
|
+
`dropscreen_client = Dropscreen::Client.new`
|
35
36
|
|
36
37
|
Alternatively, you can pass in a hash with one or more of these options:
|
37
38
|
|
39
|
+
```ruby
|
38
40
|
client = Dropscreen::Client.new(
|
39
41
|
remote_base_dir: 'remote_base_dir',
|
40
42
|
local_base_dir: 'local_base_dir'
|
41
43
|
)
|
44
|
+
```
|
42
45
|
|
43
46
|
#### Pulling files from dropbox
|
44
47
|
|
45
|
-
client.pull('some_folder'[, 'dest_folder'])
|
48
|
+
`client.pull('some_folder'[, 'dest_folder'])`
|
46
49
|
|
47
50
|
The destination folder will by default be the same name as the source folder, alternatively you can pass in a destination folder as the second param.
|
48
51
|
|
49
52
|
|
50
53
|
#### Pushing files to dropbox
|
51
54
|
|
52
|
-
client.push('some_folder'[, 'dest_folder'])
|
55
|
+
`client.push('some_folder'[, 'dest_folder'])`
|
53
56
|
|
54
57
|
The destination folder will by default be the same name as the source folder, alternatively you can pass in a destination folder as the second param.
|
55
58
|
|
59
|
+
#### Remove files/folders from dropbox
|
60
|
+
|
61
|
+
`client.remove(path)`
|
56
62
|
|
57
63
|
|
58
64
|
## Contributing
|
data/lib/dropscreen.rb
CHANGED
@@ -35,14 +35,16 @@ module Dropscreen
|
|
35
35
|
|
36
36
|
def exists? path
|
37
37
|
fullpath = File.join(@remote_base_dir,path)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
38
|
+
begin
|
39
|
+
metadata = @client.metadata(fullpath)
|
40
|
+
return not(metadata['is_deleted'])
|
41
|
+
rescue DropboxError => e
|
42
|
+
if e.message.include? 'not found'
|
43
|
+
return false
|
44
|
+
else
|
45
|
+
raise e
|
46
|
+
end
|
47
|
+
end
|
46
48
|
end
|
47
49
|
|
48
50
|
def pull(src, dest=src)
|
data/lib/dropscreen/version.rb
CHANGED
data/spec/dropscreen_spec.rb
CHANGED
@@ -18,18 +18,21 @@ describe Dropscreen do
|
|
18
18
|
|
19
19
|
it 'should pull down all the files in a given directory' do
|
20
20
|
@client.pull('reference_screenshots')
|
21
|
-
File.exists?('artifacts/reference_screenshots/advisor_page_firefox.gif').should
|
22
|
-
File.exists?('artifacts/reference_screenshots/advisor_page_ie9.gif').should
|
21
|
+
File.exists?('artifacts/reference_screenshots/advisor_page_firefox.gif').should be true
|
22
|
+
File.exists?('artifacts/reference_screenshots/advisor_page_ie9.gif').should be true
|
23
23
|
end
|
24
24
|
|
25
25
|
end
|
26
26
|
|
27
27
|
describe '#exists?' do
|
28
28
|
it 'should be false if it doesnt exist' do
|
29
|
-
@client.exists?('flibble').should
|
29
|
+
@client.exists?('flibble/flibble').should be false
|
30
|
+
end
|
31
|
+
it 'should be false if it is deleted' do
|
32
|
+
allow(@client).to receive(:exists?).and_return({'is_deleted' => true});
|
30
33
|
end
|
31
34
|
it 'should be true if it exists' do
|
32
|
-
@client.exists?('reference_screenshots').should
|
35
|
+
@client.exists?('reference_screenshots').should be true
|
33
36
|
end
|
34
37
|
end
|
35
38
|
|
@@ -57,24 +60,24 @@ describe Dropscreen do
|
|
57
60
|
describe '#remove' do
|
58
61
|
it 'should remove a directory' do
|
59
62
|
@client.push('screenshots_generated_this_run')
|
60
|
-
expect(@client.remove('screenshots_generated_this_run')).to
|
63
|
+
expect(@client.remove('screenshots_generated_this_run')).to be true
|
61
64
|
end
|
62
65
|
|
63
66
|
it 'should remove a file' do
|
64
67
|
FileUtils.touch('artifacts/screenshots_generated_this_run/little_lonely_file')
|
65
68
|
@client.push('screenshots_generated_this_run')
|
66
|
-
expect(@client.remove('screenshots_generated_this_run/little_lonely_file')).to
|
69
|
+
expect(@client.remove('screenshots_generated_this_run/little_lonely_file')).to be true
|
67
70
|
end
|
68
71
|
|
69
72
|
it 'should not complain if you try to delete a non existent folder' do
|
70
73
|
@client.remove('non_existent_folder')
|
71
|
-
expect(@client.remove('non_existent_folder')).to
|
74
|
+
expect(@client.remove('non_existent_folder')).to be true
|
72
75
|
end
|
73
76
|
|
74
77
|
it 'should not complain if you try to delete a non existent file' do
|
75
78
|
@client.push('screenshots_generated_this_run')
|
76
79
|
@client.remove('screenshot_generated_this_run/non_existent_file')
|
77
|
-
expect(@client.remove('screenshot_generated_this_run/non_existent_file')).to
|
80
|
+
expect(@client.remove('screenshot_generated_this_run/non_existent_file')).to be true
|
78
81
|
end
|
79
82
|
|
80
83
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dropscreen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sky Haiku Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dropbox-sdk
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
123
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.2.
|
124
|
+
rubygems_version: 2.2.2
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: Push and pull files to dropbox
|