lorem_ipsum_amet 0.4.0 → 0.5.0
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.
- data/.travis.yml +9 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/README.md +28 -8
- data/VERSION +1 -1
- data/lib/lorem_ipsum_amet/base.rb +1 -0
- data/lib/lorem_ipsum_amet/image.rb +18 -0
- data/lib/lorem_ipsum_amet/rails/view_helpers.rb +4 -0
- data/lib/lorem_ipsum_amet.rb +1 -0
- data/spec/lorem_ipsum/base_spec.rb +9 -0
- data/spec/lorem_ipsum/image_spec.rb +34 -0
- data/spec/support/image_helper.rb +28 -0
- metadata +23 -3
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.6.0 (Coming soon)
|
4
|
+
|
5
|
+
* Command line support
|
6
|
+
|
7
|
+
## 0.5.0 (2012-12-18)
|
8
|
+
|
9
|
+
* Added placeholder image support via placehold.it
|
10
|
+
|
3
11
|
## 0.4.0 (2012-12-10)
|
4
12
|
|
5
13
|
* Added alternative short syntax: #lorem_ipsum(c: X), #lorem_ipsum(p: X), #lorem_ipsum(w: X)
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -3,6 +3,7 @@ GEM
|
|
3
3
|
specs:
|
4
4
|
coderay (1.0.8)
|
5
5
|
diff-lcs (1.1.3)
|
6
|
+
dimensions (1.2.0)
|
6
7
|
git (1.2.5)
|
7
8
|
jeweler (1.8.4)
|
8
9
|
bundler (~> 1.0)
|
@@ -38,6 +39,7 @@ PLATFORMS
|
|
38
39
|
|
39
40
|
DEPENDENCIES
|
40
41
|
bundler (>= 1.1.3)
|
42
|
+
dimensions
|
41
43
|
jeweler (~> 1.8.4)
|
42
44
|
pry
|
43
45
|
rdoc (~> 3.12)
|
data/README.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# Lorem Ipsum Amet - blind text generator
|
2
2
|
===========
|
3
3
|
|
4
|
-
|
4
|
+
[](http://travis-ci.org/yagooar/lorem_ipsum_amet)
|
5
|
+
|
6
|
+
|
7
|
+
**Lorem Ipsum Amet** is a gem that provides a simple yet powerful DSL for generating blind texts and placeholder images in your **Ruby** or **Ruby on Rails** projects.
|
5
8
|
|
6
9
|
Lots of shortcuts have been incorporated in order to make the DSL concise yet expressive to avoid lots of typing.
|
7
10
|
|
@@ -21,9 +24,9 @@ to install it.
|
|
21
24
|
|
22
25
|
The gem provides all of its features through the namespace LoremIpsum. If you are using it in a **Rails** project, refer to the next section.
|
23
26
|
|
24
|
-
###
|
27
|
+
### Quick and dirty!
|
25
28
|
|
26
|
-
####
|
29
|
+
#### Text
|
27
30
|
|
28
31
|
LoremIpsum.lorem_ipsum
|
29
32
|
|
@@ -31,6 +34,21 @@ or (alternatively)
|
|
31
34
|
|
32
35
|
LoremIpsum.text
|
33
36
|
|
37
|
+
#### Rails (ERB)
|
38
|
+
|
39
|
+
<%= lorem_ipsum(300) %>
|
40
|
+
|
41
|
+
#### Placeholder image
|
42
|
+
|
43
|
+
LoremIpsum.placeholder_image(300, 200)
|
44
|
+
|
45
|
+
#### Rails (HAML)
|
46
|
+
|
47
|
+
= image_tag placeholder_image(200)
|
48
|
+
|
49
|
+
|
50
|
+
### More Examples
|
51
|
+
|
34
52
|
#### Characters
|
35
53
|
|
36
54
|
Get 100 characters:
|
@@ -51,15 +69,15 @@ Get 3 paragraphs:
|
|
51
69
|
|
52
70
|
LoremIpsum.lorem_ipsum(p: 3)
|
53
71
|
|
54
|
-
LoremIpsum.
|
72
|
+
LoremIpsum.p(3)
|
55
73
|
|
56
74
|
#### Words
|
57
75
|
|
58
76
|
Get 200 words:
|
59
77
|
|
60
|
-
LoremIpsum.lorem_ipsum(words:
|
78
|
+
LoremIpsum.lorem_ipsum(words: 200)
|
61
79
|
|
62
|
-
LoremIpsum.lorem_ipsum(w:
|
80
|
+
LoremIpsum.lorem_ipsum(w: 200)
|
63
81
|
|
64
82
|
LoremIpsum.w(200)
|
65
83
|
|
@@ -116,17 +134,19 @@ Very long:
|
|
116
134
|
|
117
135
|
### Rails integration
|
118
136
|
|
119
|
-
If you are using this gem in a Rails project, you can access the helper
|
137
|
+
If you are using this gem in a Rails project, you can access the following helper methods to get exactly the same functionality as described in the examples before.
|
120
138
|
|
121
|
-
The html option is activated by default.
|
139
|
+
The html option for the text helper is activated by default.
|
122
140
|
|
123
141
|
ERB:
|
124
142
|
|
125
143
|
<%= text_area_tag 'placeholder', lorem_ipsum %>
|
144
|
+
<%= image_tag placeholder_image(300) %>
|
126
145
|
|
127
146
|
HAML:
|
128
147
|
|
129
148
|
%p= lorem_ipsum(paragraphs: 5)
|
149
|
+
%p= image_tag placeholder_image(200, 100)
|
130
150
|
|
131
151
|
## Bug reports and contributions
|
132
152
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module LoremIpsumAmet
|
2
|
+
module Image
|
3
|
+
|
4
|
+
def placeholder_image(width, height = width)
|
5
|
+
dimensions = [width, height].join('x')
|
6
|
+
|
7
|
+
[base_url, dimensions].join('/')
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def base_url
|
13
|
+
'http://placehold.it'
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
data/lib/lorem_ipsum_amet.rb
CHANGED
@@ -2,6 +2,7 @@ require_relative 'lorem_ipsum_amet/text'
|
|
2
2
|
require_relative 'lorem_ipsum_amet/character'
|
3
3
|
require_relative 'lorem_ipsum_amet/paragraph'
|
4
4
|
require_relative 'lorem_ipsum_amet/word'
|
5
|
+
require_relative 'lorem_ipsum_amet/image'
|
5
6
|
require_relative 'lorem_ipsum_amet/base'
|
6
7
|
|
7
8
|
LoremIpsum = LoremIpsumAmet::Base.new
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe LoremIpsumAmet::Image do
|
4
|
+
|
5
|
+
subject { Object.new.extend(LoremIpsumAmet::Image) }
|
6
|
+
|
7
|
+
describe '#placeholder_image(:width, :height)' do
|
8
|
+
|
9
|
+
it 'returns an image with the correct dimensions' do
|
10
|
+
image_url = subject.placeholder_image(200, 200)
|
11
|
+
image_path = download_file(image_url)
|
12
|
+
|
13
|
+
image = SpecImage.new(image_path)
|
14
|
+
|
15
|
+
expect(image.width).to eq(200)
|
16
|
+
expect(image.height).to eq(200)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#placeholder_image(:width_height)' do
|
21
|
+
|
22
|
+
it 'returns an image with the correct dimensions' do
|
23
|
+
image_url = subject.placeholder_image(200)
|
24
|
+
image_path = download_file(image_url)
|
25
|
+
|
26
|
+
image = SpecImage.new(image_path)
|
27
|
+
|
28
|
+
expect(image.width).to eq(200)
|
29
|
+
expect(image.height).to eq(200)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'tempfile'
|
3
|
+
require 'dimensions'
|
4
|
+
|
5
|
+
def download_file(url)
|
6
|
+
file = Tempfile.new('file')
|
7
|
+
open(url) { |stream| file.write stream.read }
|
8
|
+
|
9
|
+
file.close
|
10
|
+
file.path
|
11
|
+
end
|
12
|
+
|
13
|
+
class SpecImage
|
14
|
+
|
15
|
+
def initialize(path)
|
16
|
+
@path = path
|
17
|
+
end
|
18
|
+
|
19
|
+
def width
|
20
|
+
Dimensions.width(@path)
|
21
|
+
end
|
22
|
+
|
23
|
+
def height
|
24
|
+
Dimensions.height(@path)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lorem_ipsum_amet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -107,6 +107,22 @@ dependencies:
|
|
107
107
|
- - ! '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: dimensions
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
110
126
|
description: Generate blind texts with tons of options in Ruby and Ruby on Rails
|
111
127
|
email: yagooar@gmail.com
|
112
128
|
executables: []
|
@@ -115,6 +131,7 @@ extra_rdoc_files:
|
|
115
131
|
- LICENSE.txt
|
116
132
|
- README.md
|
117
133
|
files:
|
134
|
+
- .travis.yml
|
118
135
|
- CHANGELOG.md
|
119
136
|
- Gemfile
|
120
137
|
- Gemfile.lock
|
@@ -125,14 +142,17 @@ files:
|
|
125
142
|
- lib/lorem_ipsum_amet.rb
|
126
143
|
- lib/lorem_ipsum_amet/base.rb
|
127
144
|
- lib/lorem_ipsum_amet/character.rb
|
145
|
+
- lib/lorem_ipsum_amet/image.rb
|
128
146
|
- lib/lorem_ipsum_amet/paragraph.rb
|
129
147
|
- lib/lorem_ipsum_amet/rails/railtie.rb
|
130
148
|
- lib/lorem_ipsum_amet/rails/view_helpers.rb
|
131
149
|
- lib/lorem_ipsum_amet/text.rb
|
132
150
|
- lib/lorem_ipsum_amet/word.rb
|
133
151
|
- spec/lorem_ipsum/base_spec.rb
|
152
|
+
- spec/lorem_ipsum/image_spec.rb
|
134
153
|
- spec/lorem_ipsum/text_spec.rb
|
135
154
|
- spec/spec_helper.rb
|
155
|
+
- spec/support/image_helper.rb
|
136
156
|
homepage: http://yagooar.github.com/lorem_ipsum_amet/
|
137
157
|
licenses:
|
138
158
|
- MIT
|
@@ -148,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
168
|
version: '0'
|
149
169
|
segments:
|
150
170
|
- 0
|
151
|
-
hash:
|
171
|
+
hash: 3620222892511120082
|
152
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
173
|
none: false
|
154
174
|
requirements:
|