gitdocs 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/README.md +44 -31
- data/lib/gitdocs.rb +0 -1
- data/lib/gitdocs/manager.rb +15 -4
- data/lib/gitdocs/public/img/error.png +0 -0
- data/lib/gitdocs/public/img/info.png +0 -0
- data/lib/gitdocs/public/img/ok.png +0 -0
- data/lib/gitdocs/public/img/warning.png +0 -0
- data/lib/gitdocs/public/js/search.js +13 -0
- data/lib/gitdocs/runner.rb +21 -11
- data/lib/gitdocs/server.rb +4 -0
- data/lib/gitdocs/version.rb +1 -1
- data/lib/gitdocs/views/app.haml +2 -0
- data/lib/gitdocs/views/search.haml +14 -0
- metadata +10 -3
data/CHANGELOG
ADDED
data/README.md
CHANGED
@@ -59,27 +59,6 @@ to enable Growl support (other platforms coming soon).
|
|
59
59
|
|
60
60
|
## Usage
|
61
61
|
|
62
|
-
### Monitoring Shares
|
63
|
-
|
64
|
-
You can add existing folders to watch:
|
65
|
-
|
66
|
-
```
|
67
|
-
gitdocs add my/path/to/watch
|
68
|
-
```
|
69
|
-
|
70
|
-
or instruct gitdocs to fetch a remote share and keep it synced with:
|
71
|
-
|
72
|
-
```
|
73
|
-
gitdocs create local/path/for/repo git@github.com:user/some/remote/repo.git
|
74
|
-
```
|
75
|
-
|
76
|
-
This will clone the remote repo and begin monitoring the local path. You can remove and clear monitored paths as well:
|
77
|
-
|
78
|
-
```
|
79
|
-
gitdocs rm my/path/to/watch
|
80
|
-
gitdocs clear
|
81
|
-
```
|
82
|
-
|
83
62
|
### Starting Gitdocs
|
84
63
|
|
85
64
|
You need to start gitdocs in order for the monitoring to work:
|
@@ -107,19 +86,43 @@ For an overview of gitdocs current status, run:
|
|
107
86
|
```
|
108
87
|
gitdocs status
|
109
88
|
```
|
110
|
-
### Conflict Resolution
|
111
89
|
|
112
|
-
|
113
|
-
In most cases, git does a good job of handling file merges for you. Still, what about cases where the conflict cannot be
|
114
|
-
resolved automatically?
|
90
|
+
### Monitoring Shares
|
115
91
|
|
116
|
-
|
117
|
-
|
118
|
-
|
92
|
+
You can add existing folders to watch:
|
93
|
+
|
94
|
+
```
|
95
|
+
gitdocs add my/path/to/watch
|
96
|
+
```
|
97
|
+
|
98
|
+
or instruct gitdocs to fetch a remote share and keep it synced with:
|
99
|
+
|
100
|
+
```
|
101
|
+
gitdocs create local/path/for/repo git@github.com:user/some/remote/repo.git
|
102
|
+
```
|
103
|
+
|
104
|
+
This will clone the remote repo and begin monitoring the local path. You can remove and clear monitored paths as well:
|
105
|
+
|
106
|
+
```
|
107
|
+
gitdocs rm my/path/to/watch
|
108
|
+
gitdocs clear
|
109
|
+
```
|
119
110
|
|
120
111
|
### Web Front-end
|
121
112
|
|
122
|
-
Gitdocs come with a handy web front-end that is available.
|
113
|
+
Gitdocs come with a handy web front-end that is available.
|
114
|
+
|
115
|
+
<a href="http://i.imgur.com/IMwqN.png">
|
116
|
+
<img src="http://i.imgur.com/IMwqN.png" width="250" />
|
117
|
+
</a>
|
118
|
+
<a href="http://i.imgur.com/0wVyB.png">
|
119
|
+
<img src="http://i.imgur.com/0wVyB.png" width="250" />
|
120
|
+
</a>
|
121
|
+
<a href="http://i.imgur.com/Ijyo9.png">
|
122
|
+
<img src="http://i.imgur.com/Ijyo9.png" width="250" />
|
123
|
+
</a>
|
124
|
+
|
125
|
+
This browser front-end supports the following features:
|
123
126
|
|
124
127
|
* Explore the files within all your shares
|
125
128
|
* View source files in your shares with code syntax highlighting
|
@@ -131,6 +134,16 @@ Gitdocs come with a handy web front-end that is available. This browser front-en
|
|
131
134
|
|
132
135
|
To check out the front-end, simply visit `http://localhost:8888` whenever gitdocs is running.
|
133
136
|
|
137
|
+
### Conflict Resolution
|
138
|
+
|
139
|
+
Proper conflict resolution is an important part of any good doc and file collaboration tool.
|
140
|
+
In most cases, git does a good job of handling file merges for you. Still, what about cases where the conflict cannot be
|
141
|
+
resolved automatically?
|
142
|
+
|
143
|
+
Don't worry, gitdocs makes handling this simple. In the event of a conflict,
|
144
|
+
**all the different versions of a document are stored** in the repo tagged with the **git sha** for each
|
145
|
+
committed version. The members of the repo can then compare all versions and resolve the conflict.
|
146
|
+
|
134
147
|
## Planned Features
|
135
148
|
|
136
149
|
Gitdocs is a young project but we have big plans for it including:
|
@@ -145,8 +158,8 @@ Gitdocs is a young project but we have big plans for it including:
|
|
145
158
|
Gitdocs is a fresh project that we spiked on in a few days time. Our primary goals are to keep the code as simple as possible,
|
146
159
|
but provide the features that makes dropbox great. If you are interested in other Dropbox alternatives, be sure to checkout our notes below:
|
147
160
|
|
148
|
-
* [SparkleShare](http://sparkleshare.org/) is an open source, self-hosted Dropbox alternative
|
149
|
-
|
161
|
+
* [SparkleShare](http://sparkleshare.org/) is an open source, self-hosted Dropbox alternative written using C# and the [Mono Project](http://www.mono-project.com/Main_Page).
|
162
|
+
More mature but has a lot of dependencies, and lacks some of the features planned in Gitdocs.
|
150
163
|
* [DVCS-Autosync](http://mayrhofer.eu.org/dvcs-autosync) is a project to create an open source replacement for Dropbox based on distributed version control systems.
|
151
164
|
Very similar project but again we have features planned that are out of scope (local tunnel file sharing, complete web ui for browsing, uploading and editing).
|
152
165
|
* [Lipsync](https://github.com/philcryer/lipsync) is another similar project. We haven't looked at this too closely, but thought we would mention it in this list.
|
data/lib/gitdocs.rb
CHANGED
data/lib/gitdocs/manager.rb
CHANGED
@@ -10,6 +10,17 @@ module Gitdocs
|
|
10
10
|
yield @config if block_given?
|
11
11
|
end
|
12
12
|
|
13
|
+
RepoDescriptor = Struct.new(:name, :index)
|
14
|
+
|
15
|
+
def search(term)
|
16
|
+
results = {}
|
17
|
+
@runners.each_with_index do |runner, index|
|
18
|
+
descriptor = RepoDescriptor.new(runner.root, index)
|
19
|
+
results[descriptor] = runner.search(term)
|
20
|
+
end
|
21
|
+
results
|
22
|
+
end
|
23
|
+
|
13
24
|
def run
|
14
25
|
run = true
|
15
26
|
trap('USR1') { run = true; EM.stop }
|
@@ -21,11 +32,11 @@ module Gitdocs
|
|
21
32
|
# Start the repo watchers
|
22
33
|
runners = nil
|
23
34
|
EM.run do
|
24
|
-
runners = config.shares.map { |share| Runner.new(share) }
|
25
|
-
runners.each(&:run)
|
35
|
+
@runners = config.shares.map { |share| Runner.new(share) }
|
36
|
+
@runners.each(&:run)
|
26
37
|
# Start the web front-end
|
27
38
|
if self.config.global.start_web_frontend
|
28
|
-
Server.new(self,
|
39
|
+
Server.new(self, *@runners).start
|
29
40
|
i = 0
|
30
41
|
web_started = false
|
31
42
|
begin
|
@@ -39,7 +50,7 @@ module Gitdocs
|
|
39
50
|
system("open http://localhost:8888/") if self.config.global.load_browser_on_startup && web_started
|
40
51
|
end
|
41
52
|
end
|
42
|
-
sleep(10) if runners && runners.empty?
|
53
|
+
sleep(10) if @runners && @runners.empty?
|
43
54
|
end
|
44
55
|
end
|
45
56
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
GitDocs.search = {
|
2
|
+
highlight : function(query) {
|
3
|
+
$('.results dl dd').each(function(idx, el) {
|
4
|
+
var result = $(el).text().replace(query, "<strong>" + query + "</strong>");
|
5
|
+
$(el).html(result);
|
6
|
+
});
|
7
|
+
}
|
8
|
+
};
|
9
|
+
|
10
|
+
$(document).ready(function() {
|
11
|
+
var query = $('.results').data("query");
|
12
|
+
GitDocs.search.highlight(query);
|
13
|
+
});
|
data/lib/gitdocs/runner.rb
CHANGED
@@ -11,13 +11,23 @@ module Gitdocs
|
|
11
11
|
@icon = File.expand_path("../../img/icon.png", __FILE__)
|
12
12
|
end
|
13
13
|
|
14
|
+
SearchResult = Struct.new(:file, :context)
|
15
|
+
def search(term)
|
16
|
+
results = []
|
17
|
+
sh_string("git grep #{ShellTools.escape(term)}").scan(/(.*?):([^\n]*)/) do |(file, context)|
|
18
|
+
results << SearchResult.new(file, context)
|
19
|
+
end
|
20
|
+
results
|
21
|
+
end
|
22
|
+
|
14
23
|
def run
|
15
24
|
return false unless self.valid?
|
16
|
-
|
17
|
-
@
|
18
|
-
@
|
19
|
-
@
|
20
|
-
|
25
|
+
@show_notifications = @share.notification
|
26
|
+
@current_remote = @share.remote_name
|
27
|
+
@current_branch = @share.branch_name
|
28
|
+
@current_revision = sh_string("git rev-parse HEAD")
|
29
|
+
Guard::Notifier.turn_on if @show_notifications
|
30
|
+
|
21
31
|
mutex = Mutex.new
|
22
32
|
|
23
33
|
info("Running gitdocs!", "Running gitdocs in `#{@root}'")
|
@@ -156,24 +166,24 @@ module Gitdocs
|
|
156
166
|
end
|
157
167
|
|
158
168
|
def warn(title, msg)
|
159
|
-
if @
|
160
|
-
|
169
|
+
if @show_notifications
|
170
|
+
Guard::Notifier.notify(msg, :title => title)
|
161
171
|
else
|
162
172
|
Kernel.warn("#{title}: #{msg}")
|
163
173
|
end
|
164
174
|
end
|
165
175
|
|
166
176
|
def info(title, msg)
|
167
|
-
if @
|
168
|
-
|
177
|
+
if @show_notifications
|
178
|
+
Guard::Notifier.notify(msg, :title => title, :image => @icon)
|
169
179
|
else
|
170
180
|
puts("#{title}: #{msg}")
|
171
181
|
end
|
172
182
|
end
|
173
183
|
|
174
184
|
def error(title, msg)
|
175
|
-
if @
|
176
|
-
|
185
|
+
if @show_notifications
|
186
|
+
Guard::Notifier.notify(msg, :title => title, :image => :failure)
|
177
187
|
else
|
178
188
|
Kernel.warn("#{title}: #{msg}")
|
179
189
|
end
|
data/lib/gitdocs/server.rb
CHANGED
@@ -36,6 +36,10 @@ module Gitdocs
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
path('search').get do
|
40
|
+
render! "search", :layout => 'app', :locals => {:conf => manager.config, :results => manager.search(request.GET['q']), :nav_state => nil}
|
41
|
+
end
|
42
|
+
|
39
43
|
var :int do |idx|
|
40
44
|
gd = gds[idx]
|
41
45
|
halt 404 if gd.nil?
|
data/lib/gitdocs/version.rb
CHANGED
data/lib/gitdocs/views/app.haml
CHANGED
@@ -19,6 +19,8 @@
|
|
19
19
|
%a(href = "/") Home
|
20
20
|
%li{ :class => ("active" if nav_state == "settings") }
|
21
21
|
%a(href = "/settings") Settings
|
22
|
+
%form{:class => "pull-left", :action => "/search", :method => 'GET'}
|
23
|
+
%input{:type => "text", :placeholder => "Search", :name => 'q'}
|
22
24
|
|
23
25
|
#main.container
|
24
26
|
.content
|
@@ -0,0 +1,14 @@
|
|
1
|
+
- @title = "Matches for #{request.params['q'].inspect}"
|
2
|
+
|
3
|
+
.results{ "data-query" => request.params['q'] }
|
4
|
+
- results.each do |repo, search_results|
|
5
|
+
%h2= repo.name
|
6
|
+
%dl
|
7
|
+
- search_results.each do |res|
|
8
|
+
%dt
|
9
|
+
%a{:href => "/#{repo.index}/#{res.file}"}
|
10
|
+
= "/#{res.file}"
|
11
|
+
%dd
|
12
|
+
= res.context
|
13
|
+
|
14
|
+
%script{ :src => "/js/search.js", :type => "text/javascript", :charset => "utf-8" }
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: gitdocs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.4.
|
5
|
+
version: 0.4.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Josh Hull
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-12-
|
14
|
+
date: 2011-12-13 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: joshbuddy-guard
|
@@ -223,6 +223,7 @@ extra_rdoc_files: []
|
|
223
223
|
|
224
224
|
files:
|
225
225
|
- .gitignore
|
226
|
+
- CHANGELOG
|
226
227
|
- Gemfile
|
227
228
|
- LICENSE
|
228
229
|
- README.md
|
@@ -243,7 +244,11 @@ files:
|
|
243
244
|
- lib/gitdocs/public/css/bootstrap.css
|
244
245
|
- lib/gitdocs/public/css/coderay.css
|
245
246
|
- lib/gitdocs/public/css/tilt.css
|
247
|
+
- lib/gitdocs/public/img/error.png
|
246
248
|
- lib/gitdocs/public/img/git_logo.png
|
249
|
+
- lib/gitdocs/public/img/info.png
|
250
|
+
- lib/gitdocs/public/img/ok.png
|
251
|
+
- lib/gitdocs/public/img/warning.png
|
247
252
|
- lib/gitdocs/public/js/ace/ace-compat.js
|
248
253
|
- lib/gitdocs/public/js/ace/ace-uncompressed.js
|
249
254
|
- lib/gitdocs/public/js/ace/ace.js
|
@@ -276,6 +281,7 @@ files:
|
|
276
281
|
- lib/gitdocs/public/js/app.js
|
277
282
|
- lib/gitdocs/public/js/edit.js
|
278
283
|
- lib/gitdocs/public/js/jquery.js
|
284
|
+
- lib/gitdocs/public/js/search.js
|
279
285
|
- lib/gitdocs/public/js/util.js
|
280
286
|
- lib/gitdocs/runner.rb
|
281
287
|
- lib/gitdocs/server.rb
|
@@ -287,6 +293,7 @@ files:
|
|
287
293
|
- lib/gitdocs/views/edit.haml
|
288
294
|
- lib/gitdocs/views/file.haml
|
289
295
|
- lib/gitdocs/views/home.haml
|
296
|
+
- lib/gitdocs/views/search.haml
|
290
297
|
- lib/gitdocs/views/settings.haml
|
291
298
|
- lib/img/icon.png
|
292
299
|
- test/configuration_test.rb
|
@@ -315,7 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
315
322
|
requirements: []
|
316
323
|
|
317
324
|
rubyforge_project: gitdocs
|
318
|
-
rubygems_version: 1.8.
|
325
|
+
rubygems_version: 1.8.12
|
319
326
|
signing_key:
|
320
327
|
specification_version: 3
|
321
328
|
summary: Open-source Dropbox using Ruby and Git
|