icomoon_toys 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c9081022a7f2726f501bb25a807f124f43be6ab356d4de9ad3432839ac890482
4
+ data.tar.gz: '057913c568ba309be1f878f12c0d1310f9730623474a2dd2e8ba97aecdd9c3b3'
5
+ SHA512:
6
+ metadata.gz: 57116326cafb5a8e8f326185102348ffc0aa6c31421427d470de0e43cbf51aa84075e811c3981d8f2ef32711abff44d5b58b0b3841ee2e0f1248cec4cc6b5195
7
+ data.tar.gz: 42b320034e33523b2800596d3baddf25222decdb28b731c7d4807bac8290d7f2ead5567a5a09f95060c9bf4e7e42e2793853bd2f7829808d787f3627de8a79dc
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## master (unreleased)
4
+
5
+ ## 0.1.0 (2020-08-10)
6
+
7
+ * Initial release.
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Alexander Popov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,64 @@
1
+ # IcoMoon Toys
2
+
3
+ [![Cirrus CI - Base Branch Build Status](https://img.shields.io/cirrus/github/AlexWayfer/icomoon_toys?style=flat-square)](https://cirrus-ci.com/github/AlexWayfer/icomoon_toys)
4
+ [![Codecov branch](https://img.shields.io/codecov/c/github/AlexWayfer/icomoon_toys/master.svg?style=flat-square)](https://codecov.io/gh/AlexWayfer/icomoon_toys)
5
+ [![Code Climate](https://img.shields.io/codeclimate/maintainability/AlexWayfer/icomoon_toys.svg?style=flat-square)](https://codeclimate.com/github/AlexWayfer/icomoon_toys)
6
+ [![Depfu](https://img.shields.io/depfu/AlexWayfer/icomoon_toys?style=flat-square)](https://depfu.com/repos/github/AlexWayfer/icomoon_toys)
7
+ [![Inline docs](https://inch-ci.org/github/AlexWayfer/icomoon_toys.svg?branch=master)](https://inch-ci.org/github/AlexWayfer/icomoon_toys)
8
+ [![License](https://img.shields.io/github/license/AlexWayfer/icomoon_toys.svg?style=flat-square)](https://github.com/AlexWayfer/icomoon_toys/blob/master/LICENSE.txt)
9
+ [![Gem](https://img.shields.io/gem/v/icomoon_toys.svg?style=flat-square)](https://rubygems.org/gems/icomoon_toys)
10
+
11
+ Toys for extracting [IcoMoon](https://icomoon.io/) archives.
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'icomoon_toys'
19
+ ```
20
+
21
+ And then execute:
22
+
23
+ ```shell
24
+ bundle install
25
+ ```
26
+
27
+ Or install it yourself as:
28
+
29
+ ```shell
30
+ gem install icomoon_toys
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ```ruby
36
+ require 'icomoon_toys'
37
+ expand IcoMoonToys::Template,
38
+ extract_map: {
39
+ 'selection.json' => 'assets/icomoon/selection.json',
40
+ 'svgxuse.min.js' => 'assets/scripts/lib/svgxuse.min.js',
41
+ 'style.css' => 'assets/styles/lib/icomoon.css',
42
+ 'symbol-defs.svg' => 'assets/images/icons/symbol-defs.svg'
43
+ }
44
+ ```
45
+
46
+ ## Development
47
+
48
+ After checking out the repo, run `bundle install` to install dependencies.
49
+
50
+ Then, run `toys rspec` to run the tests.
51
+
52
+ To install this gem onto your local machine, run `toys gem install`.
53
+
54
+ To release a new version, run `toys gem release %version%`.
55
+ See how it works [here](https://github.com/AlexWayfer/gem_toys#release).
56
+
57
+ ## Contributing
58
+
59
+ Bug reports and pull requests are welcome on [GitHub](https://github.com/AlexWayfer/icomoon_toys).
60
+
61
+ ## License
62
+
63
+ The gem is available as open source under the terms of the
64
+ [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'icomoon_toys/version'
4
+ require_relative 'icomoon_toys/template'
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'memery'
4
+ require 'toys-core'
5
+
6
+ module IcoMoonToys
7
+ ## Toys template for IcoMoon
8
+ class Template
9
+ include Toys::Template
10
+
11
+ attr_reader :extract_map
12
+
13
+ DEFAULT_EXTRACT_MAP = {
14
+ 'selection.json' => 'assets/icomoon/selection.json',
15
+ 'svgxuse.min.js' => 'public/scripts/lib/svgxuse.min.js',
16
+ 'style.css' => 'public/styles/icomoon.css',
17
+ 'symbol-defs.svg' => 'public/images/icons/symbol-defs.svg'
18
+ }.freeze
19
+
20
+ def initialize(extract_map: DEFAULT_EXTRACT_MAP)
21
+ @extract_map = DEFAULT_EXTRACT_MAP.merge extract_map
22
+ end
23
+
24
+ on_expand do |template|
25
+ tool :icomoon do
26
+ tool :extract do
27
+ include Memery
28
+
29
+ desc 'Extract IcoMoon archive'
30
+
31
+ required_arg :zip_file
32
+
33
+ to_run do
34
+ @template = template
35
+
36
+ require 'zip'
37
+ require 'fileutils'
38
+
39
+ Zip::File.open(zip_file) do |content|
40
+ extract_map.each do |source, target|
41
+ FileUtils.mkdir_p File.dirname target
42
+ content.get_entry(source).extract(target) { true }
43
+ end
44
+ end
45
+ end
46
+
47
+ private
48
+
49
+ memoize def extract_map
50
+ @template.extract_map.transform_values do |relative_path|
51
+ "#{context_directory}/#{relative_path}"
52
+ end
53
+ end
54
+ end
55
+ end
56
+
57
+ alias_tool :icomoon, 'icomoon:extract'
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module IcoMoonToys
4
+ VERSION = '0.1.0'
5
+ end
metadata ADDED
@@ -0,0 +1,236 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: icomoon_toys
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alexander Popov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-08-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: alt_memery
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubyzip
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: toys-core
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.10.5
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.10.5
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry-byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.9'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.9'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: gem_toys
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.3.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.3.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: toys
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.10.4
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.10.4
111
+ - !ruby/object:Gem::Dependency
112
+ name: codecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.2.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.2.1
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.9'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '3.9'
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.18.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.18.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 0.89.0
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 0.89.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: rubocop-performance
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '1.0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '1.0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: rubocop-rspec
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '1.0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '1.0'
195
+ description: 'Toys for extracting IcoMoon archives.
196
+
197
+ '
198
+ email:
199
+ - alex.wayfer@gmail.com
200
+ executables: []
201
+ extensions: []
202
+ extra_rdoc_files: []
203
+ files:
204
+ - CHANGELOG.md
205
+ - LICENSE.txt
206
+ - README.md
207
+ - lib/icomoon_toys.rb
208
+ - lib/icomoon_toys/template.rb
209
+ - lib/icomoon_toys/version.rb
210
+ homepage: https://github.com/AlexWayfer/icomoon_toys
211
+ licenses:
212
+ - MIT
213
+ metadata:
214
+ source_code_uri: https://github.com/AlexWayfer/icomoon_toys
215
+ homepage_uri: https://github.com/AlexWayfer/icomoon_toys
216
+ changelog_uri: https://github.com/AlexWayfer/icomoon_toys/blob/master/CHANGELOG.md
217
+ post_install_message:
218
+ rdoc_options: []
219
+ require_paths:
220
+ - lib
221
+ required_ruby_version: !ruby/object:Gem::Requirement
222
+ requirements:
223
+ - - ">="
224
+ - !ruby/object:Gem::Version
225
+ version: '2.5'
226
+ required_rubygems_version: !ruby/object:Gem::Requirement
227
+ requirements:
228
+ - - ">="
229
+ - !ruby/object:Gem::Version
230
+ version: '0'
231
+ requirements: []
232
+ rubygems_version: 3.1.2
233
+ signing_key:
234
+ specification_version: 4
235
+ summary: Toys for extracting IcoMoon archives
236
+ test_files: []