middleman-geo_pattern 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.rspec +3 -0
- data/.rubocop.yml +11 -0
- data/.simplecov +25 -0
- data/.yardopts +5 -0
- data/CONTRIBUTING.md +61 -0
- data/Gemfile +53 -0
- data/LICENSE.txt +22 -0
- data/README.md +66 -0
- data/Rakefile +46 -0
- data/coverage/.last_run.json +5 -0
- data/coverage/.resultset.json +7 -0
- data/coverage/.resultset.json.lock +0 -0
- data/cucumber.yml +2 -0
- data/features/generate_geo_pattern.feature +115 -0
- data/features/step_definitions.rb +13 -0
- data/features/support/aruba.rb +14 -0
- data/features/support/env.rb +16 -0
- data/fixtures/empty-app/.keep +0 -0
- data/lib/middleman-geo_pattern/extension.rb +79 -0
- data/lib/middleman-geo_pattern/version.rb +8 -0
- data/lib/middleman-geo_pattern.rb +12 -0
- data/lib/middleman_extension.rb +1 -0
- data/middleman-geo_pattern.gemspec +27 -0
- data/tmp/aruba/empty-app/.keep +0 -0
- data/tmp/aruba/empty-app/config.rb +1 -0
- data/tmp/aruba/empty-app/index.erb +1 -0
- data/tmp/cucumber/empty-app/.keep +0 -0
- data/tmp/cucumber/empty-app/config.rb +3 -0
- data/tmp/cucumber/empty-app/source/index.erb +1 -0
- data/tmp/cucumber/empty-app/source/layouts/layout.erb +8 -0
- metadata +136 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 32c024ba138b7ee41af05a3c4a2dad9740226443
|
4
|
+
data.tar.gz: f778ffb0ab7c5ccf74f0d9da2f8f5a54d98eae16
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6a0cf02d77e0c2b05290e2533cae64208720783cbaa00a9600013b486d211115f0bb8a609908f3ee0cd47bf600fda2a359000fc5fb1b05e733edb492dd32a9e8
|
7
|
+
data.tar.gz: bddb365e2793dcf64d7d5f3a6e4dc790648647ca2e0fb7503338d27616bc3b50807c0f584a296253b444e92136518d120a735e9e92a0e850b8c6c22334366bfa
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.simplecov
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
class ExcludeRegexFilter < SimpleCov::Filter
|
4
|
+
def matches?(source_file)
|
5
|
+
source_file.filename !~ filter_argument
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class IncludeRegexFilter < SimpleCov::Filter
|
10
|
+
def matches?(source_file)
|
11
|
+
source_file.filename =~ filter_argument
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
SimpleCov.start do
|
16
|
+
add_filter "/features/"
|
17
|
+
add_filter "/fixtures/"
|
18
|
+
add_filter "/spec/"
|
19
|
+
add_filter "/tmp"
|
20
|
+
add_filter "/vendor"
|
21
|
+
add_filter "/cli"
|
22
|
+
|
23
|
+
add_group "lib", ExcludeRegexFilter.new(%r{/cli/|/commands/})
|
24
|
+
#add_group "cli", IncludeRegexFilter.new(%r{/cli/|/commands/})
|
25
|
+
end
|
data/.yardopts
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
In the spirit of [free software][free-sw], **everyone** is encouraged to help
|
4
|
+
improve this project.
|
5
|
+
|
6
|
+
[free-sw]: http://www.fsf.org/licensing/essays/free-sw.html
|
7
|
+
|
8
|
+
Here are some ways *you* can contribute:
|
9
|
+
|
10
|
+
* by using alpha, beta, and prerelease versions
|
11
|
+
* by reporting bugs
|
12
|
+
* by suggesting new features
|
13
|
+
* by writing or editing documentation
|
14
|
+
* by writing specifications
|
15
|
+
* by writing code ( **no patch is too small** : fix typos, add comments, clean up inconsistent whitespace )
|
16
|
+
* by refactoring code
|
17
|
+
* by closing [issues][]
|
18
|
+
* by reviewing patches
|
19
|
+
|
20
|
+
[issues]: https://github.com/fedux-org/middleman-geo_pattern/issues
|
21
|
+
|
22
|
+
## Submitting an Issue
|
23
|
+
|
24
|
+
We use the [GitHub issue tracker][issues] to track bugs and features. Before
|
25
|
+
submitting a bug report or feature request, check to make sure it hasn't
|
26
|
+
already been submitted.
|
27
|
+
|
28
|
+
When submitting a bug report, please include a [Gist][] that includes a *stack
|
29
|
+
trace* and any details that may be necessary to reproduce the bug, including
|
30
|
+
your *gem version*, *Ruby version*, and *operating system*. Ideally, a bug report
|
31
|
+
should include a pull request with failing specs.
|
32
|
+
|
33
|
+
[gist]: https://gist.github.com/
|
34
|
+
|
35
|
+
## Submitting a Pull Request
|
36
|
+
|
37
|
+
1. [Fork the repository.][fork]
|
38
|
+
2. Create a topic [branch]. `git checkout -b local_topic_branch`
|
39
|
+
3. Add specs for your unimplemented feature or bug fix.
|
40
|
+
4. Run `bundle exec rake test`. If your specs pass, return to step 3.
|
41
|
+
5. Implement your feature or bug fix.
|
42
|
+
6. Run `bundle exec rake test`. If your specs fail, return to step 5.
|
43
|
+
7. Add, commit, and push your changes. To push your topic branch use `git push -u origin local_topic_branch`.
|
44
|
+
8. [Submit a pull request.][pr]
|
45
|
+
|
46
|
+
Here are some reasons why a pull request may not be merged:
|
47
|
+
|
48
|
+
1. It hasn’t been reviewed.
|
49
|
+
2. It doesn’t include specs for new functionality.
|
50
|
+
3. It doesn’t include documentation for new functionality.
|
51
|
+
4. It changes behavior without changing the relevant documentation, comments, or specs.
|
52
|
+
5. It changes behavior of an existing public API, breaking backward compatibility.
|
53
|
+
6. It breaks the tests on a supported platform.
|
54
|
+
7. It doesn’t merge cleanly (requiring Git rebasing and conflict resolution).
|
55
|
+
|
56
|
+
Include this emoji in the top of your ticket to signal to us that you read this
|
57
|
+
file: :memo:
|
58
|
+
|
59
|
+
[fork]: http://help.github.com/fork-a-repo/
|
60
|
+
[branch]: https://help.github.com/articles/fork-a-repo#create-branches
|
61
|
+
[pr]: http://help.github.com/send-pull-requests/
|
data/Gemfile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in middleman-geo_pattern.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :development, :test do
|
7
|
+
gem 'stackprof'
|
8
|
+
gem 'rspec', require: false
|
9
|
+
gem 'fuubar', require: false
|
10
|
+
gem 'simplecov', require: false
|
11
|
+
gem 'rubocop', '>= 0.25.0', require: false
|
12
|
+
gem 'coveralls', require: false
|
13
|
+
gem 'cucumber', require: false
|
14
|
+
gem 'aruba'
|
15
|
+
gem 'bundler', require: false
|
16
|
+
gem 'erubis'
|
17
|
+
gem 'versionomy', require: false
|
18
|
+
gem 'activesupport', require: false
|
19
|
+
# gem 'awesome_print', require: 'ap'
|
20
|
+
|
21
|
+
gem 'mutant', require: false
|
22
|
+
gem 'mutant-rspec', require: false
|
23
|
+
|
24
|
+
gem 'foreman', require: false
|
25
|
+
gem 'github-markup'
|
26
|
+
gem 'redcarpet', require: false
|
27
|
+
gem 'tmrb', require: false
|
28
|
+
gem 'yard', require: false
|
29
|
+
gem 'inch', require: false
|
30
|
+
gem 'license_finder', require: false
|
31
|
+
gem 'filegen', require: false
|
32
|
+
gem 'travis-lint', require: false
|
33
|
+
gem 'command_exec', require: false
|
34
|
+
gem 'rake', require: false
|
35
|
+
gem 'launchy', require: false
|
36
|
+
|
37
|
+
gem 'excon', require: false
|
38
|
+
|
39
|
+
gem 'therubyracer'
|
40
|
+
gem 'therubyrhino'
|
41
|
+
|
42
|
+
gem 'rugged'
|
43
|
+
gem 'addressable'
|
44
|
+
end
|
45
|
+
|
46
|
+
group :debug do
|
47
|
+
gem 'byebug'
|
48
|
+
gem 'pry'
|
49
|
+
gem 'pry-byebug', require: false
|
50
|
+
gem 'pry-doc', require: false
|
51
|
+
gem 'pry-stack_explorer', require: false
|
52
|
+
gem 'pry-rescue', require: false
|
53
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Max Meyer
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# middleman-geo_pattern
|
2
|
+
|
3
|
+
This gem integrates the
|
4
|
+
[`geo_pattern`](https://github.com/jasonlong/geo_pattern)-gem into
|
5
|
+
[`middleman`](https://middlemanapp.com/).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'middleman-geo_pattern'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install middleman-geo_pattern
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Activate the extension in your `config.rb`:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
activate :geo_pattern
|
29
|
+
```
|
30
|
+
|
31
|
+
To configure the patterns which should be used by default, use the
|
32
|
+
`.default_patterns`-option - see the
|
33
|
+
[README](https://github.com/jasonlong/geo_pattern#available-patterns) for a
|
34
|
+
list of available patterns.
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
activate :geo_pattern do |g|
|
38
|
+
g.default_patterns = [:xes]
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
To configure a default color, use the `.default_color`-option.
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
activate :geo_pattern do |g|
|
46
|
+
g.default_color = '#123455'
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
To configure a default base color, use the `.default_base_color`-option.
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
activate :geo_pattern do |g|
|
54
|
+
g.default_base_color = '#123455'
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
58
|
+
## Contributing
|
59
|
+
|
60
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
61
|
+
|
62
|
+
## License
|
63
|
+
|
64
|
+
(c) 2015, Max Meyer
|
65
|
+
|
66
|
+
See [LICENSE.txt](LICENSE.txt)
|
data/Rakefile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
task default: :test
|
2
|
+
|
3
|
+
require 'fedux_org_stdlib/rake_tasks/gems'
|
4
|
+
require 'fedux_org_stdlib/rake_tasks/software_version/bump'
|
5
|
+
|
6
|
+
task test: ['test:rspec', 'test:rubocop', 'test:cucumber']
|
7
|
+
|
8
|
+
namespace :test do
|
9
|
+
desc 'Test with coveralls'
|
10
|
+
task coveralls: ['test', 'coveralls:push']
|
11
|
+
|
12
|
+
task :rubocop do
|
13
|
+
sh 'bundle exec rubocop'
|
14
|
+
end
|
15
|
+
|
16
|
+
task 'rubocop:autocorrect' do
|
17
|
+
sh 'bundle exec rubocop --auto-correct'
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Run rspec'
|
21
|
+
task :rspec do
|
22
|
+
sh 'bundle exec rspec'
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Run cucumber'
|
26
|
+
task :cucumber do
|
27
|
+
sh 'bundle exec cucumber -p all'
|
28
|
+
end
|
29
|
+
|
30
|
+
desc 'Run mutant'
|
31
|
+
task :mutant do
|
32
|
+
cmd = []
|
33
|
+
cmd << 'mutant'
|
34
|
+
cmd << '--include lib'
|
35
|
+
cmd << '--require middleman-geo_pattern'
|
36
|
+
cmd << '--use rspec "Middleman::GeoPattern*"'
|
37
|
+
sh cmd.join(' ')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
namespace :gem do
|
42
|
+
desc 'Clean build packages'
|
43
|
+
task :clean do
|
44
|
+
FileUtils.rm Dir.glob(File.join(pkg_directory, '*.gem'))
|
45
|
+
end
|
46
|
+
end
|
File without changes
|
data/cucumber.yml
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
Feature: Generate GeoPattern
|
2
|
+
As a web designer
|
3
|
+
I would like to use a geo pattern within a view
|
4
|
+
In order to have a beautiful background
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a fixture app "empty-app"
|
8
|
+
And a source file named "layouts/layout.erb" with:
|
9
|
+
"""
|
10
|
+
<html>
|
11
|
+
<head>
|
12
|
+
<title>Test</title>
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
<%= yield %>
|
16
|
+
</body>
|
17
|
+
</html>
|
18
|
+
"""
|
19
|
+
|
20
|
+
Scenario: Simple string
|
21
|
+
Given a middleman config file with:
|
22
|
+
"""
|
23
|
+
activate :geo_pattern
|
24
|
+
"""
|
25
|
+
And a source file named "index.erb" with:
|
26
|
+
"""
|
27
|
+
<%= geo_pattern 'Mastering Markdown' %>
|
28
|
+
"""
|
29
|
+
And the Server is running
|
30
|
+
When I go to "/index.html"
|
31
|
+
Then I should see:
|
32
|
+
"""
|
33
|
+
background-image:
|
34
|
+
"""
|
35
|
+
|
36
|
+
Scenario: Set default patterns
|
37
|
+
Given a middleman config file with:
|
38
|
+
"""
|
39
|
+
activate :geo_pattern do |e|
|
40
|
+
e.default_patterns = [:xes]
|
41
|
+
end
|
42
|
+
"""
|
43
|
+
And a source file named "index.erb" with:
|
44
|
+
"""
|
45
|
+
<%= geo_pattern 'Mastering Markdown' %>
|
46
|
+
"""
|
47
|
+
And the Server is running
|
48
|
+
When I go to "/index.html"
|
49
|
+
Then I should see a geo pattern based on "Mastering Markdown" with patterns "xes" with color "#3f904d"
|
50
|
+
|
51
|
+
Scenario: Set default color
|
52
|
+
Given a middleman config file with:
|
53
|
+
"""
|
54
|
+
activate :geo_pattern do |e|
|
55
|
+
e.default_color = '#fff'
|
56
|
+
end
|
57
|
+
"""
|
58
|
+
And a source file named "index.erb" with:
|
59
|
+
"""
|
60
|
+
<%= geo_pattern 'Mastering Markdown' %>
|
61
|
+
"""
|
62
|
+
And the Server is running
|
63
|
+
When I go to "/index.html"
|
64
|
+
Then I should see a geo pattern based on "Mastering Markdown" with patterns "hexagons" with color "#fff"
|
65
|
+
|
66
|
+
Scenario: Set default base color
|
67
|
+
Given a middleman config file with:
|
68
|
+
"""
|
69
|
+
activate :geo_pattern do |e|
|
70
|
+
e.default_base_color = '#123456'
|
71
|
+
end
|
72
|
+
"""
|
73
|
+
And a source file named "index.erb" with:
|
74
|
+
"""
|
75
|
+
<%= geo_pattern 'Mastering Markdown' %>
|
76
|
+
"""
|
77
|
+
And the Server is running
|
78
|
+
When I go to "/index.html"
|
79
|
+
Then I should see a geo pattern based on "Mastering Markdown" with patterns "hexagons" with color "#541428"
|
80
|
+
|
81
|
+
Scenario: Set tag as string
|
82
|
+
Given a middleman config file with:
|
83
|
+
"""
|
84
|
+
activate :geo_pattern do |e|
|
85
|
+
e.html_tag = 'span'
|
86
|
+
end
|
87
|
+
"""
|
88
|
+
And a source file named "index.erb" with:
|
89
|
+
"""
|
90
|
+
<%= geo_pattern 'Mastering Markdown' %>
|
91
|
+
"""
|
92
|
+
And the Server is running
|
93
|
+
When I go to "/index.html"
|
94
|
+
Then I should see:
|
95
|
+
"""
|
96
|
+
span
|
97
|
+
"""
|
98
|
+
|
99
|
+
Scenario: Set tag as string
|
100
|
+
Given a middleman config file with:
|
101
|
+
"""
|
102
|
+
activate :geo_pattern do |e|
|
103
|
+
e.html_tag = :span
|
104
|
+
end
|
105
|
+
"""
|
106
|
+
And a source file named "index.erb" with:
|
107
|
+
"""
|
108
|
+
<%= geo_pattern 'Mastering Markdown' %>
|
109
|
+
"""
|
110
|
+
And the Server is running
|
111
|
+
When I go to "/index.html"
|
112
|
+
Then I should see:
|
113
|
+
"""
|
114
|
+
span
|
115
|
+
"""
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Given(/^a middleman config file with:$/) do |string|
|
2
|
+
step 'a file named "config.rb" with:', string
|
3
|
+
end
|
4
|
+
|
5
|
+
Given(/^a source file named "(.*?)" with:$/) do |path, string|
|
6
|
+
step %(a file named "source/#{path}" with:), string
|
7
|
+
end
|
8
|
+
|
9
|
+
# rubocop:disable Metrics/LineLength
|
10
|
+
Then(/^I should see a geo pattern based on "(.*?)" with patterns "(.*?)" with color "(.*?)"$/) do |string, patterns, color|
|
11
|
+
step %(I should see:), GeoPattern.generate(string, patterns: patterns.split(/,\s*/), color: color).to_data_uri
|
12
|
+
end
|
13
|
+
# rubocop:enable Metrics/LineLength
|
@@ -0,0 +1,16 @@
|
|
1
|
+
PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
|
2
|
+
|
3
|
+
# Pull in all of the gems including those in the `test` group
|
4
|
+
require 'bundler'
|
5
|
+
Bundler.require :default, :test, :development, :debug
|
6
|
+
|
7
|
+
require 'simplecov'
|
8
|
+
SimpleCov.command_name 'cucumber'
|
9
|
+
SimpleCov.start
|
10
|
+
|
11
|
+
require 'coveralls'
|
12
|
+
Coveralls.wear!
|
13
|
+
|
14
|
+
require 'middleman-core'
|
15
|
+
require 'middleman-core/step_definitions'
|
16
|
+
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-geo_pattern')
|
File without changes
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module Middleman
|
2
|
+
module GeoPattern
|
3
|
+
# Extension namespace
|
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'
|
8
|
+
option :html_tag, :div, 'Tag to generate'
|
9
|
+
|
10
|
+
def initialize(app, options_hash = {}, &block)
|
11
|
+
# Call super to build options from the options_hash
|
12
|
+
super
|
13
|
+
|
14
|
+
require 'geo_pattern'
|
15
|
+
|
16
|
+
# set up your extension
|
17
|
+
# puts options.my_option
|
18
|
+
end
|
19
|
+
|
20
|
+
def after_configuration
|
21
|
+
# Do something
|
22
|
+
end
|
23
|
+
|
24
|
+
# A Sitemap Manipulator
|
25
|
+
# def manipulate_resource_list(resources)
|
26
|
+
# end
|
27
|
+
|
28
|
+
helpers do
|
29
|
+
# Generate the geo pattern
|
30
|
+
#
|
31
|
+
# @param [#to_s] input
|
32
|
+
# The input used to generate the pattern
|
33
|
+
#
|
34
|
+
# @param [Array, Symbol) patterns
|
35
|
+
# The patterns which are allowed to generate
|
36
|
+
#
|
37
|
+
# @param [String] color
|
38
|
+
# The color to use for the background of the pattern. You can either
|
39
|
+
# use "color" or "base_color".
|
40
|
+
#
|
41
|
+
# @param [String] base_color
|
42
|
+
# The base_color to use for the background of the pattern. You can
|
43
|
+
# either "use color" or "base_color".
|
44
|
+
#
|
45
|
+
# @param [Hash] options
|
46
|
+
# All other options are passed on to the tag helper
|
47
|
+
#
|
48
|
+
# rubocop:disable Metrics/MethodLength
|
49
|
+
def geo_pattern(
|
50
|
+
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
|
55
|
+
)
|
56
|
+
pattern = ::GeoPattern.generate(
|
57
|
+
input,
|
58
|
+
patterns: patterns,
|
59
|
+
color: color,
|
60
|
+
base_color: base_color
|
61
|
+
)
|
62
|
+
|
63
|
+
style = format('background-image: %s', pattern.to_data_uri)
|
64
|
+
style += options.delete(:style) if options[:style]
|
65
|
+
|
66
|
+
content_tag(
|
67
|
+
extensions[:geo_pattern].options.html_tag.to_sym,
|
68
|
+
nil,
|
69
|
+
style: style,
|
70
|
+
**options
|
71
|
+
)
|
72
|
+
end
|
73
|
+
# rubocop:enable Metrics/MethodLength
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
Middleman::GeoPattern::Extension.register(:geo_pattern)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# rubocop:disable Style/FileName
|
2
|
+
require 'middleman-core'
|
3
|
+
require 'middleman-geo_pattern/extension'
|
4
|
+
require 'middleman-geo_pattern/version'
|
5
|
+
# rubocop:enable Style/FileName
|
6
|
+
|
7
|
+
# Middleman
|
8
|
+
module Middleman
|
9
|
+
# GeoPattern Extension
|
10
|
+
module GeoPattern
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'middleman-geo_pattern'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'middleman-geo_pattern/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'middleman-geo_pattern'
|
8
|
+
spec.version = Middleman::GeoPattern::VERSION
|
9
|
+
spec.authors = ['Max Meyer']
|
10
|
+
spec.email = ['dev@fedux.org']
|
11
|
+
spec.summary = 'Integrate geo_pattern-gem into middleman'
|
12
|
+
spec.homepage = 'https://github.com/fedux-org/middleman-geo_pattern'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.required_ruby_version = '>= 2.0.0'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
|
25
|
+
spec.add_runtime_dependency 'middleman-core', '>= 3.3.10'
|
26
|
+
spec.add_runtime_dependency 'geo_pattern', '~> 1.4.0'
|
27
|
+
end
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
activate :geo_pattern
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= geo_pattern 'Mastering Markdown' %>
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= geo_pattern 'Mastering Markdown' %>
|
metadata
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-geo_pattern
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Max Meyer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: middleman-core
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.3.10
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.3.10
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: geo_pattern
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.4.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.4.0
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- dev@fedux.org
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".rubocop.yml"
|
79
|
+
- ".simplecov"
|
80
|
+
- ".yardopts"
|
81
|
+
- CONTRIBUTING.md
|
82
|
+
- Gemfile
|
83
|
+
- LICENSE.txt
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- coverage/.last_run.json
|
87
|
+
- coverage/.resultset.json
|
88
|
+
- coverage/.resultset.json.lock
|
89
|
+
- cucumber.yml
|
90
|
+
- features/generate_geo_pattern.feature
|
91
|
+
- features/step_definitions.rb
|
92
|
+
- features/support/aruba.rb
|
93
|
+
- features/support/env.rb
|
94
|
+
- fixtures/empty-app/.keep
|
95
|
+
- lib/middleman-geo_pattern.rb
|
96
|
+
- lib/middleman-geo_pattern/extension.rb
|
97
|
+
- lib/middleman-geo_pattern/version.rb
|
98
|
+
- lib/middleman_extension.rb
|
99
|
+
- 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
|
107
|
+
homepage: https://github.com/fedux-org/middleman-geo_pattern
|
108
|
+
licenses:
|
109
|
+
- MIT
|
110
|
+
metadata: {}
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 2.0.0
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 2.4.5
|
128
|
+
signing_key:
|
129
|
+
specification_version: 4
|
130
|
+
summary: Integrate geo_pattern-gem into middleman
|
131
|
+
test_files:
|
132
|
+
- features/generate_geo_pattern.feature
|
133
|
+
- features/step_definitions.rb
|
134
|
+
- features/support/aruba.rb
|
135
|
+
- features/support/env.rb
|
136
|
+
has_rdoc:
|