git-background 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9dea06adae493868b880d055756aeab3c33814ba
4
+ data.tar.gz: 7355992fe7d7db6a66d0322beeb5e46857b3dff4
5
+ SHA512:
6
+ metadata.gz: fcd0b524ae7350300689e4a301575f39f7218632df2bec5cdce0549971bcef4954dd21e6cb236a3f258a10903dde147d7e981c86ece362e4d8daf384f4811e95
7
+ data.tar.gz: 116fd608cb478b4589c9c01d862cf47cc46e0cd7596b2f213c301c901ca9af5044a63c3dadf7f91df61a7e528325fe7d5206d1a23779bf87266c77d11e2e5e46
data/.gitignore ADDED
@@ -0,0 +1,17 @@
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
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'notifier'
4
+ gem 'terminal-notifier' if RUBY_PLATFORM =~ /darwin/
5
+
6
+ # Specify your gem's dependencies in git-background.gemspec
7
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 rhysd
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,29 @@
1
+ # Git::Background
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'git-background'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install git-background
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
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 new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
4
+ require 'git/background/cli'
5
+
6
+ Git::Background::CLI::start
@@ -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 'git/background/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "git-background"
8
+ spec.version = Git::Background::VERSION
9
+ spec.authors = ["rhysd"]
10
+ spec.email = ["lin90162@yahoo.co.jp"]
11
+ spec.description = %q{execute git command in background}
12
+ spec.summary = %q{This gem provides `git background` command.
13
+ git-background executes following command with background
14
+ and notify them using notification system.}
15
+ spec.homepage = "https://github.com/rhysd/git-background"
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files`.split($/)
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_dependency "terminal-notifier"
26
+ spec.add_dependency "notifier"
27
+ end
@@ -0,0 +1,7 @@
1
+ require "git/background/version"
2
+
3
+ module Git
4
+ module Background
5
+ # Your code goes here...
6
+ end
7
+ end
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+
3
+ require 'git/background/runner'
4
+
5
+ module Git
6
+ module Background
7
+ module CLI extend self
8
+
9
+ def start
10
+ if ARGV.empty?
11
+ STDERR.puts help
12
+ else
13
+ notifier = parse_notifier!
14
+ Git::Background::Runner.new(notifier).run
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def parse_notifier!
21
+ require 'optparse'
22
+
23
+ notifier = nil
24
+ opt = OptionParser.new
25
+ opt.on('--[no-]notifier[=VAL]') do |n|
26
+ notifier = n if n.class == String
27
+ end
28
+ opt.parse!(ARGV)
29
+
30
+ notifier
31
+ end
32
+
33
+ def help
34
+ 'usage: git background [--[no-]notifier=[notifier]] commands...'
35
+ end
36
+
37
+ end
38
+ end
39
+ end
40
+
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ require 'git/background/notifier_ext/osx_notification'
5
+ require 'git/background/notifier_ext/tmux'
6
+
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ require 'terminal-notifier'
4
+
5
+ module Notifier
6
+ module OsxNotification extend self
7
+
8
+ def supported?
9
+ TerminalNotifier::available?
10
+ end
11
+
12
+ def notify(options)
13
+ notifier_opts = { title: options[:title], group: Process.pid }
14
+ notifier_opts[:subtitle] = options[:subtitle] if options[:subtitle]
15
+ TerminalNotifier.notify options[:message], notifier_opts
16
+ end
17
+
18
+ end
19
+ end
20
+
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ module Notifier
5
+ module Tmux extend self
6
+
7
+ def self.which? cmd
8
+ dir = ENV['PATH'].split(':').find {|p| File.executable? File.join(p, cmd)}
9
+ File.join(dir, cmd) unless dir.nil?
10
+ end
11
+
12
+ def supported?
13
+ self.which?('tmux') && ! `tmux ls 2>/dev/null`.empty?
14
+ end
15
+
16
+ def notify(options)
17
+ `tmux display-message '[#{options[:title]}] #{options[:message]}'`
18
+ end
19
+
20
+ end
21
+ end
22
+
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ require 'notifier'
5
+ require 'git/background/notifier_ext'
6
+
7
+ module Git
8
+ module Background
9
+ class Runner
10
+
11
+ def initialize notifier_name
12
+ if notifier_name
13
+ notifier = Notifier::supported_notifier_from_name notifier_name
14
+ raise "#{notifier} is not supported" unless notifier
15
+ Notifier::default_notifier = notifier
16
+ end
17
+ end
18
+
19
+ def run
20
+ Process::daemon true
21
+ result = `git #{ARGV.join ' '}`
22
+ Notifier::notify(
23
+ title: "git-background: #{$?.success? ? 'success' : 'failed'}",
24
+ message: result
25
+ )
26
+ end
27
+ end
28
+ end
29
+ end
30
+
@@ -0,0 +1,5 @@
1
+ module Git
2
+ module Background
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git-background
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - rhysd
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: terminal-notifier
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
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: notifier
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: execute git command in background
70
+ email:
71
+ - lin90162@yahoo.co.jp
72
+ executables:
73
+ - git-background
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/git-background
83
+ - git-background.gemspec
84
+ - lib/git/background.rb
85
+ - lib/git/background/cli.rb
86
+ - lib/git/background/notifier_ext.rb
87
+ - lib/git/background/notifier_ext/osx_notification.rb
88
+ - lib/git/background/notifier_ext/tmux.rb
89
+ - lib/git/background/runner.rb
90
+ - lib/git/background/version.rb
91
+ homepage: https://github.com/rhysd/git-background
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: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.0.3
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: This gem provides `git background` command. git-background executes following
115
+ command with background and notify them using notification system.
116
+ test_files: []
117
+ has_rdoc: