attachment_magick 0.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,16 +1,16 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "rails", "3.0.7"
4
- gem "capybara", ">= 0.4.0"
3
+ gem "rails", "3.0.10"
4
+ gem "capybara", ">= 1.0.1"
5
5
  gem "sqlite3-ruby", :require => "sqlite3"
6
6
 
7
7
  gem "mongoid", "~> 2.0"
8
8
  gem "bson_ext", "~> 1.3"
9
- gem 'nokogiri'
10
- gem 'hpricot'
11
- gem 'colorific'
12
- gem 'ruby-debug19'
13
- gem 'simplecov'
14
- gem 'mime-types', '>=1.16'
15
- # Specify your gem's dependencies in attachment_magick.gemspec
9
+ gem "nokogiri"
10
+ gem "hpricot"
11
+ gem "colorific"
12
+ gem "ruby-debug19"
13
+ gem "simplecov"
14
+ gem "mime-types", ">=1.16"
15
+ # Specify your gem"s dependencies in attachment_magick.gemspec
16
16
  gemspec
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- attachment_magick (0.2.7)
5
- dragonfly (>= 0.9.4)
4
+ attachment_magick (0.3.1)
5
+ dragonfly (>= 0.9.5)
6
6
  jquery-rails (>= 0.2.7)
7
7
  marcosinger-auto_html (>= 1.3.4)
8
8
  marcosinger-css_parser (>= 1.3.0)
@@ -12,12 +12,12 @@ GEM
12
12
  remote: http://rubygems.org/
13
13
  specs:
14
14
  abstract (1.0.0)
15
- actionmailer (3.0.7)
16
- actionpack (= 3.0.7)
17
- mail (~> 2.2.15)
18
- actionpack (3.0.7)
19
- activemodel (= 3.0.7)
20
- activesupport (= 3.0.7)
15
+ actionmailer (3.0.10)
16
+ actionpack (= 3.0.10)
17
+ mail (~> 2.2.19)
18
+ actionpack (3.0.10)
19
+ activemodel (= 3.0.10)
20
+ activesupport (= 3.0.10)
21
21
  builder (~> 2.1.2)
22
22
  erubis (~> 2.6.6)
23
23
  i18n (~> 0.5.0)
@@ -25,41 +25,37 @@ GEM
25
25
  rack-mount (~> 0.6.14)
26
26
  rack-test (~> 0.5.7)
27
27
  tzinfo (~> 0.3.23)
28
- activemodel (3.0.7)
29
- activesupport (= 3.0.7)
28
+ activemodel (3.0.10)
29
+ activesupport (= 3.0.10)
30
30
  builder (~> 2.1.2)
31
31
  i18n (~> 0.5.0)
32
- activerecord (3.0.7)
33
- activemodel (= 3.0.7)
34
- activesupport (= 3.0.7)
35
- arel (~> 2.0.2)
32
+ activerecord (3.0.10)
33
+ activemodel (= 3.0.10)
34
+ activesupport (= 3.0.10)
35
+ arel (~> 2.0.10)
36
36
  tzinfo (~> 0.3.23)
37
- activeresource (3.0.7)
38
- activemodel (= 3.0.7)
39
- activesupport (= 3.0.7)
40
- activesupport (3.0.7)
37
+ activeresource (3.0.10)
38
+ activemodel (= 3.0.10)
39
+ activesupport (= 3.0.10)
40
+ activesupport (3.0.10)
41
41
  archive-tar-minitar (0.5.2)
42
- arel (2.0.9)
42
+ arel (2.0.10)
43
43
  bson (1.3.0)
44
44
  bson_ext (1.3.0)
45
45
  builder (2.1.2)
46
- capybara (0.4.1.2)
47
- celerity (>= 0.7.9)
48
- culerity (>= 0.2.4)
46
+ capybara (1.0.1)
49
47
  mime-types (>= 1.16)
50
48
  nokogiri (>= 1.3.3)
51
49
  rack (>= 1.0.0)
52
50
  rack-test (>= 0.5.4)
53
- selenium-webdriver (>= 0.0.27)
54
- xpath (~> 0.1.3)
55
- celerity (0.8.9)
56
- childprocess (0.1.8)
51
+ selenium-webdriver (~> 2.0)
52
+ xpath (~> 0.1.4)
53
+ childprocess (0.2.2)
57
54
  ffi (~> 1.0.6)
58
55
  colorific (0.0.2)
59
56
  minitest (~> 2.0)
60
57
  ruby-progressbar (>= 0.0.9)
61
58
  columnize (0.3.2)
62
- culerity (0.2.15)
63
59
  dragonfly (0.9.5)
64
60
  rack
65
61
  erubis (2.6.6)
@@ -92,28 +88,30 @@ GEM
92
88
  tzinfo (~> 0.3.22)
93
89
  will_paginate (~> 3.0.pre)
94
90
  nokogiri (1.4.4)
95
- polyglot (0.3.1)
96
- rack (1.2.2)
91
+ polyglot (0.3.2)
92
+ rack (1.2.3)
97
93
  rack-cache (1.0.3)
