smugsync 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  .kdev4
2
2
  *~
3
3
  pkg
4
+ *.gem
data/README.md CHANGED
@@ -10,6 +10,7 @@ SmugSync provides a command-line interface that is somewhat similar to git or sv
10
10
  To start, initialize a root directory for your SmugMug account:
11
11
 
12
12
  smug init
13
+ smug fetch
13
14
 
14
15
  Albums are stored as subdirs inside the root directory. To upload an album, create a directory for it, copy your images and videos there and run
15
16
 
@@ -33,3 +34,9 @@ To see the difference between your directory and SmugMug run
33
34
 
34
35
  ## Restrictions
35
36
  - Categories and subcategories are not supported.
37
+
38
+
39
+ ## Changelog
40
+ - 0.3: Ruby 1.9 is supported
41
+ - 0.2: First useful version, all commands work
42
+ - 0.1: Initial release
@@ -1,4 +1,6 @@
1
- $KCODE = 'u'
1
+ if RUBY_VERSION < "1.9.0"
2
+ $KCODE = 'u'
3
+ end
2
4
 
3
5
  commands = [
4
6
  ["init", "Initialize current folder as SmugMug folder and authorize with SmugMug"],
@@ -1,5 +1,7 @@
1
- require 'system_timer'
2
- require 'md5'
1
+ if RUBY_VERSION < "1.9.0"
2
+ require 'system_timer'
3
+ end
4
+ require 'digest/md5'
3
5
  require 'set'
4
6
 
5
7
  module Smug
@@ -68,14 +70,14 @@ Options:
68
70
  modified_albums << album
69
71
 
70
72
  begin
71
- SystemTimer.timeout_after(opts[:timeout]) do
73
+ with_timeout(opts[:timeout]) do
72
74
  puts "Uploading #{filename} (#{Time.now.to_s}) (#{i}/#{num_files})"
73
75
 
74
76
  data = File.open(filename, "rb") { |f| f.read }
75
77
 
76
78
  req = {}
77
79
  req['Content-Length'] = File.size(filename).to_s
78
- req['Content-MD5'] = MD5.hexdigest(data)
80
+ req['Content-MD5'] = Digest::MD5.hexdigest(data)
79
81
  req['X-Smug-AlbumID'] = album["id"].to_s
80
82
  req['X-Smug-Version'] = '1.3.0'
81
83
  req['X-Smug-FileName'] = filename
@@ -106,6 +108,20 @@ Options:
106
108
 
107
109
  private
108
110
 
111
+ def with_timeout(upload_timeout, &block)
112
+ if RUBY_VERSION < "1.9.0"
113
+ # older ruby need to use SystemTimer because ruby green thread timeout
114
+ # won't terminate threads that execute system calls
115
+ SystemTimer.timeout_after(upload_timeout) do
116
+ yield
117
+ end
118
+ else
119
+ timeout(upload_timeout) do
120
+ yield
121
+ end
122
+ end
123
+ end
124
+
109
125
  def albums
110
126
  # TODO: upload doesn't work without cache
111
127
  @albums ||= JSON::parse Config::config_file("cache", "r").read
data/smugsync.gemspec CHANGED
@@ -1,27 +1,29 @@
1
1
  require 'rubygems'
2
2
 
3
3
  SPEC = Gem::Specification.new do |s|
4
- s.name = "smugsync"
5
- s.version = "0.2"
6
- s.author = "Alexander Dymo"
7
- s.email = "adymo@kdevelop.org"
8
- s.homepage = "http://github.com/adymo/smugsync"
9
- s.platform = Gem::Platform::RUBY
10
- s.summary = "."
4
+ s.name = "smugsync"
5
+ s.version = "0.3"
6
+ s.author = "Alexander Dymo"
7
+ s.email = "adymo@kdevelop.org"
8
+ s.homepage = "http://github.com/adymo/smugsync"
9
+ s.platform = Gem::Platform::RUBY
10
+ s.summary = "SmugMug photo and video synchronization tool"
11
+ s.description = "The hacker-friendly command-line tool to synchronize your photos and videos two-way between your computer and SmugMug."
11
12
 
12
- s.add_development_dependency('bundler', '>= 1.0.0')
13
- s.add_development_dependency('assert_same', '>= 0.1.0')
13
+ s.add_development_dependency('assert_same', '>= 0.3.0')
14
14
 
15
15
  s.add_dependency('trollop', '>= 1.16.0')
16
16
  s.add_dependency('json', '>= 1.6.0')
17
17
  s.add_dependency('oauth', '>= 0.4.0')
18
- s.add_dependency('system_timer', '>= 1.2.0')
18
+
19
+ if RUBY_VERSION < "1.9.0"
20
+ s.add_dependency('system_timer', '>= 1.2.0')
21
+ end
19
22
 
20
23
  s.files = `git ls-files`.split("\n")
21
24
  s.test_files = `git ls-files -- test/*`.split("\n")
22
25
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
23
26
 
24
27
  s.require_path = "lib"
25
- s.autorequire = "smugsync"
26
28
  s.has_rdoc = false
27
29
  end
metadata CHANGED
@@ -1,126 +1,88 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: smugsync
3
- version: !ruby/object:Gem::Version
4
- hash: 15
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.3'
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- version: "0.2"
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Alexander Dymo
13
- autorequire: smugsync
9
+ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-05-31 00:00:00 Z
18
- dependencies:
19
- - !ruby/object:Gem::Dependency
20
- name: bundler
21
- prerelease: false
22
- requirement: &id001 !ruby/object:Gem::Requirement
12
+ date: 2012-11-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: assert_same
16
+ requirement: !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- hash: 23
28
- segments:
29
- - 1
30
- - 0
31
- - 0
32
- version: 1.0.0
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.3.0
33
22
  type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: assert_same
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
39
25
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 27
44
- segments:
45
- - 0
46
- - 1
47
- - 0
48
- version: 0.1.0
49
- type: :development
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.3.0
30
+ - !ruby/object:Gem::Dependency
52
31
  name: trollop
53
- prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
55
33
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 87
60
- segments:
61
- - 1
62
- - 16
63
- - 0
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
64
37
  version: 1.16.0
65
38
  type: :runtime
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
- name: json
69
39
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
71
41
  none: false
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- hash: 15
76
- segments:
77
- - 1
78
- - 6
79
- - 0
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.16.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: json
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
80
53
  version: 1.6.0
81
54
  type: :runtime
82
- version_requirements: *id004
83
- - !ruby/object:Gem::Dependency
84
- name: oauth
85
55
  prerelease: false
86
- requirement: &id005 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
87
57
  none: false
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- hash: 15
92
- segments:
93
- - 0
94
- - 4
95
- - 0
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.6.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: oauth
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
96
69
  version: 0.4.0
97
70
  type: :runtime
98
- version_requirements: *id005
99
- - !ruby/object:Gem::Dependency
100
- name: system_timer
101
71
  prerelease: false
102
- requirement: &id006 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
103
73
  none: false
104
- requirements:
105
- - - ">="
106
- - !ruby/object:Gem::Version
107
- hash: 31
108
- segments:
109
- - 1
110
- - 2
111
- - 0
112
- version: 1.2.0
113
- type: :runtime
114
- version_requirements: *id006
115
- description:
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.4.0
78
+ description: The hacker-friendly command-line tool to synchronize your photos and
79
+ videos two-way between your computer and SmugMug.
116
80
  email: adymo@kdevelop.org
117
- executables:
81
+ executables:
118
82
  - smug
119
83
  extensions: []
120
-
121
84
  extra_rdoc_files: []
122
-
123
- files:
85
+ files:
124
86
  - .gitignore
125
87
  - AUTHORS
126
88
  - COPYING
@@ -149,38 +111,29 @@ files:
149
111
  - test/status_command_test.rb
150
112
  homepage: http://github.com/adymo/smugsync
151
113
  licenses: []
152
-
153
114
  post_install_message:
154
115
  rdoc_options: []
155
-
156
- require_paths:
116
+ require_paths:
157
117
  - lib
158
- required_ruby_version: !ruby/object:Gem::Requirement
118
+ required_ruby_version: !ruby/object:Gem::Requirement
159
119
  none: false
160
- requirements:
161
- - - ">="
162
- - !ruby/object:Gem::Version
163
- hash: 3
164
- segments:
165
- - 0
166
- version: "0"
167
- required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
168
125
  none: false
169
- requirements:
170
- - - ">="
171
- - !ruby/object:Gem::Version
172
- hash: 3
173
- segments:
174
- - 0
175
- version: "0"
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
176
130
  requirements: []
177
-
178
131
  rubyforge_project:
179
- rubygems_version: 1.8.15
132
+ rubygems_version: 1.8.23
180
133
  signing_key:
181
134
  specification_version: 3
182
- summary: .
183
- test_files:
135
+ summary: SmugMug photo and video synchronization tool
136
+ test_files:
184
137
  - test/local/.gitignore
185
138
  - test/mock/command.rb
186
139
  - test/mock/oauth/tokens/request_token.rb