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 +5 -5
- data/.gitignore +25 -23
- data/Gemfile +20 -16
- data/LICENSE +20 -20
- data/README.rdoc +41 -20
- data/Rakefile +75 -67
- data/VERSION.yml +1 -1
- data/gitable.gemspec +7 -4
- data/lib/gitable.rb +5 -4
- data/lib/gitable/scp_uri.rb +37 -31
- data/lib/gitable/uri.rb +75 -32
- data/spec/gitable_spec.rb +427 -380
- data/spec/spec.opts +1 -1
- data/spec/spec_helper.rb +9 -9
- metadata +15 -6
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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
gem '
|
12
|
-
gem '
|
13
|
-
gem '
|
14
|
-
gem '
|
15
|
-
gem '
|
16
|
-
|
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.
|
data/README.rdoc
CHANGED
@@ -1,20 +1,41 @@
|
|
1
|
-
= Gitable
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
uri
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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 '
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
gem.
|
9
|
-
gem.
|
10
|
-
gem.
|
11
|
-
gem.
|
12
|
-
gem.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
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
|
data/VERSION.yml
CHANGED
data/gitable.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gitable}
|
8
|
-
s.version = "0.0.
|
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-
|
13
|
-
s.description = %q{
|
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{
|
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
|
|
data/lib/gitable.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
autoload :
|
4
|
-
|
1
|
+
# @author Martin Emde
|
2
|
+
module Gitable
|
3
|
+
autoload :URI, 'gitable/uri'
|
4
|
+
autoload :ScpURI, 'gitable/scp_uri'
|
5
|
+
end
|
data/lib/gitable/scp_uri.rb
CHANGED
@@ -1,31 +1,37 @@
|
|
1
|
-
require 'gitable/uri'
|
2
|
-
|
3
|
-
module Gitable
|
4
|
-
class ScpURI < Gitable::URI
|
5
|
-
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|