technomancy-gitjour 6.3.0 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
- config/hoe.rb
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
- README
1
+ = gitjour
2
2
 
3
- DEVELOPMENT
3
+ * http://github.com/technomancy/gitjour
4
4
 
5
- How to test from the console:
5
+ == DESCRIPTION:
6
6
 
7
- irb -r 'lib/gitjour/application'
8
- > Gitjour::Application.run "list"
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
- require 'config/requirements'
2
- require 'config/hoe' # setup Hoe + all gem configuration
3
-
4
- Dir['tasks/**/*.rake'].each { |rake| load rake }
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
File without changes
data/lib/gitjour.rb CHANGED
@@ -1 +1,188 @@
1
- require File.dirname(__FILE__) + '/gitjour/application'
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
metadata CHANGED
@@ -1,77 +1,65 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: technomancy-gitjour
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.3.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: 2008-07-24 00:00:00 -07:00
15
+ date: 2009-03-13 00:00:00 -07:00
15
16
  default_executable: gitjour
16
17
  dependencies:
17
18
  - !ruby/object:Gem::Dependency
18
- name: technomancy-dnssd
19
+ name: dnssd
20
+ type: :runtime
19
21
  version_requirement:
20
22
  version_requirements: !ruby/object:Gem::Requirement
21
23
  requirements:
22
- - - ">="
24
+ - - ~>
23
25
  - !ruby/object:Gem::Version
24
- version: 0.6.0
26
+ version: 0.7.1
25
27
  version:
26
28
  - !ruby/object:Gem::Dependency
27
29
  name: hoe
30
+ type: :development
28
31
  version_requirement:
29
32
  version_requirements: !ruby/object:Gem::Requirement
30
33
  requirements:
31
34
  - - ">="
32
35
  - !ruby/object:Gem::Version
33
- version: 1.7.0
36
+ version: 1.9.0
34
37
  version:
35
- description: Automates DNSSD-powered serving and cloning of git repositories.
36
- email: chad@chadfowler.com
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
37
44
  executables:
38
45
  - gitjour
39
46
  extensions: []
40
47
 
41
48
  extra_rdoc_files:
42
49
  - History.txt
43
- - License.txt
44
50
  - Manifest.txt
45
51
  - README.txt
46
- - website/index.txt
47
52
  files:
48
- - bin/gitjour
49
53
  - History.txt
50
- - License.txt
51
54
  - Manifest.txt
52
55
  - README.txt
53
56
  - Rakefile
54
- - config/hoe.rb
55
- - config/requirements.rb
57
+ - bin/gitjour
56
58
  - lib/gitjour.rb
57
- - lib/gitjour/application.rb
58
- - lib/gitjour/version.rb
59
- - script/destroy
60
- - script/generate
61
- - script/txt2html
62
- - setup.rb
63
- - tasks/deployment.rake
64
- - tasks/environment.rake
65
- - tasks/website.rake
66
59
  - test/test_gitjour.rb
67
60
  - test/test_helper.rb
68
- - website/index.html
69
- - website/index.txt
70
- - website/javascripts/rounded_corners_lite.inc.js
71
- - website/stylesheets/screen.css
72
- - website/template.rhtml
73
61
  has_rdoc: true
74
- homepage: http://gitjour.rubyforge.org
62
+ homepage: http://github.com/technomancy/gitjour
75
63
  post_install_message:
76
64
  rdoc_options:
77
65
  - --main
@@ -95,8 +83,8 @@ requirements: []
95
83
  rubyforge_project: gitjour
96
84
  rubygems_version: 1.2.0
97
85
  signing_key:
98
- specification_version: 2
99
- summary: Automates DNSSD-powered serving and cloning of git repositories.
86
+ specification_version: 3
87
+ summary: Automates zeroconf-powered serving and cloning of git repositories.
100
88
  test_files:
101
- - test/test_gitjour.rb
102
89
  - test/test_helper.rb
90
+ - test/test_gitjour.rb
data/License.txt DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2008 Chad Fowler, Evan Phoenix, Rich Kilmer
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/config/hoe.rb DELETED
@@ -1,71 +0,0 @@
1
- require 'gitjour/version'
2
-
3
- AUTHOR = ['Chad Fowler', 'Rich Kilmer', 'Evan Phoenix'] # can also be an array of Authors
4
- EMAIL = "chad@chadfowler.com"
5
- DESCRIPTION = "Automates DNSSD-powered serving and cloning of git repositories."
6
- GEM_NAME = 'gitjour' # what ppl will type to install your gem
7
- RUBYFORGE_PROJECT = 'gitjour' # The unix name for your project
8
- HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
- DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
-
11
- @config_file = "~/.rubyforge/user-config.yml"
12
- @config = nil
13
- RUBYFORGE_USERNAME = "chadfowler"
14
- def rubyforge_username
15
- unless @config
16
- begin
17
- @config = YAML.load(File.read(File.expand_path(@config_file)))
18
- rescue
19
- puts <<-EOS
20
- ERROR: No rubyforge config file found: #{@config_file}
21
- Run 'rubyforge setup' to prepare your env for access to Rubyforge
22
- - See http://newgem.rubyforge.org/rubyforge.html for more details
23
- EOS
24
- exit
25
- end
26
- end
27
- RUBYFORGE_USERNAME.replace @config["username"]
28
- end
29
-
30
-
31
- REV = nil
32
- # UNCOMMENT IF REQUIRED:
33
- # REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
34
- VERS = Gitjour::VERSION::STRING + (REV ? ".#{REV}" : "")
35
- RDOC_OPTS = ['--quiet', '--title', 'gitjour documentation',
36
- "--opname", "index.html",
37
- "--line-numbers",
38
- "--main", "README",
39
- "--inline-source"]
40
-
41
- class Hoe
42
- def extra_deps
43
- @extra_deps.reject! { |x| Array(x).first == 'hoe' }
44
- @extra_deps
45
- end
46
- end
47
-
48
- # Generate all the Rake tasks
49
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
50
- hoe = Hoe.new(GEM_NAME, VERS) do |p|
51
- p.author = AUTHOR
52
- p.description = DESCRIPTION
53
- p.email = EMAIL
54
- p.summary = DESCRIPTION
55
- p.url = HOMEPATH
56
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
57
- p.test_globs = ["test/**/test_*.rb"]
58
- p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
59
- p.extra_deps = ['dnssd']
60
- # == Optional
61
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
62
- #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
63
-
64
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
65
- p.extra_dev_deps = ['newgem']
66
- end
67
-
68
- CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
69
- PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
70
- hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
71
- hoe.rsync_args = '-av --delete --ignore-errors'
@@ -1,17 +0,0 @@
1
- require 'fileutils'
2
- include FileUtils
3
-
4
- require 'rubygems'
5
- %w[rake hoe newgem rubigen].each do |req_gem|
6
- begin
7
- require req_gem
8
- rescue LoadError
9
- puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
- puts "Installation: gem install #{req_gem} -y"
11
- exit
12
- end
13
- end
14
-
15
- $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
16
-
17
- require 'gitjour'