quickmug 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.gitignore +19 -19
- data/README.md +68 -81
- data/bin/quickmug +71 -71
- data/lib/quickmug.rb +30 -30
- data/lib/quickmug/album.rb +52 -52
- data/lib/quickmug/image.rb +41 -41
- data/lib/quickmug/upload.rb +25 -25
- data/lib/quickmug/version.rb +4 -4
- data/quickmug.gemspec +30 -30
- metadata +28 -28
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
Nzk0OGZmODIyMzY0NDBhYmI3ZWExODNkZjhjMTM4YmQ4YmZjMTJlZmVjM2M3
|
10
|
-
ZDhmMDg3NjI2NmFiZDdmYjMwMmE5YTRkZWYwOGQyOThjMTg1YmYyNzFmZjYy
|
11
|
-
MTMwNWMzMmM1Yzg2MjM3OWFmOTE1YzRmYWI2Mjk1OTgwZmUyMTA=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MTRiYzlhOTI3ZmE5ZjA5Nzc3OGYzNTRhNjVjZGI0NjJlZjdkMzIxNThjNWQ3
|
14
|
-
NzVjZWM0OGY5Njk5ZThmYmQzODE2YzkyMWE1MmVjM2M4NDZkZGIzOGVlZDdl
|
15
|
-
MTdhOTk4YzcwNDcyMmMwNzc3ZjhlZmJjM2Y0ODBkZmU1NDhkNDY=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 46dc289d490a4fb09c73c7ce06ed0c3da0d7c336
|
4
|
+
data.tar.gz: e249db7235f820217db1e2ca7bcbea4a56cbd8cf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8bc74757df705408a5dd2b6fcc4d9ae9a91b106a30910019069e423dde3d047ee212e65e89ed460c556901bce4b6eed8745f3c7453fdde28d5e03cf835d6c1d0
|
7
|
+
data.tar.gz: 8bb99ffefcab3b0523b94b63f5010e19cce58a41872c0b7f32534f123e8ef705602334bb45fc9c4619743957cb320af087987a9a006fdedf92c53c85e228f5c7
|
data/.gitignore
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
coverage
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
lib/bundler/man
|
9
|
-
pkg
|
10
|
-
rdoc
|
11
|
-
spec/reports
|
12
|
-
test/tmp
|
13
|
-
test/version_tmp
|
14
|
-
tmp
|
15
|
-
|
16
|
-
# YARD artifacts
|
17
|
-
.yardoc
|
18
|
-
_yardoc
|
19
|
-
doc/
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
coverage
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
lib/bundler/man
|
9
|
+
pkg
|
10
|
+
rdoc
|
11
|
+
spec/reports
|
12
|
+
test/tmp
|
13
|
+
test/version_tmp
|
14
|
+
tmp
|
15
|
+
|
16
|
+
# YARD artifacts
|
17
|
+
.yardoc
|
18
|
+
_yardoc
|
19
|
+
doc/
|
data/README.md
CHANGED
@@ -1,81 +1,68 @@
|
|
1
|
-
# QuickMug
|
2
|
-
|
3
|
-
I currently use [Jekyll](http://jekyllrb.com/) for
|
4
|
-
[my blog](http://mx.kelsin.net) and
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
to list a certain number.
|
70
|
-
* **last** Copies the format string for the last image in your album (this is
|
71
|
-
often the one you just uploaded).
|
72
|
-
* **upload IMAGE CAPTION** Uploads a image file to smugmug with a caption. You
|
73
|
-
don't need quotes around the caption.
|
74
|
-
|
75
|
-
## Contributing
|
76
|
-
|
77
|
-
1. Fork it
|
78
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
79
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
80
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
81
|
-
5. Create new Pull Request
|
1
|
+
# QuickMug
|
2
|
+
|
3
|
+
I currently use [Jekyll](http://jekyllrb.com/) for
|
4
|
+
[my blog](http://mx.kelsin.net) and [SmugMug](http://www.smugmug.com/) for
|
5
|
+
hosted images and photos. I created this gem to allow myself to easily upload
|
6
|
+
files to SmugMug from the command line. QuickMug also puts a string (in the
|
7
|
+
format of my chosing) on my clipboard for easy insertion into my blog post. I
|
8
|
+
use the following format string in order to do this:
|
9
|
+
|
10
|
+
[![[Caption]]([ThumbURL] "[Caption]")]([LargeURL])
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
$ gem install quickmug
|
15
|
+
|
16
|
+
## Configuation
|
17
|
+
|
18
|
+
This is a small gem that helps you upload photos to smugmug. It relies on a
|
19
|
+
config file `~/.quickmug` that is a yaml document like the following:
|
20
|
+
|
21
|
+
consumer:
|
22
|
+
key: aaa
|
23
|
+
secret: bbb
|
24
|
+
access:
|
25
|
+
token: ccc
|
26
|
+
secret: ddd
|
27
|
+
album: 123456789
|
28
|
+
format: ! "[![[Caption]]([ThumbURL] \"[Caption]\")]([LargeURL])"
|
29
|
+
|
30
|
+
Consumer data is the API app key that you can get by registering an app on
|
31
|
+
SmugMug's website. This allows you to use their api.
|
32
|
+
|
33
|
+
Access data is your personal access token for your user. You can get this using
|
34
|
+
oauth. I plan on adding a feature to this gem that helps you get that... but
|
35
|
+
it's not in the code yet (sorry).
|
36
|
+
|
37
|
+
Album is the album id that uploads will go to. You can get a list of albums by
|
38
|
+
running `quickmug albums` (as long as you have the consumer and access tokens
|
39
|
+
specified).
|
40
|
+
|
41
|
+
Format is a string that you would like copied to your clipboard after you upload
|
42
|
+
an image. Any blocks like `[xxx]` will be replaced with the `xxx` field from the
|
43
|
+
smugmug
|
44
|
+
[images.getInfo](http://api.smugmug.com/services/api/?version=1.3.0&method=smugmug.images.getInfo)
|
45
|
+
call.
|
46
|
+
|
47
|
+
## Usage
|
48
|
+
|
49
|
+
The following commands are available
|
50
|
+
|
51
|
+
* **albums** List all of your albums (the selected one is starred)
|
52
|
+
* **copy ID KEY** If you pass in a image id and key, this copies the format
|
53
|
+
string to the clipboard as if you just uploaded that image.
|
54
|
+
* **images [options]** Lists the last 5 of the images from your selected album
|
55
|
+
using your format string. You can use `-a` to list all images and `-l NUM`
|
56
|
+
to list a certain number.
|
57
|
+
* **last** Copies the format string for the last image in your album (this is
|
58
|
+
often the one you just uploaded).
|
59
|
+
* **upload IMAGE CAPTION** Uploads a image file to smugmug with a caption. You
|
60
|
+
don't need quotes around the caption.
|
61
|
+
|
62
|
+
## Contributing
|
63
|
+
|
64
|
+
1. Fork it
|
65
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
66
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
67
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
68
|
+
5. Create new Pull Request
|
data/bin/quickmug
CHANGED
@@ -1,71 +1,71 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
STDOUT.sync = true
|
3
|
-
|
4
|
-
$:.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })
|
5
|
-
|
6
|
-
require 'commander/import'
|
7
|
-
require 'quickmug'
|
8
|
-
|
9
|
-
program :name, 'quickmug'
|
10
|
-
program :version, QuickMug::VERSION
|
11
|
-
program :description, QuickMug::DESCRIPTION
|
12
|
-
|
13
|
-
default_command :help
|
14
|
-
|
15
|
-
command :upload do |c|
|
16
|
-
c.syntax = 'quickmug upload IMAGE CAPTION'
|
17
|
-
c.description = 'Uploads an IMAGE to smugmug with a caption of CAPTION'
|
18
|
-
|
19
|
-
c.action do |args, options|
|
20
|
-
QuickMug.copy(QuickMug::Upload.process(args).render)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
command :copy do |c|
|
25
|
-
c.syntax = 'quickmug copy ID KEY'
|
26
|
-
c.description = 'Uses your format setting to copy the image information to the clipboard'
|
27
|
-
|
28
|
-
c.action do |args, options|
|
29
|
-
QuickMug.copy(QuickMug::Image.fromArgs(args).render)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
command :albums do |c|
|
34
|
-
c.syntax = 'quickmug albums'
|
35
|
-
c.description = 'List your smugmug albums'
|
36
|
-
|
37
|
-
c.action do |args, options|
|
38
|
-
QuickMug::Album.all.each do |album|
|
39
|
-
puts album
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
command :last do |c|
|
45
|
-
c.syntax = 'quickmug last'
|
46
|
-
c.description = 'Copy and show the last image from the selected album'
|
47
|
-
|
48
|
-
c.action do |args, options|
|
49
|
-
QuickMug.copy(QuickMug::Album.selected.images.last)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
command :images do |c|
|
54
|
-
c.syntax = 'quickmug images [options]'
|
55
|
-
c.description = 'List images from your selected album'
|
56
|
-
c.option '-a','--all', Integer, 'Show all images'
|
57
|
-
c.option '-l NUM','--last NUM', Integer, 'Only load the last NUM images (defaults to 5)'
|
58
|
-
|
59
|
-
c.action do |args, options|
|
60
|
-
options.default :last => 5
|
61
|
-
images = QuickMug::Album.selected.images
|
62
|
-
|
63
|
-
if !options.all
|
64
|
-
images = images[(-1 * options.last)..-1]
|
65
|
-
end
|
66
|
-
|
67
|
-
images.each do |image|
|
68
|
-
puts image
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
STDOUT.sync = true
|
3
|
+
|
4
|
+
$:.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })
|
5
|
+
|
6
|
+
require 'commander/import'
|
7
|
+
require 'quickmug'
|
8
|
+
|
9
|
+
program :name, 'quickmug'
|
10
|
+
program :version, QuickMug::VERSION
|
11
|
+
program :description, QuickMug::DESCRIPTION
|
12
|
+
|
13
|
+
default_command :help
|
14
|
+
|
15
|
+
command :upload do |c|
|
16
|
+
c.syntax = 'quickmug upload IMAGE CAPTION'
|
17
|
+
c.description = 'Uploads an IMAGE to smugmug with a caption of CAPTION'
|
18
|
+
|
19
|
+
c.action do |args, options|
|
20
|
+
QuickMug.copy(QuickMug::Upload.process(args).render)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
command :copy do |c|
|
25
|
+
c.syntax = 'quickmug copy ID KEY'
|
26
|
+
c.description = 'Uses your format setting to copy the image information to the clipboard'
|
27
|
+
|
28
|
+
c.action do |args, options|
|
29
|
+
QuickMug.copy(QuickMug::Image.fromArgs(args).render)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
command :albums do |c|
|
34
|
+
c.syntax = 'quickmug albums'
|
35
|
+
c.description = 'List your smugmug albums'
|
36
|
+
|
37
|
+
c.action do |args, options|
|
38
|
+
QuickMug::Album.all.each do |album|
|
39
|
+
puts album
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
command :last do |c|
|
45
|
+
c.syntax = 'quickmug last'
|
46
|
+
c.description = 'Copy and show the last image from the selected album'
|
47
|
+
|
48
|
+
c.action do |args, options|
|
49
|
+
QuickMug.copy(QuickMug::Album.selected.images.last)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
command :images do |c|
|
54
|
+
c.syntax = 'quickmug images [options]'
|
55
|
+
c.description = 'List images from your selected album'
|
56
|
+
c.option '-a','--all', Integer, 'Show all images'
|
57
|
+
c.option '-l NUM','--last NUM', Integer, 'Only load the last NUM images (defaults to 5)'
|
58
|
+
|
59
|
+
c.action do |args, options|
|
60
|
+
options.default :last => 5
|
61
|
+
images = QuickMug::Album.selected.images
|
62
|
+
|
63
|
+
if !options.all
|
64
|
+
images = images[(-1 * options.last)..-1]
|
65
|
+
end
|
66
|
+
|
67
|
+
images.each do |image|
|
68
|
+
puts image
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/quickmug.rb
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
require 'quickmug/version'
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'oauth'
|
5
|
-
require 'safe_yaml'
|
6
|
-
require 'ruby-smugmug'
|
7
|
-
require 'clipboard'
|
8
|
-
|
9
|
-
require 'quickmug/upload'
|
10
|
-
require 'quickmug/image'
|
11
|
-
require 'quickmug/album'
|
12
|
-
|
13
|
-
module QuickMug
|
14
|
-
def self.config
|
15
|
-
@@config ||= YAML.safe_load_file(File.expand_path("~/.quickmug"))
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.client
|
19
|
-
@@client ||= SmugMug::Client.new(:api_key => config['consumer']['key'],
|
20
|
-
:oauth_secret => config['consumer']['secret'],
|
21
|
-
:user => {
|
22
|
-
:token => config['access']['token'],
|
23
|
-
:secret => config['access']['secret']})
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.copy(text)
|
27
|
-
puts(text)
|
28
|
-
Clipboard.copy(text.to_s)
|
29
|
-
end
|
30
|
-
end
|
1
|
+
require 'quickmug/version'
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'oauth'
|
5
|
+
require 'safe_yaml'
|
6
|
+
require 'ruby-smugmug'
|
7
|
+
require 'clipboard'
|
8
|
+
|
9
|
+
require 'quickmug/upload'
|
10
|
+
require 'quickmug/image'
|
11
|
+
require 'quickmug/album'
|
12
|
+
|
13
|
+
module QuickMug
|
14
|
+
def self.config
|
15
|
+
@@config ||= YAML.safe_load_file(File.expand_path("~/.quickmug"))
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.client
|
19
|
+
@@client ||= SmugMug::Client.new(:api_key => config['consumer']['key'],
|
20
|
+
:oauth_secret => config['consumer']['secret'],
|
21
|
+
:user => {
|
22
|
+
:token => config['access']['token'],
|
23
|
+
:secret => config['access']['secret']})
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.copy(text)
|
27
|
+
puts(text)
|
28
|
+
Clipboard.copy(text.to_s)
|
29
|
+
end
|
30
|
+
end
|
data/lib/quickmug/album.rb
CHANGED
@@ -1,52 +1,52 @@
|
|
1
|
-
module QuickMug
|
2
|
-
class Album
|
3
|
-
attr_reader :id, :key
|
4
|
-
|
5
|
-
def initialize(id, key)
|
6
|
-
@id = id
|
7
|
-
@key = key
|
8
|
-
end
|
9
|
-
|
10
|
-
def apiHash
|
11
|
-
{:AlbumID => @id, :AlbumKey => @key}
|
12
|
-
end
|
13
|
-
|
14
|
-
def info
|
15
|
-
@info ||= QuickMug.client.albums.getInfo(apiHash)
|
16
|
-
end
|
17
|
-
|
18
|
-
def images
|
19
|
-
@images ||= QuickMug.client.images.get(apiHash)['Images'].map do |data|
|
20
|
-
Image.fromApi(data)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def selected?
|
25
|
-
self.id == QuickMug.config['album']
|
26
|
-
end
|
27
|
-
|
28
|
-
def to_s
|
29
|
-
selected = selected? ? '*' : ' '
|
30
|
-
" #{selected} #{info['Title']} id:#@id key:#@key"
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.fromApi(data)
|
34
|
-
Album.new(data['id'], data['Key'])
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.fromArgs(args)
|
38
|
-
raise ArgumentError.new('You must specify an image ID and KEY') if args.size < 2
|
39
|
-
Album.new(args[0],args[1])
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.all
|
43
|
-
@@albums ||= QuickMug.client.albums.get.map do |data|
|
44
|
-
Album.fromApi(data)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def self.selected
|
49
|
-
@@selected ||= self.all.
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
1
|
+
module QuickMug
|
2
|
+
class Album
|
3
|
+
attr_reader :id, :key
|
4
|
+
|
5
|
+
def initialize(id, key)
|
6
|
+
@id = id
|
7
|
+
@key = key
|
8
|
+
end
|
9
|
+
|
10
|
+
def apiHash
|
11
|
+
{:AlbumID => @id, :AlbumKey => @key}
|
12
|
+
end
|
13
|
+
|
14
|
+
def info
|
15
|
+
@info ||= QuickMug.client.albums.getInfo(apiHash)
|
16
|
+
end
|
17
|
+
|
18
|
+
def images
|
19
|
+
@images ||= QuickMug.client.images.get(apiHash)['Images'].map do |data|
|
20
|
+
Image.fromApi(data)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def selected?
|
25
|
+
self.id == QuickMug.config['album']
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_s
|
29
|
+
selected = selected? ? '*' : ' '
|
30
|
+
" #{selected} #{info['Title']} id:#@id key:#@key"
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.fromApi(data)
|
34
|
+
Album.new(data['id'], data['Key'])
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.fromArgs(args)
|
38
|
+
raise ArgumentError.new('You must specify an image ID and KEY') if args.size < 2
|
39
|
+
Album.new(args[0],args[1])
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.all
|
43
|
+
@@albums ||= QuickMug.client.albums.get.map do |data|
|
44
|
+
Album.fromApi(data)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.selected
|
49
|
+
@@selected ||= self.all.find(&:selected?)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/quickmug/image.rb
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
module QuickMug
|
2
|
-
class Image
|
3
|
-
attr_reader :id, :key
|
4
|
-
|
5
|
-
def initialize(id, key)
|
6
|
-
@id = id
|
7
|
-
@key = key
|
8
|
-
end
|
9
|
-
|
10
|
-
def apiHash
|
11
|
-
{:ImageID => @id, :ImageKey => @key}
|
12
|
-
end
|
13
|
-
|
14
|
-
def info
|
15
|
-
@info ||= QuickMug.client.images.getInfo(apiHash)
|
16
|
-
end
|
17
|
-
|
18
|
-
def to_s
|
19
|
-
render
|
20
|
-
end
|
21
|
-
|
22
|
-
def render
|
23
|
-
output = QuickMug.config['format']
|
24
|
-
|
25
|
-
info.each do |key, value|
|
26
|
-
output = output.gsub("[#{key}]", value.to_s)
|
27
|
-
end
|
28
|
-
|
29
|
-
output
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.fromApi(data)
|
33
|
-
Image.new(data['id'], data['Key'])
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.fromArgs(args)
|
37
|
-
raise ArgumentError.new('You must specify an image ID and KEY') if args.size < 2
|
38
|
-
Image.new(args[0],args[1])
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
1
|
+
module QuickMug
|
2
|
+
class Image
|
3
|
+
attr_reader :id, :key
|
4
|
+
|
5
|
+
def initialize(id, key)
|
6
|
+
@id = id
|
7
|
+
@key = key
|
8
|
+
end
|
9
|
+
|
10
|
+
def apiHash
|
11
|
+
{:ImageID => @id, :ImageKey => @key}
|
12
|
+
end
|
13
|
+
|
14
|
+
def info
|
15
|
+
@info ||= QuickMug.client.images.getInfo(apiHash)
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
render
|
20
|
+
end
|
21
|
+
|
22
|
+
def render
|
23
|
+
output = QuickMug.config['format']
|
24
|
+
|
25
|
+
info.each do |key, value|
|
26
|
+
output = output.gsub("[#{key}]", value.to_s)
|
27
|
+
end
|
28
|
+
|
29
|
+
output
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.fromApi(data)
|
33
|
+
Image.new(data['id'], data['Key'])
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.fromArgs(args)
|
37
|
+
raise ArgumentError.new('You must specify an image ID and KEY') if args.size < 2
|
38
|
+
Image.new(args[0],args[1])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/quickmug/upload.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
module QuickMug
|
2
|
-
class Upload
|
3
|
-
def self.process(args)
|
4
|
-
raise ArgumentError.new('You must specify an image') if args.empty?
|
5
|
-
image = File.expand_path(args[0])
|
6
|
-
caption = args[1..-1].join(' ')
|
7
|
-
|
8
|
-
raise ArgumentError.new('The specified file does not exist') unless File.exists?(image)
|
9
|
-
raise ArgumentError.new('You must specify album in ~/.quickmug') unless QuickMug.config['album']
|
10
|
-
|
11
|
-
data = {:AlbumID => QuickMug.config['album']}
|
12
|
-
|
13
|
-
if caption.length > 0
|
14
|
-
data[:Caption] = caption
|
15
|
-
end
|
16
|
-
|
17
|
-
File.open(image, "rb") do |f|
|
18
|
-
# Upload file to the album
|
19
|
-
data = QuickMug.client.upload_media(data.merge(:file => f))
|
20
|
-
end
|
21
|
-
|
22
|
-
Image.fromApi(data)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
1
|
+
module QuickMug
|
2
|
+
class Upload
|
3
|
+
def self.process(args)
|
4
|
+
raise ArgumentError.new('You must specify an image') if args.empty?
|
5
|
+
image = File.expand_path(args[0])
|
6
|
+
caption = args[1..-1].join(' ')
|
7
|
+
|
8
|
+
raise ArgumentError.new('The specified file does not exist') unless File.exists?(image)
|
9
|
+
raise ArgumentError.new('You must specify album in ~/.quickmug') unless QuickMug.config['album']
|
10
|
+
|
11
|
+
data = {:AlbumID => QuickMug.config['album']}
|
12
|
+
|
13
|
+
if caption.length > 0
|
14
|
+
data[:Caption] = caption
|
15
|
+
end
|
16
|
+
|
17
|
+
File.open(image, "rb") do |f|
|
18
|
+
# Upload file to the album
|
19
|
+
data = QuickMug.client.upload_media(data.merge(:file => f))
|
20
|
+
end
|
21
|
+
|
22
|
+
Image.fromApi(data)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/quickmug/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module QuickMug
|
2
|
-
VERSION = "0.0.
|
3
|
-
DESCRIPTION = "Easy command line smugmug uploader"
|
4
|
-
end
|
1
|
+
module QuickMug
|
2
|
+
VERSION = "0.0.5"
|
3
|
+
DESCRIPTION = "Easy command line smugmug uploader"
|
4
|
+
end
|
data/quickmug.gemspec
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'quickmug/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "quickmug"
|
8
|
-
spec.version = QuickMug::VERSION
|
9
|
-
spec.authors = ["Christopher Giroir"]
|
10
|
-
spec.email = ["kelsin@valefor.com"]
|
11
|
-
spec.description = QuickMug::DESCRIPTION
|
12
|
-
spec.summary = QuickMug::DESCRIPTION
|
13
|
-
spec.homepage = %q{http://github.com/Kelsin/quickmug}
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files`.split($/)
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_runtime_dependency('commander', "~> 4.
|
22
|
-
spec.add_runtime_dependency('safe_yaml', "~> 0.
|
23
|
-
spec.add_runtime_dependency('oauth', "~> 0.4.7")
|
24
|
-
spec.add_runtime_dependency('ruby-smugmug', "~> 0.0.1")
|
25
|
-
spec.add_runtime_dependency('clipboard', "~> 1.0.5")
|
26
|
-
spec.add_runtime_dependency('ffi', "~> 1.
|
27
|
-
|
28
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
29
|
-
spec.add_development_dependency "rake"
|
30
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'quickmug/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "quickmug"
|
8
|
+
spec.version = QuickMug::VERSION
|
9
|
+
spec.authors = ["Christopher Giroir"]
|
10
|
+
spec.email = ["kelsin@valefor.com"]
|
11
|
+
spec.description = QuickMug::DESCRIPTION
|
12
|
+
spec.summary = QuickMug::DESCRIPTION
|
13
|
+
spec.homepage = %q{http://github.com/Kelsin/quickmug}
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency('commander', "~> 4.2.0")
|
22
|
+
spec.add_runtime_dependency('safe_yaml', "~> 1.0.3")
|
23
|
+
spec.add_runtime_dependency('oauth', "~> 0.4.7")
|
24
|
+
spec.add_runtime_dependency('ruby-smugmug', "~> 0.0.1")
|
25
|
+
spec.add_runtime_dependency('clipboard', "~> 1.0.5")
|
26
|
+
spec.add_runtime_dependency('ffi', "~> 1.9.3")
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
29
|
+
spec.add_development_dependency "rake"
|
30
|
+
end
|
metadata
CHANGED
@@ -1,125 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quickmug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Giroir
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.
|
19
|
+
version: 4.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.
|
26
|
+
version: 4.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: safe_yaml
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 1.0.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 1.0.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: oauth
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.4.7
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.4.7
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: ruby-smugmug
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.0.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.0.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: clipboard
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 1.0.5
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.0.5
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: ffi
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: 1.9.3
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: 1.9.3
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: bundler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '1.3'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1.3'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rake
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
description: Easy command line smugmug uploader
|
@@ -130,7 +130,7 @@ executables:
|
|
130
130
|
extensions: []
|
131
131
|
extra_rdoc_files: []
|
132
132
|
files:
|
133
|
-
- .gitignore
|
133
|
+
- ".gitignore"
|
134
134
|
- Gemfile
|
135
135
|
- LICENSE.txt
|
136
136
|
- README.md
|
@@ -152,17 +152,17 @@ require_paths:
|
|
152
152
|
- lib
|
153
153
|
required_ruby_version: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
|
-
- -
|
155
|
+
- - ">="
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
159
|
requirements:
|
160
|
-
- -
|
160
|
+
- - ">="
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: '0'
|
163
163
|
requirements: []
|
164
164
|
rubyforge_project:
|
165
|
-
rubygems_version: 2.
|
165
|
+
rubygems_version: 2.2.2
|
166
166
|
signing_key:
|
167
167
|
specification_version: 4
|
168
168
|
summary: Easy command line smugmug uploader
|