svg_use 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +18 -8
- data/.gitignore +2 -0
- data/Gemfile.lock +6 -25
- data/README.md +17 -4
- data/Rakefile +8 -0
- data/lib/svg_use.rb +3 -1
- data/lib/svg_use/version.rb +1 -1
- data/svg_use.gemspec +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a954d62a93f0f2a200b7edaffb620e9eaef6c5a9e2d1fcd394f467be63b7f5a
|
4
|
+
data.tar.gz: b8c96f5c20daf51f155307f0418c08a125729b9572829dc1a3240d126dc8cd59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4020855d60e156e130c56f1c4416115759fde011e64f729bf533bdfb982107db8288740bfa66852fad525cfe09aa270b94a4a2b8de2d3c9e342681b963e86b4d
|
7
|
+
data.tar.gz: 5e0baee2e24da9609071a4b6eb9691f128e4098f71932edbdc45d53aca308942a2b53ac5851fa9b0de1925db0664c387404bcd3fac6effcb64d9f25e0364f2f1
|
data/.github/workflows/main.yml
CHANGED
@@ -1,18 +1,28 @@
|
|
1
|
-
name:
|
1
|
+
name: Build
|
2
2
|
|
3
|
-
on:
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
paths-ignore:
|
6
|
+
- "README.md"
|
7
|
+
pull_request:
|
8
|
+
paths-ignore:
|
9
|
+
- "README.md"
|
4
10
|
|
5
11
|
jobs:
|
6
12
|
build:
|
7
13
|
runs-on: ubuntu-latest
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby: [2.5, 2.6, 2.7, 3.0]
|
17
|
+
rails: [5.0.0, 5.1.0, 5.2.0, 6.0.0, 6.1.0]
|
18
|
+
env:
|
19
|
+
BUNDLE_GEMFILE: spec/gemfiles/rails_${{ matrix.rails }}.Gemfile
|
8
20
|
steps:
|
9
21
|
- uses: actions/checkout@v2
|
10
22
|
- name: Set up Ruby
|
11
23
|
uses: ruby/setup-ruby@v1
|
12
24
|
with:
|
13
|
-
ruby-version:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
bundle install
|
18
|
-
bundle exec rake
|
25
|
+
ruby-version: ${{ matrix.ruby }}
|
26
|
+
bundler-cache: true
|
27
|
+
- name: Run test
|
28
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,20 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
svg_use (0.1.
|
4
|
+
svg_use (0.1.1)
|
5
5
|
actionview (>= 5.0.0)
|
6
6
|
activesupport (>= 5.0.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actionpack (6.1.3)
|
12
|
-
actionview (= 6.1.3)
|
13
|
-
activesupport (= 6.1.3)
|
14
|
-
rack (~> 2.0, >= 2.0.9)
|
15
|
-
rack-test (>= 0.6.3)
|
16
|
-
rails-dom-testing (~> 2.0)
|
17
|
-
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
11
|
actionview (6.1.3)
|
19
12
|
activesupport (= 6.1.3)
|
20
13
|
builder (~> 3.1)
|
@@ -47,7 +40,6 @@ GEM
|
|
47
40
|
loofah (2.9.0)
|
48
41
|
crass (~> 1.0.2)
|
49
42
|
nokogiri (>= 1.5.9)
|
50
|
-
method_source (1.0.0)
|
51
43
|
mini_mime (1.0.2)
|
52
44
|
minitest (5.14.4)
|
53
45
|
nokogiri (1.11.1-x86_64-linux)
|
@@ -62,14 +54,12 @@ GEM
|
|
62
54
|
nokogiri (>= 1.6)
|
63
55
|
rails-html-sanitizer (1.3.0)
|
64
56
|
loofah (~> 2.3)
|
65
|
-
railties (6.1.3)
|
66
|
-
actionpack (= 6.1.3)
|
67
|
-
activesupport (= 6.1.3)
|
68
|
-
method_source
|
69
|
-
rake (>= 0.8.7)
|
70
|
-
thor (~> 1.0)
|
71
57
|
rake (13.0.3)
|
72
58
|
regexp_parser (2.1.1)
|
59
|
+
rspec (3.10.0)
|
60
|
+
rspec-core (~> 3.10.0)
|
61
|
+
rspec-expectations (~> 3.10.0)
|
62
|
+
rspec-mocks (~> 3.10.0)
|
73
63
|
rspec-core (3.10.1)
|
74
64
|
rspec-support (~> 3.10.0)
|
75
65
|
rspec-expectations (3.10.1)
|
@@ -78,16 +68,7 @@ GEM
|
|
78
68
|
rspec-mocks (3.10.2)
|
79
69
|
diff-lcs (>= 1.2.0, < 2.0)
|
80
70
|
rspec-support (~> 3.10.0)
|
81
|
-
rspec-rails (5.0.0)
|
82
|
-
actionpack (>= 5.2)
|
83
|
-
activesupport (>= 5.2)
|
84
|
-
railties (>= 5.2)
|
85
|
-
rspec-core (~> 3.10)
|
86
|
-
rspec-expectations (~> 3.10)
|
87
|
-
rspec-mocks (~> 3.10)
|
88
|
-
rspec-support (~> 3.10)
|
89
71
|
rspec-support (3.10.2)
|
90
|
-
thor (1.1.0)
|
91
72
|
tzinfo (2.0.4)
|
92
73
|
concurrent-ruby (~> 1.0)
|
93
74
|
xpath (3.2.0)
|
@@ -100,7 +81,7 @@ PLATFORMS
|
|
100
81
|
DEPENDENCIES
|
101
82
|
capybara (~> 3)
|
102
83
|
rake (~> 13.0)
|
103
|
-
rspec
|
84
|
+
rspec (~> 3.0)
|
104
85
|
svg_use!
|
105
86
|
|
106
87
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# SvgUse
|
1
|
+
# SvgUse [![Build](https://github.com/frullah/svg_use/actions/workflows/main.yml/badge.svg)](https://github.com/frullah/svg_use/actions/workflows/main.yml)
|
2
2
|
|
3
|
-
svg_use is helper for render svg [use](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/use) tag from inline SVG sprite
|
3
|
+
svg_use is a helper for render svg [use](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/use) tag from inline SVG sprite
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,12 +18,25 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install svg_use
|
20
20
|
|
21
|
-
##
|
21
|
+
## Helper method
|
22
22
|
|
23
|
-
|
23
|
+
```ruby
|
24
|
+
svg_use(name:, classes: nil, style: nil)
|
25
|
+
```
|
24
26
|
|
25
27
|
where the name is the _id_ attribute of [_symbol_](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/symbol) tag
|
26
28
|
|
29
|
+
for example
|
30
|
+
```ruby
|
31
|
+
svg_use(name: "icon-x", classes: "another-class", style: "fill: #000")
|
32
|
+
```
|
33
|
+
will render
|
34
|
+
```html
|
35
|
+
<svg class="icon another-class" style="fill: #000">
|
36
|
+
<use href="#icon-x"></use>
|
37
|
+
</svg>
|
38
|
+
```
|
39
|
+
|
27
40
|
## Development
|
28
41
|
|
29
42
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Rakefile
CHANGED
@@ -6,3 +6,11 @@ require "rspec/core/rake_task"
|
|
6
6
|
RSpec::Core::RakeTask.new(:spec)
|
7
7
|
|
8
8
|
task default: :spec
|
9
|
+
|
10
|
+
task :test_all do
|
11
|
+
rails_versions = %w[5.0.0 5.1.0 5.2.0 6.0.0 6.1.0]
|
12
|
+
rails_versions.each do |rails_version|
|
13
|
+
env = "BUNDLE_GEMFILE=spec/gemfiles/rails_#{rails_version}.Gemfile"
|
14
|
+
sh %(#{env} bundle install --quiet && #{env} bundle exec rake spec)
|
15
|
+
end
|
16
|
+
end
|
data/lib/svg_use.rb
CHANGED
@@ -5,7 +5,9 @@ require_relative "svg_use/version"
|
|
5
5
|
|
6
6
|
module SvgUse
|
7
7
|
def svg_use(name:, classes: nil, style: nil)
|
8
|
-
|
8
|
+
content_tag(:svg, class: "icon #{classes}", style: style) do
|
9
|
+
content_tag(:use, nil, href: "##{name}")
|
10
|
+
end
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
data/lib/svg_use/version.rb
CHANGED
data/svg_use.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["frullah"]
|
9
9
|
spec.email = ["frullah12@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary = "use inline SVG
|
11
|
+
spec.summary = "helper for render svg <use> tag when using inline SVG sprite"
|
12
12
|
# spec.description = ""
|
13
13
|
# spec.homepage = ""
|
14
14
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
|
33
33
|
spec.add_development_dependency "capybara", "~> 3"
|
34
34
|
spec.add_development_dependency "rake", "~> 13.0"
|
35
|
-
spec.add_development_dependency "rspec
|
35
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
36
36
|
|
37
37
|
# For more information and examples about making a new gem, checkout our
|
38
38
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svg_use
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- frullah
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -67,19 +67,19 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '13.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
70
|
+
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
75
|
+
version: '3.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
82
|
+
version: '3.0'
|
83
83
|
description:
|
84
84
|
email:
|
85
85
|
- frullah12@gmail.com
|
@@ -122,5 +122,5 @@ requirements: []
|
|
122
122
|
rubygems_version: 3.2.3
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
|
-
summary: use inline SVG
|
125
|
+
summary: helper for render svg <use> tag when using inline SVG sprite
|
126
126
|
test_files: []
|