gitjour 6.0.9 → 6.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +13 -0
- data/Manifest.txt +1 -18
- data/README.txt +64 -5
- data/Rakefile +15 -4
- data/bin/gitjour +3 -1
- data/lib/gitjour.rb +188 -1
- data/test/test_gitjour.rb +17 -5
- data/test/test_helper.rb +1 -0
- metadata +30 -31
- data/License.txt +0 -20
- data/config/hoe.rb +0 -71
- data/config/requirements.rb +0 -17
- data/lib/gitjour/application.rb +0 -95
- data/lib/gitjour/version.rb +0 -9
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -74
- data/setup.rb +0 -1585
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
- data/tasks/website.rake +0 -17
- data/website/index.html +0 -11
- data/website/index.txt +0 -39
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -138
- data/website/template.rhtml +0 -48
data/History.txt
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
== 6.4.0 2009-03-13
|
2
|
+
|
3
|
+
* Add pull command
|
4
|
+
* Support git 1.6+
|
5
|
+
* Require dnssd 0.7.1+ to support Avahi
|
6
|
+
|
7
|
+
== 6.3.0 2008-08-23
|
8
|
+
|
9
|
+
* Simplify project layout, remove newgem dependency
|
10
|
+
* Add a prefix to projects' served name
|
11
|
+
|
12
|
+
[...]
|
13
|
+
|
1
14
|
== 0.0.1 2008-05-29
|
2
15
|
|
3
16
|
* 1 major enhancement:
|
data/Manifest.txt
CHANGED
@@ -1,25 +1,8 @@
|
|
1
|
-
bin/gitjour
|
2
1
|
History.txt
|
3
|
-
License.txt
|
4
2
|
Manifest.txt
|
5
3
|
README.txt
|
6
4
|
Rakefile
|
7
|
-
|
8
|
-
config/requirements.rb
|
5
|
+
bin/gitjour
|
9
6
|
lib/gitjour.rb
|
10
|
-
lib/gitjour/application.rb
|
11
|
-
lib/gitjour/version.rb
|
12
|
-
script/destroy
|
13
|
-
script/generate
|
14
|
-
script/txt2html
|
15
|
-
setup.rb
|
16
|
-
tasks/deployment.rake
|
17
|
-
tasks/environment.rake
|
18
|
-
tasks/website.rake
|
19
7
|
test/test_gitjour.rb
|
20
8
|
test/test_helper.rb
|
21
|
-
website/index.html
|
22
|
-
website/index.txt
|
23
|
-
website/javascripts/rounded_corners_lite.inc.js
|
24
|
-
website/stylesheets/screen.css
|
25
|
-
website/template.rhtml
|
data/README.txt
CHANGED
@@ -1,8 +1,67 @@
|
|
1
|
-
|
1
|
+
= gitjour
|
2
2
|
|
3
|
-
|
3
|
+
* http://github.com/technomancy/gitjour
|
4
4
|
|
5
|
-
|
5
|
+
== DESCRIPTION:
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
Automates zeroconf-powered serving and cloning of git repositories.
|
8
|
+
|
9
|
+
== SYNOPSIS:
|
10
|
+
|
11
|
+
% gitjour serve [project_dir] [name_to_advertise_as]
|
12
|
+
Registered phil-gitjour on port 9418. Starting service.
|
13
|
+
|
14
|
+
% gitjour list
|
15
|
+
Gathering for up to 5 seconds...
|
16
|
+
=== phil-gitjour on pdp10.local.:9418 ===
|
17
|
+
gitjour (clone|pull) phil-gitjour
|
18
|
+
|
19
|
+
% gitjour clone phil-gitjour
|
20
|
+
Gathering for up to 5 seconds...
|
21
|
+
Connecting to pdp10.local.:9418
|
22
|
+
Initialized empty Git repository in /home/phil/phil-gitjour/.git/
|
23
|
+
[...]
|
24
|
+
Resolving deltas: 100% (342/342), done.
|
25
|
+
|
26
|
+
% gitjour pull phil-gitjour
|
27
|
+
Gathering for up to 5 seconds...
|
28
|
+
Connecting to pdp10.local.:9418
|
29
|
+
From git://pdp10.local.:9418
|
30
|
+
* branch master -> FETCH_HEAD
|
31
|
+
Updating 5ede61a..781bc4d
|
32
|
+
[...]
|
33
|
+
4 files changed, 35 insertions(+), 80 deletions(-)
|
34
|
+
|
35
|
+
== REQUIREMENTS:
|
36
|
+
|
37
|
+
* dnssd, which requires development headers to bonjour or avahi
|
38
|
+
See dnssd documentation for details.
|
39
|
+
|
40
|
+
== INSTALL:
|
41
|
+
|
42
|
+
* sudo gem install gitjour
|
43
|
+
|
44
|
+
== LICENSE:
|
45
|
+
|
46
|
+
(The MIT License)
|
47
|
+
|
48
|
+
Copyright (c) 2008 Chad Fowler, Evan Phoenix, and Rich Kilmer
|
49
|
+
|
50
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
51
|
+
a copy of this software and associated documentation files (the
|
52
|
+
'Software'), to deal in the Software without restriction, including
|
53
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
54
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
55
|
+
permit persons to whom the Software is furnished to do so, subject to
|
56
|
+
the following conditions:
|
57
|
+
|
58
|
+
The above copyright notice and this permission notice shall be
|
59
|
+
included in all copies or substantial portions of the Software.
|
60
|
+
|
61
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
62
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
63
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
64
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
65
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
66
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
67
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,4 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require './lib/gitjour.rb'
|
6
|
+
|
7
|
+
Hoe.new('gitjour', Gitjour::VERSION) do |p|
|
8
|
+
p.extra_deps << ['dnssd', "~> 0.7.1"]
|
9
|
+
p.developer('Chad Fowler', 'chad@chadfowler.com')
|
10
|
+
p.developer('Evan Phoenix', 'evan@fallingsnow.net')
|
11
|
+
p.developer('Rich Kilmer', 'rich@example.com')
|
12
|
+
p.developer('Phil Hagelberg', 'technomancy@gmail.com')
|
13
|
+
end
|
14
|
+
|
15
|
+
# vim: syntax=Ruby
|
data/bin/gitjour
CHANGED
data/lib/gitjour.rb
CHANGED
@@ -1 +1,188 @@
|
|
1
|
-
require '
|
1
|
+
require 'rubygems'
|
2
|
+
require 'dnssd'
|
3
|
+
require 'set'
|
4
|
+
|
5
|
+
Thread.abort_on_exception = true
|
6
|
+
|
7
|
+
module Gitjour
|
8
|
+
VERSION = "6.4.0"
|
9
|
+
GitService = Struct.new(:name, :host, :port, :description)
|
10
|
+
|
11
|
+
class Application
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def run(*args)
|
15
|
+
case args.shift
|
16
|
+
when "list"
|
17
|
+
list
|
18
|
+
when "pull"
|
19
|
+
pull(*args)
|
20
|
+
when "clone"
|
21
|
+
clone(*args)
|
22
|
+
when "serve"
|
23
|
+
serve(*args)
|
24
|
+
when "remote"
|
25
|
+
remote(*args)
|
26
|
+
else
|
27
|
+
help
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def list
|
34
|
+
service_list.each do |service|
|
35
|
+
puts "=== #{service.name} on #{service.host}:#{service.port} ==="
|
36
|
+
puts " gitjour (clone|pull) #{service.name}"
|
37
|
+
if service.description != '' && service.description !~ /^Unnamed repository/
|
38
|
+
puts " #{service.description}"
|
39
|
+
end
|
40
|
+
puts
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def pull(repository_name, branch = "master")
|
45
|
+
service = locate_repo(repository_name) or
|
46
|
+
abort "ERROR: Unable to find project named '#{repository_name}'"
|
47
|
+
|
48
|
+
puts "Connecting to #{service.host}:#{service.port}"
|
49
|
+
|
50
|
+
system "git pull git://#{service.host}:#{service.port}/ #{branch}"
|
51
|
+
end
|
52
|
+
|
53
|
+
def clone(repository_name, *rest)
|
54
|
+
dir = rest.shift || repository_name
|
55
|
+
if File.exists?(dir)
|
56
|
+
abort "ERROR: Clone directory '#{dir}' already exists."
|
57
|
+
end
|
58
|
+
|
59
|
+
puts "Cloning '#{repository_name}' into directory '#{dir}'..."
|
60
|
+
|
61
|
+
service = locate_repo(repository_name) or
|
62
|
+
abort "ERROR: Unable to find project named '#{repository_name}'"
|
63
|
+
|
64
|
+
puts "Connecting to #{service.host}:#{service.port}"
|
65
|
+
|
66
|
+
system "git clone git://#{service.host}:#{service.port}/ #{dir}"
|
67
|
+
end
|
68
|
+
|
69
|
+
def remote(repository_name, *rest)
|
70
|
+
dir = rest.shift || repository_name
|
71
|
+
service = locate_repo repository_name
|
72
|
+
system "git remote add #{dir} git://#{service.host}:#{service.port}/"
|
73
|
+
end
|
74
|
+
|
75
|
+
def serve(path=Dir.pwd, *rest)
|
76
|
+
path = File.expand_path(path)
|
77
|
+
name = rest.shift || File.basename(path)
|
78
|
+
port = rest.shift || 9418
|
79
|
+
|
80
|
+
# If the name starts with ^, then don't apply the prefix
|
81
|
+
if name[0] == ?^
|
82
|
+
name = name[1..-1]
|
83
|
+
else
|
84
|
+
prefix = `git config --get gitjour.prefix`.chomp
|
85
|
+
prefix = ENV["USER"] if prefix.empty?
|
86
|
+
name = [prefix, name].compact.join("-")
|
87
|
+
end
|
88
|
+
|
89
|
+
if File.exists?("#{path}/.git")
|
90
|
+
announce_repo(path, name, port.to_i)
|
91
|
+
else
|
92
|
+
Dir["#{path}/*"].each do |dir|
|
93
|
+
if File.directory?(dir)
|
94
|
+
name = File.basename(dir)
|
95
|
+
announce_repo(dir, name, 9418)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
`git daemon --verbose --export-all --port=#{port} --base-path=#{path} --base-path-relaxed`
|
101
|
+
end
|
102
|
+
|
103
|
+
def help
|
104
|
+
puts "Gitjour #{Gitjour::VERSION}"
|
105
|
+
puts "Serve up and use git repositories via ZeroConf."
|
106
|
+
puts "\nUsage: gitjour <command> [args]"
|
107
|
+
puts
|
108
|
+
puts " list"
|
109
|
+
puts " Lists available repositories."
|
110
|
+
puts
|
111
|
+
puts " clone <project> [<directory>]"
|
112
|
+
puts " Clone a gitjour-served repository."
|
113
|
+
puts
|
114
|
+
puts " serve <path_to_project> [<name_of_project>] [<port>] or"
|
115
|
+
puts " <path_to_projects>"
|
116
|
+
puts " Serve up the current directory or projects via gitjour."
|
117
|
+
puts
|
118
|
+
puts " The name of your project is automatically prefixed with"
|
119
|
+
puts " `git config --get gitjour.prefix` or your username (preference"
|
120
|
+
puts " in that order). If you don't want a prefix, put a ^ on the front"
|
121
|
+
puts " of the name_of_project (the ^ is removed before announcing)."
|
122
|
+
puts
|
123
|
+
puts " pull <project> [<branch>]"
|
124
|
+
puts " Pull from a gitjour-served repository."
|
125
|
+
puts
|
126
|
+
puts " remote <project> [<name>]"
|
127
|
+
puts " Add a ZeroConf remote into your current repository."
|
128
|
+
puts " Optionally pass name to not use pwd."
|
129
|
+
puts
|
130
|
+
end
|
131
|
+
|
132
|
+
class Done < RuntimeError; end
|
133
|
+
|
134
|
+
def discover(timeout=5)
|
135
|
+
waiting_thread = Thread.current
|
136
|
+
|
137
|
+
dns = DNSSD.browse "_git._tcp" do |reply|
|
138
|
+
DNSSD.resolve reply.name, reply.type, reply.domain do |resolve_reply|
|
139
|
+
service = GitService.new(reply.name,
|
140
|
+
resolve_reply.target,
|
141
|
+
resolve_reply.port,
|
142
|
+
resolve_reply.text_record['description'].to_s)
|
143
|
+
begin
|
144
|
+
yield service
|
145
|
+
rescue Done
|
146
|
+
waiting_thread.run
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
puts "Gathering for up to #{timeout} seconds..."
|
152
|
+
sleep timeout
|
153
|
+
dns.stop
|
154
|
+
end
|
155
|
+
|
156
|
+
def locate_repo(name)
|
157
|
+
found = nil
|
158
|
+
|
159
|
+
discover do |obj|
|
160
|
+
if obj.name == name
|
161
|
+
found = obj
|
162
|
+
raise Done
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
return found
|
167
|
+
end
|
168
|
+
|
169
|
+
def service_list
|
170
|
+
list = Set.new
|
171
|
+
discover { |obj| list << obj }
|
172
|
+
|
173
|
+
return list
|
174
|
+
end
|
175
|
+
|
176
|
+
def announce_repo(path, name, port)
|
177
|
+
return unless File.exists?("#{path}/.git")
|
178
|
+
|
179
|
+
tr = DNSSD::TextRecord.new
|
180
|
+
tr['description'] = File.read("#{path}/.git/description") rescue "a git project"
|
181
|
+
|
182
|
+
DNSSD.register(name, "_git._tcp", 'local', port, tr.encode) do |rr|
|
183
|
+
puts "Registered #{name} on port #{port}. Starting service."
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
data/test/test_gitjour.rb
CHANGED
@@ -1,11 +1,23 @@
|
|
1
|
+
require 'net/telnet'
|
1
2
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
3
|
|
3
4
|
class TestGitjour < Test::Unit::TestCase
|
5
|
+
def test_thread_friendly
|
6
|
+
repo = File.dirname(__FILE__) + '/repo'
|
7
|
+
port = 3289
|
8
|
+
FileUtils.rm_rf repo
|
9
|
+
`mkdir -p #{repo}; cd #{repo}; git init`
|
10
|
+
|
11
|
+
thread = Thread.new do
|
12
|
+
Gitjour::Application.send(:serve, repo, 'test', port)
|
13
|
+
end
|
4
14
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
15
|
+
sleep 1
|
16
|
+
Net::Telnet::new("Host" => "localhost", "Port" => port)
|
17
|
+
|
18
|
+
thread.kill
|
19
|
+
assert_raises(Errno::ECONNREFUSED) do
|
20
|
+
Net::Telnet::new("Host" => "localhost", "Port" => port)
|
21
|
+
end
|
10
22
|
end
|
11
23
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,68 +1,67 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitjour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0
|
4
|
+
version: 6.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Fowler
|
8
|
-
- Rich Kilmer
|
9
8
|
- Evan Phoenix
|
9
|
+
- Rich Kilmer
|
10
|
+
- Phil Hagelberg
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
14
|
|
14
|
-
date:
|
15
|
+
date: 2009-03-16 00:00:00 -07:00
|
15
16
|
default_executable:
|
16
17
|
dependencies:
|
17
18
|
- !ruby/object:Gem::Dependency
|
18
19
|
name: dnssd
|
20
|
+
type: :runtime
|
21
|
+
version_requirement:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.7.1
|
27
|
+
version:
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: hoe
|
30
|
+
type: :development
|
19
31
|
version_requirement:
|
20
32
|
version_requirements: !ruby/object:Gem::Requirement
|
21
33
|
requirements:
|
22
34
|
- - ">="
|
23
35
|
- !ruby/object:Gem::Version
|
24
|
-
version:
|
36
|
+
version: 1.9.0
|
25
37
|
version:
|
26
|
-
description: Automates
|
27
|
-
email:
|
38
|
+
description: Automates zeroconf-powered serving and cloning of git repositories.
|
39
|
+
email:
|
40
|
+
- chad@chadfowler.com
|
41
|
+
- evan@fallingsnow.net
|
42
|
+
- rich@example.com
|
43
|
+
- technomancy@gmail.com
|
28
44
|
executables:
|
29
45
|
- gitjour
|
30
46
|
extensions: []
|
31
47
|
|
32
48
|
extra_rdoc_files:
|
33
49
|
- History.txt
|
34
|
-
- License.txt
|
35
50
|
- Manifest.txt
|
36
51
|
- README.txt
|
37
|
-
- website/index.txt
|
38
52
|
files:
|
39
|
-
- bin/gitjour
|
40
53
|
- History.txt
|
41
|
-
- License.txt
|
42
54
|
- Manifest.txt
|
43
55
|
- README.txt
|
44
56
|
- Rakefile
|
45
|
-
-
|
46
|
-
- config/requirements.rb
|
57
|
+
- bin/gitjour
|
47
58
|
- lib/gitjour.rb
|
48
|
-
- lib/gitjour/application.rb
|
49
|
-
- lib/gitjour/version.rb
|
50
|
-
- script/destroy
|
51
|
-
- script/generate
|
52
|
-
- script/txt2html
|
53
|
-
- setup.rb
|
54
|
-
- tasks/deployment.rake
|
55
|
-
- tasks/environment.rake
|
56
|
-
- tasks/website.rake
|
57
59
|
- test/test_gitjour.rb
|
58
60
|
- test/test_helper.rb
|
59
|
-
- website/index.html
|
60
|
-
- website/index.txt
|
61
|
-
- website/javascripts/rounded_corners_lite.inc.js
|
62
|
-
- website/stylesheets/screen.css
|
63
|
-
- website/template.rhtml
|
64
61
|
has_rdoc: true
|
65
|
-
homepage: http://gitjour
|
62
|
+
homepage: http://github.com/technomancy/gitjour
|
63
|
+
licenses: []
|
64
|
+
|
66
65
|
post_install_message:
|
67
66
|
rdoc_options:
|
68
67
|
- --main
|
@@ -84,10 +83,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
83
|
requirements: []
|
85
84
|
|
86
85
|
rubyforge_project: gitjour
|
87
|
-
rubygems_version: 1.
|
86
|
+
rubygems_version: 1.3.1.2403
|
88
87
|
signing_key:
|
89
|
-
specification_version:
|
90
|
-
summary: Automates
|
88
|
+
specification_version: 3
|
89
|
+
summary: Automates zeroconf-powered serving and cloning of git repositories.
|
91
90
|
test_files:
|
92
|
-
- test/test_gitjour.rb
|
93
91
|
- test/test_helper.rb
|
92
|
+
- test/test_gitjour.rb
|