dbinbox 0.0.1
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.
- data/.gitignore +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +21 -0
- data/LICENSE.txt +22 -0
- data/README.md +36 -0
- data/Rakefile +5 -0
- data/bin/dbinbox +79 -0
- data/dbinbox.gemspec +30 -0
- data/lib/dbinbox.rb +64 -0
- data/lib/dbinbox/version.rb +3 -0
- data/pkg/dbinbox-0.0.1.gem +0 -0
- metadata +114 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.DS_Store
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
dbinbox (0.0.1)
|
5
|
+
rest-client (~> 1.6.7)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
mime-types (1.23)
|
11
|
+
rake (10.0.4)
|
12
|
+
rest-client (1.6.7)
|
13
|
+
mime-types (>= 1.16)
|
14
|
+
|
15
|
+
PLATFORMS
|
16
|
+
ruby
|
17
|
+
|
18
|
+
DEPENDENCIES
|
19
|
+
bundler (~> 1.3)
|
20
|
+
dbinbox!
|
21
|
+
rake
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Christian Genco
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Dbinbox
|
2
|
+
|
3
|
+
Command line interface for the file sending site dbinbox.com. Allows command line uploading of files, directories, and messages from ARGV to specified dbinbox users.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install dbinbox
|
8
|
+
|
9
|
+
Or, to use within a Ruby project, add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'dbinbox'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
$ dbinbox USERNAME cat.jpg
|
20
|
+
# uploads cat.jpg to http://dbinbox.com/USERNAME/
|
21
|
+
|
22
|
+
$ dbinbox USERNAME cats/
|
23
|
+
# uploads the directory cats and all of its contents
|
24
|
+
|
25
|
+
$ dbinbox USERNAME/lolcats bobtail.png bengal.jpg manx.gif
|
26
|
+
# uploads three images to the /lolcats dbinbox directory
|
27
|
+
|
28
|
+
$ dbinbox USERNAME "hey there - how's it going?"
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
1. Fork it
|
33
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
34
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
35
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
36
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/dbinbox
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Christian Genco (@cgenco)
|
3
|
+
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
@options = {}
|
7
|
+
parser = OptionParser.new do |opt|
|
8
|
+
opt.banner = "" +
|
9
|
+
"dbinbox: send files, directories, and messages to dbinbox.com from the command line\n\n" +
|
10
|
+
"For more information, see the README at:\n"+
|
11
|
+
"github.com/christiangenco/dbinbox_gem\n\n" +
|
12
|
+
"Usage:\n" +
|
13
|
+
" $ dbinbox USERNAME cat.jpg\n\n" +
|
14
|
+
" $ dbinbox USERNAME cats/\n" +
|
15
|
+
" # uploads the directory cats and all of its contents\n\n"
|
16
|
+
" $ dbinbox USERNAME/lolcats bobtail.png bengal.jpg manx.gif \n" +
|
17
|
+
" # uploads three images to the /lolcats dbinbox directory\n\n" +
|
18
|
+
" $ dbinbox USERNAME \"hey there - how's it going?\"\n"
|
19
|
+
|
20
|
+
opt.summary_indent = ' '
|
21
|
+
opt.separator "\nOptions:\n"
|
22
|
+
|
23
|
+
opt.on('-h', '--help', 'Shows this help message') do
|
24
|
+
puts parser
|
25
|
+
exit
|
26
|
+
end
|
27
|
+
|
28
|
+
opt.on('-v', '--version', 'Shows the current version') do
|
29
|
+
require 'dbinbox/version'
|
30
|
+
puts Dbinbox::VERSION
|
31
|
+
|
32
|
+
exit
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
parser.parse!
|
37
|
+
|
38
|
+
unless ARGV.length >= 2
|
39
|
+
STDERR.puts "Error: at least two arguments are required\n"
|
40
|
+
STDERR.puts parser
|
41
|
+
exit 1
|
42
|
+
end
|
43
|
+
|
44
|
+
require 'dbinbox'
|
45
|
+
|
46
|
+
# username is always the first argument
|
47
|
+
@dbinbox = Dbinbox.new(ARGV.shift)
|
48
|
+
|
49
|
+
# all subsequent arguments will be messages or filenames
|
50
|
+
@dbinbox.send ARGV
|
51
|
+
|
52
|
+
|
53
|
+
# binding.pry
|
54
|
+
|
55
|
+
# RestClient.post(, "files[]" => File.new("./christian.png"))
|
56
|
+
# RestClient.post("http://dbinbox.com/send/#{username}", "files[]" => ARGF.read)
|
57
|
+
|
58
|
+
# filename=title&message=message
|
59
|
+
|
60
|
+
|
61
|
+
# apt-get install dbinbox
|
62
|
+
# gem install dbinbox
|
63
|
+
# sudo npm install -g dbinbox
|
64
|
+
|
65
|
+
# dbinbox cgenco FILENAME[S]
|
66
|
+
# # uploads list of files to /send/cgenco in param files[]
|
67
|
+
|
68
|
+
# dbinbox cgenco "Hello there!"
|
69
|
+
# # sends the text "Hello there!" to /send/cgenco in param message
|
70
|
+
|
71
|
+
# dbinbox cgenco/cats cat.jpg
|
72
|
+
# # sends cat.jpg to the cats directory of cgenco
|
73
|
+
|
74
|
+
# dbinbox cgenco rofl/
|
75
|
+
# # where rofl is a directory. Recursively sends the contents of rofl to cgenco with the same directory structure
|
76
|
+
|
77
|
+
# alias send="dbinbox cgenco"
|
78
|
+
# send FILENAME[S]
|
79
|
+
# # same as above
|
data/dbinbox.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
# this file generated with:
|
4
|
+
# bundle gem dbinbox
|
5
|
+
|
6
|
+
lib = File.expand_path('../lib', __FILE__)
|
7
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
8
|
+
require 'dbinbox/version'
|
9
|
+
|
10
|
+
Gem::Specification.new do |spec|
|
11
|
+
spec.name = "dbinbox"
|
12
|
+
spec.version = Dbinbox::VERSION
|
13
|
+
spec.authors = ["Christian Genco"]
|
14
|
+
spec.email = ["christian.genco@gmail.com"]
|
15
|
+
|
16
|
+
spec.summary = "send files, directories, and messages to dbinbox.com from the command line"
|
17
|
+
spec.description = "Command line interface for the file sending site dbinbox.com. Allows command line uploading of files, directories, and messages from ARGV to specified dbinbox users."
|
18
|
+
spec.homepage = 'https://github.com/christiangenco/dbinbox_gem'
|
19
|
+
spec.license = "MIT"
|
20
|
+
|
21
|
+
spec.files = `git ls-files`.split($/)
|
22
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
23
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_runtime_dependency "rest-client", "~> 1.6.7"
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
29
|
+
spec.add_development_dependency "rake"
|
30
|
+
end
|
data/lib/dbinbox.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# yardoc info: http://cheat.errtheblog.com/s/yard/
|
2
|
+
|
3
|
+
class Dbinbox
|
4
|
+
# @author Christian Genco (@cgenco)
|
5
|
+
|
6
|
+
require 'rest_client'
|
7
|
+
|
8
|
+
# @attribute username [String] the username that items are sent to
|
9
|
+
# @attribute path [String] the subdirectory items are sent to
|
10
|
+
# @attribute record [Array] a record of all files uploaded
|
11
|
+
attr_accessor :username, :path, :record
|
12
|
+
|
13
|
+
# A new instance of Dbinbox, which will keep the username and path constant for multiple uploads.
|
14
|
+
#
|
15
|
+
# @param [String] username_path initializes both the username and the path
|
16
|
+
def initialize(username_path)
|
17
|
+
@username, *@path = username_path.split("/")
|
18
|
+
end
|
19
|
+
|
20
|
+
# Uploads an array of files, strings, and directories to a specified user's dbinbox account under a specified path.
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# Dbinbox.send('USERNAME', ["hello there!", "cat.jpg", "dogs/"])
|
24
|
+
# Dbinbox.send('USERNAME/photos', ["beach.png"])
|
25
|
+
#
|
26
|
+
# @param [String] username the username (and optional path) that items are sent to
|
27
|
+
# @param [Array] args an array of files, strings, and directories to be uploaded
|
28
|
+
def self.send(username, args)
|
29
|
+
url = "http://dbinbox.com/send/#{username}"
|
30
|
+
|
31
|
+
# force args to an array
|
32
|
+
args = [args] unless args.respond_to? :each
|
33
|
+
|
34
|
+
args.each{ |arg|
|
35
|
+
if File.directory?(arg)
|
36
|
+
# STDERR.puts "#{arg} is a directory"
|
37
|
+
Dir.glob(File.join(arg, "*")).each{|f|
|
38
|
+
Dbinbox.send("#{username}", f)
|
39
|
+
}
|
40
|
+
elsif File.exists?(arg)
|
41
|
+
u = url + arg.sub(File.basename(arg), '')
|
42
|
+
STDERR.puts "Uploading #{arg} to #{u}"
|
43
|
+
RestClient.post(u, "files[]" => File.new(arg))
|
44
|
+
else
|
45
|
+
STDERR.puts "Sending \"#{arg}\" to #{url}"
|
46
|
+
RestClient.post(url, "message" => arg)
|
47
|
+
end
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# An alias for Dbinbox.send, but uses the username and filepath specified in the constructor.
|
52
|
+
#
|
53
|
+
# @example
|
54
|
+
# dbinbox = Dbinbox.new('USERNAME')
|
55
|
+
# dbinbox.send ["hello there!", "cat.jpg", "dogs/"]
|
56
|
+
#
|
57
|
+
# dbinbox = Dbinbox.new('USERNAME/photos')
|
58
|
+
# dbinbox.send ["beach.png"]
|
59
|
+
#
|
60
|
+
# @param [Array] args an array of files, strings, and directories to be uploaded
|
61
|
+
def send(args)
|
62
|
+
Dbinbox.send([@username, @path].join('/'), args)
|
63
|
+
end
|
64
|
+
end
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dbinbox
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Christian Genco
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-08-31 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rest-client
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.6.7
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.6.7
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.3'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.3'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: Command line interface for the file sending site dbinbox.com. Allows
|
63
|
+
command line uploading of files, directories, and messages from ARGV to specified
|
64
|
+
dbinbox users.
|
65
|
+
email:
|
66
|
+
- christian.genco@gmail.com
|
67
|
+
executables:
|
68
|
+
- dbinbox
|
69
|
+
extensions: []
|
70
|
+
extra_rdoc_files: []
|
71
|
+
files:
|
72
|
+
- .gitignore
|
73
|
+
- Gemfile
|
74
|
+
- Gemfile.lock
|
75
|
+
- LICENSE.txt
|
76
|
+
- README.md
|
77
|
+
- Rakefile
|
78
|
+
- bin/dbinbox
|
79
|
+
- dbinbox.gemspec
|
80
|
+
- lib/dbinbox.rb
|
81
|
+
- lib/dbinbox/version.rb
|
82
|
+
- pkg/dbinbox-0.0.1.gem
|
83
|
+
homepage: https://github.com/christiangenco/dbinbox_gem
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
hash: -2082758460685036002
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
segments:
|
106
|
+
- 0
|
107
|
+
hash: -2082758460685036002
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 1.8.24
|
111
|
+
signing_key:
|
112
|
+
specification_version: 3
|
113
|
+
summary: send files, directories, and messages to dbinbox.com from the command line
|
114
|
+
test_files: []
|