hitch 0.7.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'highline', '1.6.2'
4
+ gem 'rake'
5
+ gem 'rspec', '~>2.6.0'
6
+
7
+ unless RUBY_VERSION =~ /^1.8.6/
8
+ gem 'ruby-debug', :require => 'ruby-debug', :platform => 'ruby_18'
9
+ gem 'ruby-debug19', :require => 'ruby-debug', :platform => 'ruby_19'
10
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,46 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ archive-tar-minitar (0.5.2)
5
+ columnize (0.3.4)
6
+ diff-lcs (1.1.3)
7
+ highline (1.6.2)
8
+ linecache (0.46)
9
+ rbx-require-relative (> 0.0.4)
10
+ linecache19 (0.5.12)
11
+ ruby_core_source (>= 0.1.4)
12
+ rake (0.9.2)
13
+ rbx-require-relative (0.0.5)
14
+ rspec (2.6.0)
15
+ rspec-core (~> 2.6.0)
16
+ rspec-expectations (~> 2.6.0)
17
+ rspec-mocks (~> 2.6.0)
18
+ rspec-core (2.6.4)
19
+ rspec-expectations (2.6.0)
20
+ diff-lcs (~> 1.1.2)
21
+ rspec-mocks (2.6.0)
22
+ ruby-debug (0.10.4)
23
+ columnize (>= 0.1)
24
+ ruby-debug-base (~> 0.10.4.0)
25
+ ruby-debug-base (0.10.4)
26
+ linecache (>= 0.3)
27
+ ruby-debug-base19 (0.11.25)
28
+ columnize (>= 0.3.1)
29
+ linecache19 (>= 0.5.11)
30
+ ruby_core_source (>= 0.1.4)
31
+ ruby-debug19 (0.11.6)
32
+ columnize (>= 0.3.1)
33
+ linecache19 (>= 0.5.11)
34
+ ruby-debug-base19 (>= 0.11.19)
35
+ ruby_core_source (0.1.5)
36
+ archive-tar-minitar (>= 0.5.2)
37
+
38
+ PLATFORMS
39
+ ruby
40
+
41
+ DEPENDENCIES
42
+ highline (= 1.6.2)
43
+ rake
44
+ rspec (~> 2.6.0)
45
+ ruby-debug
46
+ ruby-debug19
data/README.md CHANGED
@@ -2,6 +2,8 @@ hitch
2
2
  =====