98
94
  rack (>= 0.4)
99
95
  rack-mount (0.6.14)
100
96
  rack (>= 1.0.0)
101
97
  rack-test (0.5.7)
102
98
  rack (>= 1.0)
103
- rails (3.0.7)
104
- actionmailer (= 3.0.7)
105
- actionpack (= 3.0.7)
106
- activerecord (= 3.0.7)
107
- activeresource (= 3.0.7)
108
- activesupport (= 3.0.7)
99
+ rails (3.0.10)
100
+ actionmailer (= 3.0.10)
101
+ actionpack (= 3.0.10)
102
+ activerecord (= 3.0.10)
103
+ activeresource (= 3.0.10)
104
+ activesupport (= 3.0.10)
109
105
  bundler (~> 1.0)
110
- railties (= 3.0.7)
111
- railties (3.0.7)
112
- actionpack (= 3.0.7)
113
- activesupport (= 3.0.7)
106
+ railties (= 3.0.10)
107
+ railties (3.0.10)
108
+ actionpack (= 3.0.10)
109
+ activesupport (= 3.0.10)
114
110
  rake (>= 0.8.7)
111
+ rdoc (~> 3.4)
115
112
  thor (~> 0.14.4)
116
- rake (0.8.7)
113
+ rake (0.9.2)
114
+ rdoc (3.9.4)
117
115
  ruby-debug-base19 (0.11.25)
118
116
  columnize (>= 0.3.1)
119
117
  linecache19 (>= 0.5.11)
@@ -126,8 +124,8 @@ GEM
126
124
  ruby_core_source (0.1.5)
127
125
  archive-tar-minitar (>= 0.5.2)
128
126
  rubyzip (0.9.4)
129
- selenium-webdriver (0.2.0)
130
- childprocess (>= 0.1.7)
127
+ selenium-webdriver (2.5.0)
128
+ childprocess (>= 0.2.1)
131
129
  ffi (>= 1.0.7)
132
130
  json_pure
133
131
  rubyzip
@@ -138,9 +136,10 @@ GEM
138
136
  sqlite3-ruby (1.3.3)
139
137
  sqlite3 (>= 1.3.3)
140
138
  thor (0.14.6)
141
- treetop (1.4.9)
139
+ treetop (1.4.10)
140
+ polyglot
142
141
  polyglot (>= 0.3.1)
143
- tzinfo (0.3.27)
142
+ tzinfo (0.3.29)
144
143
  will_paginate (3.0.pre2)
145
144
  xpath (0.1.4)
146
145
  nokogiri (~> 1.3)
@@ -151,13 +150,13 @@ PLATFORMS
151
150
  DEPENDENCIES
152
151
  attachment_magick!
153
152
  bson_ext (~> 1.3)
154
- capybara (>= 0.4.0)
153
+ capybara (>= 1.0.1)
155
154
  colorific
156
155
  hpricot
157
156
  mime-types (>= 1.16)
158
157
  mongoid (~> 2.0)
159
158
  nokogiri
160
- rails (= 3.0.7)
159
+ rails (= 3.0.10)
161
160
  ruby-debug19
162
161
  simplecov
163
162
  sqlite3-ruby
data/README.rdoc CHANGED
@@ -23,11 +23,16 @@ And if you are using ActiveRecord, run this too
23
23
  Create a initializer like this (config/initializers/attachment_magick_setup.rb)
24
24
 
25
25
  AttachmentMagick.setup do |config|
26
- #config.default_add_partial = '/attachment_magick/add_image' # default
27
- config.columns_amount = 16
28
- config.columns_width = 52
29
- config.gutter = 8
30
- config.orms = ["ActiveRecord", "Mongoid"] # Mongoid is default
26
+ # config.default_add_partial = '/attachment_magick/add_image' # default
27
+
28
+ # You can set grid size manually:
29
+ config.columns_amount = 16
30
+ config.columns_width = 52
31
+ config.gutter = 8
32
+ # Or with our magick :)
33
+ config.parse_stylesheet('name_of_my_grid_file.css')
34
+
35
+ config.orms = ["ActiveRecord", "Mongoid"] # Mongoid is default
31
36
 
32
37
  config.custom_styles do
33
38
  publisher "52x"
@@ -30,13 +30,13 @@ module AttachmentMagick::AttachmentMagickHelper
30
30
  def attachment_for_view(object, partial = nil, collection=nil, use_sortable=true)
31
31
  unless object.new_record?
32
32
  unless collection.present?
33
- if defined? Mongoid::Document
33
+ if AttachmentMagick.configuration.orms.include?("Mongoid")
34
34
  if object.class.include?(Mongoid::Document)
35
35
  collection = object.images.order_by(:priority.asc)
36
36
  end
37
37
  end
38
38
 
39
- if defined? ActiveRecord::Persistence
39
+ if AttachmentMagick.configuration.orms.include?("ActiveRecord")
40
40
  if object.class.include?(ActiveRecord::Persistence)
