tmbundle-manager 0.1.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: eca4ac7b55486034165b1b5477275faebdda6f9f
4
+ data.tar.gz: b7788a53dc1ec478e19e4d6616649a5e178fb73b
5
+ SHA512:
6
+ metadata.gz: b4c17656a55946f59d3abc1dd035b0eaea6d14df9b3c1bcef19319f4649aa596ac49eda142ba2251522ff66d90e4a513bc8db9eeebbb7265305a75d9d16f4a79
7
+ data.tar.gz: 3c0f0a7fbb39e1d82dde75268becada03f297528742c1d86b28cd0ff32aca105ab611bd902241e951cebb32f44a3e80d6281cd144ba7fac9218298fbc189eb58
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tmbundle-manager.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Elia Schito
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # TM Bundles/Package manager
2
+
3
+
4
+
5
+ ## Installation
6
+
7
+ Install with RubyGems in your Terminal:
8
+
9
+ gem install tmbundle-manager
10
+
11
+
12
+ ## Usage
13
+
14
+ Use the `tmb` executable:
15
+
16
+ ```shell
17
+ $ tmb help
18
+
19
+ Commands:
20
+ tmb edit PARTIAL_NAME # Edit an installed bundle (name will be matched against PARTIAL_NAME)
21
+ tmb help [COMMAND] # Describe available commands or one specific command
22
+ tmb update # Update installed bundles
23
+
24
+ ```
25
+
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it ( https://github.com/[my-github-username]/tmbundle-manager/fork )
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -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
+
data/bin/tmb ADDED
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+ require 'thor'
5
+
6
+ class TMBundle < Thor
7
+ desc 'edit PARTIAL_NAME', 'Edit an installed bundle (name will be matched against PARTIAL_NAME)'
8
+ def edit partial_name
9
+ matches = installed_bundles.select do |bundle|
10
+ bundle.name =~ /^#{partial_name}/i
11
+ end
12
+
13
+ if matches.size > 1
14
+ puts "please be more specific:"
15
+ matches.each_with_index {|m,i| puts " #{i+1}) #{m.name}"}
16
+ return false
17
+ end
18
+
19
+ if matches.empty?
20
+ puts "nothing found"
21
+ return false
22
+ end
23
+
24
+ bundle = matches.first
25
+ mate bundle.path
26
+ end
27
+
28
+ desc 'update', 'Update installed bundles'
29
+ def update
30
+ require 'thread'
31
+ signals = Queue.new
32
+ trap('INT') { signals << :int }
33
+
34
+ updated = []
35
+ skipped = []
36
+ errored = []
37
+
38
+ installed_bundles[0..4].each do |bundle|
39
+ within bundle do
40
+ if not(File.exist?('./.git'))
41
+ puts "------> Skipping #{bundle.name} (not a Git repo, delta bundle?)"
42
+ skipped << bundle
43
+ next
44
+ end
45
+
46
+ puts "------> Updating #{bundle.name}..."
47
+ system *%w[git pull --ff-only]
48
+ success = $? == 0
49
+ updated << bundle if success
50
+ errored << bundle unless success
51
+ puts
52
+ (puts 'Exiting…'; exit) if signals.pop == :int until signals.empty?
53
+ end
54
+ end
55
+
56
+ puts
57
+ puts
58
+ puts '------> Summary'
59
+ puts
60
+ puts "Skipped (#{skipped.size})\n- #{skipped.map(&:name).join("\n- ")}\n\n" if skipped.any?
61
+ puts "Updated (#{updated.size})\n- #{updated.map(&:name).join("\n- ")}\n\n" if updated.any?
62
+ puts "Errored (#{errored.size})\n- #{errored.map(&:name).join("\n- ")}\n\n" if errored.any?
63
+ end
64
+
65
+ private
66
+
67
+ def within bundle
68
+ Dir.chdir bundle.path do
69
+ yield
70
+ end
71
+ end
72
+
73
+ def installed_bundles
74
+ @installed_bundles ||= begin
75
+ bundles_dir = Pathname('~/Library/Application Support/Avian/Bundles').expand_path
76
+ Dir[bundles_dir.join('*').to_s].map {|path| Bundle.new(path)}
77
+ end
78
+ end
79
+
80
+ class Bundle < Struct.new(:path)
81
+ def name
82
+ @name ||= File.basename(path, '.tmbundle')
83
+ end
84
+ end
85
+
86
+ def mate *args
87
+ exec 'mate', *args
88
+ end
89
+ end
90
+
91
+ TMBundle.start
@@ -0,0 +1,19 @@
1
+ require 'sinatra/base'
2
+ module Tmbundle
3
+ module Manager
4
+ class Server < Sinatra::Base
5
+ get '/api/v1/bundles' do
6
+ [
7
+ {
8
+ name: 'elia/avian-missing',
9
+ git: 'https://github.com/elia/avian-missing.git'
10
+ },
11
+ {
12
+ name: 'elia/markdown-redcarpet',
13
+ git: 'https://github.com/elia/markdown-redcarpet.git'
14
+ },
15
+ ].to_yaml
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ module Tmbundle
2
+ module Manager
3
+ VERSION = '0.1.0.pre1'
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ require 'tmbundle/manager/version'
2
+
3
+ module Tmbundle
4
+ module Manager
5
+ end
6
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'tmbundle/manager'
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Tmbundle::Manager do
4
+ it 'has a version number' do
5
+ expect(Tmbundle::Manager::VERSION).not_to be nil
6
+ end
7
+
8
+ it 'does something useful' do
9
+ expect(false).to eq(true)
10
+ end
11
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tmbundle/manager/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'tmbundle-manager'
8
+ spec.version = Tmbundle::Manager::VERSION
9
+ spec.authors = ['Elia Schito']
10
+ spec.email = ['elia@schito.me']
11
+ spec.summary = %q{TextMate 2 Bundle/Package Manager}
12
+ # spec.description = %q{TODO: Write a longer description. Optional.}
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'thor'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.6'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'rspec'
26
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tmbundle-manager
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.pre1
5
+ platform: ruby
6
+ authors:
7
+ - Elia Schito
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-22 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.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '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
+ description:
70
+ email:
71
+ - elia@schito.me
72
+ executables:
73
+ - tmb
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - bin/tmb
85
+ - lib/tmbundle/manager.rb
86
+ - lib/tmbundle/manager/server.rb
87
+ - lib/tmbundle/manager/version.rb
88
+ - spec/spec_helper.rb
89
+ - spec/tmbundle/manager_spec.rb
90
+ - tmbundle-manager.gemspec
91
+ homepage: ''
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">"
107
+ - !ruby/object:Gem::Version
108
+ version: 1.3.1
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.2.2
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: TextMate 2 Bundle/Package Manager
115
+ test_files:
116
+ - spec/spec_helper.rb
117
+ - spec/tmbundle/manager_spec.rb