gitable 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.document CHANGED
@@ -1,5 +1,5 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore CHANGED
@@ -1,23 +1,25 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- gbin
18
- coverage
19
- rdoc
20
- pkg
21
- vendor/gems
22
-
23
- ## PROJECT::SPECIFIC
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ gbin
18
+ coverage
19
+ doc
20
+ rdoc
21
+ pkg
22
+ vendor/gems
23
+ .yardoc
24
+
25
+ ## PROJECT::SPECIFIC
data/Gemfile CHANGED
@@ -1,16 +1,20 @@
1
- source 'http://gemcutter.org'
2
-
3
- bin_path 'gbin'
4
- disable_system_gems
5
-
6
- gem 'addressable', :require_as => 'addressable/uri'
7
-
8
- only :test do
9
- gem 'jeweler'
10
- gem 'bundler'
11
- gem 'rspec', :require_as => 'spec'
12
- gem 'ZenTest'
13
- gem 'rake'
14
- gem 'rcov'
15
- gem 'ruby-debug'
16
- end
1
+ source 'http://gemcutter.org'
2
+
3
+ bin_path 'gbin'
4
+ disable_system_gems
5
+
6
+ only :runtime do
7
+ gem 'addressable', :require_as => 'addressable/uri'
8
+ end
9
+
10
+ only :development do
11
+ gem 'bundler'
12
+ gem 'jeweler'
13
+ gem 'bundler'
14
+ gem 'rspec', :require_as => 'spec'
15
+ gem 'ZenTest'
16
+ gem 'rake'
17
+ gem 'rcov'
18
+ gem 'ruby-debug'
19
+ gem 'yard'
20
+ end
data/LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright (c) 2009 Martin Emde
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.
1
+ Copyright (c) 2009 Martin Emde
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.
@@ -1,20 +1,41 @@
1
- = Gitable
2
-
3
- Like Addressable::URI but for Git
4
-
5
- require 'gitable/uri'
6
- uri = Gitable::URI.parse('git@github.com:martinemde/gitable.git')
7
-
8
- uri.path # => 'martinemde/gitable.git'
9
- uri.user # => 'git'
10
- uri.host # => 'github.com'
11
-
12
- Works with any valid Git uri.
13
-
14
- == That's it?
15
-
16
- yep. What else did you expect?
17
-
18
- == Copyright
19
-
20
- Copyright (c) 2010 Martin Emde. See LICENSE for details.
1
+ = Gitable
2
+
3
+ == +Addressable::URI+ for Git.
4
+
5
+ Works with any valid Git URI.
6
+
7
+ == Example!?
8
+
9
+ require 'gitable/uri'
10
+ uri = Gitable::URI.parse('git@github.com:martinemde/gitable.git')
11
+
12
+ uri.path # => 'martinemde/gitable.git'
13
+ uri.user # => 'git'
14
+ uri.host # => 'github.com'
15
+
16
+ uri.to_s # => 'git@github.com:martinemde/gitable.git'
17
+ uri.project_name # => 'gitable'
18
+ uri.kind_of?(Addressable::URI) # => true
19
+
20
+ == heuristic_parse
21
+
22
+ You can use +Gitable::URI.heuristic_parse+ to take user input.
23
+
24
+ Currently this supports the mistake of copying the url bar instead of the git
25
+ uri for a few of the popular git webhosts. It also runs through Addressable's
26
+ heuristic_parse so it will correct some poorly typed URIs.
27
+
28
+ uri = Gitable::URI.heuristic_parse('http://github.com:martinemde/gitable')
29
+ uri.to_s # => 'git://github.com/martinemde/gitable.git'
30
+
31
+ Heuristic parse is currently fairly limited. If the url doesn't end in .git, it
32
+ switches +http://+ to +git://+ and adds .git to the basename. This works fine for
33
+ github.com and gitorious.org.
34
+
35
+ == That's it?
36
+
37
+ yep. What else did you expect? (let me know or write a patch)
38
+
39
+ == Copyright
40
+
41
+ Copyright (c) 2010 Martin Emde. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,67 +1,75 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "gitable"
8
- gem.summary = %Q{Like Addressable::URI but for Git}
9
- gem.description = %Q{Use this like an Addressable::URI that understands the various git URI formats.}
10
- gem.email = "martin.emde@gmail.com"
11
- gem.homepage = "http://github.com/martinemde/gitable"
12
- gem.authors = ["Martin Emde"]
13
- end
14
- Jeweler::GemcutterTasks.new
15
- rescue LoadError
16
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
17
- end
18
-
19
- require 'spec/rake/spectask'
20
- Spec::Rake::SpecTask.new(:spec) do |spec|
21
- spec.libs << 'lib' << 'spec'
22
- spec.spec_files = FileList['spec/**/*_spec.rb']
23
- end
24
-
25
- Spec::Rake::SpecTask.new(:rcov) do |spec|
26
- spec.libs << 'lib' << 'spec'
27
- spec.pattern = 'spec/**/*_spec.rb'
28
- spec.rcov = true
29
- end
30
-
31
- task :spec => :check_dependencies
32
-
33
- begin
34
- require 'reek/adapters/rake_task'
35
- Reek::RakeTask.new do |t|
36
- t.fail_on_error = true
37
- t.verbose = false
38
- t.source_files = 'lib/**/*.rb'
39
- end
40
- rescue LoadError
41
- task :reek do
42
- abort "Reek is not available. In order to run reek, you must: sudo gem install reek"
43
- end
44
- end
45
-
46
- begin
47
- require 'roodi'
48
- require 'roodi_task'
49
- RoodiTask.new do |t|
50
- t.verbose = false
51
- end
52
- rescue LoadError
53
- task :roodi do
54
- abort "Roodi is not available. In order to run roodi, you must: sudo gem install roodi"
55
- end
56
- end
57
-
58
- task :default => :spec
59
-
60
- begin
61
- require 'yard'
62
- YARD::Rake::YardocTask.new
63
- rescue LoadError
64
- task :yardoc do
65
- abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
66
- end
67
- end
1
+ require 'bundler'
2
+ Bundler.require_env
3
+ require 'rake'
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gem|
8
+ gem.name = "gitable"
9
+ gem.summary = %Q{Addressable::URI for Git}
10
+ gem.description = %Q{It's like Addressable::URI but for Git. Gitable.}
11
+ gem.email = "martin.emde@gmail.com"
12
+ gem.homepage = "http://github.com/martinemde/gitable"
13
+ gem.authors = ["Martin Emde"]
14
+
15
+ bundle = Bundler::Bundle.load(File.dirname(__FILE__) + '/Gemfile')
16
+ bundle.environment.dependencies.each do |d|
17
+ if d.only && d.only.include?('runtime')
18
+ gem.add_dependency d.name, d.version.to_s
19
+ end
20
+ end
21
+ end
22
+ Jeweler::GemcutterTasks.new
23
+ rescue LoadError
24
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
25
+ end
26
+
27
+ require 'spec/rake/spectask'
28
+ Spec::Rake::SpecTask.new(:spec) do |spec|
29
+ spec.libs << 'lib' << 'spec'
30
+ spec.spec_files = FileList['spec/**/*_spec.rb']
31
+ end
32
+
33
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
34
+ spec.libs << 'lib' << 'spec'
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :spec => :check_dependencies
40
+
41
+ begin
42
+ require 'reek/adapters/rake_task'
43
+ Reek::RakeTask.new do |t|
44
+ t.fail_on_error = true
45
+ t.verbose = false
46
+ t.source_files = 'lib/**/*.rb'
47
+ end
48
+ rescue LoadError
49
+ task :reek do
50
+ abort "Reek is not available. In order to run reek, you must: sudo gem install reek"
51
+ end
52
+ end
53
+
54
+ begin
55
+ require 'roodi'
56
+ require 'roodi_task'
57
+ RoodiTask.new do |t|
58
+ t.verbose = false
59
+ end
60
+ rescue LoadError
61
+ task :roodi do
62
+ abort "Roodi is not available. In order to run roodi, you must: sudo gem install roodi"
63
+ end
64
+ end
65
+
66
+ task :default => :spec
67
+
68
+ begin
69
+ require 'yard'
70
+ YARD::Rake::YardocTask.new
71
+ rescue LoadError
72
+ task :yardoc do
73
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
74
+ end
75
+ end
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
- :patch: 1
4
+ :patch: 2
5
5
 
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gitable}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Martin Emde"]
12
- s.date = %q{2010-01-12}
13
- s.description = %q{Use this like an Addressable::URI that understands the various git URI formats.}
12
+ s.date = %q{2010-01-14}
13
+ s.description = %q{It's like Addressable::URI but for Git. Gitable.}
14
14
  s.email = %q{martin.emde@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
36
36
  s.rdoc_options = ["--charset=UTF-8"]
37
37
  s.require_paths = ["lib"]
38
38
  s.rubygems_version = %q{1.3.5}
39
- s.summary = %q{Like Addressable::URI but for Git}
39
+ s.summary = %q{Addressable::URI for Git}
40
40
  s.test_files = [
41
41
  "spec/gitable_spec.rb",
42
42
  "spec/spec_helper.rb"
@@ -47,9 +47,12 @@ Gem::Specification.new do |s|
47
47
  s.specification_version = 3
48
48
 
49
49
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
50
+ s.add_runtime_dependency(%q<addressable>, [">= 0"])
50
51
  else
52
+ s.add_dependency(%q<addressable>, [">= 0"])
51
53
  end
52
54
  else
55
+ s.add_dependency(%q<addressable>, [">= 0"])
53
56
  end
54
57
  end
55
58
 
@@ -1,4 +1,5 @@
1
- module Gitable
2
- autoload :URI, 'gitable/uri'
3
- autoload :ScpURI, 'gitable/scp_uri'
4
- end
1
+ # @author Martin Emde
2
+ module Gitable
3
+ autoload :URI, 'gitable/uri'
4
+ autoload :ScpURI, 'gitable/scp_uri'
5
+ end
@@ -1,31 +1,37 @@
1
- require 'gitable/uri'
2
-
3
- module Gitable
4
- class ScpURI < Gitable::URI
5
- # Keep URIs like this relative:
6
- #
7
- # git@github.com:martinemde/gitable.git
8
- #
9
- # Without breaking URIs like these:
10
- #
11
- # git@host.com:/home/martinemde/gitable.git
12
- #
13
- def path=(new_path)
14
- super
15
- if new_path[0..0] != "/"
16
- @path = path.sub(%r|^/|,'')
17
- end
18
- path
19
- end
20
-
21
- def to_s
22
- @uri_string ||= begin
23
- uri_string = "#{authority}:#{path.to_s}"
24
- if uri_string.respond_to?(:force_encoding)
25
- uri_string.force_encoding(Encoding::UTF_8)
26
- end
27
- uri_string
28
- end
29
- end
30
- end
31
- end
1
+ require 'gitable/uri'
2
+
3
+ module Gitable
4
+ class ScpURI < Gitable::URI
5
+
6
+ # Keep URIs like this relative:
7
+ #
8
+ # git@github.com:martinemde/gitable.git
9
+ #
10
+ # Without breaking URIs like these:
11
+ #
12
+ # git@host.com:/home/martinemde/gitable.git
13
+ #
14
+ # @param [String] new_path The new path to be set.
15
+ # @return [String] The same path passed in.
16
+ def path=(new_path)
17
+ super
18
+ if new_path[0..0] != "/"
19
+ @path = path.sub(%r|^/|,'')
20
+ end
21
+ path
22
+ end
23
+
24
+ # Get the URI as a string in the same form it was input.
25
+ #
26
+ # @return [String] The URI as a string.
27
+ def to_s
28
+ @uri_string ||= begin
29
+ uri_string = "#{authority}:#{path.to_s}"
30
+ if uri_string.respond_to?(:force_encoding)
31
+ uri_string.force_encoding(Encoding::UTF_8)
32
+ end
33
+ uri_string
34
+ end
35
+ end
36
+ end
37
+ end