dpm 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5363ebe1f9d4ac0d23bc31243416edec27f1a0cb
4
- data.tar.gz: 486cb64025f7facdbd9065520b7756dd1aac18c0
3
+ metadata.gz: 3ffeed967b14f997c6f64cb62b9e2263a6f88090
4
+ data.tar.gz: 8818ced3597bfc3137ec8de2bd67dd8b6e8a9e0e
5
5
  SHA512:
6
- metadata.gz: c25c863ff5e66080935271fbf533ce14ac170c6c7433a7bdcc1eda9c69fceb56bb8e0e6d7b141de824ba97d0e8656a42433cf37afe97458beabfaa083a5b0cd0
7
- data.tar.gz: d3bc189f8429ffc90eb790c59f1336560e50740c79aaee3bcd5e3baedb7318defd505b202a3eb2a42cb5d2805d5f9148395e7c0fbf343bc1b683a74040a2e574
6
+ metadata.gz: fb093ac951a5d55c3cd762768b185505d813011cdb965004e4f8f0920b1af0c8a8ffc676f6074ef8c7a3b5a91e196e13f8eba5c68b3a2edd7fc725acce88fdc1
7
+ data.tar.gz: e131a0ef6a8bf179809f0e960333450c32ddf775c644db12cb4133ddb00089e28b3c2eb255174ef1b3e916166e33e2bee464b43e28e74f34bd435974e8052bc9
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dpm (0.0.2)
4
+ dpm (0.0.4)
5
5
  gli (= 2.13.4)
6
6
 
7
7
  GEM
@@ -4,6 +4,7 @@
4
4
  "version": "1.0",
5
5
  "sketch_plugins": [
6
6
  "marvelapp/marvel-sketch",
7
- "matt-curtis/fluid-for-sketch"
7
+ "matt-curtis/fluid-for-sketch",
8
+ "marcosvidal/Sketch-Notebook"
8
9
  ]
9
- }
10
+ }
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
- install_single_sketch_plugin(args.first)
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)
@@ -1,3 +1,3 @@
1
1
  module Dpm
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alasdair Monk