git-audio-commit 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "bundler", "~> 1.0.0"
10
+ gem "jeweler", "~> 1.6.4"
11
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,16 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.6.4)
6
+ bundler (~> 1.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.9.2.2)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ bundler (~> 1.0.0)
16
+ jeweler (~> 1.6.4)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Sean Geoghegan
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # git-audio-commit
2
+
3
+ Adds two commands to git to support adding and reading audio files to commit messages.
4
+
5
+ ## Installation
6
+
7
+ gem install git-audio-commit
8
+
9
+ ## Adding audio to a commit
10
+
11
+ Use `git audio-commit` instead of git commit. The audio file should be one
12
+ that is supported by `afplay`, mp3, aiff and wav should work.
13
+
14
+ git audio-commit -m "<text message>" --audio <audio file>
15
+
16
+ ## Hearing the logs
17
+
18
+ You can play back the logs using:
19
+
20
+ git say-log
21
+
22
+ This will support the same arguments as git log.
23
+
24
+ ## Requirements
25
+
26
+ Currently only works on Mac OSX since it uses the `afplay` command line utility.
27
+
28
+ ## Copyright
29
+
30
+ Copyright (c) 2012 Sean Geoghegan. See LICENSE.txt for
31
+ further details.
32
+
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "git-audio-commit"
18
+ gem.homepage = "http://github.com/seangeo/git-audio-commit"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Attach audio files to git commits.}
21
+ gem.description = %Q{}
22
+ gem.email = "seangeo@gmail.com"
23
+ gem.authors = ["Sean Geoghegan"]
24
+ gem.executables = ["git-audio-commit", "git-say-log"]
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'tempfile'
4
+ require 'base64'
5
+
6
+ options = {}
7
+
8
+ def capture(name)
9
+ val = nil
10
+ ARGV.each_with_index do |arg, index|
11
+ if arg == name
12
+ val = ARGV[index+1]
13
+ ARGV.delete_at(index+1)
14
+ ARGV.delete_at(index)
15
+ end
16
+ end
17
+ val
18
+ end
19
+
20
+ options[:audio] = capture("--audio")
21
+ options[:message] = capture("-m")
22
+
23
+ if options[:audio].nil? || options[:message].nil?
24
+ puts "Usage: git audio-commit --audio <audio-file> -m <message> ..."
25
+ exit(1)
26
+ end
27
+
28
+ tempfile = Tempfile.new("git-audio-commit")
29
+
30
+ begin
31
+ tempfile << options[:message]
32
+ tempfile << "\n\n--BEGIN-AUDIO--\n"
33
+ tempfile << Base64.encode64(File.read(options[:audio]))
34
+ tempfile << "--END-AUDIO--\n"
35
+ tempfile.close
36
+
37
+ system("git commit -F #{tempfile.path} #{ARGV.join(" ")}")
38
+ ensure
39
+ tempfile.unlink
40
+ end
data/bin/git-say-log ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'tempfile'
4
+ require 'base64'
5
+
6
+ def say_it(audio)
7
+ tempfile = Tempfile.new("git-say-log")
8
+ tempfile.write Base64.decode64(audio)
9
+ tempfile.close
10
+ system("afplay #{tempfile.path}")
11
+ sleep(0.5)
12
+ ensure
13
+ tempfile.unlink
14
+ end
15
+
16
+ IO.popen("git log --color #{ARGV.join('')}") do |log|
17
+ in_audio = false
18
+ audio = nil
19
+
20
+ log.each do |line|
21
+ case
22
+ when line =~ /--BEGIN-AUDIO--$/
23
+ in_audio = true
24
+ audio = ""
25
+ when line =~ /--END-AUDIO--$/
26
+ in_audio = false
27
+ audio << line
28
+ audio << "\n"
29
+ say_it(audio)
30
+ when in_audio
31
+ audio << line
32
+ else
33
+ puts line
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,54 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "git-audio-commit"
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Sean Geoghegan"]
12
+ s.date = "2012-01-14"
13
+ s.description = ""
14
+ s.email = "seangeo@gmail.com"
15
+ s.executables = ["git-audio-commit", "git-say-log"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.md"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.md",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "bin/git-audio-commit",
29
+ "bin/git-say-log",
30
+ "git-audio-commit.gemspec",
31
+ "hello-world.aiff"
32
+ ]
33
+ s.homepage = "http://github.com/seangeo/git-audio-commit"
34
+ s.licenses = ["MIT"]
35
+ s.require_paths = ["lib"]
36
+ s.rubygems_version = "1.8.10"
37
+ s.summary = "Attach audio files to git commits."
38
+
39
+ if s.respond_to? :specification_version then
40
+ s.specification_version = 3
41
+
42
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
44
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
45
+ else
46
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
47
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
48
+ end
49
+ else
50
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
51
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
52
+ end
53
+ end
54
+
data/hello-world.aiff ADDED
Binary file
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git-audio-commit
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Sean Geoghegan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-14 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: &2157427960 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.0.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *2157427960
25
+ - !ruby/object:Gem::Dependency
26
+ name: jeweler
27
+ requirement: &2157427060 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 1.6.4
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2157427060
36
+ description: ''
37
+ email: seangeo@gmail.com
38
+ executables:
39
+ - git-audio-commit
40
+ - git-say-log
41
+ extensions: []
42
+ extra_rdoc_files:
43
+ - LICENSE.txt
44
+ - README.md
45
+ files:
46
+ - .document
47
+ - Gemfile
48
+ - Gemfile.lock
49
+ - LICENSE.txt
50
+ - README.md
51
+ - Rakefile
52
+ - VERSION
53
+ - bin/git-audio-commit
54
+ - bin/git-say-log
55
+ - git-audio-commit.gemspec
56
+ - hello-world.aiff
57
+ homepage: http://github.com/seangeo/git-audio-commit
58
+ licenses:
59
+ - MIT
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ segments:
71
+ - 0
72
+ hash: -4065758775372223459
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 1.8.10
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: Attach audio files to git commits.
85
+ test_files: []