middleman-geo_pattern 0.0.1 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32c024ba138b7ee41af05a3c4a2dad9740226443
4
- data.tar.gz: f778ffb0ab7c5ccf74f0d9da2f8f5a54d98eae16
3
+ metadata.gz: e2bdf192996be8b11abbfe2ffb250bc3960ca0c6
4
+ data.tar.gz: 1bb02bf2806545331cde9af1fc54e51d5d2e4144
5
5
  SHA512:
6
- metadata.gz: 6a0cf02d77e0c2b05290e2533cae64208720783cbaa00a9600013b486d211115f0bb8a609908f3ee0cd47bf600fda2a359000fc5fb1b05e733edb492dd32a9e8
7
- data.tar.gz: bddb365e2793dcf64d7d5f3a6e4dc790648647ca2e0fb7503338d27616bc3b50807c0f584a296253b444e92136518d120a735e9e92a0e850b8c6c22334366bfa
6
+ metadata.gz: a117ed19217a66558c8b94b07d45c6ee5271e548d240343bc0f3f1df358272055e9947ae0a9093be4714ceb8e68fab997bc2ae61e947a3084f85b3894e6239b0
7
+ data.tar.gz: 84ad9dcbc9f7c5aa9f97617a3d51977f6ff5bdbb80ef54d58026e004f2742e30accaad294e501bac8f2006b0e9de864f1565c42354ee4b678b0b8182efcbc93c
data/.gitignore CHANGED
@@ -1,5 +1,14 @@
1
- # Ignore bundler lock file
2
- /Gemfile.lock
3
-
4
- # Ignore pkg folder
5
- /pkg
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.bundle
10
+ *.so
11
+ *.o
12
+ *.a
13
+ mkmf.log
14
+ *.log
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ sudo: false
2
+ env:
3
+ - CI=1
4
+ language: ruby
5
+ rvm:
6
+ - 2.1.5
7
+ - 2.2.0
8
+ install: scripts/bootstrap
9
+ script: scripts/test
10
+ cache: bundler
data/Gemfile CHANGED
@@ -4,7 +4,8 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :development, :test do
7
- gem 'stackprof'
7
+ gem 'fedux_org-stdlib', require: false
8
+ gem 'stackprof', require: false
8
9
  gem 'rspec', require: false
9
10
  gem 'fuubar', require: false
10
11
  gem 'simplecov', require: false
data/Gemfile.lock ADDED
@@ -0,0 +1,316 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ middleman-geo_pattern (0.0.2)
5
+ geo_pattern (~> 1.4.0)
6
+ middleman-core (>= 3.3.10)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ abstract_type (0.0.7)
12
+ activesupport (4.1.9)
13
+ i18n (~> 0.6, >= 0.6.9)
14
+ json (~> 1.7, >= 1.7.7)
15
+ minitest (~> 5.1)
16
+ thread_safe (~> 0.1)
17
+ tzinfo (~> 1.1)
18
+ adamantium (0.2.0)
19
+ ice_nine (~> 0.11.0)
20
+ memoizable (~> 0.4.0)
21
+ addressable (2.3.7)
22
+ anima (0.2.0)
23
+ abstract_type (~> 0.0.7)
24
+ adamantium (~> 0.1)
25
+ equalizer (~> 0.0.8)
26
+ aruba (0.6.2)
27
+ childprocess (>= 0.3.6)
28
+ cucumber (>= 1.1.1)
29
+ rspec-expectations (>= 2.7.0)
30
+ ast (2.0.0)
31
+ astrolabe (1.3.0)
32
+ parser (>= 2.2.0.pre.3, < 3.0)
33
+ binding_of_caller (0.7.2)
34
+ debug_inspector (>= 0.0.1)
35
+ blockenspiel (0.4.5)
36
+ builder (3.2.2)
37
+ byebug (3.5.1)
38
+ columnize (~> 0.8)
39
+ debugger-linecache (~> 1.2)
40
+ slop (~> 3.6)
41
+ celluloid (0.16.0)
42
+ timers (~> 4.0.0)
43
+ childprocess (0.5.5)
44
+ ffi (~> 1.0, >= 1.0.11)
45
+ coderay (1.1.0)
46
+ color (1.7.1)
47
+ columnize (0.9.0)
48
+ command_exec (0.2.0)
49
+ activesupport
50
+ smart_colored
51
+ xml-simple
52
+ concord (0.1.5)
53
+ adamantium (~> 0.2.0)
54
+ equalizer (~> 0.0.9)
55
+ coveralls (0.7.11)
56
+ multi_json (~> 1.10)
57
+ rest-client (>= 1.6.8, < 2)
58
+ simplecov (~> 0.9.1)
59
+ term-ansicolor (~> 1.3)
60
+ thor (~> 0.19.1)
61
+ cucumber (1.3.19)
62
+ builder (>= 2.1.2)
63
+ diff-lcs (>= 1.1.3)
64
+ gherkin (~> 2.12)
65
+ multi_json (>= 1.7.5, < 2.0)
66
+ multi_test (>= 0.1.2)
67
+ debug_inspector (0.0.2)
68
+ debugger-linecache (1.2.0)
69
+ diff-lcs (1.2.5)
70
+ docile (1.1.5)
71
+ dotenv (1.0.2)
72
+ equalizer (0.0.9)
73
+ erubis (2.7.0)
74
+ excon (0.44.3)
75
+ fedux_org-stdlib (0.11.16)
76
+ activesupport
77
+ ffi (1.9.6)
78
+ filegen (0.4.3)
79
+ activesupport
80
+ foreman (0.77.0)
81
+ dotenv (~> 1.0.2)
82
+ thor (~> 0.19.1)
83
+ fuubar (2.0.0)
84
+ rspec (~> 3.0)
85
+ ruby-progressbar (~> 1.4)
86
+ geo_pattern (1.4.0)
87
+ color (~> 1.5)
88
+ gherkin (2.12.2)
89
+ multi_json (~> 1.3)
90
+ github-markup (1.3.3)
91
+ hitimes (1.2.2)
92
+ hooks (0.4.0)
93
+ uber (~> 0.0.4)
94
+ httparty (0.13.3)
95
+ json (~> 1.8)
96
+ multi_xml (>= 0.5.2)
97
+ i18n (0.7.0)
98
+ ice_nine (0.11.1)
99
+ inch (0.5.10)
100
+ pry
101
+ sparkr (>= 0.2.0)
102
+ term-ansicolor
103
+ yard (~> 0.8.7.5)
104
+ interception (0.5)
105
+ json (1.8.2)
106
+ launchy (2.4.3)
107
+ addressable (~> 2.3)
108
+ libv8 (3.16.14.7)
109
+ license_finder (1.2)
110
+ bundler
111
+ httparty
112
+ sequel
113
+ sqlite3
114
+ thor
115
+ xml-simple
116
+ listen (2.8.5)
117
+ celluloid (>= 0.15.2)
118
+ rb-fsevent (>= 0.9.3)
119
+ rb-inotify (>= 0.9)
120
+ memoizable (0.4.2)
121
+ thread_safe (~> 0.3, >= 0.3.1)
122
+ method_source (0.8.2)
123
+ middleman-core (3.3.10)
124
+ activesupport (~> 4.1.0)
125
+ bundler (~> 1.1)
126
+ erubis
127
+ hooks (~> 0.3)
128
+ i18n (~> 0.7.0)
129
+ listen (>= 2.7.9, < 3.0)
130
+ padrino-helpers (~> 0.12.3)
131
+ rack (>= 1.4.5, < 2.0)
132
+ rack-test (~> 0.6.2)
133
+ thor (>= 0.15.2, < 2.0)
134
+ tilt (~> 1.4.1, < 2.0)
135
+ mime-types (2.4.3)
136
+ minitest (5.5.1)
137
+ morpher (0.2.3)
138
+ abstract_type (~> 0.0.7)
139
+ adamantium (~> 0.2.0)
140
+ anima (~> 0.2.0)
141
+ ast (~> 2.0.0)
142
+ concord (~> 0.1.4)
143
+ equalizer (~> 0.0.9)
144
+ ice_nine (~> 0.11.0)
145
+ procto (~> 0.0.2)
146
+ multi_json (1.11.0)
147
+ multi_test (0.1.2)
148
+ multi_xml (0.5.5)
149
+ mutant (0.7.7)
150
+ abstract_type (~> 0.0.7)
151
+ adamantium (~> 0.2.0)
152
+ anima (~> 0.2.0)
153
+ ast (~> 2.0)
154
+ concord (~> 0.1.5)
155
+ diff-lcs (~> 1.2)
156
+ equalizer (~> 0.0.9)
157
+ ice_nine (~> 0.11.1)
158
+ memoizable (~> 0.4.2)
159
+ morpher (~> 0.2.3)
160
+ parallel (~> 1.3)
161
+ parser (~> 2.2.0.2)
162
+ procto (~> 0.0.2)
163
+ unparser (~> 0.2.2)
164
+ mutant-rspec (0.7.7)
165
+ mutant (~> 0.7.7)
166
+ rspec-core (>= 3.0.0, < 3.3.0)
167
+ netrc (0.10.3)
168
+ padrino-helpers (0.12.5)
169
+ i18n (~> 0.6, >= 0.6.7)
170
+ padrino-support (= 0.12.5)
171
+ tilt (~> 1.4.1)
172
+ padrino-support (0.12.5)
173
+ activesupport (>= 3.1)
174
+ parallel (1.4.0)
175
+ parser (2.2.0.3)
176
+ ast (>= 1.1, < 3.0)
177
+ powerpack (0.1.0)
178
+ procto (0.0.2)
179
+ pry (0.10.1)
180
+ coderay (~> 1.1.0)
181
+ method_source (~> 0.8.1)
182
+ slop (~> 3.4)
183
+ pry-byebug (3.0.1)
184
+ byebug (~> 3.4)
185
+ pry (~> 0.10)
186
+ pry-doc (0.6.0)
187
+ pry (~> 0.9)
188
+ yard (~> 0.8)
189
+ pry-rescue (1.4.1)
190
+ interception (>= 0.5)
191
+ pry
192
+ pry-stack_explorer (0.4.9.1)
193
+ binding_of_caller (>= 0.7)
194
+ pry (>= 0.9.11)
195
+ rack (1.6.0)
196
+ rack-test (0.6.3)
197
+ rack (>= 1.0)
198
+ rainbow (2.0.0)
199
+ rake (10.4.2)
200
+ rb-fsevent (0.9.4)
201
+ rb-inotify (0.9.5)
202
+ ffi (>= 0.5.0)
203
+ redcarpet (3.2.2)
204
+ ref (1.0.5)
205
+ rest-client (1.7.3)
206
+ mime-types (>= 1.16, < 3.0)
207
+ netrc (~> 0.7)
208
+ rspec (3.2.0)
209
+ rspec-core (~> 3.2.0)
210
+ rspec-expectations (~> 3.2.0)
211
+ rspec-mocks (~> 3.2.0)
212
+ rspec-core (3.2.1)
213
+ rspec-support (~> 3.2.0)
214
+ rspec-expectations (3.2.0)
215
+ diff-lcs (>= 1.2.0, < 2.0)
216
+ rspec-support (~> 3.2.0)
217
+ rspec-mocks (3.2.1)
218
+ diff-lcs (>= 1.2.0, < 2.0)
219
+ rspec-support (~> 3.2.0)
220
+ rspec-support (3.2.2)
221
+ rubocop (0.29.1)
222
+ astrolabe (~> 1.3)
223
+ parser (>= 2.2.0.1, < 3.0)
224
+ powerpack (~> 0.1)
225
+ rainbow (>= 1.99.1, < 3.0)
226
+ ruby-progressbar (~> 1.4)
227
+ ruby-progressbar (1.7.1)
228
+ rugged (0.21.4)
229
+ sequel (4.19.0)
230
+ simplecov (0.9.2)
231
+ docile (~> 1.1.0)
232
+ multi_json (~> 1.0)
233
+ simplecov-html (~> 0.9.0)
234
+ simplecov-html (0.9.0)
235
+ slop (3.6.0)
236
+ smart_colored (1.1.1)
237
+ sparkr (0.4.1)
238
+ sqlite3 (1.3.10)
239
+ stackprof (0.2.7)
240
+ term-ansicolor (1.3.0)
241
+ tins (~> 1.0)
242
+ therubyracer (0.12.1)
243
+ libv8 (~> 3.16.14.0)
244
+ ref
245
+ therubyrhino (2.0.4)
246
+ therubyrhino_jar (>= 1.7.3)
247
+ therubyrhino_jar (1.7.4)
248
+ thor (0.19.1)
249
+ thread_safe (0.3.4)
250
+ tilt (1.4.1)
251
+ timers (4.0.1)
252
+ hitimes
253
+ tins (1.3.4)
254
+ tmrb (1.2.7)
255
+ thor
256
+ travis-lint (2.0.0)
257
+ json
258
+ tzinfo (1.2.2)
259
+ thread_safe (~> 0.1)
260
+ uber (0.0.13)
261
+ unparser (0.2.2)
262
+ abstract_type (~> 0.0.7)
263
+ adamantium (~> 0.2.0)
264
+ concord (~> 0.1.5)
265
+ diff-lcs (~> 1.2.5)
266
+ equalizer (~> 0.0.9)
267
+ parser (~> 2.2.0.2)
268
+ procto (~> 0.0.2)
269
+ versionomy (0.4.4)
270
+ blockenspiel (>= 0.4.5)
271
+ xml-simple (1.1.4)
272
+ yard (0.8.7.6)
273
+
274
+ PLATFORMS
275
+ ruby
276
+
277
+ DEPENDENCIES
278
+ activesupport
279
+ addressable
280
+ aruba
281
+ bundler
282
+ byebug
283
+ command_exec
284
+ coveralls
285
+ cucumber
286
+ erubis
287
+ excon
288
+ fedux_org-stdlib
289
+ filegen
290
+ foreman
291
+ fuubar
292
+ github-markup
293
+ inch
294
+ launchy
295
+ license_finder
296
+ middleman-geo_pattern!
297
+ mutant
298
+ mutant-rspec
299
+ pry
300
+ pry-byebug
301
+ pry-doc
302
+ pry-rescue
303
+ pry-stack_explorer
304
+ rake
305
+ redcarpet
306
+ rspec
307
+ rubocop (>= 0.25.0)
308
+ rugged
309
+ simplecov
310
+ stackprof
311
+ therubyracer
312
+ therubyrhino
313
+ tmrb
314
+ travis-lint
315
+ versionomy
316
+ yard
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # middleman-geo_pattern
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/middleman-geo_pattern.svg)](http://badge.fury.io/rb/middleman-geo_pattern)
4
+ [![Build Status](https://travis-ci.org/fedux-org/middleman-geo_pattern.png?branch=master)](https://travis-ci.org/fedux-org/middleman-geo_pattern)
5
+ [![Coverage Status](https://coveralls.io/repos/maxmeyer/middleman-geo_pattern/badge.png?branch=master)](https://coveralls.io/r/maxmeyer/middleman-geo_pattern?branch=master)
6
+ [![Inline docs](http://inch-ci.org/github/maxmeyer/middleman-geo_pattern.svg?branch=master)](http://inch-ci.org/github/maxmeyer/middleman-geo_pattern)
7
+
3
8
  This gem integrates the
4
9
  [`geo_pattern`](https://github.com/jasonlong/geo_pattern)-gem into
5
10
  [`middleman`](https://middlemanapp.com/).
@@ -22,44 +27,105 @@ Or install it yourself as:
22
27
 
23
28
  ## Usage
24
29
 
30
+ ### Activate extension
31
+
25
32
  Activate the extension in your `config.rb`:
26
33
 
27
34
  ```ruby
28
35
  activate :geo_pattern
29
36
  ```
30
37
 
38
+ ### Use helper in view
39
+
40
+ #### erb
41
+
42
+ ```erb
43
+ <%= geo_pattern 'Mastering Markdown' %>
44
+ ```
45
+
46
+ #### haml
47
+
48
+ ```haml
49
+ = geo_pattern 'Mastering Markdown'
50
+ ```
51
+
52
+ ### Define patterns
53
+
31
54
  To configure the patterns which should be used by default, use the
32
- `.default_patterns`-option - see the
55
+ `.patterns`-option - see the
33
56
  [README](https://github.com/jasonlong/geo_pattern#available-patterns) for a
34
57
  list of available patterns.
35
58
 
36
59
  ```ruby
37
60
  activate :geo_pattern do |g|
38
- g.default_patterns = [:xes]
61
+ g.patterns = [:xes]
39
62
  end
40
63
  ```
41
64
 
65
+ To define them only per invocation, use the `patterns`-option.
66
+
67
+ ```ruby
68
+ geo_pattern 'Mastering Markdown', patterns: [:xes]
69
+ ```
70
+
71
+ ### Define color
72
+
42
73
  To configure a default color, use the `.default_color`-option.
43
74
 
44
75
  ```ruby
45
76
  activate :geo_pattern do |g|
46
- g.default_color = '#123455'
77
+ g.color = '#123455'
47
78
  end
48
79
  ```
49
80
 
81
+ To set it once only, use the `color`-option.
82
+
83
+ ```ruby
84
+ geo_pattern 'Mastering Markdown', color: '#123456'
85
+ ```
86
+
87
+ ### Define base color
88
+
50
89
  To configure a default base color, use the `.default_base_color`-option.
51
90
 
52
91
  ```ruby
53
92
  activate :geo_pattern do |g|
54
- g.default_base_color = '#123455'
93
+ g.base_color = '#123455'
55
94
  end
56
95
  ```
57
96
 
97
+ To set it once only, use the `base_color`-option.
98
+
99
+ ```ruby
100
+ geo_pattern 'Mastering Markdown', base_color: '#123456'
101
+ ```
102
+
103
+ ### Pass a block to the helper
104
+
105
+ You can also pass a block to geo pattern, to embed some other code within it:
106
+
107
+ #### erb
108
+
109
+ Please mind the missing `=` in `<% geo...`.
110
+
111
+ ```erb
112
+ <% geo_pattern('Mastering Markdown') do %>
113
+ <%= content_tag :h1, 'Mastering Markdown' %>
114
+ <% end %>
115
+ ```
116
+
117
+ #### haml
118
+
119
+ ```haml
120
+ = geo_pattern('Mastering Markdown') do
121
+ = content_tag :h1, 'Mastering Markdown'
122
+ ```
123
+
58
124
  ## Contributing
59
125
 
60
126
  See [CONTRIBUTING.md](CONTRIBUTING.md)
61
127
 
62
- ## License
128
+ ## Copyright
63
129
 
64
130
  (c) 2015, Max Meyer
65
131
 
data/Rakefile CHANGED
@@ -44,3 +44,9 @@ namespace :gem do
44
44
  FileUtils.rm Dir.glob(File.join(pkg_directory, '*.gem'))
45
45
  end
46
46
  end
47
+
48
+ namespace :documentation do
49
+ task :inch do
50
+ sh 'inch'
51
+ end
52
+ end
@@ -36,8 +36,8 @@ Feature: Generate GeoPattern
36
36
  Scenario: Set default patterns
37
37
  Given a middleman config file with:
38
38
  """
39
- activate :geo_pattern do |e|
40
- e.default_patterns = [:xes]
39
+ activate :geo_pattern do |g|
40
+ g.patterns = [:xes]
41
41
  end
42
42
  """
43
43
  And a source file named "index.erb" with:
@@ -51,8 +51,8 @@ Feature: Generate GeoPattern
51
51
  Scenario: Set default color
52
52
  Given a middleman config file with:
53
53
  """
54
- activate :geo_pattern do |e|
55
- e.default_color = '#fff'
54
+ activate :geo_pattern do |g|
55
+ g.color = '#fff'
56
56
  end
57
57
  """
58
58
  And a source file named "index.erb" with:
@@ -66,8 +66,8 @@ Feature: Generate GeoPattern
66
66
  Scenario: Set default base color
67
67
  Given a middleman config file with:
68
68
  """
69
- activate :geo_pattern do |e|
70
- e.default_base_color = '#123456'
69
+ activate :geo_pattern do |g|
70
+ g.base_color = '#123456'
71
71
  end
72
72
  """
73
73
  And a source file named "index.erb" with:
@@ -81,8 +81,8 @@ Feature: Generate GeoPattern
81
81
  Scenario: Set tag as string
82
82
  Given a middleman config file with:
83
83
  """
84
- activate :geo_pattern do |e|
85
- e.html_tag = 'span'
84
+ activate :geo_pattern do |g|
85
+ g.html_tag = 'span'
86
86
  end
87
87
  """
88
88
  And a source file named "index.erb" with:
@@ -99,8 +99,8 @@ Feature: Generate GeoPattern
99
99
  Scenario: Set tag as string
100
100
  Given a middleman config file with:
101
101
  """
102
- activate :geo_pattern do |e|
103
- e.html_tag = :span
102
+ activate :geo_pattern do |g|
103
+ g.html_tag = :span
104
104
  end
105
105
  """
106
106
  And a source file named "index.erb" with:
@@ -113,3 +113,77 @@ Feature: Generate GeoPattern
113
113
  """
114
114
  span
115
115
  """
116
+
117
+ Scenario: Use block with erb
118
+ Given a middleman config file with:
119
+ """
120
+ activate :geo_pattern
121
+ """
122
+ And a source file named "index.erb" with:
123
+ """
124
+ <% geo_pattern('Mastering Markdown') do %>
125
+ <%= content_tag :h1, 'Mastering Markdown' %>
126
+ <% end %>
127
+ """
128
+ And the Server is running
129
+ When I go to "/index.html"
130
+ Then I should see:
131
+ """
132
+ <h1>
133
+ """
134
+
135
+ Scenario: Pass option to tag helper
136
+ Given a middleman config file with:
137
+ """
138
+ activate :geo_pattern
139
+ """
140
+ And a source file named "index.erb" with:
141
+ """
142
+ <%= geo_pattern 'Mastering Markdown', class: 'gp-content' %>
143
+ """
144
+ And the Server is running
145
+ When I go to "/index.html"
146
+ Then I should see:
147
+ """
148
+ class="gp-content"
149
+ """
150
+
151
+ Scenario: Generate content tag
152
+ Given a middleman config file with:
153
+ """
154
+ activate :geo_pattern
155
+ """
156
+ And a source file named "index.erb" with:
157
+ """
158
+ <%= geo_pattern 'Mastering Markdown' %>
159
+ """
160
+ And the Server is running
161
+ When I go to "/index.html"
162
+ Then I should see:
163
+ """
164
+ <div
165
+ """
166
+ And I should see:
167
+ """
168
+ </div>
169
+ """
170
+
171
+ Scenario: Generate no content tag
172
+ Given a middleman config file with:
173
+ """
174
+ activate :geo_pattern
175
+ """
176
+ And a source file named "index.erb" with:
177
+ """
178
+ <%= geo_pattern 'Mastering Markdown', html_tag: 'img', is_content_tag: false %>
179
+ """
180
+ And the Server is running
181
+ When I go to "/index.html"
182
+ Then I should see:
183
+ """
184
+ <img
185
+ """
186
+ And I should not see:
187
+ """
188
+ </img>
189
+ """
@@ -2,7 +2,12 @@ PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
2
2
 
3
3
  # Pull in all of the gems including those in the `test` group
4
4
  require 'bundler'
5
- Bundler.require :default, :test, :development, :debug
5
+ groups = if ENV.key? 'CI'
6
+ [:default, :test, :development]
7
+ else
8
+ [:default, :test, :development, :debug]
9
+ end
10
+ Bundler.require(*groups)
6
11
 
7
12
  require 'simplecov'
8
13
  SimpleCov.command_name 'cucumber'
@@ -2,9 +2,10 @@ module Middleman
2
2
  module GeoPattern
3
3
  # Extension namespace
4
4
  class Extension < ::Middleman::Extension
5
- option :default_patterns, nil, 'Which patterns should be used'
6
- option :default_color, nil, 'The color to use'
7
- option :default_base_color, nil, 'The base color to use'
5
+ option :patterns, nil, 'Which patterns should be used'
6
+ option :color, nil, 'The color to use'
7
+ option :base_color, nil, 'The base color to use'
8
+ option :is_content_tag, true, 'Is content tag?'
8
9
  option :html_tag, :div, 'Tag to generate'
9
10
 
10
11
  def initialize(app, options_hash = {}, &block)
@@ -46,12 +47,16 @@ module Middleman
46
47
  # All other options are passed on to the tag helper
47
48
  #
48
49
  # rubocop:disable Metrics/MethodLength
50
+ # rubocop:disable Metrics/ParameterLists
49
51
  def geo_pattern(
50
52
  input,
51
- patterns: extensions[:geo_pattern].options.default_patterns,
52
- color: extensions[:geo_pattern].options.default_color,
53
- base_color: extensions[:geo_pattern].options.default_base_color,
54
- **options
53
+ patterns: extensions[:geo_pattern].options.patterns,
54
+ color: extensions[:geo_pattern].options.color,
55
+ base_color: extensions[:geo_pattern].options.base_color,
56
+ is_content_tag: extensions[:geo_pattern].options.is_content_tag,
57
+ html_tag: extensions[:geo_pattern].options.html_tag,
58
+ **options,
59
+ &block
55
60
  )
56
61
  pattern = ::GeoPattern.generate(
57
62
  input,
@@ -63,14 +68,14 @@ module Middleman
63
68
  style = format('background-image: %s', pattern.to_data_uri)
64
69
  style += options.delete(:style) if options[:style]
65
70
 
66
- content_tag(
67
- extensions[:geo_pattern].options.html_tag.to_sym,
68
- nil,
69
- style: style,
70
- **options
71
- )
71
+ # rubocop:disable Metrics/LineLength
72
+ return public_send(:content_tag, html_tag, nil, **options, style: style, &block) if is_content_tag == true
73
+ # rubocop:enable Metrics/LineLength
74
+
75
+ public_send(:tag, html_tag, **options, style: style)
72
76
  end
73
77
  # rubocop:enable Metrics/MethodLength
78
+ # rubocop:enable Metrics/ParameterLists
74
79
  end
75
80
  end
76
81
  end
@@ -1,8 +1,8 @@
1
+ # encoding: utf-8
1
2
  # Middleman
2
3
  module Middleman
3
- # GeoPattern Extension
4
+ # GeoPattern
4
5
  module GeoPattern
5
- # The version
6
- VERSION = '0.0.1'
6
+ VERSION = '0.0.3'
7
7
  end
8
8
  end
data/scripts/bootstrap ADDED
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ info_msg="\e[0;32m[INFO]\e[0;30m"
6
+ error_msg="\e[0;31mFAILED\e[0;30m"
7
+
8
+ function output_error_log {
9
+ [[ -f error.log ]] && ( cat error.log >&2; rm error.log)
10
+ }
11
+
12
+ echo -ne "$info_msg Checking if ruby installed? "
13
+ which 'ruby' >/dev/null 2>error.log || ( echo -e "$error_msg\n\nCould not find \`ruby\`. Please install ruby or add it to PATH"; output_error_log; exit 1 )
14
+ echo OK
15
+
16
+ echo -en "$info_msg rubygem \"bundler\" "
17
+ gem install bundler >/dev/null 2>error.log || ( echo -e "$error_msg\n\nAn error occurred during installation of bundler. Run \`gem install bundler\` yourself."; output_error_log; exit 1 )
18
+ echo OK
19
+
20
+ echo -en "$info_msg \"bundle install\" "
21
+ bundle install --without debug >/dev/null 2>error.log || ( echo -e "$error_msg\n\nAn error occurred during bundle install. Run \`bundle install\` yourself."; output_error_log; exit 1 )
22
+ echo OK
data/scripts/console ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler'
4
+ Bundler.require :default, :test, :development
5
+
6
+ Pry.start
data/scripts/test ADDED
@@ -0,0 +1,16 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ function output_error_log {
6
+ [[ -f error.log ]] && ( cat error.log >&2; rm error.log)
7
+ }
8
+
9
+ info_msg="\e[0;32m[INFO]\e[0;30m"
10
+ error_msg="\e[0;31mFAILED\e[0;30m"
11
+
12
+ echo -e "$info_msg Testing in normal mode"
13
+ rake_task='test'
14
+
15
+ echo -en "$info_msg Running rake task \"$rake_task\" "
16
+ bundle exec rake --trace $rake_task
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-geo_pattern
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Meyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-06 00:00:00.000000000 Z
11
+ date: 2015-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -77,15 +77,14 @@ files:
77
77
  - ".rspec"
78
78
  - ".rubocop.yml"
79
79
  - ".simplecov"
80
+ - ".travis.yml"
80
81
  - ".yardopts"
81
82
  - CONTRIBUTING.md
82
83
  - Gemfile
84
+ - Gemfile.lock
83
85
  - LICENSE.txt
84
86
  - README.md
85
87
  - Rakefile
86
- - coverage/.last_run.json
87
- - coverage/.resultset.json
88
- - coverage/.resultset.json.lock
89
88
  - cucumber.yml
90
89
  - features/generate_geo_pattern.feature
91
90
  - features/step_definitions.rb
@@ -97,13 +96,9 @@ files:
97
96
  - lib/middleman-geo_pattern/version.rb
98
97
  - lib/middleman_extension.rb
99
98
  - middleman-geo_pattern.gemspec
100
- - tmp/aruba/empty-app/.keep
101
- - tmp/aruba/empty-app/config.rb
102
- - tmp/aruba/empty-app/index.erb
103
- - tmp/cucumber/empty-app/.keep
104
- - tmp/cucumber/empty-app/config.rb
105
- - tmp/cucumber/empty-app/source/index.erb
106
- - tmp/cucumber/empty-app/source/layouts/layout.erb
99
+ - scripts/bootstrap
100
+ - scripts/console
101
+ - scripts/test
107
102
  homepage: https://github.com/fedux-org/middleman-geo_pattern
108
103
  licenses:
109
104
  - MIT
@@ -1,5 +0,0 @@
1
- {
2
- "result": {
3
- "covered_percent": 100.0
4
- }
5
- }
@@ -1,7 +0,0 @@
1
- {
2
- "cucumber": {
3
- "coverage": {
4
- },
5
- "timestamp": 1425627704
6
- }
7
- }
File without changes
File without changes
@@ -1 +0,0 @@
1
- activate :geo_pattern
@@ -1 +0,0 @@
1
- <%= geo_pattern 'Mastering Markdown' %>
File without changes
@@ -1,3 +0,0 @@
1
- activate :geo_pattern do |e|
2
- e.html_tag = :span
3
- end
@@ -1 +0,0 @@
1
- <%= geo_pattern 'Mastering Markdown' %>
@@ -1,8 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Test</title>
4
- </head>
5
- <body>
6
- <%= yield %>
7
- </body>
8
- </html>