bulldog 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.0.15 2010-04-13
2
+
3
+ * Fix image dimensions when exif:Orientation is 8.
4
+
1
5
  == 0.0.14 2010-01-19
2
6
 
3
7
  * Optimizations.
data/Rakefile CHANGED
@@ -1,62 +1,25 @@
1
- require 'rake'
2
- require 'spec/rake/spectask'
3
- require 'rake/rdoctask'
4
-
5
- PLUGIN_ROOT = File.dirname(__FILE__)
6
-
7
- begin
8
- require 'jeweler'
9
- Jeweler::Tasks.new do |gem|
10
- gem.name = "bulldog"
11
- gem.summary = "A heavy-duty paperclip. File attachments for ActiveRecord."
12
- gem.description = File.read("#{PLUGIN_ROOT}/DESCRIPTION.txt")
13
- gem.email = "george.ogata@gmail.com"
14
- gem.homepage = "http://github.com/oggy/bulldog"
15
- gem.authors = ["George Ogata"]
16
- gem.add_development_dependency "rspec"
17
- gem.add_development_dependency "rspec_outlines"
18
- gem.add_development_dependency "mocha"
19
- end
20
- rescue LoadError
21
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
22
- end
1
+ gem 'ritual'
2
+ require 'ritual'
23
3
 
24
4
  require 'rake/rdoctask'
25
- Rake::RDocTask.new do |rdoc|
26
- if File.exist?('VERSION')
27
- version = File.read('VERSION')
28
- else
29
- version = ""
30
- end
31
-
32
- rdoc.rdoc_dir = 'rdoc'
33
- rdoc.title = "Bulldog #{version}"
34
- rdoc.rdoc_files.include('README*')
35
- rdoc.rdoc_files.include('lib/**/*.rb')
5
+ rdoc_task do |t|
6
+ t.rdoc_dir = 'rdoc'
7
+ t.title = "Bulldog #{version}"
8
+ t.rdoc_files.include 'README*', 'lib/**/*.rb'
36
9
  end
37
10
 
38
11
  desc "Run all specs."
39
- task :spec => ['check_dependencies', 'spec:unit', 'spec:integration']
12
+ task :spec => ['spec:unit', 'spec:integration']
40
13
 
41
14
  namespace :spec do
42
- Spec::Rake::SpecTask.new(:unit) do |t|
15
+ spec_task :unit do |t|
43
16
  t.pattern = 'spec/unit/**/*_spec.rb'
44
17
  t.libs << 'lib' << 'spec'
45
18
  end
46
19
 
47
- Spec::Rake::SpecTask.new(:integration) do |t|
20
+ spec_task :integration do |t|
48
21
  t.pattern = 'spec/integration/**/*_spec.rb'
49
22
  t.libs << 'lib' << 'spec'
