chest 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65aa90d80384f349e429206838c688bdf2cdc8d6
4
- data.tar.gz: 2577a229f02f5be3d5e914b8a4dda8244d00b229
3
+ metadata.gz: 0b3fbfee6e72a1502bf98f0c41226d3e1243fe4a
4
+ data.tar.gz: 2f503ef1c259c48620d343f68c44a0e3e78ea222
5
5
  SHA512:
6
- metadata.gz: 6b4def3328ee5719e23dcc1b74824238d184530629ef29ee42da3587b907ff80950b48716e4cb1e621262f6f00b52d97266d0c416cb914f2dfdef6fa0909d8da
7
- data.tar.gz: e429e352e92e7e30ec39cc0a9946ccadd7019dddbd68d0c1c567d1a95820922c234c5361ce6607cf795fedce9ac710c72d1c7c09566250168262df17c14ea92b
6
+ metadata.gz: a7766f77968cd7f6e735f5bcf8c8299f029d8d39b2778b109bf81092629b55f740a35a0a632d4da99d87b62a425aa79a7323bf9e68c33677865c4d552dd60a8d
7
+ data.tar.gz: 24f8b85d0c109d9b13e4314de30e7d6695d250766bdcaeff2c3cd7f56089d85c977c7e816f51fc134d94dea9870fa4fbfe5fe7c997617d99c586df3e135c161b
data/.gitignore CHANGED
@@ -1,10 +1,6 @@
1
1
  /.bundle/
2
2
  /vendor/bundle/
3
- /.yardoc
4
3
  /Gemfile.lock
5
- /_yardoc/
6
- /coverage/
7
- /doc/
8
4
  /pkg/
9
5
  /spec/reports/
10
6
  /tmp/
@@ -1,3 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.0
3
+ - 2.0.0
4
+ - 2.3.1
5
+ sudo: false
@@ -1,3 +1,16 @@
1
- # 0.1.0
1
+ # [Unreleased] - Unreleased
2
+
3
+ - Integrate Chest registry service(URL: TBD)
4
+
5
+ # [2.0.0] - 2016-05-08
6
+
7
+ - Add #init, #info, #open command
8
+ - Support for new plugin architecture since Sketch 3.3
9
+
10
+ # [1.0.0] - 2015-03-02
11
+
12
+ - Support for reducted format of plugin specification
13
+
14
+ # [0.1.0] - 2015-02-15
2
15
 
3
16
  - First release
@@ -10,4 +10,4 @@ Project maintainers have the right and responsibility to remove, edit, or reject
10
10
 
11
11
  Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
12
 