3
3
  by Rogelio J. Samour (http://blog.therubymug.com)
4
4
 
5
+ [![Build Status](https://travis-ci.org/therubymug/hitch.png?branch=master)](https://travis-ci.org/therubymug/hitch)
6
+
5
7
  Description:
6
8
  -----------
7
9
 
@@ -35,15 +37,8 @@ Install:
35
37
  <pre><code>for x in $(rvm list strings); do rvm use $x@global && gem install hitch; done</code></pre>
36
38
  * hitch --setup >> ~/.bashrc
37
39
  - this prints out the necessary shell function and aliases you need to add to your ~/.bashrc or ~/.zshrc
38
- * Or copy/paste the following into your ~/.bashrc or ~/.zshrc:
39
- <pre><code>hitch() {
40
- command hitch "$@"
41
- if [[ -s "$HOME/.hitch_export_authors" ]] ; then source "$HOME/.hitch_export_authors" ; fi
42
- }
43
- alias unhitch='hitch -u'
44
- # Uncomment to persist pair info between terminal instances
45
- # hitch
46
- </code></pre>
40
+ * Or copy/paste [the code](lib/hitch/hitch.sh) into your ~/.bashrc or ~/.zshrc
41
+ * As another option, copy/symlink the script to a separate file (e.g. `~/.bash/hitch.sh` or `/etc/profile.d/hitch.sh`) and source it. You can get the path using `hitch --setup-path`.
47
42
 
48
43
  Development:
49
44
  -----------
@@ -51,9 +46,9 @@ Development:
51
46
  * It's easier if you use rvm.
52
47
  * Fork hitch
53
48
  * When you cd into the directory the .rvmrc will activate and create a hitch gemset
54
- * Then run the following scripts:
55
- <pre><code>sh install_supported_rubies.sh
56
- sh rake_spec_with_all_rubies.sh # this also bundles all necessary gems</code></pre>
49
+ * Add tests and code for your feature
50
+ * Create a pull request
51
+ * Double-check TravisCI to make sure all tests pass
57
52
 
58
53
  Requirements:
59
54
  ------------
data/Rakefile CHANGED
@@ -1,4 +1,122 @@
1
+ #############################################################################
2
+ #
3
+ # Helper functions
4
+ #
5
+ #############################################################################
6
+
7
+ def name
8
+ @name ||= Dir['*.gemspec'].first.split('.').first
9
+ end
10
+
11
+ def version
12
+ line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
13
+ line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
14
+ end
15
+
16
+ def date
17
+ Date.today.to_s
18
+ end
19
+
20
+ def gemspec_file
21
+ "#{name}.gemspec"
22
+ end
23
+
24
+ def gem_file
25
+ "#{name}-#{version}.gem"
26
+ end
27
+
28
+ def replace_header(head, header_name)
29
+ head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
30
+ end
31
+
32
+ #############################################################################
33
+ #
34
+ # Standard tasks
35
+ #
36
+ #############################################################################
37
+
38
+ require 'rspec'
1
39
  require 'rspec/core/rake_task'
2
- RSpec::Core::RakeTask.new(:spec)
3
40
 
4
- task :default => :spec
41
+ desc "Run all specs"
42
+ task RSpec::Core::RakeTask.new('spec')
43
+
44
+ task :default => "spec"
45
+
46
+ desc "Open an irb session preloaded with this library"
47
+ task :console do
48
+ sh "irb -rubygems -r ./lib/#{name}.rb"
49
+ end
50
+
51
+ #############################################################################
52
+ #
53
+ # Custom tasks (add your own tasks here)
54
+ #
55
+ #############################################################################
56
+
57
+
58
+ #############################################################################
59
+ #
60
+ # Packaging tasks
61
+ #
62
+ #############################################################################
63
+
64
+ desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
65
+ task :release => :build do
66
+ unless `git branch` =~ /^\* master$/
67
+ puts "You must be on the master branch to release!"
68
+ exit!
69
+ end
70
+ sh "git commit --allow-empty -a -m 'Release #{version}'"
71
+ sh "git tag v#{version}"
72
+ sh "git push origin master"
73
+ sh "git push origin v#{version}"
74
+ sh "gem push pkg/#{name}-#{version}.gem"
75
+ end
76
+
77
+ desc "Build #{gem_file} into the pkg directory"
78
+ task :build => :gemspec do
79
+ sh "mkdir -p pkg"
80
+ sh "gem build #{gemspec_file}"
81
+ sh "mv #{gem_file} pkg"
82
+ end
83
+
84
+ desc "Generate #{gemspec_file}"
85
+ task :gemspec => :validate do
86
+ # read spec file and split out manifest section
87
+ spec = File.read(gemspec_file)
88
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
89
+
90
+ # replace name version and date
91
+ replace_header(head, :name)
92
+ replace_header(head, :version)
93
+ replace_header(head, :date)
94
+
95
+ # determine file list from git ls-files
96
+ files = `git ls-files`.
97
+ split("\n").
98
+ sort.
99
+ reject { |file| file =~ /^\./ }.
100
+ reject { |file| file =~ /^(rdoc|pkg)/ }.
101
+ map { |file| " #{file}" }.
102
+ join("\n")
103
+
104
+ # piece file back together and write
105
+ manifest = " s.files = %w[\n#{files}\n ]\n"
106
+ spec = [head, manifest, tail].join(" # = MANIFEST =\n")
107
+ File.open(gemspec_file, 'w') { |io| io.write(spec) }
108
+ puts "Updated #{gemspec_file}"
109
+ end
110
+
111
+ desc "Validate #{gemspec_file}"
112
+ task :validate do
113
+ libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
114
+ unless libfiles.empty?
115
+ puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
116
+ exit!
117
+ end
118
+ unless Dir['VERSION*'].empty?
119
+ puts "A `VERSION` file at root level violates Gem best practices."
120
+ exit!
121
+ end
122
+ end
data/bin/hitch CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib hitch]))
4
- require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib hitch version]))
5
4
 
