phil 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/lib/phil/version.rb +1 -1
- data/lib/phil.rb +19 -0
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3668992d36762d34360443d60b52a7d95470ecf2
|
4
|
+
data.tar.gz: f79137b76250fdca9aba3a7f3ee47d9323a4bc22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5364b5be4065f4b3ffa0d768e049ef80cffadc33fc64df2f1e54db090ec82f0bd18a283e1ca7cc9826cbd2163c615bfd475e413f1082bbdf5f18a8a830aa401
|
7
|
+
data.tar.gz: 727d7a711e09ccb853ac3856e1fd622637b1722896a3ee53ba20ab0d24d3a2727ca9749f9361891bd7451fd22c26308dda5931757f604990c8f2e4f248608e7f
|
data/README.md
CHANGED
@@ -46,6 +46,19 @@ Phil.markup
|
|
46
46
|
Phil.markup "h1 p h2 ul p blockquote h5 h6"
|
47
47
|
```
|
48
48
|
|
49
|
+
### Images
|
50
|
+
|
51
|
+
Generate a [placehold.it](http://placehold.it) image URL. Requires dimensions, but you can also request colors (in the format `#background/#foreground`) and containing text. Placehold.it doesn't play nice with some containing text characters so those are stripped out.
|
52
|
+
|
53
|
+
You can pass arguments in any order – Phil is reasonably smart about figuring them out.
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
Phil.image 200 # http://placehold.it/200
|
57
|
+
Phil.image 200x400, #ff0000 # http://placehold.it/200x400/ff0000
|
58
|
+
Phil.image 200x400, #ff0000/#00ff00 # http://placehold.it/200x400/ff0000/00ff00
|
59
|
+
Phil.image 'Jackie Jormp-Jomp?', 600 # http://placehold.it/600&text=Jackie+Jormp-Jomp
|
60
|
+
```
|
61
|
+
|
49
62
|
### Lorem methods (all take ranges or numbers)
|
50
63
|
|
51
64
|
```ruby
|
data/lib/phil/version.rb
CHANGED
data/lib/phil.rb
CHANGED
@@ -103,6 +103,14 @@ module Phil
|
|
103
103
|
Faker::AddressUS.state_abbr
|
104
104
|
end
|
105
105
|
|
106
|
+
def image(*arguments)
|
107
|
+
opts = {}
|
108
|
+
arguments.each do |arg|
|
109
|
+
opts.merge! parse_image_argument(arg.to_s)
|
110
|
+
end
|
111
|
+
opts[:size] && "http://placehold.it/#{opts[:size]}#{opts[:color]}#{opts[:text]}"
|
112
|
+
end
|
113
|
+
|
106
114
|
alias_method :body_content, :markup
|
107
115
|
|
108
116
|
private
|
@@ -133,6 +141,17 @@ module Phil
|
|
133
141
|
"<#{name}>#{content}</#{name}>".html_safe
|
134
142
|
end
|
135
143
|
|
144
|
+
def parse_image_argument(argument)
|
145
|
+
case argument
|
146
|
+
when /^(#[a-f\d]{3,6}(\/(?=#))?){1,2}$/
|
147
|
+
{ :color => "/#{argument.gsub('#', '')}" }
|
148
|
+
when /^\d*x?\d*?$/
|
149
|
+
{ :size => argument }
|
150
|
+
else
|
151
|
+
{ :text => "&text=#{argument.gsub(/[^\d\w\!,\.;:-]+/, '+').gsub(/\+?$/, '')}" }
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
136
155
|
end
|
137
156
|
|
138
157
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Daigle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffaker
|
@@ -80,7 +80,10 @@ dependencies:
|
|
80
80
|
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
description: Phil
|
83
|
+
description: Phil is a collection of markup generation and iteration methods to ease
|
84
|
+
creation of UI mockups. It uses Faker for standard content generation and adds a
|
85
|
+
number of convenience methods and ways to build consistently varied markup for layout
|
86
|
+
testing.
|
84
87
|
email:
|
85
88
|
- cameron@hashrocket.com
|
86
89
|
executables: []
|
@@ -115,5 +118,5 @@ rubyforge_project:
|
|
115
118
|
rubygems_version: 2.0.3
|
116
119
|
signing_key:
|
117
120
|
specification_version: 4
|
118
|
-
summary:
|
121
|
+
summary: Quickly and easily generate varied markup and content.
|
119
122
|
test_files: []
|