13
- This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at <http://contributor-covenant.org/version/1/0/0/>
@@ -0,0 +1,22 @@
1
+ # How to contribute
2
+
3
+ ## Build
4
+
5
+ ```
6
+ $ git clone https://github.com/Sketch-Chest/chest.git
7
+ $ cd chest
8
+ $ bundle install
9
+ $ bundle exec rake build
10
+ ```
11
+
12
+ ## Test
13
+
14
+ > Build this project before testing.
15
+
16
+ ```
17
+ $ bundle exec rspec
18
+ ```
19
+
20
+ ## Submit pull request
21
+
22
+ Go to [Pull Requests](https://github.com/Sketch-Chest/chest/pulls).
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in chest.gemspec
4
3
  gemspec
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 Yasuaki Uechi
3
+ Copyright (c) 2016 Yasuaki Uechi (https://randompaper.co)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,7 +1,13 @@
1
- # Sketch-Chest
1
+ ![Logo](https://raw.githubusercontent.com/Sketch-Chest/chest/master/assets/readme_images/logo.png)
2
+
3
+ # Chest
4
+
5
+ [![Join the chat at https://gitter.im/Sketch-Chest/chest](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Sketch-Chest/chest?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2
6
 
3
7
  The lightweight plugin manager for Sketch.app.
4
8
 
9
+ This requires OS X Mavericks or higher.
10
+
5
11
  ## Installation
6
12
 
7
13
  ```console
@@ -15,16 +21,15 @@ You can install Sketch plugins from Github by using `install` command:
15
21
  ```console
16
22
  $ chest install https://github.com/uetchy/Sketch-StickyGrid.git
17
23
  $ chest install uetchy/Sketch-StickyGrid
18
- $ chest i uetchy/Sketch-StickyGrid
19
24
  ```
20
25
 
21
- Also you can use `uninstall`, `update`, `list` commands like this:
26
+ Also you can use `uninstall`, `update`, `list` commands:
22
27
 
23
28
  ```console
24
- $ chest uninstall Sketch-StickyGrid # delete from Plugins folder
25
- $ chest update Sketch-StickyGrid # pull from git
26
- $ chest update # this updates all of plugins
27
- $ chest list # list installed plugins
29
+ $ chest uninstall StickyGrid # delete from Plugins folder
30
+ $ chest update StickyGrid # pull from git
31
+ $ chest update # updates all plugins
32
+ $ chest list # list installed plugins
28
33
  ```
29
34
 
30
35
  To see all of available commands, use `help` command:
@@ -41,7 +46,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
41
46
 
42
47
  ## Contributing
43
48
 
44
- 1. Fork it ( https://github.com/uetchy/Sketch-Chest/fork )
49
+ 1. Fork it ( <https://github.com/Sketch-Chest/chest/fork> )
45
50
  2. Create your feature branch (`git checkout -b my-new-feature`)
46
51
  3. Commit your changes (`git commit -am 'Add some feature'`)
47
52
  4. Push to the branch (`git push origin my-new-feature`)
data/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
7
-
6
+ task default: :spec
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "chest"
3
+ require 'chest'
4
4
 
5
5
  begin
6
6
  Chest::CLI.start ARGV
@@ -4,24 +4,29 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'chest/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "chest"
7
+ spec.name = 'chest'
8
8
  spec.version = Chest::VERSION
9
- spec.authors = ["Yasuaki Uechi"]
10
- spec.email = ["uetchy@randompaper.co"]
9
+ spec.authors = ['Yasuaki Uechi']
10
+ spec.email = ['uetchy@randompaper.co']
11
11
 
12
- spec.summary = %q{The lightweight plugin manager for Sketch.app}
13
- spec.homepage = "https://github.com/uetchy/Sketch-Chest"
14
- spec.license = "MIT"
12
+ spec.summary = 'The lightweight plugin manager for Sketch.app'
13
+ spec.homepage = 'https://github.com/Sketch-Chest/chest'
14
+ spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
- spec.bindir = "exe"
18
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
- spec.require_paths = ["lib"]
17
+ spec.bindir = 'bin'
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency "thor"
21
+ spec.add_dependency 'thor', '~> 0.19.1'
22
+ spec.add_dependency 'rest-client', '~> 1.8.0'
23
+ spec.add_dependency 'semantic', '~> 1.4.1'
24
+ spec.add_dependency 'parseconfig', '~> 1.0.6'
25
+ spec.add_dependency 'git', '~> 1.2.9'
22
26
 
23
- spec.add_development_dependency "bundler", "~> 1.8"
24
- spec.add_development_dependency "rake", "~> 10.0"
25
- spec.add_development_dependency "rspec"
26
- spec.add_development_dependency "pry-byebug"
27
+ spec.add_development_dependency 'bundler'
28
+ spec.add_development_dependency 'rake'
29
+ spec.add_development_dependency 'rspec'
30
+ spec.add_development_dependency 'pry-byebug'
31
+ spec.add_development_dependency 'webmock'
27
32
  end
@@ -1,4 +1,9 @@
1
- require 'chest/config'
2
- require 'chest/plugin'
3
1
  require 'chest/version'
2
+ require 'chest/helper'
3
+ require 'chest/plugin_folder'
4
+ require 'chest/config'
5
+ require 'chest/registry'
4
6
  require 'chest/cli'
7
+
8
+ module Chest
9
+ end
@@ -1,51 +1,155 @@
1
1
  require 'thor'
2
2
  require 'fileutils'
3
+ require 'json'
4
+ require 'git'
3
5
 
4
6
  class Chest::CLI < Thor
5
- desc 'list', 'List plugins'
6
- def list
7
- Chest::Plugin.all.each do |plugin|
8
- puts "(#{plugin.kind})\t#{plugin.name}"
9
- end
7
+ def initialize(*args)
8
+ super
9
+ end
10
+
11
+ desc "version", "Prints the bundler's version information"
12
+ def version
13
+ say "Chest version #{Chest::VERSION}"
10
14
  end
15
+ map %w(-v --version) => :version
11
16
 
12
- desc 'install QUERY', 'Install plugin'
17
+ desc 'install NAME', 'Install plugin'
13
18
  def install(query)
14
- if query =~ /\.git$/
15
- # just url
16
- name = File.basename query, '.*'
17
- url = query
18
- elsif query =~ /([^\/]+)\/([^\/]+)/
19
- # user/repo
20
- name = $2
21
- url = "https://github.com/#{$1}/#{$2}.git"
22
- end
19
+ git_url = Chest::Registry.new.normalize_to_git_url(query)
20
+ plugin_folder = Chest::PluginFolder.new
23
21
 
24
- path = File.join(Chest::PLUGINS_FOLDER, name)
25
- if Dir.exist? path
26
- puts "#{name} was already installed."
27
- exit
22
+ begin
23
+ say "===> Cloning #{git_url}"
24
+ Dir.mktmpdir do |tmpdir|
25
+ repo = Git.clone(git_url, 'p', path: tmpdir)
26
+ remote_path = URI.parse(repo.remote.url).path
27
+ repo_name = File.basename(remote_path, File.extname(remote_path))
28
+ plugin_folder.install(File.join(tmpdir, 'p'), repo_name)
29
+ info(repo_name)
30
+ end
31
+ rescue => e
32
+ say '===> Error', :red
33
+ raise e
34
+ else
35
+ say '💎 Successfully installed'
28
36
  end
29
-
30
- puts "Installing '#{name}' ..."
31
- system "git clone '#{url}' '#{path}'"
32
37
  end
33
38
 
34
39
  desc 'uninstall NAME', 'Uninstall plugin'
35
- def uninstall(name)
36
- path = File.join(Chest::PLUGINS_FOLDER, name)
37
- return unless Dir.exist? path
40
+ def uninstall(plugin_name)
41
+ plugin_folder = Chest::PluginFolder.new
38
42
 
39
- puts "Uninstalling '#{name}' ..."
40
- FileUtils.rm_r(path)
43
+ begin
44
+ plugin_path = plugin_folder.path_for(plugin_name, true)
45
+ unless Dir.exist? plugin_path
46
+ raise "#{plugin_name} doesn't exist"
47
+ end
48
+ delete = yes? "Are you sure to uninstall '#{plugin_name}'? (y/n)"
49
+ if delete
50
+ say '===> Uninstalling'
51
+ deleted_path = plugin_folder.uninstall(plugin_path)
52
+ say "Deleted: #{deleted_path}"
53
+ end
54
+ rescue => e
55
+ say '===> Error', :red
56
+ raise e.to_s
57
+ end
41
58
  end
42
59
 
43
60
  desc 'update [NAME]', 'Update plugins'
44
- def update(name=nil)
45
- if name
46
- Chest::Plugin.all.find{|x| name == x.name and x.update}
47
- else
48
- Chest::Plugin.all.map(&:update)
61
+ def update(plugin_name = nil)
62
+ plugin_folder = Chest::PluginFolder.new
63
+ plugins = plugin_name ? [plugin_folder.path_for(plugin_name, true)] : plugin_folder.plugins
64
+
65
+ say '===> Updating plugins'
66
+ plugins.each do |plugin_path|
67
+ begin
68
+ manifest = plugin_folder.manifest_for(plugin_path)
69
+ repo = Git.open(plugin_path)
70
+ repo.pull
71
+ rescue => e
72
+ say "Error: #{e.to_s}", :red
73
+ else
74
+ new_manifest = plugin_folder.manifest_for(plugin_path)
75
+ say "Updated #{manifest['name']} (#{manifest['version']} > #{new_manifest['version']})", :green
76
+ end
77
+ end
78
+ end
79
+
80
+ desc 'info NAME', 'Show plugin info'
81
+ def info(plugin_name)
82
+ plugin_folder = Chest::PluginFolder.new
83
+ plugin_path = plugin_folder.path_for(plugin_name, true)
84
+ unless Dir.exist? plugin_path
85
+ raise "#{plugin_name} doesn't exist"
49
86
  end
87
+ manifest = plugin_folder.manifest_for(plugin_path)
88
+ say "#{manifest['name']}: #{manifest['version']}"
89
+ say (manifest['description']).to_s
90
+ say "Author: #{manifest['author']}"
91
+ say (manifest['homepage']).to_s
92
+ end
93
+
94
+ desc 'list', 'List plugins'
95
+ def list
96
+ plugin_folder = Chest::PluginFolder.new
97
+ plugins = plugin_folder.plugins
98
+ plugins.each do |plugin_path|
99
+ manifest = plugin_folder.manifest_for(plugin_path)
100
+ say "#{manifest['name']} (#{manifest['version']})"
101
+ end
102
+ end
103
+
104
+ desc 'init', 'Create manifest.json'
105
+ def init
106
+ package = {}
107
+
108
+ say 'Creating manifest.json ...'
109
+
110
+ # Name
111
+ package['name'] = ask 'name:', default: File.basename(Dir.pwd)
112
+
113
+ # Version
114
+ package['version'] = ask 'version:', default: '1.0.0'
115
+
116
+ # Description
117
+ package['description'] = ask 'description:'
118
+
119
+ # Keywords
120
+ package['keywords'] = [ask('keywords:')]
121
+
122
+ # Authors
123
+ git_user = `git config --get user.name`.strip
124
+ git_email = `git config --get user.email`.strip
125
+ package['author'] = ask('author:', default: git_user)
126
+ package['authorEmail'] = ask('authorEmail:', default: git_email)
127
+
128
+ # License
129
+ package['license'] = ask 'license:', default: 'MIT'
130
+
131
+ # Homepage
132
+ remote_url = `git config --get remote.origin.url`.strip
133
+ package['homepage'] = ask 'homepage:', if remote_url =~ /github\.com[:\/]([a-zA-Z0-9_-]+?)\/([a-zA-Z0-9_\-]+?)\.git/
134
+ { default: "https://github.com/#{Regexp.last_match(1)}/#{Regexp.last_match(2)}" }
135
+ end
136
+
137
+ # Repository
138
+ package['repository'] = remote_url
139
+
140
+ say "\n"
141
+ json = JSON.pretty_generate(package)
142
+ say json
143
+ if yes? 'Looks good?', :green
144
+ if File.exist?('manifest.json') && !file_collision('manifest.json')
145
+ raise SystemExit
146
+ end
147
+ File.open('manifest.json', 'w').write(json)
148
+ end
149
+ end
150
+
151
+ desc 'open', 'Open plugins folder'
152
+ def open
153
+ system %(/usr/bin/open "#{Chest::PluginFolder::SKETCH_PLUGIN_FOLDER_PATH}")
50
154
  end
51
155
  end
@@ -3,46 +3,47 @@ require 'ostruct'
3
3
  require 'fileutils'
4
4
 
5
5
  module Chest
6
-
7
- CONFIG_NAME = '.chestrc'
8
- CONFIG_PATH = File.expand_path(CONFIG_NAME, '~')
6
+ CONFIG_BASE_DIR = File.expand_path('.config/chest', '~')
7
+ CONFIG_PATH = File.join(CONFIG_BASE_DIR, 'config.json')
9
8
 
10
9
  class FileMissingError < StandardError; end
11
10
 
12
11
  class Config < OpenStruct
13
12
  attr_reader :file_path
14
13
 
15
- def initialize(file_path=CONFIG_PATH)
14
+ def initialize(file_path = CONFIG_PATH)
16
15
  super({})
17
16
  @file_path = file_path
18
- self.load!
17
+ load!
19
18
  end
20
19
 
21
20
  def load!
22
- begin
23
- if File.exist? @file_path
24
- File.open(@file_path, 'r') do |f|
25
- self.marshal_load(symbolize_keys(JSON(f.read)))
26
- end
21
+ if File.exist? @file_path
22
+ File.open(@file_path, 'r') do |f|
23
+ marshal_load(symbolize_keys(JSON(f.read)))
27
24
  end
28
- rescue Errno::ENOENT, IOError
29
- raise FileMissingError
30
25
  end
26
+ rescue Errno::ENOENT, IOError
27
+ raise FileMissingError, @file_path
28
+ end
29
+
30
+ def method_missing(name, *args)
31
+ super(name, *args)
31
32
  end
32
33
 
33
- def update!(attributes={})
34
+ def update!(attributes = {})
34
35
  attributes_with!(attributes)
35
36
  end
36
37
 
37
- def attributes_with!(attributes={})
38
+ def attributes_with!(attributes = {})
38
39
  attributes.each do |key, value|
39
- self.send(key.to_s + "=", value) if self.respond_to?(key.to_s + "=")
40
+ send(key.to_s + '=', value) if respond_to?(key.to_s + '=')
40
41
  end
41
42
  end
42
43
 
43
44
  def save
44
45
  FileUtils.mkpath(File.dirname(@file_path))
45
- File.open(@file_path, 'w') {|f| f.puts self.to_json }
46
+ File.open(@file_path, 'w') { |f| f.puts to_json }
46
47
  end
47
48
 
48
49
  def to_hash
@@ -56,7 +57,7 @@ module Chest
56
57
  private
57
58
 
58
59
  def symbolize_keys(hash)
59
- hash.inject({}){|res, (k,v)| res[k.to_sym] = v; res}
60
+ hash.inject({}) { |res, (k, v)| res[k.to_sym] = v; res }
60
61
  end
61
62
  end
62
63
  end
@@ -0,0 +1,5 @@
1
+ module Chest
2
+ def sanitize_name(name)
3
+ name.gsub(/[\s\/]/, '-')
4
+ end
5
+ end
@@ -0,0 +1,69 @@
1
+ require 'fileutils'
2
+
3
+ module Chest
4
+ class PluginFolder
5
+ SKETCH_PLUGIN_FOLDER_PATH = File.expand_path('~/Library/Application Support/com.bohemiancoding.sketch3/Plugins/').freeze
6
+ SKETCH_APPSTORE_PLUGIN_FOLDER_PATH = File.expand_path('~/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application Support/com.bohemiancoding.sketch3/Plugins/').freeze
7
+
8
+ class InvalidArgumentError < StandardError; end
9
+
10
+ def initialize
11
+ @registry = Chest::Registry.new
12
+ end
13
+
14
+ def manifest_for(plugin_path)
15
+ manifest_path = Dir.glob(File.join(plugin_path, '*.sketchplugin/Contents/Sketch/manifest.json')).first
16
+ JSON.parse(File.open(manifest_path).read)
17
+ end
18
+
19
+ def path_for(name, include_manifest = false)
20
+ exact_plugin_path = File.join(SKETCH_PLUGIN_FOLDER_PATH, name)
21
+ return exact_plugin_path unless include_manifest
22
+ plugins.each do |plugin_path|
23
+ if manifest_for(plugin_path)['name'] == name || File.identical?(plugin_path, exact_plugin_path)
24
+ return plugin_path
25
+ end
26
+ end
27
+
28
+ return nil
29
+ end
30
+
31
+ def plugins
32
+ Dir.glob(File.join(SKETCH_PLUGIN_FOLDER_PATH, '*/'))
33
+ end
34
+
35
+ def install(source_path, plugin_name)
36
+ destination_path = path_for(plugin_name)
37
+ if Dir.exist? destination_path
38
+ raise "#{plugin_name} already installed"
39
+ end
40
+ FileUtils.cp_r(source_path, destination_path)
41
+ end
42
+
43
+ def uninstall(plugin_path)
44
+ if Dir.exist? plugin_path
45
+ FileUtils.rm_rf(plugin_path)
46
+ return plugin_path
47
+ else
48
+ raise "#{plugin_path} doesn't exist"
49
+ end
50
+ end
51
+
52
+ def update
53
+ fetch_method = "update_#{type}"
54
+ if respond_to?(fetch_method, true)
55
+ begin
56
+ send(fetch_method)
57
+ rescue => e
58
+ raise "#{@name}: #{e}"
59
+ else
60
+ manifest = Manifest.new
61
+ manifest.add_plugin(@name, to_option)
62
+ manifest.save
63
+ end
64
+ else
65
+ raise "Unknown strategy type: #{type}"
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,49 @@
1
+ require 'json'
2
+ require 'rest_client'
3
+ require 'uri'
4
+ require 'fileutils'
5
+
6
+ class Chest::Registry
7
+ def initialize(token = nil, endpoint: 'http://sketchchest.com/api/')
8
+ @token = token
9
+ @endpoint = endpoint
10
+ end
11
+
12
+ def request_raw(method, path, params = {})
13
+ case method
14
+ when :get
15
+ RestClient.get path, params: params
16
+ when :post
17
+ RestClient.post(path, params, content_type: :json, accept: :json)
18
+ when :delete
19
+ RestClient.delete(path, params: params)
20
+ end
21
+ end
22
+
23
+ def request(method, path, params = {})
24
+ params[:token] = @token
25
+ response = request_raw(method, URI.join(@endpoint, path).to_s, params)
26
+ JSON.parse(response.body)
27
+ end
28
+
29
+ def fetch_package(package_name)
30
+ request :get, "packages/#{package_name}.json"
31
+ end
32
+
33
+ def normalize_to_git_url(query)
34
+ if query =~ /\.git$/
35
+ return query
36
+ elsif query =~ /\A([a-zA-Z0-9_\-]+)\/([a-zA-Z0-9_\-]+)\z/
37
+ user = Regexp.last_match(1)
38
+ repository = Regexp.last_match(2)
39
+ url = "https://github.com/#{user}/#{repository}.git"
40
+ return url
41
+ else
42
+ package = fetch_package(query)
43
+ if package["error"]
44
+ raise InvalidArgumentError, "Specify valid query for #{query}"
45
+ end
46
+ return package["git_url"]
47
+ end
48
+ end
49
+ end
@@ -1,3 +1,3 @@
1
1
  module Chest
2
- VERSION = "1.0.0"
2
+ VERSION = '2.0.0'.freeze
3
3
  end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'chest'
5
+
6
+ require 'pry'
7
+ Pry.start
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install --path vendor/bundle --binstubs .bundle/bin -j4
metadata CHANGED
@@ -1,57 +1,113 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuaki Uechi
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-02 00:00:00.000000000 Z
11
+ date: 2016-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.19.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.19.1
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
28
+ name: rest-client
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.8'
34
- type: :development
33
+ version: 1.8.0
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.8'
40
+ version: 1.8.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
42
+ name: semantic
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
48
- type: :development
47
+ version: 1.4.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.4.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: parseconfig
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.6
62
+ type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '10.0'
68
+ version: 1.0.6
69
+ - !ruby/object:Gem::Dependency
70
+ name: git
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.2.9
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.2.9
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
55
111
  - !ruby/object:Gem::Dependency
56
112
  name: rspec
57
113
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +136,20 @@ dependencies:
80
136
  - - ">="
81
137
  - !ruby/object:Gem::Version
82
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: webmock
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
83
153
  description:
84
154
  email:
85
155
  - uetchy@randompaper.co
@@ -93,20 +163,24 @@ files:
93
163
  - ".travis.yml"
94
164
  - CHANGELOG.md
95
165
  - CODE_OF_CONDUCT.md
166
+ - CONTRIBUTING.md
96
167
  - Gemfile
97
- - LICENSE.txt
168
+ - LICENSE
98
169
  - README.md
99
170
  - Rakefile
100
- - bin/console
101
- - bin/setup
171
+ - assets/readme_images/logo.png
172
+ - bin/chest
102
173
  - chest.gemspec
103
- - exe/chest
104
174
  - lib/chest.rb
105
175
  - lib/chest/cli.rb
106
176
  - lib/chest/config.rb
107
- - lib/chest/plugin.rb
177
+ - lib/chest/helper.rb
178
+ - lib/chest/plugin_folder.rb
179
+ - lib/chest/registry.rb
108
180
  - lib/chest/version.rb
109
- homepage: https://github.com/uetchy/Sketch-Chest
181
+ - tools/console
182
+ - tools/setup
183
+ homepage: https://github.com/Sketch-Chest/chest
110
184
  licenses:
111
185
  - MIT
112
186
  metadata: {}
@@ -126,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
200
  version: '0'
127
201
  requirements: []
128
202
  rubyforge_project:
129
- rubygems_version: 2.4.5
203
+ rubygems_version: 2.5.1
130
204
  signing_key:
131
205
  specification_version: 4
132
206
  summary: The lightweight plugin manager for Sketch.app
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "chest"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- require "pry"
10
- Pry.start
data/bin/setup DELETED
@@ -1,5 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
@@ -1,49 +0,0 @@
1
- module Chest
2
- PLUGINS_FOLDER = File.expand_path('~/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application Support/com.bohemiancoding.sketch3/Plugins')
3
-
4
- class Plugin
5
- attr_reader :path, :name, :kind
6
-
7
- def initialize(path)
8
- @path = path
9
- @name = File.basename(path)
10
- @kind = guess_kind(path)
11
- end
12
-
13
- def updatable?
14
- @kind != :local
15
- end
16
-
17
- def update
18
- case @kind
19
- when :git
20
- update_git
21
- else
22
- puts "#{@name} is kind of un-updatable plugin"
23
- false
24
- end
25
- end
26
-
27
- class << self
28
- def all
29
- Dir.glob(File.join(PLUGINS_FOLDER, '*')).collect do |path|
30
- Dir.exist?(path) ? Plugin.new(path) : nil
31
- end.compact
32
- end
33
- end
34
-
35
- private
36
- def guess_kind(path)
37
- if Dir.exist? File.join(path, '.git')
38
- :git
39
- else
40
- :local
41
- end
42
- end
43
-
44
- def update_git
45
- puts "Updating '#{@name}' ..."
46
- system "cd '#{@path}' && git pull"
47
- end
48
- end
49
- end