6
5
  args = ARGV
7
6
  options = []
@@ -12,6 +11,9 @@ opts = OptionParser.new do |opts|
12
11
  opts.on("-s", "--setup", "Print out shell goodies") do
13
12
  options = [:setup]
14
13
  end
14
+ opts.on("--setup-path", "Print out path to shell goodies") do
15
+ options = [:print_setup_path]
16
+ end
15
17
  opts.on("-e N", "--expire N", Integer, "Expire pair information in N hours.") do |n|
16
18
  options = [:expire, n]
17
19
  end
data/hitch.gemspec ADDED
@@ -0,0 +1,60 @@
1
+ # -*- encoding: utf-8 -*-
2
+ Gem::Specification.new do |s|
3
+ s.specification_version = 2 if s.respond_to? :specification_version=
4
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
5
+ s.rubygems_version = '1.3.5'
6
+
7
+ s.name = %q{hitch}
8
+ s.version = '1.0.0'
9
+ s.date = Time.now.strftime('%F')
10
+
11
+ s.description = %q{Git author attribution helper for pair programmers.}
12
+ s.summary = %q{Hitch allows developers to be properly credited when Pair Programming and using Git.}
13
+ s.authors = [%q{Rogelio J. Samour}]
14
+ s.email = ["rogelio@therubymug.com"]
15
+ s.homepage = %q{http://github.com/therubymug/hitch}
16
+ s.require_paths = %w[lib]
17
+ s.extra_rdoc_files = %w[README.md LICENSE.md]
18
+ s.rdoc_options = [%q{--charset=UTF-8}]
19
+
20
+ s.executables = [%q{hitch}]
21
+ if s.respond_to? :specification_version then
22
+ s.specification_version = 3
23
+
24
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
25
+ s.add_development_dependency(%q<rspec>, [">= 2.6.0"])
26
+ s.add_runtime_dependency(%q<highline>, [">= 1.6.2"])
27
+ else
28
+ s.add_dependency(%q<rspec>, [">= 2.6.0"])
29
+ s.add_dependency(%q<highline>, [">= 1.6.2"])
30
+ end
31
+ else
32
+ s.add_dependency(%q<rspec>, [">= 2.6.0"])
33
+ s.add_dependency(%q<highline>, [">= 1.6.2"])
34
+ end
35
+
36
+ ## Leave this section as-is. It will be automatically generated from the
37
+ ## contents of your Git repository via the gemspec task. DO NOT REMOVE
38
+ ## THE MANIFEST COMMENTS, they are used as delimiters by the task.
39
+ # = MANIFEST =
40
+ s.files = %w[
41
+ Gemfile
42
+ Gemfile.lock
43
+ LICENSE.md
44
+ README.md
45
+ Rakefile
46
+ bin/hitch
47
+ hitch.gemspec
48
+ lib/hitch.rb
49
+ lib/hitch/author.rb
50
+ lib/hitch/hitch.sh
51
+ lib/hitch/ui.rb
52
+ spec/hitch/author_spec.rb
53
+ spec/hitch/ui_spec.rb
54
+ spec/hitch_spec.rb
55
+ spec/spec_helper.rb
56
+ ]
57
+ # = MANIFEST =
58
+
59
+ s.test_files = s.files.grep(%r{^spec/})
60
+ end
data/lib/hitch.rb CHANGED
@@ -6,6 +6,8 @@ require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib hitch ui]))
6
6
 
7
7
  module Hitch
8
8
 
9
+ VERSION = '1.0.0'
10
+
9
11
  def self.print_info
10
12
  if Hitch.pairing? && STDOUT.tty?
11
13
  Hitch::UI.highline.say("#{Hitch.git_author_name} <#{Hitch.git_author_email}>")
