gitdocs 0.3.3 → 0.3.4
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/gitdocs.gemspec +1 -1
- data/lib/gitdocs/cli.rb +12 -25
- data/lib/gitdocs/configuration.rb +4 -0
- data/lib/gitdocs/version.rb +1 -1
- data/test/configuration_test.rb +7 -0
- metadata +2 -2
data/gitdocs.gemspec
CHANGED
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
|
24
24
|
s.add_dependency 'redcarpet'
|
|
25
25
|
s.add_dependency 'thor'
|
|
26
26
|
s.add_dependency 'coderay'
|
|
27
|
-
s.add_dependency 'dante', '~> 0.
|
|
27
|
+
s.add_dependency 'dante', '~> 0.1.2'
|
|
28
28
|
s.add_dependency 'growl', '~> 1.0.3'
|
|
29
29
|
s.add_dependency 'yajl-ruby'
|
|
30
30
|
s.add_dependency 'haml'
|
data/lib/gitdocs/cli.rb
CHANGED
|
@@ -9,12 +9,11 @@ module Gitdocs
|
|
|
9
9
|
desc "start", "Starts a daemonized gitdocs process"
|
|
10
10
|
method_option :debug, :type => :boolean, :aliases => "-D"
|
|
11
11
|
def start
|
|
12
|
-
if
|
|
13
|
-
self.runner
|
|
14
|
-
until_true(5) { self.running? }
|
|
12
|
+
if self.stopped? && !options[:debug]
|
|
13
|
+
self.runner.execute { Gitdocs.run }
|
|
15
14
|
self.running? ? say("Started gitdocs", :green) : say("Failed to start gitdocs", :red)
|
|
16
|
-
elsif
|
|
17
|
-
say "
|
|
15
|
+
elsif self.stopped? && options[:debug]
|
|
16
|
+
say "Starting in debug mode", :yellow
|
|
18
17
|
Gitdocs.run(nil, true)
|
|
19
18
|
else # already running
|
|
20
19
|
say "Gitdocs is already running, please use restart", :red
|
|
@@ -24,7 +23,7 @@ module Gitdocs
|
|
|
24
23
|
desc "stop", "Stops the gitdocs process"
|
|
25
24
|
def stop
|
|
26
25
|
if self.running?
|
|
27
|
-
self.runner(:kill => true
|
|
26
|
+
self.runner.execute(:kill => true)
|
|
28
27
|
say "Stopped gitdocs", :red
|
|
29
28
|
else # not running
|
|
30
29
|
say "Gitdocs is not running", :red
|
|
@@ -34,7 +33,6 @@ module Gitdocs
|
|
|
34
33
|
desc "restart", "Restarts the gitdocs process"
|
|
35
34
|
def restart
|
|
36
35
|
self.stop
|
|
37
|
-
until_true(5) { self.running? }
|
|
38
36
|
self.start
|
|
39
37
|
end
|
|
40
38
|
|
|
@@ -54,7 +52,7 @@ module Gitdocs
|
|
|
54
52
|
|
|
55
53
|
desc "clear", "Clears all paths from gitdocs"
|
|
56
54
|
def clear
|
|
57
|
-
self.config.
|
|
55
|
+
self.config.clear
|
|
58
56
|
say "Cleared paths from gitdocs"
|
|
59
57
|
end
|
|
60
58
|
|
|
@@ -88,7 +86,7 @@ module Gitdocs
|
|
|
88
86
|
# Helpers for thor
|
|
89
87
|
no_tasks do
|
|
90
88
|
def runner(options={})
|
|
91
|
-
Dante::Runner.new('gitdocs', options)
|
|
89
|
+
Dante::Runner.new('gitdocs', options.merge(:debug => false, :daemonize => true, :pid_path => self.pid_path))
|
|
92
90
|
end
|
|
93
91
|
|
|
94
92
|
def config
|
|
@@ -96,26 +94,15 @@ module Gitdocs
|
|
|
96
94
|
end
|
|
97
95
|
|
|
98
96
|
def running?
|
|
99
|
-
|
|
100
|
-
Process.kill 0, File.read(pid_path).to_i
|
|
101
|
-
true
|
|
102
|
-
rescue Errno::ESRCH
|
|
103
|
-
false
|
|
97
|
+
self.runner.daemon_running?
|
|
104
98
|
end
|
|
105
99
|
|
|
106
|
-
def
|
|
107
|
-
|
|
100
|
+
def stopped?
|
|
101
|
+
self.runner.daemon_stopped?
|
|
108
102
|
end
|
|
109
103
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
def until_true(retry_count, &block)
|
|
113
|
-
count = 0
|
|
114
|
-
while count < retry_count && block.call != true
|
|
115
|
-
count += 1
|
|
116
|
-
sleep(1)
|
|
117
|
-
end
|
|
118
|
-
count < retry_count
|
|
104
|
+
def pid_path
|
|
105
|
+
"/tmp/gitdocs.pid"
|
|
119
106
|
end
|
|
120
107
|
end
|
|
121
108
|
|
data/lib/gitdocs/version.rb
CHANGED
data/test/configuration_test.rb
CHANGED
|
@@ -26,6 +26,13 @@ describe "gitdocs configuration" do
|
|
|
26
26
|
assert_equal ["/my/path"], @config.shares.map(&:path)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
+
it "can clear paths" do
|
|
30
|
+
@config.add_path('/my/path')
|
|
31
|
+
@config.add_path('/my/path/2')
|
|
32
|
+
@config.clear
|
|
33
|
+
assert_equal [], @config.shares.map(&:path)
|
|
34
|
+
end
|
|
35
|
+
|
|
29
36
|
it "can normalize paths" do
|
|
30
37
|
assert_equal File.expand_path("../test_helper.rb", Dir.pwd), @config.normalize_path("../test_helper.rb")
|
|
31
38
|
end
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: gitdocs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 0.3.
|
|
5
|
+
version: 0.3.4
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Josh Hull
|
|
@@ -88,7 +88,7 @@ dependencies:
|
|
|
88
88
|
requirements:
|
|
89
89
|
- - ~>
|
|
90
90
|
- !ruby/object:Gem::Version
|
|
91
|
-
version: 0.
|
|
91
|
+
version: 0.1.2
|
|
92
92
|
type: :runtime
|
|
93
93
|
version_requirements: *id007
|
|
94
94
|
- !ruby/object:Gem::Dependency
|