bananajour 2.1.9 → 2.2

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -5,7 +5,6 @@ Local git repository hosting with a sexy web interface and Bonjour discovery. It
5
5
 
6
6
  Unlike Gitjour, the repositories you're serving are not your working git repositories, they're served from `~/.bananajour/repositories`. You can push to your bananajour repositories from your working copies just like you do with github.
7
7
 
8
- Bananajour is the baby of [Tim Lucas](http://toolmantim.com/) with much railscamp hackage by [Nathan de Vries](http://github.com/atnan), [Lachlan Hardy](http://github.com/lachlanhardy), [Josh Bassett](http://github.com/nullobject), [Myles Byrne](http://github.com/quackingduck), [Ben Hoskings](http://github.com/benhoskings), [Brett Goulder](http://github.com/brettgo1), [Tony Issakov](https://github.com/tissak), and [Mark Bennett](http://github.com/MarkBennett). The rad logo was by [Carla Hackett](http://carlahackettdesign.com/). Other various fixes and contributions by [Travis Swicegood](http://github.com/tswicegood) and [Nate Haas](http://github.com/natehaas).
9
8
 
10
9
  ![Screenshot of local view of Bananajour 2.1.3](http://cloud.github.com/downloads/toolmantim/bananajour/screenshot.png)
11
10
 
@@ -14,11 +13,11 @@ Installation and usage
14
13
 
15
14
  You'll need at least [git version 1.6](http://git-scm.com/). Run `git --version` if you're unsure.
16
15
 
17
- Install it from github via gems:
16
+ Install it from [gemcutter](http://gemcutter.org/) via gems:
18
17
 
19
- gem install toolmantim-bananajour
18
+ gem install bananajour
20
19
 
21
- (you might need to do a `gem sources -a http://gems.github.com` beforehand!)
20
+ (you might need to do a `gem sources -a http://gemcutter.org` beforehand!)
22
21
 
23
22
  Start it up:
24
23
 
@@ -49,6 +48,8 @@ To install the dnssd gem on linux you'll need [avahi](http://avahi.org/). For Ub
49
48
 
50
49
  sudo apt-get install libavahi-compat-libdnssd-dev
51
50
 
51
+ On Linux, if you kill bananajour with kill -9 it doesn't get a chance to unregister the Bonjour services, and when it is restarted it will die with DNSSD::AlreadyRegisteredError. Although not ideal, you can work around this my restarting avahi-daemon first.
52
+
52
53
  Using with Ginatra
53
54
  ------------------
54
55
 
@@ -76,6 +77,22 @@ If you then want to run your working copy as your public bananajour rebuild and
76
77
 
77
78
  sudo rake gem:install
78
79
 
80
+ Contributors
81
+ ------------
82
+
83
+ * [Carla Hackett](http://carlahackettdesign.com/) (logo)
84
+ * [Nathan de Vries](http://github.com/atnan)
85
+ * [Lachlan Hardy](http://github.com/lachlanhardy)
86
+ * [Josh Bassett](http://github.com/nullobject)
87
+ * [Myles Byrne](http://github.com/quackingduck)
88
+ * [Ben Hoskings](http://github.com/benhoskings)
89
+ * [Brett Goulder](http://github.com/brettgo1)
90
+ * [Tony Issakov](https://github.com/tissak)
91
+ * [Mark Bennett](http://github.com/MarkBennett)
92
+ * [Travis Swicegood](http://github.com/tswicegood)
93
+ * [Nate Haas](http://github.com/natehaas)
94
+ * [James Sadler](http://github.com/freshtonic)
95
+
79
96
  License
80
97
  -------
81
98
 
@@ -2,9 +2,9 @@ module Bananajour::Bonjour
2
2
  class BananajourBrowser
3
3
 
4
4
  def initialize
5
- @browser = Browser.new('_bananajour._http._tcp')
5
+ @browser = Browser.new('_http._tcp,_bananajour')
6
6
  end
7
-
7
+
8
8
  def bananajours
9
9
  @browser.replies.map do |reply|
10
10
  Person.new(
@@ -8,8 +8,8 @@ Thread.abort_on_exception = true
8
8
  # Generic bonjour browser
9
9
  #
10
10
  # Example use:
11
- #
12
- # browser = BonjourBrowser.new("_bananajour._git._tcp")
11
+ #
12
+ # browser = BonjourBrowser.new("_git._tcp,_bananajour")
13
13
  # loop do
14
14
  # sleep(1)
15
15
  # pp browser.replies.map {|r| r.name}
@@ -17,19 +17,23 @@ Thread.abort_on_exception = true
17
17
  #
18
18
  # Probably gem-worthy
19
19
  class Bananajour::Bonjour::Browser
20
- attr_reader :replies
21
20
  def initialize(service)
22
21
  @service = service
23
22
  @mutex = Mutex.new
24
23
  @replies = []
25
24
  watch!
26
25
  end
26
+ def replies
27
+ @mutex.synchronize do
28
+ @replies.clone
29
+ end
30
+ end
27
31
  private
28
32
  def watch!
29
33
  DNSSD.browse(@service) do |br|
30
34
  begin
31
35
  Timeout.timeout(5) do
32
- DNSSD.resolve(br.name, br.type, br.domain) do |rr|
36
+ DNSSD.resolve(br) do |rr|
33
37
  begin
34
38
  @mutex.synchronize do
35
39
  rr_exists = Proc.new {|existing_rr| existing_rr.target == rr.target && existing_rr.fullname == rr.fullname}
@@ -39,11 +43,15 @@ class Bananajour::Bonjour::Browser
39
43
  @replies.delete_if(&rr_exists)
40
44
  end
41
45
  end
46
+ rescue DNSSD::UnknownError
47
+ $stderr.puts "unknown error occurred in dnssd: #{$!.message}"
42
48
  ensure
43
- rr.service.stop
49
+ rr.service.stop unless rr.service.stopped?
44
50
  end
45
51
  end
46
52
  end
53
+ rescue DNSSD::UnknownError
54
+ $stderr.puts "unknown error occurred in dnssd: #{$!.message}"
47
55
  rescue Timeout::Error
48
56
  # Do nothing
49
57
  end
@@ -2,9 +2,9 @@ module Bananajour::Bonjour
2
2
  class RepositoryBrowser
3
3
 
4
4
  def initialize
5
- @browser = Browser.new('_bananajour._git._tcp')
5
+ @browser = Browser.new('_git._tcp,_bananajour')
6
6
  end
7
-
7
+
8
8
  def repositories
9
9
  @browser.replies.map do |reply|
10
10
  Repository.new(
@@ -4,10 +4,10 @@ module Bananajour
4
4
  DEPENDENCIES = [
5
5
  %w( sinatra 0.9.2 ),
6
6
  %w( json 1.1.7 ),
7
- %w( chrislloyd-fancypath 0.5.8 ),
7
+ %w( fancypath 0.5.13 ),
8
8
  %w( rainbow 1.0.1 ),
9
- %w( mojombo-grit 1.1.1 ),
10
- %w( dnssd 0.7.1 ),
9
+ %w( grit 1.1.1 ),
10
+ %w( dnssd 1.3.1 ),
11
11
  %w( rack 1.0.0 ),
12
12
  %w( thin 1.0.0 ),
13
13
  %w( haml 2.0.9 ),
@@ -1,4 +1,4 @@
1
- Bananajour.require_gem 'mojombo-grit', 'grit'
1
+ Bananajour.require_gem 'grit'
2
2
 
3
3
  module Bananajour
4
4
  class Repository
@@ -1,3 +1,3 @@
1
1
  module Bananajour
2
- VERSION = '2.1.9'
2
+ VERSION = '2.2'
3
3
  end
data/lib/bananajour.rb CHANGED
@@ -10,7 +10,7 @@ require 'bananajour/gem_dependencies'
10
10
 
11
11
  Bananajour.require_gem 'rainbow'
12
12
  Bananajour.require_gem 'dnssd'
13
- Bananajour.require_gem 'chrislloyd-fancypath', 'fancypath'
13
+ Bananajour.require_gem 'fancypath'
14
14
 
15
15
  require 'bananajour/repository'
16
16
  require 'bananajour/grit_extensions'
@@ -65,7 +65,12 @@ module Bananajour
65
65
  end
66
66
 
67
67
  def host_name
68
- Socket.gethostname
68
+ hn = Socket.gethostname
69
+ if hn =~ /\.local$/
70
+ hn
71
+ else
72
+ hn + ".local"
73
+ end
69
74
  end
70
75
 
71
76
  def git_uri
@@ -96,4 +101,4 @@ module Bananajour
96
101
 
97
102
  end
98
103
 
99
- end
104
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bananajour
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.9
4
+ version: "2.2"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Lucas
@@ -33,14 +33,14 @@ dependencies:
33
33
  version: 1.1.7
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
- name: chrislloyd-fancypath
36
+ name: fancypath
37
37
  type: :runtime
38
38
  version_requirement:
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - "="
42
42
  - !ruby/object:Gem::Version
43
- version: 0.5.8
43
+ version: 0.5.13
44
44
  version:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: rainbow
@@ -53,7 +53,7 @@ dependencies:
53
53
  version: 1.0.1
54
54
  version:
55
55
  - !ruby/object:Gem::Dependency
56
- name: mojombo-grit
56
+ name: grit
57
57
  type: :runtime
58
58
  version_requirement:
59
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -70,7 +70,7 @@ dependencies:
70
70
  requirements:
71
71
  - - "="
72
72
  - !ruby/object:Gem::Version
73
- version: 0.7.1
73
+ version: 1.3.1
74
74
  version:
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rack