@@ -54,7 +56,7 @@ module Hitch
54
56
  if Hitch::Author.find(author)
55
57
  config[:current_pair] << author
56
58
  else
57
- if new_author = Hitch::UI.prompt_for_pair(author)
59
+ if Hitch::UI.prompt_for_pair(author)
58
60
  config[:current_pair] << author
59
61
  end
60
62
  end
@@ -86,19 +88,16 @@ module Hitch
86
88
  group_email.split('@').last
87
89
  end
88
90
 
91
+ def self.setup_path
92
+ File.join(File.dirname(__FILE__), 'hitch', 'hitch.sh')
93
+ end
94
+
95
+ def self.print_setup_path
96
+ puts setup_path
97
+ end
98
+
89
99
  def self.setup
90
- Hitch::UI.highline.say <<-stp
91
-
92
- # Add the following to your ~/.bashrc or ~/.zshrc
93
- hitch() {
94
- command hitch "$@"
95
- if [[ -s "$HOME/.hitch_export_authors" ]] ; then source "$HOME/.hitch_export_authors" ; fi
96
- }
97
- alias unhitch='hitch -u'
98
- # Uncomment to persist pair info between terminal instances
99
- # hitch
100
-
101
- stp
100
+ Hitch::UI.highline.say(File.read(setup_path))
102
101
  end
103
102
 
104
103
  def self.write_file
@@ -0,0 +1,12 @@
1
+ # Add the following to your ~/.bashrc or ~/.zshrc
2
+ #
3
+ # Alternatively, copy/symlink this file and source in your shell. See `hitch --setup-path`.
4
+
5
+ hitch() {
6
+ command hitch "$@"
7
+ if [[ -s "$HOME/.hitch_export_authors" ]] ; then source "$HOME/.hitch_export_authors" ; fi
8
+ }
9
+ alias unhitch='hitch -u'
10
+
11
+ # Uncomment to persist pair info between terminal instances
12
+ # hitch
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hitch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-02 00:00:00.000000000Z
12
+ date: 2013-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70229657686720 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 2.6.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70229657686720
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 2.6.0
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: highline
27
- requirement: &70229657686240 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,22 +37,33 @@ dependencies:
32
37
  version: 1.6.2
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70229657686240
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.6.2
36
46
  description: Git author attribution helper for pair programmers.
37
- email: rogelio@therubymug.com
47
+ email:
48
+ - rogelio@therubymug.com
38
49
  executables:
39
50
  - hitch
40
51
  extensions: []
41
- extra_rdoc_files: []
52
+ extra_rdoc_files:
53
+ - README.md
54
+ - LICENSE.md
42
55
  files:
43
- - lib/hitch/author.rb
44
- - lib/hitch/ui.rb
45
- - lib/hitch/version.rb
46
- - lib/hitch.rb
47
- - bin/hitch
48
- - Rakefile
56
+ - Gemfile
57
+ - Gemfile.lock
49
58
  - LICENSE.md
50
59
  - README.md
60
+ - Rakefile
61
+ - bin/hitch
62
+ - hitch.gemspec
63
+ - lib/hitch.rb
64
+ - lib/hitch/author.rb
65
+ - lib/hitch/hitch.sh
66
+ - lib/hitch/ui.rb
51
67
  - spec/hitch/author_spec.rb
52
68
  - spec/hitch/ui_spec.rb
53
69
  - spec/hitch_spec.rb
@@ -70,10 +86,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
86
  requirements:
71
87
  - - ! '>='
72
88
  - !ruby/object:Gem::Version
73
- version: 1.3.6
89
+ version: '0'
74
90
  requirements: []
75
91
  rubyforge_project:
76
- rubygems_version: 1.8.15
92
+ rubygems_version: 1.8.25
77
93
  signing_key:
78
94
  specification_version: 3
79
95
  summary: Hitch allows developers to be properly credited when Pair Programming and
data/lib/hitch/version.rb DELETED
@@ -1,3 +0,0 @@
1
- module Hitch
2
- VERSION = "0.7.1"
3
- end