icomoon-cli 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/README.md +18 -5
- data/exe/icomoon +3 -3
- data/icomoon.gemspec +2 -2
- data/lib/icomoon.rb +32 -18
- data/lib/icomoon/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54e58814511a2c9deb563392dd4e81f3cd6bf09e
|
4
|
+
data.tar.gz: 50dcc0a2ccdef3347f25886958d98eb3bd0cb4ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b197ef77ff83ec3bbbd7fa7c67e2494bcd9e7f44e816889ec049adac49345849f2c1455e22dffa7ef2cdd09fc430cb74049ccd63a525f9aa3272104e63e2af17
|
7
|
+
data.tar.gz: 96fa42273490b74a02d4ae8e4cf01da98df6cfa677f7f41b5e0ad9846c9a81388f01ec6999d7367dc331dc0a674d7e44c1c324072ba8e192770926efd4335c29
|
data/README.md
CHANGED
@@ -1,18 +1,31 @@
|
|
1
1
|
# Icomoon
|
2
2
|
|
3
|
-
Icomoon gem helps to update icomoon
|
3
|
+
Icomoon gem helps to update icomoon's icons via command line. this gem will automate all the steps to be done while we update icomoon's icon set.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
8
|
-
$ gem install icomoon
|
7
|
+
$ gem install icomoon-cli
|
9
8
|
|
10
9
|
## Usage
|
11
10
|
|
11
|
+
- Open [Iconmoon App](https://icomoon.io/app/#/projects)
|
12
|
+
- Follow this [Documentation](https://icomoon.io/docs.html) to know how to get started with icomoon.
|
13
|
+
- Once you have created icon set download the icon set.
|
14
|
+
- By default this gem assume it's Rails Application hence will be importing to our default rails assets folder and will be keeping a copy of `selection.json` file in our applications **public folder**. if you want to customise the path you can create a file name `.icomoon.yml` add the key value pair as follows in the root of project directory.
|
15
|
+
|
16
|
+
```yml
|
17
|
+
working_directory: "/vendor/icofont/tmp"
|
18
|
+
font_directory: "/vendor/icofont/fonts"
|
19
|
+
stylesheet_directory: "/vendor/icofont/stylesheets"
|
20
|
+
stylesheet: "icons.scss"
|
21
|
+
selection_directory: "/vendor/icofont/stylesheets"
|
22
|
+
```
|
23
|
+
|
24
|
+
- You can either give path for icomoon's generated zip file or you can just give path to the extracted icon set folder.
|
12
25
|
|
13
|
-
|
26
|
+
$ icomoon [path/to/icomoon]
|
27
|
+
|
14
28
|
|
15
|
-
> By default this gem assume icomoon assets resides inside our default rails assets folder and this will keep a copy of selection.json file in our applications public folder.
|
16
29
|
|
17
30
|
## Contributing
|
18
31
|
|
data/exe/icomoon
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'icomoon'
|
3
3
|
|
4
|
-
|
4
|
+
icomoon_files = ARGV[0]
|
5
5
|
|
6
|
-
abort "Provide a file path to icomoon
|
6
|
+
abort "Provide a file path to icomoon files" unless icomoon_files
|
7
7
|
|
8
|
-
Icomoon.
|
8
|
+
Icomoon.import(icomoon_files)
|
data/icomoon.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Vishal Taj PM"]
|
9
9
|
spec.email = ["vishaltajpm@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
11
|
+
spec.summary = "A command line tool to update icomoon icon sets for rails application"
|
12
|
+
spec.description = "Icomoon gem helps to update icomoon's icons via command line. this gem will automate all the steps to be done while we update icomoon's icon set."
|
13
13
|
spec.homepage = "https://github.com/VishalTaj/icomoon"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
data/lib/icomoon.rb
CHANGED
@@ -1,33 +1,47 @@
|
|
1
1
|
require "icomoon/version"
|
2
2
|
|
3
|
+
require 'yaml'
|
4
|
+
|
3
5
|
module Icomoon
|
4
6
|
class Error < StandardError; end
|
5
|
-
def self.
|
7
|
+
def self.import(icomoon_files)
|
6
8
|
begin
|
7
|
-
|
9
|
+
icomoon_files = File.join(icomoon_files)
|
8
10
|
app_root = Dir.getwd
|
9
|
-
|
10
|
-
|
11
|
-
|
11
|
+
icon_config = YAML.load_file(File.join(app_root, '.icomoon.yml')).to_hash rescue {}
|
12
|
+
|
13
|
+
working_dir = icon_config["working_directory"] ? File.join(app_root, icon_config["working_directory"], "icofont") : File.join(app_root, 'tmp', 'iconfont')
|
14
|
+
working_dir = File.expand_path(working_dir)
|
15
|
+
font_dir = icon_config["font_directory"] ? File.join(app_root, icon_config["font_directory"]) : File.join(app_root, 'app', 'assets', 'fonts')
|
16
|
+
css_dir = icon_config["stylesheet_directory"] ? File.join(app_root, icon_config["stylesheet_directory"]) : File.join(app_root, 'app', 'assets', 'stylesheets')
|
17
|
+
selection_dir = icon_config["selection_directory"] ? File.join(app_root, icon_config["selection_directory"]) : File.join(app_root, 'public', 'selection.json')
|
18
|
+
stylesheet_name = icon_config["stylesheet"] || 'icons.css'
|
12
19
|
|
13
|
-
if !File.exist?(File.join(app_root, 'tmp')) || !File.exist?(
|
14
|
-
abort "Current directory
|
20
|
+
if (!File.exist?(File.join(app_root, 'tmp')) || !icon_config["working_directory"]) || !File.exist?(font_dir) || !File.exist?(css_dir)
|
21
|
+
abort "Current directory doesn't seems to be an application directory. please move to project root folder and run again"
|
15
22
|
end
|
16
23
|
|
17
|
-
unless File.directory?
|
18
|
-
system "mkdir #{
|
24
|
+
unless File.directory? working_dir
|
25
|
+
system "mkdir #{working_dir}"
|
19
26
|
end
|
20
27
|
|
21
|
-
|
28
|
+
if File.extname(icomoon_files) == '.zip'
|
29
|
+
system "unzip -u #{icomoon_files} -d #{working_dir}"
|
30
|
+
is_temp = true
|
31
|
+
else
|
32
|
+
working_dir = File.expand_path(icomoon_files)
|
33
|
+
is_temp = false
|
34
|
+
end
|
22
35
|
|
23
|
-
Dir.glob(File.join(
|
24
|
-
puts "Copying #{file} to #{
|
25
|
-
system "cp #{file} #{
|
36
|
+
Dir.glob(File.join(working_dir, 'fonts', '*')) do |file|
|
37
|
+
puts "Copying #{file} to #{font_dir}"
|
38
|
+
system "cp #{file} #{font_dir}"
|
26
39
|
end
|
27
40
|
|
28
41
|
puts 'Copying the stylesheet'
|
29
|
-
stylesheet = File.join(
|
30
|
-
|
42
|
+
stylesheet = File.join(css_dir, stylesheet_name)
|
43
|
+
File.write(stylesheet, "") unless File.exist?(stylesheet)
|
44
|
+
system "cp #{File.join(working_dir, 'style.css')} #{stylesheet}"
|
31
45
|
|
32
46
|
puts 'Updating font URLs in stylesheet'
|
33
47
|
stylesheet_content = File.read(stylesheet)
|
@@ -37,12 +51,12 @@ module Icomoon
|
|
37
51
|
end
|
38
52
|
|
39
53
|
puts 'Updating selection.json file'
|
40
|
-
system "cp -
|
54
|
+
system "cp -f #{File.join(working_dir, 'selection.json')} #{File.join(selection_dir)}"
|
41
55
|
|
42
56
|
ensure
|
43
|
-
if File.directory?
|
57
|
+
if File.directory?(working_dir) && is_temp
|
44
58
|
puts 'Deleting tmp folder'
|
45
|
-
system "rm -rf #{
|
59
|
+
system "rm -rf #{working_dir}"
|
46
60
|
end
|
47
61
|
end
|
48
62
|
end
|
data/lib/icomoon/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icomoon-cli
|
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
|
- Vishal Taj PM
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,7 +52,8 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
-
description:
|
55
|
+
description: Icomoon gem helps to update icomoon's icons via command line. this gem
|
56
|
+
will automate all the steps to be done while we update icomoon's icon set.
|
56
57
|
email:
|
57
58
|
- vishaltajpm@gmail.com
|
58
59
|
executables:
|
@@ -100,5 +101,5 @@ rubyforge_project:
|
|
100
101
|
rubygems_version: 2.6.13
|
101
102
|
signing_key:
|
102
103
|
specification_version: 4
|
103
|
-
summary:
|
104
|
+
summary: A command line tool to update icomoon icon sets for rails application
|
104
105
|
test_files: []
|