artwork 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/README.md CHANGED
@@ -36,12 +36,17 @@ you have a _2x versions of your thumbs, the helper will choose the _2x one.
36
36
  - Ruby 1.8.7 or newer
37
37
  - Rails 2.3 or newer
38
38
  - Paperclip 2.3 or newer
39
+ - A JavaScript runtime
39
40
 
40
41
  ## Installation
41
42
 
42
- Add this line to your application's Gemfile:
43
+ Add these lines to your application's Gemfile:
43
44
 
44
45
  gem 'artwork'
46
+ gem 'therubyracer'
47
+
48
+ You can skip `therubyracer` if you have other JavaScript environments available
49
+ on your machine (including on the prodiction one).
45
50
 
46
51
  And then execute:
47
52
 
@@ -100,6 +105,8 @@ the `artwork_tag` view helper. Example:
100
105
 
101
106
  1. [Fork it](https://github.com/mitio/artwork/fork)
102
107
  2. Create your feature branch (`git checkout -b my-new-feature`)
103
- 3. Commit your changes (`git commit -am 'Add some feature'`)
104
- 4. Push to the branch (`git push origin my-new-feature`)
105
- 5. Create a new Pull Request
108
+ 3. Make your changes
109
+ 4. Make sure the tests pass (`bundle exec rake`)
110
+ 5. Commit your changes (`git commit -am 'Add some feature'`)
111
+ 6. Push to the branch (`git push origin my-new-feature`)
112
+ 7. Create a new Pull Request
data/Rakefile CHANGED
@@ -1,2 +1,9 @@
1
1
  require 'bundler/gem_tasks'
2
+ require 'rspec/core'
3
+ require 'rspec/core/rake_task'
2
4
 
5
+ RSpec::Core::RakeTask.new(:spec) do |spec|
6
+ spec.pattern = FileList['spec/**/*_spec.rb']
7
+ end
8
+
9
+ task :default => :spec
data/artwork.gemspec CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency 'bundler', '~> 1.6'
22
22
  spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'rspec', '~> 3'
23
24
 
24
25
  spec.add_dependency 'rails', '>= 2.3'
25
26
  spec.add_dependency 'paperclip', '>= 2.3'
data/lib/artwork.rb CHANGED
@@ -3,7 +3,7 @@ require 'artwork/configuration'
3
3
  require 'artwork/model'
4
4
  require 'artwork/view'
5
5
  require 'artwork/controller'
6
- require 'artwork/engine' if Rails.const_defined?(:Engine)
6
+ require 'artwork/engine' if Object.const_defined?(:Rails) and Rails.const_defined?(:Engine)
7
7
 
8
8
  module Artwork
9
9
  extend Configuration
data/lib/artwork/model.rb CHANGED
@@ -1,34 +1,23 @@
1
+ require 'artwork/thumbnail'
2
+
1
3
  module Artwork
2
4
  module Model
3
- THUMBNAIL_NAME_PATTERN = /^[0-9]+x(\w*?)(_2x)?$/i.freeze
4
-
5
5
  def artwork_thumb_for(attachment_name, size)
6
- size = size.to_s
6
+ desired_thumb = Thumbnail.new(size)
7
7
  matching_thumb_name = nil
8
8
 
9
- if size =~ THUMBNAIL_NAME_PATTERN
10
- desired_size = size.to_i / ratio_for_current_resolution
11
-
12
- available_attachments = []
13
-
14
- # Pick attachments which follow our naming conventions, skipping retina images
15
- attachment_styles_for(attachment_name).each do |thumb_name|
16
- if thumb_name.to_s =~ THUMBNAIL_NAME_PATTERN
17
- is_retina = $2
18
- thumb_width = thumb_name.to_s.to_i
9
+ if desired_thumb.compatible?
10
+ desired_size = desired_thumb.width / ratio_for_current_resolution
19
11
 
20
- available_attachments << [thumb_name, thumb_width] unless is_retina
21
- end
22
- end
23
-
24
- # Sort attachments by width, in ascending order
25
- available_attachments = available_attachments.sort_by do |thumb_name, thumb_width|
26
- thumb_width
27
- end
12
+ thumbs = attachment_styles_for(attachment_name) \
13
+ .map { |thumb_name| Thumbnail.new(thumb_name) } \
14
+ .select(&:compatible?) \
15
+ .reject(&:retina?) \
16
+ .sort
28
17
 
29
- available_attachments.each do |thumb_name, thumb_width|
30
- if desired_size <= thumb_width
31
- matching_thumb_name = thumb_name
18
+ thumbs.each do |thumb|
19
+ if desired_size <= thumb.width and thumb.label == desired_thumb.label
20
+ matching_thumb_name = thumb.name
32
21
  break
33
22
  end
34
23
  end
@@ -36,7 +25,7 @@ module Artwork
36
25
  # If we did not find any matching attachment definitions,
37
26
  # the desired size is probably larger than all of our thumb widths,
38
27
  # So pick the last (largest) one we have.
39
- matching_thumb_name ||= available_attachments.last.first
28
+ matching_thumb_name ||= thumbs.last.name
40
29
  end
41
30
 
42
31
  matching_thumb_name ||= size.to_sym
@@ -48,7 +37,7 @@ module Artwork
48
37
  matching_thumb_name.to_sym
49
38
  end
50
39
 
51
- def artwork_url(attachment_name, size, options = {})
40
+ def artwork_url(attachment_name, size, options = nil)
52
41
  thumb_name = artwork_thumb_for(attachment_name, size)
53
42
  send(attachment_name).url(thumb_name, options)
54
43
  end
@@ -0,0 +1,46 @@
1
+ module Artwork
2
+ class Thumbnail
3
+ include Comparable
4
+
5
+ NAME_PATTERN = /^(\d+)x(\w*?)(_2x)?$/i.freeze
6
+
7
+ attr :name
8
+ attr :width
9
+ attr :label
10
+
11
+ def initialize(name)
12
+ @name = name.to_s
13
+
14
+ if match = @name.match(NAME_PATTERN)
15
+ @width = match[1].to_i
16
+ @label = match[2].to_s.gsub(/^_|_$/, '')
17
+ @retina_flag = match[3]
18
+ end
19
+ end
20
+
21
+ def compatible?
22
+ not width.nil?
23
+ end
24
+
25
+ def retina?
26
+ @retina_flag == '_2x'
27
+ end
28
+
29
+ def <=>(other_thumb)
30
+ width <=> other_thumb.width
31
+ end
32
+
33
+ def eq(other)
34
+ name == other.name and \
35
+ width == other.width and \
36
+ label == other.label and \
37
+ retina? == other.retina?
38
+ end
39
+
40
+ alias == eq
41
+
42
+ def self.compatible?(name)
43
+ name.to_s =~ NAME_PATTERN ? true : false
44
+ end
45
+ end
46
+ end
@@ -1,3 +1,3 @@
1
1
  module Artwork
2
- VERSION = '0.2.1'
2
+ VERSION = '0.3.0'
3
3
  end
data/lib/artwork/view.rb CHANGED
@@ -1,9 +1,7 @@
1
1
  module Artwork
2
2
  module View
3
3
  def activate_resolution_independence
4
- content_tag :script do
5
- Thread.current[:artwork_script] ||= compile_artwork_script
6
- end
4
+ Thread.current[:artwork_script] ||= content_tag :script, compile_artwork_script
7
5
  end
8
6
 
9
7
  def artwork_tag(record, attachment_name, size, options = {})
@@ -0,0 +1,114 @@
1
+ require 'spec_helper'
2
+
3
+ module Artwork
4
+ describe Configuration do
5
+ let(:config) { Class.new { extend Configuration } }
6
+
7
+ before :each do
8
+ thread_variables = {}
9
+ allow(Thread).to receive(:current) { thread_variables }
10
+ end
11
+
12
+ [:default_resolution, :supported_resolutions_list].each do |option_name|
13
+ describe "##{option_name}" do
14
+ it 'raises an error if not set' do
15
+ expect { config.send(option_name) }.to raise_error
16
+ end
17
+
18
+ it 'uses Thread.current to store values' do
19
+ expect(Thread).to receive(:current).and_return(option_name => 'value')
20
+ expect(config.send(option_name)).to eq 'value'
21
+ end
22
+ end
23
+ end
24
+
25
+ describe '#supported_resolutions_list=' do
26
+ it 'converts the resolutions to integers' do
27
+ config.supported_resolutions_list = ['123', '456']
28
+ expect(config.supported_resolutions_list).to eq [123, 456]
29
+ end
30
+ end
31
+
32
+ describe '#current_resolution' do
33
+ it 'falls back to default_resolution' do
34
+ expect(config).to receive(:default_resolution).and_return('default')
35
+ expect(config.current_resolution).to eq 'default'
36
+ end
37
+ end
38
+
39
+ describe '#current_resolution=' do
40
+ it 'allows arbitrary resolutions if called directly' do
41
+ config.current_resolution = 12345
42
+ expect(config.current_resolution).to eq 12345
43
+ end
44
+ end
45
+
46
+ describe '#reset_configuration' do
47
+ it 'resets the current_resolution' do
48
+ config.current_resolution = 'current'
49
+ expect(config.current_resolution).to eq 'current'
50
+
51
+ config.reset_configuration
52
+
53
+ expect(config).to receive(:default_resolution).and_return('default')
54
+ expect(config.current_resolution).to eq 'default'
55
+ end
56
+
57
+ it 'resets the retina flag' do
58
+ config.load_2x_images = 'retina_flag'
59
+ expect(config.load_2x_images?).to eq 'retina_flag'
60
+
61
+ config.reset_configuration
62
+
63
+ expect(config.load_2x_images?).to eq false
64
+ end
65
+ end
66
+
67
+ describe '#configure_for' do
68
+ def make_request(cookies_hash = {})
69
+ double :cookies => cookies_hash
70
+ end
71
+
72
+ it 'sets current_resolution and load_2x_images from request cookies' do
73
+ config.supported_resolutions_list = [1000, 2000, 3000]
74
+ config.configure_for make_request('_retina' => '1', '_width' => '2000')
75
+
76
+ expect(config.current_resolution).to eq 2000
77
+ expect(config.load_2x_images?).to eq true
78
+ end
79
+
80
+ it 'sets the load_2x_images flag from the _retina cookie' do
81
+ config.supported_resolutions_list = [1000, 2000, 3000]
82
+ config.default_resolution = 1000
83
+
84
+ config.configure_for make_request('_retina' => '0')
85
+ expect(config.load_2x_images?).to eq false
86
+
87
+ config.configure_for make_request('_retina' => '1')
88
+ expect(config.load_2x_images?).to eq true
89
+ end
90
+
91
+ it 'picks only from the supported resolutions list' do
92
+ config.supported_resolutions_list = [1000, 2000, 3000]
93
+
94
+ config.configure_for make_request('_width' => '1234')
95
+ expect(config.current_resolution).to eq 2000
96
+
97
+ config.configure_for make_request('_width' => '234')
98
+ expect(config.current_resolution).to eq 1000
99
+
100
+ config.configure_for make_request('_width' => '10234')
101
+ expect(config.current_resolution).to eq 3000
102
+ end
103
+
104
+ it 'falls back to default_resolution if no _width cookie' do
105
+ config.supported_resolutions_list = []
106
+ config.default_resolution = 5000
107
+
108
+ config.configure_for make_request
109
+
110
+ expect(config.current_resolution).to eq 5000
111
+ end
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ module Artwork
4
+ describe Controller do
5
+ let(:application_controller) { Class.new }
6
+
7
+ it 'adds an around_filter and declares view helpers when included' do
8
+ expect(application_controller).to receive(:around_filter).with(:initialize_artwork_env)
9
+ expect(application_controller).to receive(:helper).with(View)
10
+
11
+ application_controller.send :include, Controller
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,170 @@
1
+ require 'spec_helper'
2
+
3
+ module Artwork
4
+ describe Model do
5
+ let(:model) { Class.new { include Artwork::Model } }
6
+ let(:instance) { model.new }
7
+
8
+ before :each do
9
+ allow(model).to receive(:attachment_definitions).and_return({
10
+ :image => {
11
+ :styles => {
12
+ :'320x' => '320x>',
13
+ :'320x_2x' => '640x>',
14
+ :'640x_2x' => '1280x>',
15
+ :'640x' => '640x>',
16
+ :'1280x' => '1280x>',
17
+ :'1280x_2x' => '2560x>',
18
+ :'2000x' => '2000x>',
19
+ :'1500x_2x' => '3000x>',
20
+ :'320x_some_label' => '320x>',
21
+ :'320x_some_label_2x' => '640x>',
22
+ :'320x500' => '320x500>',
23
+ :'320x500_2x' => '640x1000>',
24
+ :'320x500_crop' => '320x500#',
25
+ :'320x500_crop_2x' => '640x1000#',
26
+ :unsupported => '100x100>'
27
+ },
28
+ },
29
+ })
30
+ end
31
+
32
+ describe '#attachment_styles_for' do
33
+ it 'returns the list of available thumbnails' do
34
+ expect(instance.attachment_styles_for(:image)).to match_array [
35
+ :'320x',
36
+ :'320x_2x',
37
+ :'640x_2x',
38
+ :'640x',
39
+ :'1280x',
40
+ :'1280x_2x',
41
+ :'2000x',
42
+ :'1500x_2x',
43
+ :'320x_some_label',
44
+ :'320x_some_label_2x',
45
+ :'320x500',
46
+ :'320x500_2x',
47
+ :'320x500_crop',
48
+ :'320x500_crop_2x',
49
+ :unsupported,
50
+ ]
51
+ end
52
+ end
53
+
54
+ describe '#artwork_url' do
55
+ it 'returns the computed url of an attachment by delegating to artwork_thumb_for' do
56
+ expect(instance).to receive(:artwork_thumb_for).with(:photo, :size).and_return(:computed_size)
57
+
58
+ attachment = double
59
+ expect(attachment).to receive(:url).with(:computed_size, 'options').and_return 'some/url'
60
+ expect(instance).to receive(:photo).and_return(attachment)
61
+
62
+ expect(instance.artwork_url(:photo, :size, 'options')).to eq 'some/url'
63
+ end
64
+
65
+ it 'works with two arguments and a hash options' do
66
+ expect(instance).to receive(:artwork_thumb_for).with(:photo, :size).and_return(:computed_size)
67
+
68
+ attachment = double
69
+ expect(attachment).to receive(:url).with(:computed_size, :some => 'options').and_return 'some/url'
70
+ expect(instance).to receive(:photo).and_return(attachment)
71
+
72
+ expect(instance.artwork_url(:photo, :size, :some => 'options')).to eq 'some/url'
73
+ end
74
+
75
+ it 'works with two arguments only without any options hash' do
76
+ expect(instance).to receive(:artwork_thumb_for).with(:photo, :size).and_return(:computed_size)
77
+
78
+ attachment = double
79
+ expect(attachment).to receive(:url).with(:computed_size, nil).and_return 'some/url'
80
+ expect(instance).to receive(:photo).and_return(attachment)
81
+
82
+ expect(instance.artwork_url(:photo, :size)).to eq 'some/url'
83
+ end
84
+ end
85
+
86
+ describe '#artwork_thumb_for' do
87
+ before :each do
88
+ Artwork.default_resolution = 1000
89
+ Artwork.current_resolution = 1000
90
+ Artwork.load_2x_images = false
91
+ end
92
+
93
+ def expect_thumb(size, expected)
94
+ expect(instance.artwork_thumb_for(:image, size)).to eq expected
95
+ end
96
+
97
+ it 'picks the exact requested size if it exists' do
98
+ expect_thumb '2000x', :'2000x'
99
+ end
100
+
101
+ it 'accepts sizes passed as both a symbol or a string' do
102
+ expect_thumb '2000x', :'2000x'
103
+ expect_thumb :'2000x', :'2000x'
104
+ end
105
+
106
+ it 'scales the required size according to current_resolution' do
107
+ Artwork.default_resolution = 1000
108
+ Artwork.current_resolution = 2000
109
+
110
+ expect_thumb '1000x', :'2000x'
111
+ expect_thumb '640x', :'1280x'
112
+ end
113
+
114
+ it 'ignores the retina thumbs when looking for a given size' do
115
+ expect_thumb '1500x', :'2000x'
116
+ end
117
+
118
+ it 'uses the _2x thumb for retina screens' do
119
+ Artwork.load_2x_images = true
120
+ expect_thumb '640x', :'640x_2x'
121
+ expect_thumb '640x', :'640x_2x'
122
+ end
123
+
124
+ it 'uses the non-retina thumb for retina screens if no _2x thumb is available' do
125
+ Artwork.load_2x_images = true
126
+ expect_thumb '2000x', :'2000x'
127
+ end
128
+
129
+ it 'passes through unsupported thumb names' do
130
+ expect_thumb 'unsupported', :unsupported
131
+
132
+ Artwork.load_2x_images = true
133
+ Artwork.default_resolution = 1000
134
+ Artwork.current_resolution = 5000
135
+
136
+ expect_thumb 'unsupported', :unsupported
137
+ end
138
+
139
+ it 'picks the nearest non-retina size to our desizred size' do
140
+ expect_thumb '400x', :'640x'
141
+ end
142
+
143
+ it 'picks the largest available size if requesting a too large thumb' do
144
+ expect_thumb '5000x', :'2000x'
145
+ end
146
+
147
+ it 'picks the smallest available size if requesting a too small thumb' do
148
+ expect_thumb '100x', :'320x'
149
+ end
150
+
151
+ it 'distinguishes thumbs by the supplied text label' do
152
+ expect_thumb '320x', :'320x'
153
+ expect_thumb '320x_some_label', :'320x_some_label'
154
+ expect_thumb '200x_some_label', :'320x_some_label'
155
+ end
156
+
157
+ it 'distinguishes thumbs by the supplied numerical label, as a vertical height' do
158
+ expect_thumb :'200x500', :'320x500'
159
+ Artwork.load_2x_images = true
160
+ expect_thumb :'200x500', :'320x500_2x'
161
+ end
162
+
163
+ it 'distinguishes thumbs by the supplied numerical label ignoring retina flags' do
164
+ expect_thumb :'200x500_2x', :'320x500'
165
+ Artwork.load_2x_images = true
166
+ expect_thumb :'200x500_2x', :'320x500_2x'
167
+ end
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,70 @@
1
+ require 'spec_helper'
2
+
3
+ module Artwork
4
+ describe Thumbnail do
5
+ expected_defaults = {:compatible? => true}
6
+
7
+ examples = {
8
+ :'320x' => {:width => 320, :retina? => false, :label => ''},
9
+ :'320x_2x' => {:width => 320, :retina? => true, :label => ''},
10
+ :'640x_2x' => {:width => 640, :retina? => true, :label => ''},
11
+ :'640x' => {:width => 640, :retina? => false, :label => ''},
12
+ :'1280x' => {:width => 1280, :retina? => false, :label => ''},
13
+ :'1280x_2x' => {:width => 1280, :retina? => true, :label => ''},
14
+ :'2000x' => {:width => 2000, :retina? => false, :label => ''},
15
+ :'1500x_2x' => {:width => 1500, :retina? => true, :label => ''},
16
+ :'320x_some_label' => {:width => 320, :retina? => false, :label => 'some_label'},
17
+ :'320x_some_label_2x' => {:width => 320, :retina? => true, :label => 'some_label'},
18
+ :'320x500' => {:width => 320, :retina? => false, :label => '500'},
19
+ :'320x500_2x' => {:width => 320, :retina? => true, :label => '500'},
20
+ :'320x500_crop' => {:width => 320, :retina? => false, :label => '500_crop'},
21
+ :'320x500_crop_2x' => {:width => 320, :retina? => true, :label => '500_crop'},
22
+ :unsupported => {:compatible? => false},
23
+ 'unsupported_thumb' => {:compatible? => false},
24
+ }
25
+
26
+ examples.each do |thumb_name, expected_properties|
27
+ expected_properties = expected_defaults.merge(expected_properties)
28
+ expected_properties.each do |field_name, expected_value|
29
+ it "##{field_name} is #{expected_value.inspect} for #{thumb_name}" do
30
+ thumbnail = Thumbnail.new(thumb_name)
31
+ expect(thumbnail.send(field_name)).to eq expected_value
32
+ end
33
+ end
34
+
35
+ compatible = expected_properties[:compatible?]
36
+ it "compatible? is true for #{thumb_name.inspect}" do
37
+ expect(Thumbnail.compatible?(thumb_name)).to eq compatible
38
+ end
39
+ end
40
+
41
+ describe '#eq' do
42
+ it 'is true for different objects with the same width, label and retina flag' do
43
+ expect(Thumbnail.new(:'1200x500_crop_2x')).to eq Thumbnail.new('1200x500_crop_2x')
44
+ expect(Thumbnail.new(:'1200x_2x')).to eq Thumbnail.new('1200x_2x')
45
+ expect(Thumbnail.new(:'1200x')).to eq Thumbnail.new('1200x')
46
+ expect(Thumbnail.new(:'1200x_black_and_white')).to eq Thumbnail.new('1200x_black_and_white')
47
+ end
48
+
49
+ it 'is false for different objects if any of the width, label or retina flag differ' do
50
+ expect(Thumbnail.new(:'1200x500_crop_2x')).not_to eq Thumbnail.new('1200x500_crop')
51
+ expect(Thumbnail.new(:'1200x500_crop_2x')).not_to eq Thumbnail.new('1200x500crop_2x')
52
+ expect(Thumbnail.new(:'1200x500_crop_2x')).not_to eq Thumbnail.new('1201x500_crop_2x')
53
+ expect(Thumbnail.new(:'1200x500_crop_2x')).not_to eq Thumbnail.new('1500x')
54
+ end
55
+ end
56
+
57
+ describe 'comparison' do
58
+ it 'is based on the thumb width' do
59
+ small = Thumbnail.new('90x_crop')
60
+ medium = Thumbnail.new('500x_crop')
61
+ large = Thumbnail.new('1090x_2x')
62
+ huge = Thumbnail.new('3200x')
63
+
64
+ unsorted = [huge, large, small, medium]
65
+
66
+ expect(unsorted.sort).to eq [small, medium, large, huge]
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ module Artwork
4
+ describe View do
5
+ let(:view_context) { Class.new { include View }.new }
6
+
7
+ describe '#activate_resolution_independence' do
8
+ it 'returns an HTML script tag' do
9
+ stub_const('Uglifier', double(:compile => 'compiled_script'))
10
+ expect(Thread).to receive(:current).and_return({})
11
+ expect(view_context).to receive(:content_tag).with(:script, 'compiled_script').and_return('compiled_script_html')
12
+
13
+ expect(view_context.activate_resolution_independence).to eq 'compiled_script_html'
14
+ end
15
+
16
+ it 'caches the compiled script in Thread.current' do
17
+ expect(Thread).to receive(:current).and_return(:artwork_script => 'cached_compiled_script')
18
+ expect(view_context.activate_resolution_independence).to eq 'cached_compiled_script'
19
+ end
20
+ end
21
+
22
+ it 'defines the artwork_tag helper method' do
23
+ expect(View.instance_methods.map(&:to_sym)).to include(:artwork_tag)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Artwork do
4
+ it 'responds to root_path' do
5
+ expect(Artwork).to respond_to(:root_path)
6
+ end
7
+
8
+ it 'responds to configuration methods' do
9
+ expect(Artwork).to respond_to(:configure_for)
10
+ expect(Artwork).to respond_to(:reset_configuration)
11
+ expect(Artwork).to respond_to(:default_resolution)
12
+ expect(Artwork).to respond_to(:default_resolution=)
13
+ expect(Artwork).to respond_to(:supported_resolutions_list)
14
+ expect(Artwork).to respond_to(:supported_resolutions_list=)
15
+ expect(Artwork).to respond_to(:load_2x_images?)
16
+ expect(Artwork).to respond_to(:current_resolution)
17
+ end
18
+ end
@@ -0,0 +1,2 @@
1
+ require 'rspec'
2
+ require 'artwork'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artwork
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
9
- - 1
10
- version: 0.2.1
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dimitar Dimitrov
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2014-06-11 00:00:00 +03:00
18
+ date: 2014-06-17 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -48,9 +48,23 @@ dependencies:
48
48
  type: :development
49
49
  version_requirements: *id002
50
50
  - !ruby/object:Gem::Dependency
51
- name: rails
51
+ name: rspec
52
52
  prerelease: false
53
53
  requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ hash: 5
59
+ segments:
60
+ - 3
61
+ version: "3"
62
+ type: :development
63
+ version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
65
+ name: rails
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
54
68
  none: false
55
69
  requirements:
56
70
  - - ">="
@@ -61,11 +75,11 @@ dependencies:
61
75
  - 3
62
76
  version: "2.3"
63
77
  type: :runtime
64
- version_requirements: *id003
78
+ version_requirements: *id004
65
79
  - !ruby/object:Gem::Dependency
66
80
  name: paperclip
67
81
  prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
82
+ requirement: &id005 !ruby/object:Gem::Requirement
69
83
  none: false
70
84
  requirements:
71
85
  - - ">="
@@ -76,11 +90,11 @@ dependencies:
76
90
  - 3
77
91
  version: "2.3"
78
92
  type: :runtime
79
- version_requirements: *id004
93
+ version_requirements: *id005
80
94
  - !ruby/object:Gem::Dependency
81
95
  name: uglifier
82
96
  prerelease: false
83
- requirement: &id005 !ruby/object:Gem::Requirement
97
+ requirement: &id006 !ruby/object:Gem::Requirement
84
98
  none: false
85
99
  requirements:
86
100
  - - ">="
@@ -90,7 +104,7 @@ dependencies:
90
104
  - 0
91
105
  version: "0"
92
106
  type: :runtime
93
- version_requirements: *id005
107
+ version_requirements: *id006
94
108
  description: Automated user resolution based image size choosing for your Rails views, but done at the backend.
95
109
  email:
96
110
  - dimitar@live.bg
@@ -102,6 +116,7 @@ extra_rdoc_files: []
102
116
 
103
117
  files:
104
118
  - .gitignore
119
+ - .rspec
105
120
  - Gemfile
106
121
  - LICENSE.txt
107
122
  - README.md
@@ -112,9 +127,17 @@ files:
112
127
  - lib/artwork/controller.rb
113
128
  - lib/artwork/engine.rb
114
129
  - lib/artwork/model.rb
130
+ - lib/artwork/thumbnail.rb
115
131
  - lib/artwork/version.rb
116
132
  - lib/artwork/view.rb
117
133
  - lib/assets/javascripts/artwork.js
134
+ - spec/artwork/configuration_spec.rb
135
+ - spec/artwork/controller_spec.rb
136
+ - spec/artwork/model_spec.rb
137
+ - spec/artwork/thumbnail_spec.rb
138
+ - spec/artwork/view_spec.rb
139
+ - spec/artwork_spec.rb
140
+ - spec/spec_helper.rb
118
141
  has_rdoc: true
119
142
  homepage: https://github.com/mitio/artwork
120
143
  licenses:
@@ -149,5 +172,11 @@ rubygems_version: 1.6.2
149
172
  signing_key:
150
173
  specification_version: 3
151
174
  summary: Automated user resolution based image size choosing for Rails.
152
- test_files: []
153
-
175
+ test_files:
176
+ - spec/artwork/configuration_spec.rb
177
+ - spec/artwork/controller_spec.rb
178
+ - spec/artwork/model_spec.rb
179
+ - spec/artwork/thumbnail_spec.rb
180
+ - spec/artwork/view_spec.rb
181
+ - spec/artwork_spec.rb
182
+ - spec/spec_helper.rb