picture_tag-rails 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Guardfile CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  guard 'rspec', :version => 2 do
5
5
  watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/picture_tag/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
6
+ watch(%r{^lib/picture_tag-rails/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
7
  watch('spec/spec_helper.rb') { "spec" }
8
8
  end
9
9
 
data/README.md CHANGED
@@ -1,44 +1,98 @@
1
- # picture_tag
1
+ # Picture-Tag Rails
2
+
3
+ A Rails view helper extension to generate HTML5 `<picture>` tag markup
4
+ from the W3C HTML Responsive Images Extension Proposal.
5
+
6
+ [w3.org/community/respimg](http://www.w3.org/community/respimg)
7
+
8
+
9
+ ## Current Version
10
+
11
+ 0.0.1
12
+
13
+
14
+ ## Requirements
15
+
16
+ * [Ruby on Rails](http://rubyonrails.org) > 3.0
17
+
2
18
 
3
- A Rails view helper extension to generate the proposed HTML5 picture tag markup.
4
19
 
5
20
  ## Installation
6
21
 
7
- Add this line to your application's Gemfile:
22
+ ### Gemfile
8
23
 
9
- `gem 'picture_tag-rails'`
24
+ Add this line to your application's Gemfile.
10
25
 
11
- Or install it yourself as:
26
+ ```ruby
27
+ gem 'picture_tag-rails'
28
+ ```
29
+
30
+ ### Manual
31
+
32
+ Or install it yourself.
33
+
34
+ ```bash
35
+ gem install picture_tag-rails
36
+ ```
12
37
 
13
- `gem install picture_tag-rails`
14
38
 
15
39
  ## Usage
16
40
 
41
+ Add to some Ruby file in your Rails app.
42
+
43
+ ```ruby
44
+ require 'picture_tag'
45
+ ```
46
+
47
+ Use it in your views as you would the `image_tag()` helper.
48
+
17
49
  ```erb
18
50
  <%= picture_tag(image_path, options) %>
19
- ```
51
+ ```
52
+
53
+
54
+ ## Examples
55
+
56
+ The vanilla usage with default sizes and media queries:
20
57
 
21
- With default sizes and media queries
22
58
  ```erb
23
- <%= picture_tag('/images/cat.jpg', alt: "Kitty cat!") %>
24
- ```
59
+ <%= picture_tag("cat.jpg", alt: "Kitty cat!") %>
60
+ ```
25
61
 
26
- produces
62
+ produces:
27
63
 
28
64
  ```html
29
65
  <picture>
30
- <source media='(min-width: 1600px)' srcset='/images/cat-large.jpg 1x, /images/cat-large@2x.jpg 2x' />
31
- <source media='(min-width: 1000px)' srcset='/images/cat-medium.jpg 1x, /images/cat-medium@2x.jpg 2x' />
32
- <source media='(min-width: 768px)' srcset='/images/cat-small.jpg 1x, /images/cat-small@2x.jpg 2x' />
33
- <source media='(min-width: 480px)' srcset='/images/cat-tiny.jpg 1x, /images/cat-tiny@2x.jpg 2x' />
34
- <source srcset='/images/cat-tiny.jpg 1x, /images/cat-tiny@2x.jpg 2x' />
35
- <img alt=\"Kitty cat!\" src=\"/images/cat-tiny.jpg\" />
66
+ <source media="(min-width: 1600px)" srcset="cat-large.jpg 1x, cat-large@2x.jpg 2x" />
67
+ <source media="(min-width: 1000px)" srcset="cat-medium.jpg 1x, cat-medium@2x.jpg 2x" />
68
+ <source media="(min-width: 768px)" srcset="cat-small.jpg 1x, cat-small@2x.jpg 2x" />
69
+ <source media="(min-width: 480px)" srcset="cat-tiny.jpg 1x, cat-tiny@2x.jpg 2x" />
70
+ <source srcset="cat-tiny.jpg 1x, cat-tiny@2x.jpg 2x" />
71
+ <img alt="Kitty cat!" src="cat-tiny.jpg" />
36
72
  </picture>
37
73
  ```
38
74
 
75
+ ### Options
76
+
77
+ To exclude certain `<source>` elements with media queries above a max width:
78
+
79
+ ```erb
80
+ <%= picture_tag(image_path, max_width: "600px") %>
81
+ ```
82
+
83
+ To override the default media queries and names:
84
+
85
+ ```erb
86
+ <%= picture_tag(image_path, sizes: { itty_bitty: "(min-width: 10px)" }) %>
87
+ ```
88
+
89
+ All `image_tag` options are valid for `picture_tag`.
90
+ See [image_tag Docs](http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html)
91
+
92
+
39
93
  ## Paperclip
40
94
 
41
- Paperclip options for default media queries and sizes
95
+ Paperclip options for default media queries and sizes.
42
96
 
43
97
  ```ruby
44
98
  has_attached_file :image, {
@@ -56,21 +110,66 @@ has_attached_file :image, {
56
110
  }
57
111
  ```
58
112
 
59
- ## Options
60
113
 
61
- To exclude `<source>` elements with media queries above a max width:
62
- ```erb
63
- <%= picture_tag(image_path, max_width: "600px") %>
114
+ ## TODO
115
+
116
+ - Add optional paperclip integration functionality
117
+ - Implement Retina support
118
+
119
+
120
+ ## Authors
121
+
122
+ * Bookis Smuin / [@bookis](https://github.com/bookis)
123
+ * Chad Crissman / [@crissmancd](https://github.com/crissmancd)
124
+
125
+
126
+ ## Contributions
127
+
128
+ 1. Fork it
129
+ 2. Get it running (see Installation above)
130
+ 3. Create your feature branch (`git checkout -b my-new-feature`)
131
+ 4. Write your code and **specs**
132
+ 5. Commit your changes (`git commit -am 'Add some feature'`)
133
+ 6. Push to the branch (`git push origin my-new-feature`)
134
+ 7. Create new Pull Request
135
+
136
+ If you find bugs, have feature requests or questions, please
137
+ [file an issue](https://github.com/G5/picture_tag-rails/issues).
138
+
139
+ ### Specs
140
+
141
+ ```bash
142
+ rake spec
64
143
  ```
65
144
 
66
- To override the default media queries and names:
67
- ```erb
68
- <%= picture_tag(image_path, sizes: {itty_bitty: "(min-width: 10px)"}) %>
145
+ ### Releases
146
+
147
+ ```bash
148
+ TODO how do you do a release?
69
149
  ```
70
150
 
71
- All `image_tag` options are valid for `picture_tag`. See [image_tag Docs](http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html)
72
151
 
73
- ## Todo
152
+ ## License
74
153
 
75
- - Add optional paperclip integration functionality
76
- - Implement Retina support
154
+ Copyright (c) 2012 G5
155
+
156
+ MIT License
157
+
158
+ Permission is hereby granted, free of charge, to any person obtaining
159
+ a copy of this software and associated documentation files (the
160
+ "Software"), to deal in the Software without restriction, including
161
+ without limitation the rights to use, copy, modify, merge, publish,
162
+ distribute, sublicense, and/or sell copies of the Software, and to
163
+ permit persons to whom the Software is furnished to do so, subject to
164
+ the following conditions:
165
+
166
+ The above copyright notice and this permission notice shall be
167
+ included in all copies or substantial portions of the Software.
168
+
169
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
170
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
171
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
172
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
173
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
174
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
175
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,4 +1,4 @@
1
- require 'picture_tag/view_helpers'
1
+ require 'picture_tag-rails/view_helpers'
2
2
  module PictureTag
3
3
  class Railtie < Rails::Railtie
4
4
  initializer "picture_tag.view_helpers" do
@@ -1,3 +1,3 @@
1
1
  module PictureTag
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,2 @@
1
+ require "picture_tag-rails/version"
2
+ require 'picture_tag-rails/railtie'
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'picture_tag/version'
4
+ require 'picture_tag-rails/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "picture_tag-rails"
@@ -16,4 +16,6 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency 'rails', '>= 3.0'
19
21
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picture_tag-rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bookis Smuin
@@ -15,9 +15,23 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-09-25 00:00:00 Z
19
- dependencies: []
20
-
18
+ date: 2012-09-26 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rails
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 7
29
+ segments:
30
+ - 3
31
+ - 0
32
+ version: "3.0"
33
+ type: :runtime
34
+ version_requirements: *id001
21
35
  description: Rails View Helper picture_tag extension
22
36
  email:
23
37
  - vegan.bookis@gmail.com
@@ -34,10 +48,10 @@ files:
34
48
  - LICENSE.txt
35
49
  - README.md
36
50
  - Rakefile
37
- - lib/picture_tag.rb
38
- - lib/picture_tag/railtie.rb
39
- - lib/picture_tag/version.rb
40
- - lib/picture_tag/view_helpers.rb
51
+ - lib/picture_tag-rails.rb
52
+ - lib/picture_tag-rails/railtie.rb
53
+ - lib/picture_tag-rails/version.rb
54
+ - lib/picture_tag-rails/view_helpers.rb
41
55
  - picture_tag-rails.gemspec
42
56
  - spec/lib/view_helpers_spec.rb
43
57
  - spec/spec_helper.rb
data/lib/picture_tag.rb DELETED
@@ -1,2 +0,0 @@
1
- require "picture_tag/version"
2
- require 'picture_tag/railtie' if defined?(Rails)