grosser-smusher 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Rakefile +23 -0
- data/VERSION +1 -0
- data/lib/smusher.rb +12 -4
- data/smusher.gemspec +67 -0
- data/spec/empty/.gitignore +0 -0
- metadata +24 -23
- data/VERSION.yml +0 -4
data/.gitignore
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
desc "Run all specs in spec directory"
|
2
|
+
task :default do |t|
|
3
|
+
require 'spec'
|
4
|
+
options = "--colour --format progress --loadby --reverse"
|
5
|
+
files = FileList['spec/**/*_spec.rb']
|
6
|
+
system("spec #{options} #{files}")
|
7
|
+
end
|
8
|
+
|
9
|
+
#Gemspec
|
10
|
+
begin
|
11
|
+
require 'jeweler'
|
12
|
+
project_name = 'smusher'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
gem.name = project_name
|
15
|
+
gem.summary = "Automatic Lossless Reduction Of All Your Images"
|
16
|
+
gem.email = "grosser.michael@gmail.com"
|
17
|
+
gem.homepage = "http://github.com/grosser/#{project_name}"
|
18
|
+
gem.authors = ["Michael Grosser"]
|
19
|
+
%w[rake json httpclient].each{|d| gem.add_dependency d}
|
20
|
+
end
|
21
|
+
rescue LoadError
|
22
|
+
puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
23
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.3.7
|
data/lib/smusher.rb
CHANGED
@@ -49,6 +49,7 @@ private
|
|
49
49
|
|
50
50
|
def write_optimized_data(file)
|
51
51
|
optimized = optimized_image_data_for(file)
|
52
|
+
puts optimized
|
52
53
|
|
53
54
|
raise "Error: got larger" if size(file) < optimized.size
|
54
55
|
raise "Error: empty file downloaded" if optimized.size < MINIMUM_IMAGE_SIZE
|
@@ -88,10 +89,17 @@ private
|
|
88
89
|
end
|
89
90
|
|
90
91
|
def optimized_image_data_for(file)
|
91
|
-
|
92
|
+
#I leave these urls here, just in case it stops working again...
|
93
|
+
# url = "http://smush.it/ws.php" # original, redirects to somewhere else..
|
94
|
+
url = 'http://ws1.adq.ac4.yahoo.com/ysmush.it/ws.php'
|
95
|
+
# url = "http://developer.yahoo.com/yslow/smushit/ws.php" # official but does not work
|
96
|
+
# url = "http://smushit.com/ysmush.it/ws.php" # used at the new page but does not hande uploads
|
97
|
+
# url = "http://smushit.eperf.vip.ac4.yahoo.com/ysmush.it/ws.php" # used at the new page but does not hande uploads
|
98
|
+
response = HTTPClient.post url, { 'files[]' => File.new(file) }
|
99
|
+
response = JSON.parse(response.body.content)
|
92
100
|
raise "smush.it: #{response['error']}" if response['error']
|
93
|
-
|
94
|
-
raise "no dest path found" unless
|
95
|
-
open(
|
101
|
+
image_url = response['dest']
|
102
|
+
raise "no dest path found" unless image_url
|
103
|
+
open(image_url) { |source| source.read() }
|
96
104
|
end
|
97
105
|
end
|
data/smusher.gemspec
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{smusher}
|
5
|
+
s.version = "0.3.7"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Michael Grosser"]
|
9
|
+
s.date = %q{2009-08-08}
|
10
|
+
s.default_executable = %q{smusher}
|
11
|
+
s.email = %q{grosser.michael@gmail.com}
|
12
|
+
s.executables = ["smusher"]
|
13
|
+
s.extra_rdoc_files = [
|
14
|
+
"README.markdown"
|
15
|
+
]
|
16
|
+
s.files = [
|
17
|
+
".gitignore",
|
18
|
+
"README.markdown",
|
19
|
+
"Rakefile",
|
20
|
+
"VERSION",
|
21
|
+
"bin/smusher",
|
22
|
+
"lib/smusher.rb",
|
23
|
+
"smusher.gemspec",
|
24
|
+
"spec/empty/.gitignore",
|
25
|
+
"spec/images/ad.gif",
|
26
|
+
"spec/images/add.png",
|
27
|
+
"spec/images/drink_empty.png",
|
28
|
+
"spec/images/logo.gif",
|
29
|
+
"spec/images/people.jpg",
|
30
|
+
"spec/images/water.JPG",
|
31
|
+
"spec/images/woman.jpeg",
|
32
|
+
"spec/out/ad.gif",
|
33
|
+
"spec/out/people.jpg",
|
34
|
+
"spec/reduced/add.png",
|
35
|
+
"spec/reduced/fam.png",
|
36
|
+
"spec/smusher_spec.rb",
|
37
|
+
"spec/spec_helper.rb"
|
38
|
+
]
|
39
|
+
s.homepage = %q{http://github.com/grosser/smusher}
|
40
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
41
|
+
s.require_paths = ["lib"]
|
42
|
+
s.rubygems_version = %q{1.3.4}
|
43
|
+
s.summary = %q{Automatic Lossless Reduction Of All Your Images}
|
44
|
+
s.test_files = [
|
45
|
+
"spec/spec_helper.rb",
|
46
|
+
"spec/smusher_spec.rb"
|
47
|
+
]
|
48
|
+
|
49
|
+
if s.respond_to? :specification_version then
|
50
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
51
|
+
s.specification_version = 3
|
52
|
+
|
53
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
54
|
+
s.add_runtime_dependency(%q<rake>, [">= 0"])
|
55
|
+
s.add_runtime_dependency(%q<json>, [">= 0"])
|
56
|
+
s.add_runtime_dependency(%q<httpclient>, [">= 0"])
|
57
|
+
else
|
58
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
59
|
+
s.add_dependency(%q<json>, [">= 0"])
|
60
|
+
s.add_dependency(%q<httpclient>, [">= 0"])
|
61
|
+
end
|
62
|
+
else
|
63
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
64
|
+
s.add_dependency(%q<json>, [">= 0"])
|
65
|
+
s.add_dependency(%q<httpclient>, [">= 0"])
|
66
|
+
end
|
67
|
+
end
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grosser-smusher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-08 00:00:00 -07:00
|
13
13
|
default_executable: smusher
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -48,35 +48,35 @@ executables:
|
|
48
48
|
- smusher
|
49
49
|
extensions: []
|
50
50
|
|
51
|
-
extra_rdoc_files:
|
52
|
-
|
51
|
+
extra_rdoc_files:
|
52
|
+
- README.markdown
|
53
53
|
files:
|
54
|
-
-
|
54
|
+
- .gitignore
|
55
55
|
- README.markdown
|
56
|
+
- Rakefile
|
57
|
+
- VERSION
|
56
58
|
- bin/smusher
|
57
59
|
- lib/smusher.rb
|
58
|
-
-
|
59
|
-
- spec/
|
60
|
-
- spec/
|
61
|
-
- spec/empty
|
62
|
-
- spec/spec_helper.rb
|
63
|
-
- spec/smusher_spec.rb
|
64
|
-
- spec/images
|
65
|
-
- spec/images/logo.gif
|
66
|
-
- spec/images/woman.jpeg
|
60
|
+
- smusher.gemspec
|
61
|
+
- spec/empty/.gitignore
|
62
|
+
- spec/images/ad.gif
|
67
63
|
- spec/images/add.png
|
68
64
|
- spec/images/drink_empty.png
|
69
|
-
- spec/images/
|
65
|
+
- spec/images/logo.gif
|
70
66
|
- spec/images/people.jpg
|
71
67
|
- spec/images/water.JPG
|
72
|
-
- spec/
|
73
|
-
- spec/
|
68
|
+
- spec/images/woman.jpeg
|
69
|
+
- spec/out/ad.gif
|
70
|
+
- spec/out/people.jpg
|
74
71
|
- spec/reduced/add.png
|
75
|
-
|
72
|
+
- spec/reduced/fam.png
|
73
|
+
- spec/smusher_spec.rb
|
74
|
+
- spec/spec_helper.rb
|
75
|
+
has_rdoc: false
|
76
76
|
homepage: http://github.com/grosser/smusher
|
77
|
+
licenses:
|
77
78
|
post_install_message:
|
78
79
|
rdoc_options:
|
79
|
-
- --inline-source
|
80
80
|
- --charset=UTF-8
|
81
81
|
require_paths:
|
82
82
|
- lib
|
@@ -95,9 +95,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
requirements: []
|
96
96
|
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 1.
|
98
|
+
rubygems_version: 1.3.5
|
99
99
|
signing_key:
|
100
|
-
specification_version:
|
100
|
+
specification_version: 3
|
101
101
|
summary: Automatic Lossless Reduction Of All Your Images
|
102
|
-
test_files:
|
103
|
-
|
102
|
+
test_files:
|
103
|
+
- spec/spec_helper.rb
|
104
|
+
- spec/smusher_spec.rb
|
data/VERSION.yml
DELETED