jesus 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +0 -1
- data/LICENSE +20 -0
- data/{README.textile → README.md} +21 -14
- data/Rakefile +10 -1
- data/cruise_config.rb +4 -0
- data/lib/jesus/server.rb +4 -5
- data/lib/jesus/server/helpers.rb +38 -0
- data/lib/jesus/server/views/home.erb +1 -0
- data/spec/server/home_spec.rb +1 -1
- metadata +7 -7
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Damien MATHIEU
|
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.
|
@@ -1,44 +1,51 @@
|
|
1
|
-
|
1
|
+
Jesus
|
2
|
+
=====
|
2
3
|
|
3
|
-
Jesus is a web interface to
|
4
|
+
Jesus is a web interface to [god](http://github.com/mojombo/god)
|
4
5
|
It allows you to see the process and monitor/unmonitor them.
|
5
6
|
|
6
|
-
!http://cloud.github.com/downloads/dmathieu/jesus/jesus-0.0.1.thumb.png(
|
7
|
+
[![Jesus Screenshot](http://cloud.github.com/downloads/dmathieu/jesus/jesus-0.0.1.thumb.png)](http://cloud.github.com/downloads/dmathieu/jesus/jesus-0.0.1.png)
|
7
8
|
|
8
|
-
|
9
|
+
Installation
|
10
|
+
------------
|
9
11
|
|
10
12
|
To install the application you first need to have "bundler":http://github.com/wycats/bundler installed on your machine.
|
11
13
|
Once that is done, clone the project in the directory of your choice.
|
12
14
|
|
13
|
-
|
15
|
+
git clone git://github.com/dmathieu/jesus.git
|
16
|
+
|
17
|
+
Or using the gem.
|
18
|
+
|
19
|
+
gem install jesus --source http://gemcutter.org
|
14
20
|
|
15
21
|
Then you should install the dependencies.
|
16
22
|
|
17
|
-
|
23
|
+
gem bundle
|
18
24
|
|
19
25
|
You now have Jesus available on your machine. Start your god process.
|
20
26
|
And start Jesus.
|
21
27
|
|
22
|
-
|
23
|
-
|
24
|
-
@rackup@
|
28
|
+
god -c /path/to/your/god.config
|
29
|
+
rackup
|
25
30
|
|
26
31
|
Note: Jesus and God should be started with the same user. Otherwise, Jesus won't be able to get access to the God informations.
|
27
32
|
|
28
|
-
Go to
|
33
|
+
Go to [localhot:9292](http://localhost:9292) to watch the process monitored by god.
|
29
34
|
|
30
|
-
|
35
|
+
Contributing
|
36
|
+
------------
|
31
37
|
|
32
38
|
If you think Jesus is great but can be improved, feel free to contribute.
|
33
39
|
To do so, you can :
|
34
40
|
|
35
|
-
*
|
41
|
+
* [Fork](http://help.github.com/forking/) the project
|
36
42
|
* Do your changes and commit them to your repository
|
37
43
|
* Test your changes. We won't accept any untested contributions (except if they're not testable).
|
38
|
-
* Create an
|
44
|
+
* Create an [issue](http://help.github.com/forking/) with a link to your commits.
|
39
45
|
|
40
46
|
And that's it! We'll soon take a look at your issue and review your changes.
|
41
47
|
|
42
|
-
|
48
|
+
Author
|
49
|
+
------
|
43
50
|
|
44
51
|
Damien MATHIEU :: 42 (AT|CHEZ) dmathieu.com
|
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ begin
|
|
13
13
|
gemspec.email = "42@dmathieu.com"
|
14
14
|
gemspec.homepage = "http://github.com/dmathieu/jesus"
|
15
15
|
gemspec.authors = ["Damien MATHIEU"]
|
16
|
-
gemspec.version = '0.0.
|
16
|
+
gemspec.version = '0.0.3'
|
17
17
|
end
|
18
18
|
rescue LoadError
|
19
19
|
puts "Jeweler not available. Install it with:"
|
@@ -30,4 +30,13 @@ desc "Run all specs"
|
|
30
30
|
Spec::Rake::SpecTask.new('spec') do |t|
|
31
31
|
t.spec_files = FileList['spec/**/*.rb']
|
32
32
|
t.spec_opts = ['-cfs']
|
33
|
+
end
|
34
|
+
|
35
|
+
#
|
36
|
+
# SDoc
|
37
|
+
#
|
38
|
+
begin
|
39
|
+
require 'sdoc_helpers'
|
40
|
+
rescue LoadError
|
41
|
+
puts "sdoc support not enabled. Please gem install sdoc-helpers."
|
33
42
|
end
|
data/cruise_config.rb
ADDED
data/lib/jesus/server.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
require 'sinatra/base'
|
2
|
-
require 'sinatra_more/render_plugin'
|
3
2
|
require 'jesus/interface'
|
4
3
|
require 'jesus/server/helpers'
|
5
4
|
|
6
5
|
module Jesus
|
7
6
|
class Server < Sinatra::Base
|
8
7
|
dir = File.dirname(File.expand_path(__FILE__))
|
9
|
-
register SinatraMore::RenderPlugin
|
10
8
|
include Jesus::Helpers
|
11
9
|
|
12
10
|
set :views, "#{dir}/server/views"
|
@@ -20,7 +18,7 @@ module Jesus
|
|
20
18
|
#
|
21
19
|
get '/' do
|
22
20
|
@status = Jesus::Interface.new.status
|
23
|
-
|
21
|
+
show @status.nil? ? :error : :home
|
24
22
|
end
|
25
23
|
|
26
24
|
#
|
@@ -28,7 +26,7 @@ module Jesus
|
|
28
26
|
#
|
29
27
|
get '/logs/:process' do
|
30
28
|
@log = Jesus::Interface.new.log(params[:process])
|
31
|
-
|
29
|
+
show @log.nil? ? :error : :log
|
32
30
|
end
|
33
31
|
|
34
32
|
#
|
@@ -42,8 +40,9 @@ module Jesus
|
|
42
40
|
#
|
43
41
|
# Executes a command (start, restart, stop, quit or terminate) on the server
|
44
42
|
#
|
45
|
-
|
43
|
+
get '/command/:command/:process' do
|
46
44
|
@command = Jesus::Interface.new.command(params[:command], params[:process])
|
45
|
+
flash(:notice, 'The command ' + params[:command] + ' has successfully been executed. It might take a few seconds before the status process effectively changes.')
|
47
46
|
redirect '/'
|
48
47
|
end
|
49
48
|
end
|
data/lib/jesus/server/helpers.rb
CHANGED
@@ -1,18 +1,56 @@
|
|
1
1
|
module Jesus
|
2
2
|
module Helpers
|
3
|
+
#
|
4
|
+
# Is this menu link the current page ?
|
5
|
+
#
|
3
6
|
def class_if_current(link)
|
4
7
|
link = '^/$' if link == '/'
|
5
8
|
'class="current"' if request.path_info =~ Regexp.new(link)
|
6
9
|
end
|
10
|
+
#
|
11
|
+
# The menu link li
|
12
|
+
#
|
7
13
|
def tab(name, link)
|
8
14
|
"<li #{class_if_current(link)}><a href='#{link}'>#{name}</a></li>"
|
9
15
|
end
|
10
16
|
|
17
|
+
#
|
18
|
+
# The flash message tag
|
19
|
+
#
|
11
20
|
def flash_tag(type)
|
12
21
|
"<div id='flash'>#{session.delete(type)}</div>" unless session[type].nil?
|
13
22
|
end
|
23
|
+
#
|
24
|
+
# Defines a flash message
|
25
|
+
#
|
14
26
|
def flash(type, message)
|
15
27
|
session[type] = message
|
16
28
|
end
|
29
|
+
#
|
30
|
+
# A confirmation, to be included in a link
|
31
|
+
#
|
32
|
+
def confirm(message='Are you sure you want to do this ?')
|
33
|
+
return "javascript:return confirm('" + message + "');"
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# Displays an erb page
|
38
|
+
#
|
39
|
+
def show(page, layout = true)
|
40
|
+
erb page.to_sym, {:layout => layout}
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# Displays the actions links for a process
|
45
|
+
#
|
46
|
+
def process_action(process)
|
47
|
+
case process[1][:state]
|
48
|
+
when :up
|
49
|
+
return '<li><a href="/command/stop/' + process[0] + '" onclick="' + confirm + '">Stop Process</a></li>' +
|
50
|
+
'<li><a href="/command/restart/' + process[0] + '" onclick="' + confirm + '">Restart Process</a></li>'
|
51
|
+
when :unmonitored
|
52
|
+
return '<li><a href="/command/start/' + process[0] + '">Start Process</a></li>'
|
53
|
+
end
|
54
|
+
end
|
17
55
|
end
|
18
56
|
end
|
data/spec/server/home_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jesus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damien MATHIEU
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-01 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -17,23 +17,23 @@ description: A web interface for god to speak with mankind
|
|
17
17
|
email: 42@dmathieu.com
|
18
18
|
executables:
|
19
19
|
- autospec
|
20
|
-
- rake2thor
|
21
|
-
- sinatra_gen
|
22
20
|
- spec
|
23
21
|
- rackup
|
24
22
|
- god
|
25
23
|
- rake
|
26
|
-
- thor
|
27
24
|
extensions: []
|
28
25
|
|
29
26
|
extra_rdoc_files:
|
30
|
-
-
|
27
|
+
- LICENSE
|
28
|
+
- README.md
|
31
29
|
files:
|
32
30
|
- .gitignore
|
33
31
|
- Gemfile
|
34
|
-
-
|
32
|
+
- LICENSE
|
33
|
+
- README.md
|
35
34
|
- Rakefile
|
36
35
|
- config.ru
|
36
|
+
- cruise_config.rb
|
37
37
|
- lib/jesus/interface.rb
|
38
38
|
- lib/jesus/server.rb
|
39
39
|
- lib/jesus/server/helpers.rb
|