41
41
  collection = object.images.order(:priority)
42
42
  end
@@ -18,9 +18,9 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_dependency 'dragonfly', '>= 0.9.4'
22
- s.add_dependency 'rack-cache', '>= 1.0'
23
- s.add_dependency 'jquery-rails', '>= 0.2.7'
24
- s.add_dependency 'marcosinger-auto_html', '>= 1.3.4'
25
- s.add_dependency 'marcosinger-css_parser', '>= 1.3.0'
21
+ s.add_dependency "dragonfly", ">= 0.9.5"
22
+ s.add_dependency "rack-cache", ">= 1.0"
23
+ s.add_dependency "jquery-rails", ">= 0.2.7"
24
+ s.add_dependency "marcosinger-auto_html", ">= 1.3.4"
25
+ s.add_dependency "marcosinger-css_parser", ">= 1.3.0"
26
26
  end
@@ -83,4 +83,10 @@ module AttachmentMagick
83
83
  end
84
84
  end
85
85
  end
86
+
87
+ module InstanceMethods
88
+ def image_cover
89
+ self.images.order(:priority).first
90
+ end
91
+ end
86
92
  end
@@ -1,3 +1,3 @@
1
1
  module AttachmentMagick
2
- VERSION = "0.3"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -9,4 +9,12 @@ class ArtistTest < ActiveSupport::TestCase
9
9
  assert_equal "909x230#", Artist.style_grid_16
10
10
  assert_equal "x700>", Artist.style_portrait
11
11
  end
12
+
13
+ def test_image_cover
14
+ @artist = Artist.create(:name => "Busk")
15
+ @image = @artist.images.create(:photo => exemple_file, :priority => 0)
16
+ @artist.images.create(:photo => exemple_file, :priority => 1)
17
+
18
+ assert_equal @artist.image_cover, @image
19
+ end
12
20
  end
@@ -1,8 +1,16 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class PlaceTest < ActiveSupport::TestCase
4
- # Replace this with your real tests.
5
- test "the truth" do
6
- assert true
4
+ def test_access_grid_method
5
+ assert_equal "168x", Place.style_grid_3
6
+ assert_equal "54x", Place.style_publisher
7
+ end
8
+
9
+ def test_image_cover
10
+ @place = Place.create(:name => "Busk")
11
+ @image = @place.images.create(:photo => exemple_file, :priority => 0)
12
+ @place.images.create(:photo => exemple_file, :priority => 1)
13
+
14
+ assert_equal @place.image_cover, @image
7
15
  end
8
16
  end
@@ -1,5 +1,5 @@
1
1
  # Define a bare test case to use with Capybara
2
2
  class ActiveSupport::IntegrationCase < ActiveSupport::TestCase
3
- include Capybara
3
+ include Capybara::DSL
4
4
  include Rails.application.routes.url_helpers
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attachment_magick
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,23 +11,23 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-08-30 00:00:00.000000000 -03:00
14
+ date: 2011-08-31 00:00:00.000000000 -03:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: dragonfly
19
- requirement: &2153183920 !ruby/object:Gem::Requirement
19
+ requirement: &2155959540 !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
22
  - - ! '>='
23
23
  - !ruby/object:Gem::Version
24
- version: 0.9.4
24
+ version: 0.9.5
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *2153183920
27
+ version_requirements: *2155959540
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rack-cache
30
- requirement: &2153183420 !ruby/object:Gem::Requirement
30
+ requirement: &2155958400 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ! '>='
@@ -35,10 +35,10 @@ dependencies:
35
35
  version: '1.0'
36
36
  type: :runtime
37
37
  prerelease: false
38
- version_requirements: *2153183420
38
+ version_requirements: *2155958400
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: jquery-rails
41
- requirement: &2153182960 !ruby/object:Gem::Requirement
41
+ requirement: &2155957120 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ! '>='
@@ -46,10 +46,10 @@ dependencies:
46
46
  version: 0.2.7
47
47
  type: :runtime
48
48
  prerelease: false
49
- version_requirements: *2153182960
49
+ version_requirements: *2155957120
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: marcosinger-auto_html
52
- requirement: &2153182500 !ruby/object:Gem::Requirement
52
+ requirement: &2155955560 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ! '>='
@@ -57,10 +57,10 @@ dependencies:
57
57
  version: 1.3.4
58
58
  type: :runtime
59
59
  prerelease: false
60
- version_requirements: *2153182500
60
+ version_requirements: *2155955560
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: marcosinger-css_parser
63
- requirement: &2153182040 !ruby/object:Gem::Requirement
63
+ requirement: &2155954640 !ruby/object:Gem::Requirement
64
64
  none: false
65
65
  requirements:
66
66
  - - ! '>='
@@ -68,7 +68,7 @@ dependencies:
68
68
  version: 1.3.0
69
69
  type: :runtime
70
70
  prerelease: false
71
- version_requirements: *2153182040
71
+ version_requirements: *2155954640
72
72
  description:
73
73
  email:
74
74
  - markaum@gmail.com