dpm 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Palette.json +3 -2
- data/bin/dpm +36 -29
- data/lib/dpm/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ffeed967b14f997c6f64cb62b9e2263a6f88090
|
4
|
+
data.tar.gz: 8818ced3597bfc3137ec8de2bd67dd8b6e8a9e0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb093ac951a5d55c3cd762768b185505d813011cdb965004e4f8f0920b1af0c8a8ffc676f6074ef8c7a3b5a91e196e13f8eba5c68b3a2edd7fc725acce88fdc1
|
7
|
+
data.tar.gz: e131a0ef6a8bf179809f0e960333450c32ddf775c644db12cb4133ddb00089e28b3c2eb255174ef1b3e916166e33e2bee464b43e28e74f34bd435974e8052bc9
|
data/Gemfile.lock
CHANGED
data/Palette.json
CHANGED
data/bin/dpm
CHANGED
@@ -39,7 +39,11 @@ command :install do |c|
|
|
39
39
|
c.desc 'Installs dependencies from a local Palette.json'
|
40
40
|
c.action do |global_options,options,args|
|
41
41
|
if args.first != nil
|
42
|
-
|
42
|
+
if args[1] != nil && args[1] == "--save"
|
43
|
+
install_and_save_single_sketch_plugin(args.first)
|
44
|
+
else
|
45
|
+
install_single_sketch_plugin(args.first)
|
46
|
+
end
|
43
47
|
else
|
44
48
|
working_directory = Dir.pwd
|
45
49
|
local_palettefile = "#{working_directory}/Palette.json"
|
@@ -66,7 +70,7 @@ command :init do |c|
|
|
66
70
|
puts "Palette.json already exists".red
|
67
71
|
else
|
68
72
|
tempHash = {
|
69
|
-
"name" => "My Project",
|
73
|
+
"name" => " My Project",
|
70
74
|
"author" => "",
|
71
75
|
"version" => "1.0",
|
72
76
|
"sketch_plugins" => []
|
@@ -107,33 +111,6 @@ def clean_palette_tmp_dir
|
|
107
111
|
system "rm -rf .palette && mkdir .palette"
|
108
112
|
end
|
109
113
|
|
110
|
-
def install_fonts(local_palettefile)
|
111
|
-
fonts_to_install = []
|
112
|
-
file = File.read local_palettefile
|
113
|
-
manifest = Crack::JSON.parse(file)
|
114
|
-
|
115
|
-
puts "#{manifest['name']} #{manifest['version']}".blue
|
116
|
-
|
117
|
-
if manifest['fonts']
|
118
|
-
manifest['fonts'].each do |font_url|
|
119
|
-
download_file(font_url, SecureRandom.hex)
|
120
|
-
end
|
121
|
-
|
122
|
-
Dir.glob(".palette/**/*.otf").each do |unzipped_files|
|
123
|
-
fonts_to_install << unzipped_files
|
124
|
-
@font_install_count += 1
|
125
|
-
end
|
126
|
-
|
127
|
-
Dir.glob(".palette/**/*.ttf").each do |unzipped_files|
|
128
|
-
fonts_to_install << unzipped_files
|
129
|
-
@font_install_count += 1
|
130
|
-
end
|
131
|
-
|
132
|
-
puts "Installing fonts..."
|
133
|
-
system "open #{fonts_to_install.join(" ")}"
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
114
|
def install_sketch_plugins(local_palettefile)
|
138
115
|
plugins_to_install = []
|
139
116
|
|
@@ -174,6 +151,36 @@ def install_single_sketch_plugin(args)
|
|
174
151
|
puts "Installed Sketch plugins #{args}".green
|
175
152
|
end
|
176
153
|
|
154
|
+
def install_and_save_single_sketch_plugin(args)
|
155
|
+
working_directory = Dir.pwd
|
156
|
+
local_palettefile = "#{working_directory}/Palette.json"
|
157
|
+
|
158
|
+
if File.exists?(local_palettefile)
|
159
|
+
install_single_sketch_plugin(args)
|
160
|
+
|
161
|
+
file = File.read local_palettefile
|
162
|
+
manifest = Crack::JSON.parse(file)
|
163
|
+
|
164
|
+
tempHash = {
|
165
|
+
"name" => manifest['name'],
|
166
|
+
"author" => manifest['author'],
|
167
|
+
"version" => manifest['version'],
|
168
|
+
"sketch_plugins" => manifest['sketch_plugins']
|
169
|
+
}
|
170
|
+
|
171
|
+
tempHash['sketch_plugins'] << args
|
172
|
+
|
173
|
+
File.open("Palette.json","w") do |f|
|
174
|
+
pprint = tempHash.to_json
|
175
|
+
if f.write(JSON.pretty_generate(JSON.parse(pprint)))
|
176
|
+
puts "Saved to Palette.json file".green
|
177
|
+
end
|
178
|
+
end
|
179
|
+
else
|
180
|
+
raise "No Palette.json file exists".red
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
177
184
|
def download_file(url, unique_id)
|
178
185
|
pbar = nil
|
179
186
|
uri = URI.parse(url)
|
data/lib/dpm/version.rb
CHANGED