50
- t.spec_opts = ['--options', "\"#{PLUGIN_ROOT}/spec/spec.opts\""]
51
- end
52
- end
53
-
54
- desc "Run all specs in spec directory with RCov"
55
- Spec::Rake::SpecTask.new(:rcov) do |t|
56
- t.spec_opts = ['--options', "\"#{PLUGIN_ROOT}/spec/spec.opts\""]
57
- t.rcov = true
58
- t.rcov_opts = lambda do
59
- IO.readlines(File.dirname(__FILE__) + "/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
60
23
  end
61
24
  end
62
25
 
@@ -52,7 +52,7 @@ module Bulldog
52
52
  output = `identify -format "%w %h %[exif:Orientation]" #{stream.path} 2> /dev/null`
53
53
  if $?.success? && output.present?
54
54
  width, height, orientation = *output.scan(/(\d+) (\d+) (\d?)/).first.map{|s| s.to_i}
55
- rotated = (orientation & 0x4).nonzero?
55
+ rotated = (5..8).include?(orientation)
56
56
  @original_dimensions = rotated ? [height, width] : [width, height]
57
57
  true
58
58
  else
@@ -0,0 +1,3 @@
1
+ module Bulldog
2
+ VERSION = [0, 0, 15]
3
+ end
@@ -63,13 +63,36 @@ describe Attachment::Image do
63
63
  @thing.photo.dimensions(:unfilled).should == [120, 90]
64
64
  end
65
65
 
66
- it "should honor the exif:Orientation header" do
67
- path = create_image("#{temporary_directory}/test.jpg", :size => '40x30')
68
- rotated_path = "#{temporary_directory}/rotated-test.jpg"
69
- run "exif --create-exif --ifd=EXIF --tag=Orientation --set-value=4 --output=#{rotated_path} #{path}"
70
- open(rotated_path) do |file|
71
- @thing.photo = file
72
- @thing.photo.dimensions(:original).should == [30, 40]
66
+ describe "when an exif:Orientation header is set" do
67
+ before do
68
+ @path = create_image("#{temporary_directory}/test.jpg", :size => '40x30')
69
+ @rotated_path = "#{temporary_directory}/rotated-test.jpg"
70
+ end
71
+
72
+ attr_reader :path, :rotated_path
73
+
74
+ def set_header(value)
75
+ run "exif --create-exif --ifd=EXIF --tag=Orientation --set-value=#{value} --output=#{rotated_path} #{path}"
76
+ end
77
+
78
+ it "should not swap the dimensions if the value is between 1 and 4" do
79
+ (1..4).each do |value|
80
+ set_header value
81
+ open(rotated_path) do |file|
82
+ @thing.photo = file
83
+ @thing.photo.dimensions(:original).should == [40, 30]
84
+ end
85
+ end
86
+ end
87
+
88
+ it "should swap the dimensions if the value is between 5 and 8" do
89
+ (5..8).each do |value|
90
+ set_header value
91
+ open(rotated_path) do |file|
92
+ @thing.photo = file
93
+ @thing.photo.dimensions(:original).should == [30, 40]
94
+ end
95
+ end
73
96
  end
74
97
  end
75
98
 
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulldog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 15
9
+ version: 0.0.15
5
10
  platform: ruby
6
11
  authors:
7
12
  - George Ogata
@@ -9,45 +14,56 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-01-19 00:00:00 -05:00
17
+ date: 2010-04-14 00:00:00 -04:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: rspec
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
- - - ">="
25
+ - - "="
22
26
  - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
27
+ segments:
28
+ - 1
29
+ - 3
30
+ - 0
31
+ version: 1.3.0
32
+ type: :development
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: rspec_outlines
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
- - - ">="
39
+ - - "="
32
40
  - !ruby/object:Gem::Version
33
- version: "0"
34
- version:
41
+ segments:
42
+ - 0
43
+ - 0
44
+ - 1
45
+ version: 0.0.1
46
+ type: :development
47
+ version_requirements: *id002
35
48
  - !ruby/object:Gem::Dependency
36
49
  name: mocha
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
40
52
  requirements:
41
- - - ">="
53
+ - - "="
42
54
  - !ruby/object:Gem::Version
43
- version: "0"
44
- version:
55
+ segments:
56
+ - 0
57
+ - 9
58
+ - 8
59
+ version: 0.9.8
60
+ type: :development
61
+ version_requirements: *id003
45
62
  description: |
46
- = Bulldog
47
-
48
- Flexible file attachments for active record.
63
+ Provides file attachments for ActiveRecord objects. Designed for high-volume use.
49
64
 
50
- email: george.ogata@gmail.com
65
+ email:
66
+ - george.ogata@gmail.com
51
67
  executables: []
52
68
 
53
69
  extensions: []
@@ -56,16 +72,10 @@ extra_rdoc_files:
56
72
  - LICENSE
57
73
  - README.rdoc
58
74
  files:
59
- - .gitignore
60
75
  - CHANGELOG
61
- - DESCRIPTION.txt
62
76
  - LICENSE
63
77
  - README.rdoc
64
78
  - Rakefile
65
- - VERSION
66
- - bulldog.gemspec
67
- - lib/bulldog.rb
68
- - lib/bulldog/attachment.rb
69
79
  - lib/bulldog/attachment/base.rb
70
80
  - lib/bulldog/attachment/has_dimensions.rb
71
81
  - lib/bulldog/attachment/image.rb
@@ -74,16 +84,17 @@ files:
74
84
  - lib/bulldog/attachment/pdf.rb
75
85
  - lib/bulldog/attachment/unknown.rb
76
86
  - lib/bulldog/attachment/video.rb
87
+ - lib/bulldog/attachment.rb
77
88
  - lib/bulldog/error.rb
78
89
  - lib/bulldog/has_attachment.rb
79
90
  - lib/bulldog/interpolation.rb
80
91
  - lib/bulldog/missing_file.rb
81
- - lib/bulldog/processor.rb
82
92
  - lib/bulldog/processor/argument_tree.rb
83
93
  - lib/bulldog/processor/base.rb
84
94
  - lib/bulldog/processor/ffmpeg.rb
85
95
  - lib/bulldog/processor/image_magick.rb
86
96
  - lib/bulldog/processor/one_shot.rb
97
+ - lib/bulldog/processor.rb
87
98
  - lib/bulldog/reflection.rb
88
99
  - lib/bulldog/saved_file.rb
89
100
  - lib/bulldog/stream.rb
@@ -93,9 +104,10 @@ files:
93
104
  - lib/bulldog/util.rb
94
105
  - lib/bulldog/validations.rb
95
106
  - lib/bulldog/vector2.rb
107
+ - lib/bulldog/version.rb
108
+ - lib/bulldog.rb
96
109
  - rails/init.rb
97
110
  - rails/rails.rb
98
- - script/console
99
111
  - spec/data/empty.txt
100
112
  - spec/data/test.jpg
101
113
  - spec/data/test.mov
@@ -135,7 +147,6 @@ files:
135
147
  - spec/unit/style_spec.rb
136
148
  - spec/unit/validations_spec.rb
137
149
  - spec/unit/vector2_spec.rb
138
- - tasks/bulldog_tasks.rake
139
150
  has_rdoc: true
140
151
  homepage: http://github.com/oggy/bulldog
141
152
  licenses: []
@@ -149,28 +160,40 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
160
  requirements:
150
161
  - - ">="
151
162
  - !ruby/object:Gem::Version
163
+ segments:
164
+ - 0
152
165
  version: "0"
153
- version:
154
166
  required_rubygems_version: !ruby/object:Gem::Requirement
155
167
  requirements:
156
168
  - - ">="
157
169
  - !ruby/object:Gem::Version
158
- version: "0"
159
- version:
170
+ segments:
171
+ - 1
172
+ - 3
173
+ - 6
174
+ version: 1.3.6
160
175
  requirements: []
161
176
 
162
177
  rubyforge_project:
163
- rubygems_version: 1.3.5
178
+ rubygems_version: 1.3.6
164
179
  signing_key:
165
180
  specification_version: 3
166
181
  summary: A heavy-duty paperclip. File attachments for ActiveRecord.
167
182
  test_files:
183
+ - spec/data/empty.txt
184
+ - spec/data/test.jpg
185
+ - spec/data/test.mov
186
+ - spec/data/test.ogg
187
+ - spec/data/test.pdf
188
+ - spec/data/test.png
189
+ - spec/data/test2.jpg
168
190
  - spec/helpers/image_creation.rb
169
191
  - spec/helpers/temporary_directory.rb
170
192
  - spec/helpers/temporary_models.rb
171
193
  - spec/helpers/temporary_values.rb
172
194
  - spec/helpers/test_upload_files.rb
173
195
  - spec/helpers/time_travel.rb
196
+ - spec/integration/data/test.jpg
174
197
  - spec/integration/lifecycle_hooks_spec.rb
175
198
  - spec/integration/processing_image_attachments.rb
176
199
  - spec/integration/processing_video_attachments_spec.rb
data/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- /pkg
2
- /tmp
@@ -1,3 +0,0 @@
1
- = Bulldog
2
-
3
- Flexible file attachments for active record.
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.14
@@ -1,162 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{bulldog}
8
- s.version = "0.0.14"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["George Ogata"]
12
- s.date = %q{2010-01-19}
13
- s.description = %q{= Bulldog
14
-
15
- Flexible file attachments for active record.
16
- }
17
- s.email = %q{george.ogata@gmail.com}
18
- s.extra_rdoc_files = [
19
- "LICENSE",
20
- "README.rdoc"
21
- ]
22
- s.files = [
23
- ".gitignore",
24
- "CHANGELOG",
25
- "DESCRIPTION.txt",
26
- "LICENSE",
27
- "README.rdoc",
28
- "Rakefile",
29
- "VERSION",
30
- "bulldog.gemspec",
31
- "lib/bulldog.rb",
32
- "lib/bulldog/attachment.rb",
33
- "lib/bulldog/attachment/base.rb",
34
- "lib/bulldog/attachment/has_dimensions.rb",
35
- "lib/bulldog/attachment/image.rb",
36
- "lib/bulldog/attachment/maybe.rb",
37
- "lib/bulldog/attachment/none.rb",
38
- "lib/bulldog/attachment/pdf.rb",
39
- "lib/bulldog/attachment/unknown.rb",
40
- "lib/bulldog/attachment/video.rb",
41
- "lib/bulldog/error.rb",
42
- "lib/bulldog/has_attachment.rb",
43
- "lib/bulldog/interpolation.rb",
44
- "lib/bulldog/missing_file.rb",
45
- "lib/bulldog/processor.rb",
46
- "lib/bulldog/processor/argument_tree.rb",
47
- "lib/bulldog/processor/base.rb",
48
- "lib/bulldog/processor/ffmpeg.rb",
49
- "lib/bulldog/processor/image_magick.rb",
50
- "lib/bulldog/processor/one_shot.rb",
51
- "lib/bulldog/reflection.rb",
52
- "lib/bulldog/saved_file.rb",
53
- "lib/bulldog/stream.rb",
54
- "lib/bulldog/style.rb",
55
- "lib/bulldog/style_set.rb",
56
- "lib/bulldog/tempfile.rb",
57
- "lib/bulldog/util.rb",
58
- "lib/bulldog/validations.rb",
59
- "lib/bulldog/vector2.rb",
60
- "rails/init.rb",
61
- "rails/rails.rb",
62
- "script/console",
63
- "spec/data/empty.txt",
64
- "spec/data/test.jpg",
65
- "spec/data/test.mov",
66
- "spec/data/test.ogg",
67
- "spec/data/test.pdf",
68
- "spec/data/test.png",
69
- "spec/data/test2.jpg",
70
- "spec/helpers/image_creation.rb",
71
- "spec/helpers/temporary_directory.rb",
72
- "spec/helpers/temporary_models.rb",
73
- "spec/helpers/temporary_values.rb",
74
- "spec/helpers/test_upload_files.rb",
75
- "spec/helpers/time_travel.rb",
76
- "spec/integration/data/test.jpg",
77
- "spec/integration/lifecycle_hooks_spec.rb",
78
- "spec/integration/processing_image_attachments.rb",
79
- "spec/integration/processing_video_attachments_spec.rb",
80
- "spec/integration/saving_an_attachment_spec.rb",
81
- "spec/matchers/file_operations.rb",
82
- "spec/spec_helper.rb",
83
- "spec/unit/attachment/base_spec.rb",
84
- "spec/unit/attachment/image_spec.rb",
85
- "spec/unit/attachment/maybe_spec.rb",
86
- "spec/unit/attachment/pdf_spec.rb",
87
- "spec/unit/attachment/video_spec.rb",
88
- "spec/unit/attachment_spec.rb",
89
- "spec/unit/has_attachment_spec.rb",
90
- "spec/unit/interpolation_spec.rb",
91
- "spec/unit/processor/argument_tree_spec.rb",
92
- "spec/unit/processor/ffmpeg_spec.rb",
93
- "spec/unit/processor/image_magick_spec.rb",
94
- "spec/unit/processor/one_shot_spec.rb",
95
- "spec/unit/rails_spec.rb",
96
- "spec/unit/reflection_spec.rb",
97
- "spec/unit/stream_spec.rb",
98
- "spec/unit/style_set_spec.rb",
99
- "spec/unit/style_spec.rb",
100
- "spec/unit/validations_spec.rb",
101
- "spec/unit/vector2_spec.rb",
102
- "tasks/bulldog_tasks.rake"
103
- ]
104
- s.homepage = %q{http://github.com/oggy/bulldog}
105
- s.rdoc_options = ["--charset=UTF-8"]
106
- s.require_paths = ["lib"]
107
- s.rubygems_version = %q{1.3.5}
108
- s.summary = %q{A heavy-duty paperclip. File attachments for ActiveRecord.}
109
- s.test_files = [
110
- "spec/helpers/image_creation.rb",
111
- "spec/helpers/temporary_directory.rb",
112
- "spec/helpers/temporary_models.rb",
113
- "spec/helpers/temporary_values.rb",
114
- "spec/helpers/test_upload_files.rb",
115
- "spec/helpers/time_travel.rb",
116
- "spec/integration/lifecycle_hooks_spec.rb",
117
- "spec/integration/processing_image_attachments.rb",
118
- "spec/integration/processing_video_attachments_spec.rb",
119
- "spec/integration/saving_an_attachment_spec.rb",
120
- "spec/matchers/file_operations.rb",
121
- "spec/spec_helper.rb",
122
- "spec/unit/attachment/base_spec.rb",
123
- "spec/unit/attachment/image_spec.rb",
124
- "spec/unit/attachment/maybe_spec.rb",
125
- "spec/unit/attachment/pdf_spec.rb",
126
- "spec/unit/attachment/video_spec.rb",
127
- "spec/unit/attachment_spec.rb",
128
- "spec/unit/has_attachment_spec.rb",
129
- "spec/unit/interpolation_spec.rb",
130
- "spec/unit/processor/argument_tree_spec.rb",
131
- "spec/unit/processor/ffmpeg_spec.rb",
132
- "spec/unit/processor/image_magick_spec.rb",
133
- "spec/unit/processor/one_shot_spec.rb",
134
- "spec/unit/rails_spec.rb",
135
- "spec/unit/reflection_spec.rb",
136
- "spec/unit/stream_spec.rb",
137
- "spec/unit/style_set_spec.rb",
138
- "spec/unit/style_spec.rb",
139
- "spec/unit/validations_spec.rb",
140
- "spec/unit/vector2_spec.rb"
141
- ]
142
-
143
- if s.respond_to? :specification_version then
144
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
145
- s.specification_version = 3
146
-
147
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
148
- s.add_development_dependency(%q<rspec>, [">= 0"])
149
- s.add_development_dependency(%q<rspec_outlines>, [">= 0"])
150
- s.add_development_dependency(%q<mocha>, [">= 0"])
151
- else
152
- s.add_dependency(%q<rspec>, [">= 0"])
153
- s.add_dependency(%q<rspec_outlines>, [">= 0"])
154
- s.add_dependency(%q<mocha>, [">= 0"])
155
- end
156
- else
157
- s.add_dependency(%q<rspec>, [">= 0"])
158
- s.add_dependency(%q<rspec_outlines>, [">= 0"])
159
- s.add_dependency(%q<mocha>, [">= 0"])
160
- end
161
- end
162
-
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'irb'
4
- $:.unshift 'lib'
5
- require 'active_record'
6
- require 'bulldog'
7
- require 'init'
8
- IRB.start
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :bulldog do
3
- # # Task goes here
4
- # end