dpm 0.0.2 → 0.0.3

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: c123444865aae70f7cd5210b47a2e06fe4288e95
4
- data.tar.gz: 9168a0301e124c1979fc146968795b0dfb97727b
3
+ metadata.gz: 8bb953d9de893f34e9d355f5781f211e9d983008
4
+ data.tar.gz: 02d314c4686b0428d34e99d7c75198e19adb11d7
5
5
  SHA512:
6
- metadata.gz: 6c3138bc7f7578a5aed0910292f9736fbabe677387a9c879c5ba59945976c6943bd44b89964846283371d1a5f711ee759220a1d5ee142814d3f02f5e87da3c8c
7
- data.tar.gz: f4148b1faa7e4fb75cd2d1c61188a20ab303389ec251ab2440fb9f5ff12cb086ffdf29c8240875b03696f8f495353acd1cba7187610149dd66ef0260dba5f72b
6
+ metadata.gz: cdc249f6788cd0b8d36ebf7d76bf954458f1b6bb620a2d68a1bbb4741fe554654d8deda3fbb07c12532b3979883d00de03dcd3282b38f796ef8aeb74a9a41d68
7
+ data.tar.gz: ca10451fa0e073a456b50a271cbf187f3bd6c8795fe0d310962f207a84d926ecbf936fe5d7a6a2a4efcec53a1b9ecadbd9c3ae060b7af3892f1a39835b660692
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dpm (0.0.1)
4
+ dpm (0.0.2)
5
5
  gli (= 2.13.4)
6
6
 
7
7
  GEM
@@ -1,11 +1,9 @@
1
1
  {
2
2
  "name": "My Project",
3
- "author": "",
3
+ "author": "Alasdair Monk",
4
4
  "version": "1.0",
5
- "fonts": [
6
-
7
- ],
8
5
  "sketch_plugins": [
9
-
6
+ "marvelapp/marvel-sketch",
7
+ "matt-curtis/fluid-for-sketch"
10
8
  ]
11
- }
9
+ }
data/bin/dpm CHANGED
@@ -30,7 +30,6 @@ subcommand_option_handling :normal
30
30
 
31
31
  # Constants
32
32
  @sketch_plugins_dir = "#{Dir.home}/Library/Application Support/com.bohemiancoding.sketch3/Plugins/".gsub(/ /, '\ ')
33
- @font_install_count = 0
34
33
  @sketch_plugin_install_count = 0
35
34
 
36
35
  # Begin setup
@@ -39,22 +38,25 @@ arg_name 'Describe arguments to list here'
39
38
  command :install do |c|
40
39
  c.desc 'Installs dependencies from a local Palette.json'
41
40
  c.action do |global_options,options,args|
42
- working_directory = Dir.pwd
43
- local_palettefile = "#{working_directory}/Palette.json"
44
-
45
- if File.exists? local_palettefile
46
- clean_palette_tmp_dir
47
- install_fonts(local_palettefile)
48
- install_sketch_plugins(local_palettefile)
49
- puts "Palette complete. #{@font_install_count} fonts, #{@sketch_plugin_install_count} Sketch plugins now installed.".green
41
+ if args.first != nil
42
+ install_single_sketch_plugin(args.first)
50
43
  else
51
- raise "No Palette.json found.".red
44
+ working_directory = Dir.pwd
45
+ local_palettefile = "#{working_directory}/Palette.json"
46
+
47
+ if File.exists? local_palettefile
48
+ clean_palette_tmp_dir
49
+ install_sketch_plugins(local_palettefile)
50
+ puts "Palette complete. #{@sketch_plugin_install_count} Sketch plugins now installed.".green
51
+ else
52
+ raise "No Palette.json found.".red
53
+ end
52
54
  end
53
55
  end
54
56
  end
55
57
 
56
58
  desc 'Creates a sample Palette.json in the local directory'
57
- command :touch do |c|
59
+ command :init do |c|
58
60
  c.desc 'Creates a sample Palette.json in the local directory'
59
61
  c.action do |global_options,options,args|
60
62
  working_directory = Dir.pwd
@@ -67,7 +69,6 @@ command :touch do |c|
67
69
  "name" => "My Project",
68
70
  "author" => "",
69
71
  "version" => "1.0",
70
- "fonts" => [],
71
72
  "sketch_plugins" => []
72
73
  }
73
74
 
@@ -141,7 +142,7 @@ def install_sketch_plugins(local_palettefile)
141
142
 
142
143
  if manifest['sketch_plugins']
143
144
  manifest['sketch_plugins'].each do |plugin_url|
144
- download_file(plugin_url, SecureRandom.hex)
145
+ download_file("https://github.com/#{plugin_url}/archive/master.zip", SecureRandom.hex)
145
146
  end
146
147
 
147
148
  puts "Installing Sketch plugins..."
@@ -158,6 +159,21 @@ def install_sketch_plugins(local_palettefile)
158
159
  end
159
160
  end
160
161
 
162
+ def install_single_sketch_plugin(args)
163
+ puts "Installing Sketch plugin #{args}..."
164
+ download_file("https://github.com/#{args}/archive/master.zip", SecureRandom.hex)
165
+
166
+ Dir.glob(".palette/**/*.sketchplugin").each do |unzipped_files|
167
+ parent = File.basename(File.expand_path("..", unzipped_files))
168
+ filename = File.basename(unzipped_files)
169
+
170
+ system "[ -d #{@sketch_plugins_dir}#{parent} ] || mkdir -p #{@sketch_plugins_dir}#{parent}"
171
+ system "cp -r #{unzipped_files.gsub(/ /, '\ ')} #{@sketch_plugins_dir}#{parent}/#{filename.gsub(/ /, '\ ')}"
172
+ end
173
+
174
+ puts "Installed Sketch plugins #{args}".green
175
+ end
176
+
161
177
  def download_file(url, unique_id)
162
178
  pbar = nil
163
179
  uri = URI.parse(url)
@@ -1,3 +1,3 @@
1
1
  module Dpm
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alasdair Monk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-29 00:00:00.000000000 Z
11
+ date: 2016-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  version: '0'
115
115
  requirements: []
116
116
  rubyforge_project:
117
- rubygems_version: 2.4.5.1
117
+ rubygems_version: 2.4.8
118
118
  signing_key:
119
119
  specification_version: 4
120
120
  summary: A package manager for designers