chest 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 55c3329304474c96b37ecad89d250855fc8fb1ae
4
+ data.tar.gz: 309be62c63ac9496921b00344163cef9cc8d55be
5
+ SHA512:
6
+ metadata.gz: 15108dda85ff3f2c52f7159892b614b56b1b5f478042d8f8d26af24e2395c3d775bb8e6720fa2400e89cc15b84231bd1e9d277ad39b917735a66f823b04334a9
7
+ data.tar.gz: af790a5c5eaa2f9941ca9b95076caa83eb8fa3a77fdfa9abf0cda80bfb0d413c1b872f47fe4cde0ba6de8c481f2aad51563a01041185e49e6568cdab0bbcd0e1
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /vendor/bundle/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
@@ -0,0 +1,3 @@
1
+ # 0.1.0
2
+
3
+ - First release
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
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
+
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/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in chest.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Yasuaki Uechi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Sketch-Chest
2
+
3
+ The lightweight plugin manager for Sketch.app.
4
+
5
+ ## Installation
6
+
7
+ ```console
8
+ $ gem install chest
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```console
14
+ $ chest help
15
+ ```
16
+
17
+ ## Development
18
+
19
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec chest` to use the code located in this directory, ignoring other installed copies of this gem.
20
+
21
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/uetchy/Sketch-Chest/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create a new Pull Request
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,10 @@
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
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'chest/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "chest"
8
+ spec.version = Chest::VERSION
9
+ spec.authors = ["Yasuaki Uechi"]
10
+ spec.email = ["uetchy@randompaper.co"]
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"
15
+
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"]
20
+
21
+ spec.add_dependency "thor"
22
+
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
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "chest"
4
+
5
+ begin
6
+ Chest::CLI.start ARGV
7
+ rescue SystemExit, Interrupt
8
+ rescue Exception => err
9
+ puts err
10
+ end
@@ -0,0 +1,6 @@
1
+ require "chest/version"
2
+ require "chest/plugin"
3
+ require "chest/cli"
4
+
5
+ module Chest
6
+ end
@@ -0,0 +1,46 @@
1
+ require 'thor'
2
+ require 'fileutils'
3
+
4
+ class Chest::CLI < Thor
5
+ PLUGINS_FOLDER = File.expand_path '~/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application Support/com.bohemiancoding.sketch3/Plugins'
6
+
7
+ desc 'list', 'List plugins'
8
+ def list
9
+ plugins.each do |plugin|
10
+ puts "(#{plugin.kind})\t#{plugin.name}"
11
+ end
12
+ end
13
+
14
+ desc 'install URL', 'Install plugin'
15
+ def install(url)
16
+ name = File.basename url, '.*'
17
+ path = File.join(PLUGINS_FOLDER, name)
18
+ puts "Installing '#{name}' ..."
19
+ system "git clone '#{url}' '#{path}'"
20
+ end
21
+
22
+ desc 'uninstall NAME', 'Uninstall plugin'
23
+ def uninstall(name)
24
+ path = File.join(PLUGINS_FOLDER, name)
25
+ return unless Dir.exist? path
26
+ puts "Uninstalling '#{name}' ..."
27
+ FileUtils.rm_r(path)
28
+ end
29
+
30
+ desc 'update [NAME]', 'Update plugins'
31
+ def update(name=nil)
32
+ if name
33
+ plugins.find{|x| name == x.name and x.update}
34
+ else
35
+ plugins.map(&:update)
36
+ end
37
+ end
38
+
39
+ private
40
+
41
+ def plugins
42
+ Dir.glob(File.join(PLUGINS_FOLDER, '*')).collect do |path|
43
+ Dir.exist?(path) ? Chest::Plugin.new(path) : nil
44
+ end.compact
45
+ end
46
+ end
@@ -0,0 +1,37 @@
1
+ class Chest::Plugin
2
+ attr_reader :path, :name, :kind
3
+
4
+ def initialize(path)
5
+ @path = path
6
+ @name = File.basename(path)
7
+ @kind = guess_kind(path)
8
+ end
9
+
10
+ def updatable?
11
+ @kind != :local
12
+ end
13
+
14
+ def update
15
+ case @kind
16
+ when :git
17
+ update_git
18
+ else
19
+ false
20
+ end
21
+ end
22
+
23
+ def update_git
24
+ puts "Updating '#{@name}' ..."
25
+ system "cd '#{@path}' && git pull"
26
+ end
27
+
28
+ private
29
+
30
+ def guess_kind(path)
31
+ if Dir.exist? File.join(path, '.git')
32
+ :git
33
+ else
34
+ :local
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,3 @@
1
+ module Chest
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chest
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Yasuaki Uechi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-02-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description:
84
+ email:
85
+ - uetchy@randompaper.co
86
+ executables:
87
+ - chest
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
94
+ - CHANGELOG.md
95
+ - CODE_OF_CONDUCT.md
96
+ - Gemfile
97
+ - LICENSE.txt
98
+ - README.md
99
+ - Rakefile
100
+ - bin/console
101
+ - bin/setup
102
+ - chest.gemspec
103
+ - exe/chest
104
+ - lib/chest.rb
105
+ - lib/chest/cli.rb
106
+ - lib/chest/plugin.rb
107
+ - lib/chest/version.rb
108
+ homepage: https://github.com/uetchy/Sketch-Chest
109
+ licenses:
110
+ - MIT
111
+ metadata: {}
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubyforge_project:
128
+ rubygems_version: 2.4.5
129
+ signing_key:
130
+ specification_version: 4
131
+ summary: The lightweight plugin manager for Sketch.app
132
+ test_files: []