plist_colors 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/plist_colors +3 -0
- data/lib/plist_colors.rb +56 -0
- metadata +60 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 45a084b3341d17c1688920c7a0d1254d5b4e13c6
|
4
|
+
data.tar.gz: ed7b15fd572dbe9d01d7eaaab31e7adb1e1c3820
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5b2589f6554b1643558a56acbccae355d4f816af3701c2061019bd1d3a15d7130969daae00fa2b3873d40557e3f97ac18867f4a5a577bcc7966461e2dd5c18b1
|
7
|
+
data.tar.gz: 2d1d6a0854d8163bcbe94b80cd235b19d10d886e8c6f1253141598fcf04b4629e45938e4ec8f9d9213a97771b2ed4de835ac8d60521ef6c8ee8537d843e23d60
|
data/bin/plist_colors
ADDED
data/lib/plist_colors.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require "plist"
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
def generate_png(colors_hash)
|
5
|
+
colors_path = 'colors'
|
6
|
+
|
7
|
+
FileUtils.rm_rf colors_path
|
8
|
+
FileUtils.mkdir colors_path
|
9
|
+
|
10
|
+
montages = []
|
11
|
+
colors_hash.each do |key, value|
|
12
|
+
image_path = "#{colors_path}/#{key}.png"
|
13
|
+
image_key_path = "#{colors_path}/#{key}_text_key.png"
|
14
|
+
image_value_path = "#{colors_path}/#{key}_text_value.png"
|
15
|
+
image_result_path = "#{colors_path}/#{key}_montage.png"
|
16
|
+
|
17
|
+
`convert -size 100x100 xc:##{value} #{image_path}`
|
18
|
+
`convert -background white -pointsize 22 caption:#{key} #{image_key_path}`
|
19
|
+
`convert -background white -pointsize 22 caption:#{value} #{image_value_path}`
|
20
|
+
`montage #{image_path} #{image_key_path} #{image_value_path} -tile x1 -geometry +5+5 #{image_result_path}`
|
21
|
+
montages << image_result_path
|
22
|
+
end
|
23
|
+
|
24
|
+
all_paths = montages.join " "
|
25
|
+
`montage #{all_paths} -tile 1x -geometry +5+5 color_mapping.png`
|
26
|
+
|
27
|
+
FileUtils.rm_rf colors_path
|
28
|
+
end
|
29
|
+
|
30
|
+
def colors_hash_from_plist(plist_content)
|
31
|
+
colors_hash = {}
|
32
|
+
plist_content.each do |key, value|
|
33
|
+
if key.downcase == "colors" then
|
34
|
+
colors_hash = colors_hash.merge(value)
|
35
|
+
elsif value.is_a?(Hash)
|
36
|
+
sub_hash = colors_hash_from_plist(value)
|
37
|
+
colors_hash = colors_hash.merge(sub_hash)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
colors_hash
|
41
|
+
end
|
42
|
+
|
43
|
+
def colors_hash_from_plist_files(plist_files)
|
44
|
+
colors_hash = {}
|
45
|
+
plist_files.each do |plist_file|
|
46
|
+
content = Plist::parse_xml(plist_file)
|
47
|
+
plist_colors = colors_hash_from_plist(content)
|
48
|
+
colors_hash = colors_hash.merge(plist_colors)
|
49
|
+
end
|
50
|
+
colors_hash
|
51
|
+
end
|
52
|
+
|
53
|
+
path = "."
|
54
|
+
plist_files = Dir.glob("#{path}/Configuration/**/*.plist")
|
55
|
+
colors_hash = colors_hash_from_plist_files(plist_files)
|
56
|
+
generate_png(colors_hash)
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: plist_colors
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pierre Felgines
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: plist
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.2'
|
27
|
+
description:
|
28
|
+
email: pierre.felgines@gmail.com
|
29
|
+
executables:
|
30
|
+
- plist_colors
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- bin/plist_colors
|
35
|
+
- lib/plist_colors.rb
|
36
|
+
homepage: https://github.com/felginep
|
37
|
+
licenses:
|
38
|
+
- MIT
|
39
|
+
metadata: {}
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirements: []
|
55
|
+
rubyforge_project:
|
56
|
+
rubygems_version: 2.4.5.1
|
57
|
+
signing_key:
|
58
|
+
specification_version: 4
|
59
|
+
summary: Extract colors from xcode plist
|
60
|
+
test_files: []
|