slipsquare 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.travis.yml +9 -0
- data/CHANGELOG.md +21 -0
- data/CONTRIBUTING.md +28 -0
- data/Gemfile +4 -0
- data/LICENSE.md +22 -0
- data/README.md +93 -0
- data/Rakefile +6 -0
- data/bin/slipsquare +7 -0
- data/lib/slipsquare.rb +6 -0
- data/lib/slipsquare/cli.rb +105 -0
- data/lib/slipsquare/config.rb +67 -0
- data/lib/slipsquare/middleware.rb +106 -0
- data/lib/slipsquare/middleware/account.rb +14 -0
- data/lib/slipsquare/middleware/ask_for_credentials.rb +39 -0
- data/lib/slipsquare/middleware/base.rb +28 -0
- data/lib/slipsquare/middleware/check_configuration.rb +18 -0
- data/lib/slipsquare/middleware/check_credentials.rb +27 -0
- data/lib/slipsquare/middleware/chunked_upload.rb +29 -0
- data/lib/slipsquare/middleware/delete_file.rb +13 -0
- data/lib/slipsquare/middleware/download_file.rb +25 -0
- data/lib/slipsquare/middleware/inject_client.rb +27 -0
- data/lib/slipsquare/middleware/inject_configuration.rb +15 -0
- data/lib/slipsquare/middleware/list_files.rb +19 -0
- data/lib/slipsquare/middleware/make_directory.rb +25 -0
- data/lib/slipsquare/middleware/upload_file.rb +17 -0
- data/lib/slipsquare/version.rb +3 -0
- data/slipsquare.gemspec +34 -0
- data/spec/cli/account.rb +24 -0
- data/spec/cli/authorize_spec.rb +46 -0
- data/spec/cli/chunked_upload_spec.rb +39 -0
- data/spec/cli/delete_file.rb +23 -0
- data/spec/cli/download_file.rb +43 -0
- data/spec/cli/get_keys_spec.rb +30 -0
- data/spec/cli/help_cli_spec.rb +17 -0
- data/spec/cli/ls_spec.rb +36 -0
- data/spec/cli/mkdir_spec.rb +52 -0
- data/spec/cli/upload_file.rb +33 -0
- data/spec/cli/verify_spec.rb +33 -0
- data/spec/cli/version_cli_spec.rb +16 -0
- data/spec/config_spec.rb +70 -0
- data/spec/fixtures/account.json +11 -0
- data/spec/fixtures/chunked_upload.json +5 -0
- data/spec/fixtures/commit_chunked_upload.json +13 -0
- data/spec/fixtures/find_foo_directory.json +15 -0
- data/spec/fixtures/ls_path_success.json +29 -0
- data/spec/fixtures/ls_success.json +14 -0
- data/spec/fixtures/mkdir_success.json +12 -0
- data/spec/fixtures/mkdir_success_multiple_path.json +12 -0
- data/spec/fixtures/upload_success.json +13 -0
- data/spec/fixtures/verify_success.json +14 -0
- data/spec/middleware/base_spec.rb +15 -0
- data/spec/middleware/check_configuration_spec.rb +16 -0
- data/spec/middleware/inject_configuration_spec.rb +16 -0
- data/spec/shared/environment.rb +49 -0
- data/spec/spec_helper.rb +20 -0
- data/tmp/.gitkeep +0 -0
- metadata +270 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"size": "225.4KB",
|
3
|
+
"rev": "35e97029684fe",
|
4
|
+
"thumb_exists": false,
|
5
|
+
"bytes": 230783,
|
6
|
+
"modified": "Tue, 19 Jul 2011 21:55:38 +0000",
|
7
|
+
"client_mtime": "Mon, 18 Jul 2011 18:04:35 +0000",
|
8
|
+
"path": "/Getting_Started.pdf",
|
9
|
+
"is_dir": false,
|
10
|
+
"icon": "page_white_acrobat",
|
11
|
+
"root": "dropbox",
|
12
|
+
"mime_type": "application/pdf",
|
13
|
+
"revision": 220823
|
14
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"size": "225.4KB",
|
3
|
+
"rev": "35e97029684fe",
|
4
|
+
"thumb_exists": false,
|
5
|
+
"bytes": 230783,
|
6
|
+
"modified": "Tue, 19 Jul 2011 21:55:38 +0000",
|
7
|
+
"path": "/foo.txt",
|
8
|
+
"is_dir": false,
|
9
|
+
"icon": "page_white_acrobat",
|
10
|
+
"root": "dropbox",
|
11
|
+
"mime_type": "application/pdf",
|
12
|
+
"revision": 220823
|
13
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"size": "225.4KB",
|
3
|
+
"rev": "35e97029684fe",
|
4
|
+
"thumb_exists": false,
|
5
|
+
"bytes": 230783,
|
6
|
+
"modified": "Tue, 19 Jul 2011 21:55:38 +0000",
|
7
|
+
"client_mtime": "Mon, 18 Jul 2011 18:04:35 +0000",
|
8
|
+
"path": "/Getting_Started.pdf",
|
9
|
+
"is_dir": false,
|
10
|
+
"icon": "page_white_acrobat",
|
11
|
+
"root": "dropbox",
|
12
|
+
"mime_type": "application/pdf",
|
13
|
+
"revision": 220823
|
14
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Slipsquare::Middleware::Base do
|
4
|
+
include_context "spec"
|
5
|
+
|
6
|
+
let(:klass) { described_class }
|
7
|
+
|
8
|
+
describe ".initialize" do
|
9
|
+
it "prints a clear line" do
|
10
|
+
$stdout.should_receive(:print).with("")
|
11
|
+
klass.new({})
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Slipsquare::Middleware::CheckConfiguration do
|
4
|
+
include_context "spec"
|
5
|
+
|
6
|
+
describe ".call" do
|
7
|
+
it "raises SystemExit with no configuration" do
|
8
|
+
|
9
|
+
# Delete the temp configuration file.
|
10
|
+
File.delete(project_path + "/tmp/slipsquare")
|
11
|
+
|
12
|
+
expect {described_class.new(app).call(env) }.to raise_error(SystemExit)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Slipsquare::Middleware::InjectConfiguration do
|
4
|
+
include_context "spec"
|
5
|
+
|
6
|
+
describe ".call" do
|
7
|
+
|
8
|
+
it "loads the configuration into the environment" do
|
9
|
+
described_class.new(app).call(env)
|
10
|
+
|
11
|
+
env["config"].should == config
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
shared_context "spec" do
|
4
|
+
# Default configuration and
|
5
|
+
let(:config) { Slipsquare::Configuration.instance }
|
6
|
+
let(:app_key) { "foo" }
|
7
|
+
let(:secret_key) { "bar" }
|
8
|
+
let(:app_token) { "baz" }
|
9
|
+
let(:app_secret) { "qux" }
|
10
|
+
let(:app) { lambda { |env| } }
|
11
|
+
let(:env) { {} }
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
$stdout.sync = true
|
15
|
+
$stderr.sync = true
|
16
|
+
|
17
|
+
@cli = Slipsquare::CLI.new
|
18
|
+
|
19
|
+
# Set a temprary project path and create fake config.
|
20
|
+
config.create_config_file(app_key, secret_key, app_token, app_secret)
|
21
|
+
config.reload!
|
22
|
+
|
23
|
+
# Keep track of the old stderr / out
|
24
|
+
@orig_stderr = $stderr
|
25
|
+
@orig_stdout = $stdout
|
26
|
+
|
27
|
+
# Make them strings so we can manipulate and compare.
|
28
|
+
$stderr = StringIO.new
|
29
|
+
$stdout = StringIO.new
|
30
|
+
|
31
|
+
@orig_ruby_progress_bar = ENV['RUBY_PROGRESS_BAR_LENGTH']
|
32
|
+
|
33
|
+
ENV['RUBY_PROGRESS_BAR_LENGTH'] = '80'
|
34
|
+
end
|
35
|
+
|
36
|
+
after(:each) do
|
37
|
+
# Reassign the stderr / out so rspec can have it back.
|
38
|
+
$stderr = @orig_stderr
|
39
|
+
$stdout = @orig_stdout
|
40
|
+
|
41
|
+
ENV['RUBY_PROGRESS_BAR_LENGTH'] = @orig_ruby_progress_bar
|
42
|
+
end
|
43
|
+
|
44
|
+
after(:each) do
|
45
|
+
# Delete the temporary configuration file if it exists.
|
46
|
+
File.delete(project_path + "/tmp/slipsquare") if File.exist?(project_path + "/tmp/slipsquare")
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'slipsquare'
|
2
|
+
require 'webmock/rspec'
|
3
|
+
require 'shared/environment'
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
# Pretty tests
|
7
|
+
config.color_enabled = true
|
8
|
+
|
9
|
+
config.order = :random
|
10
|
+
end
|
11
|
+
|
12
|
+
def project_path
|
13
|
+
File.expand_path("../..", __FILE__)
|
14
|
+
end
|
15
|
+
|
16
|
+
def fixture(fixture_name)
|
17
|
+
File.new(project_path + "/spec/fixtures/#{fixture_name}.json")
|
18
|
+
end
|
19
|
+
|
20
|
+
ENV["SLIPSTREAM_CONFIG_PATH"] = project_path + "/tmp/slipsquare"
|
data/tmp/.gitkeep
ADDED
File without changes
|
metadata
ADDED
@@ -0,0 +1,270 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: slipsquare
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Peter Souter
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.18.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.18.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: middleware
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: dropbox-api-petems
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.4.2
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.4.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: table_print
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.1.5
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.1.5
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: ruby-progressbar
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.2.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.2.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 10.1.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 10.1.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-core
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.13.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.13.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec-expectations
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.13.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 2.13.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rspec-mocks
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.13.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ~>
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.13.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: webmock
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ~>
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 1.11.0
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ~>
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 1.11.0
|
153
|
+
description: A command line tool for uploading to dropbox.
|
154
|
+
email:
|
155
|
+
- p.morsou@gmail.com
|
156
|
+
executables:
|
157
|
+
- slipsquare
|
158
|
+
extensions: []
|
159
|
+
extra_rdoc_files: []
|
160
|
+
files:
|
161
|
+
- .gitignore
|
162
|
+
- .travis.yml
|
163
|
+
- CHANGELOG.md
|
164
|
+
- CONTRIBUTING.md
|
165
|
+
- Gemfile
|
166
|
+
- LICENSE.md
|
167
|
+
- README.md
|
168
|
+
- Rakefile
|
169
|
+
- bin/slipsquare
|
170
|
+
- lib/slipsquare.rb
|
171
|
+
- lib/slipsquare/cli.rb
|
172
|
+
- lib/slipsquare/config.rb
|
173
|
+
- lib/slipsquare/middleware.rb
|
174
|
+
- lib/slipsquare/middleware/account.rb
|
175
|
+
- lib/slipsquare/middleware/ask_for_credentials.rb
|
176
|
+
- lib/slipsquare/middleware/base.rb
|
177
|
+
- lib/slipsquare/middleware/check_configuration.rb
|
178
|
+
- lib/slipsquare/middleware/check_credentials.rb
|
179
|
+
- lib/slipsquare/middleware/chunked_upload.rb
|
180
|
+
- lib/slipsquare/middleware/delete_file.rb
|
181
|
+
- lib/slipsquare/middleware/download_file.rb
|
182
|
+
- lib/slipsquare/middleware/inject_client.rb
|
183
|
+
- lib/slipsquare/middleware/inject_configuration.rb
|
184
|
+
- lib/slipsquare/middleware/list_files.rb
|
185
|
+
- lib/slipsquare/middleware/make_directory.rb
|
186
|
+
- lib/slipsquare/middleware/upload_file.rb
|
187
|
+
- lib/slipsquare/version.rb
|
188
|
+
- slipsquare.gemspec
|
189
|
+
- spec/cli/account.rb
|
190
|
+
- spec/cli/authorize_spec.rb
|
191
|
+
- spec/cli/chunked_upload_spec.rb
|
192
|
+
- spec/cli/delete_file.rb
|
193
|
+
- spec/cli/download_file.rb
|
194
|
+
- spec/cli/get_keys_spec.rb
|
195
|
+
- spec/cli/help_cli_spec.rb
|
196
|
+
- spec/cli/ls_spec.rb
|
197
|
+
- spec/cli/mkdir_spec.rb
|
198
|
+
- spec/cli/upload_file.rb
|
199
|
+
- spec/cli/verify_spec.rb
|
200
|
+
- spec/cli/version_cli_spec.rb
|
201
|
+
- spec/config_spec.rb
|
202
|
+
- spec/fixtures/account.json
|
203
|
+
- spec/fixtures/chunked_upload.json
|
204
|
+
- spec/fixtures/commit_chunked_upload.json
|
205
|
+
- spec/fixtures/find_foo_directory.json
|
206
|
+
- spec/fixtures/ls_path_success.json
|
207
|
+
- spec/fixtures/ls_success.json
|
208
|
+
- spec/fixtures/mkdir_success.json
|
209
|
+
- spec/fixtures/mkdir_success_multiple_path.json
|
210
|
+
- spec/fixtures/upload_success.json
|
211
|
+
- spec/fixtures/verify_success.json
|
212
|
+
- spec/middleware/base_spec.rb
|
213
|
+
- spec/middleware/check_configuration_spec.rb
|
214
|
+
- spec/middleware/inject_configuration_spec.rb
|
215
|
+
- spec/shared/environment.rb
|
216
|
+
- spec/spec_helper.rb
|
217
|
+
- tmp/.gitkeep
|
218
|
+
homepage: https://github.com/petems/slipsquare
|
219
|
+
licenses:
|
220
|
+
- MIT
|
221
|
+
metadata: {}
|
222
|
+
post_install_message:
|
223
|
+
rdoc_options: []
|
224
|
+
require_paths:
|
225
|
+
- lib
|
226
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
227
|
+
requirements:
|
228
|
+
- - '>='
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
version: '0'
|
231
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - '>='
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: '0'
|
236
|
+
requirements: []
|
237
|
+
rubyforge_project:
|
238
|
+
rubygems_version: 2.1.2
|
239
|
+
signing_key:
|
240
|
+
specification_version: 4
|
241
|
+
summary: Slipsquare is a CLI for Dropbox, for downloading and uploading files.
|
242
|
+
test_files:
|
243
|
+
- spec/cli/account.rb
|
244
|
+
- spec/cli/authorize_spec.rb
|
245
|
+
- spec/cli/chunked_upload_spec.rb
|
246
|
+
- spec/cli/delete_file.rb
|
247
|
+
- spec/cli/download_file.rb
|
248
|
+
- spec/cli/get_keys_spec.rb
|
249
|
+
- spec/cli/help_cli_spec.rb
|
250
|
+
- spec/cli/ls_spec.rb
|
251
|
+
- spec/cli/mkdir_spec.rb
|
252
|
+
- spec/cli/upload_file.rb
|
253
|
+
- spec/cli/verify_spec.rb
|
254
|
+
- spec/cli/version_cli_spec.rb
|
255
|
+
- spec/config_spec.rb
|
256
|
+
- spec/fixtures/account.json
|
257
|
+
- spec/fixtures/chunked_upload.json
|
258
|
+
- spec/fixtures/commit_chunked_upload.json
|
259
|
+
- spec/fixtures/find_foo_directory.json
|
260
|
+
- spec/fixtures/ls_path_success.json
|
261
|
+
- spec/fixtures/ls_success.json
|
262
|
+
- spec/fixtures/mkdir_success.json
|
263
|
+
- spec/fixtures/mkdir_success_multiple_path.json
|
264
|
+
- spec/fixtures/upload_success.json
|
265
|
+
- spec/fixtures/verify_success.json
|
266
|
+
- spec/middleware/base_spec.rb
|
267
|
+
- spec/middleware/check_configuration_spec.rb
|
268
|
+
- spec/middleware/inject_configuration_spec.rb
|
269
|
+
- spec/shared/environment.rb
|
270
|
+
- spec/spec_helper.rb
|