ginst 2.0.1 → 2009.11.23
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/Rakefile +20 -21
- data/VERSION +1 -1
- data/app/controllers/application_controller.rb +1 -1
- data/app/controllers/status_controller.rb +10 -0
- data/app/controllers/tasks_controller.rb +9 -7
- data/app/helpers/projects_helper.rb +9 -4
- data/app/models/project.rb +38 -15
- data/app/models/task.rb +15 -3
- data/app/views/grit/commits/_commit.html.erb +3 -12
- data/app/views/layouts/projects.html.erb +1 -1
- data/app/views/status/show.html.erb +6 -1
- data/app/views/tasks/_task.html.erb +43 -26
- data/app/views/tasks/_task_item.html.erb +22 -0
- data/app/views/tasks/index.html.erb +3 -2
- data/app/views/tasks/show.html.erb +1 -46
- data/config/database.yml +4 -1
- data/config/environment.rb +4 -4
- data/config/routes.rb +1 -5
- data/ginst.gemspec +17 -18
- data/lib/ginst.rb +5 -2
- data/lib/ginst/builder.rb +2 -0
- data/lib/ginst/cli.rb +21 -44
- data/lib/ginst/console.rb +9 -0
- data/lib/ginst/ginst_template/webserver.ymlt +2 -0
- data/lib/ginst/logger.rb +31 -0
- data/lib/ginst/template.rb +1 -0
- data/lib/ginst/web_server.rb +28 -6
- data/log/development.log +49 -0
- data/public/stylesheets/screen.css +73 -38
- data/script/builder.rb +6 -1
- data/{features/step_definitions/ginst_steps.rb → tmp/.gittouch} +0 -0
- data/tmp/cache/.gittouch +0 -0
- data/tmp/pids/.gittouch +0 -0
- data/tmp/sessions/.gittouch +0 -0
- data/tmp/sockets/.gittouch +0 -0
- metadata +19 -17
- data/features/ginst.feature +0 -9
- data/features/support/env.rb +0 -4
- data/spec/ginst_spec.rb +0 -7
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -9
@@ -0,0 +1,22 @@
|
|
1
|
+
<% content_tag_for(:li, task_item, :class=> "#{task_item.status} ") do %>
|
2
|
+
<pre><%= link_to task_item.name, project_task_path(@project, task_item) %></pre>
|
3
|
+
<p><%= simple_format(h(truncate(task_item.output))) %></p>
|
4
|
+
<dl>
|
5
|
+
<dt>Command:</dt>
|
6
|
+
<dd><%= truncate(task_item.code,:length => 35) %></dd>
|
7
|
+
|
8
|
+
<dt>created_at</dt>
|
9
|
+
<dd><%= show_time(task_item.created_at) %></dd>
|
10
|
+
<dt>started_at</dt>
|
11
|
+
<dd><%= show_time(task_item.started_at) %></dd>
|
12
|
+
|
13
|
+
<dt>ended_At</dt>
|
14
|
+
<dd><%= show_time(task_item.ended_at) %></dd>
|
15
|
+
|
16
|
+
<dt>status</dt>
|
17
|
+
<dd><%= task_item.status %></dd>
|
18
|
+
|
19
|
+
</dl>
|
20
|
+
|
21
|
+
<% end %>
|
22
|
+
|
@@ -1,10 +1,11 @@
|
|
1
1
|
<% content_for :submenu do %>
|
2
|
-
<ul class="
|
2
|
+
<ul class="submenu">
|
3
3
|
<li><%= link_to_unless params[:scope]=='prepared', 'Waiting', "?scope=prepared" %></li>
|
4
4
|
<li><%= link_to_unless params[:scope]=='finished', 'Finished', "?scope=finished" %></li>
|
5
5
|
<li><%= link_to_unless params[:scope]=='building', 'Building', "?scope=building" %></li>
|
6
6
|
</ul>
|
7
7
|
<% end %>
|
8
|
+
|
8
9
|
<ul>
|
9
|
-
<%= render :partial => '
|
10
|
+
<%= render :partial => 'task_item', :collection => @tasks %>
|
10
11
|
</ul>
|
@@ -10,49 +10,4 @@
|
|
10
10
|
<% end %>
|
11
11
|
<% end %>
|
12
12
|
|
13
|
-
|
14
|
-
<h1><%= @task.name %></h1>
|
15
|
-
<p class="status <%= @task.status %>">Build status: <%= @task.status %></p>
|
16
|
-
|
17
|
-
<div class='task_description'>
|
18
|
-
<% if @task.prepared? %>
|
19
|
-
<p>This tasks is prepared to be run. Please wait other tasks finish.</p>
|
20
|
-
<pre id="output"><%= @task.parsed_output %></pre>
|
21
|
-
|
22
|
-
<% else %>
|
23
|
-
<dl>
|
24
|
-
<dt>Started at:</dt>
|
25
|
-
<dd><%= show_time(@task.started_at) %></dd>
|
26
|
-
|
27
|
-
<% if @task.building? %>
|
28
|
-
<dt>Elapsed time</dt>
|
29
|
-
<dd class="elapsed_time"><%= show_elapsed(@task.build_duration) %></dd>
|
30
|
-
<dt>Pid</dt>
|
31
|
-
<dd><%= @task.pid %>
|
32
|
-
<% form_for @task, :url => project_task_path(@project,@task) do |f| %>
|
33
|
-
<%= hidden_field_tag :kill, 'INT' %>
|
34
|
-
<%= f.submit 'INT' %>
|
35
|
-
<% end %>
|
36
|
-
|
37
|
-
<% form_for @task, :url => project_task_path(@project,@task) do |f| %>
|
38
|
-
<%= hidden_field_tag :kill, 'QUIT' %>
|
39
|
-
<%= f.submit 'QUIT' %>
|
40
|
-
<% end %>
|
41
|
-
|
42
|
-
<% form_for @task, :url => project_task_path(@project,@task) do |f| %>
|
43
|
-
<%= hidden_field_tag :kill, 'KILL' %>
|
44
|
-
<%= f.submit 'QUIT' %>
|
45
|
-
<% end %>
|
46
|
-
|
47
|
-
</dd>
|
48
|
-
<% else %>
|
49
|
-
<dt>Ended at:</dt>
|
50
|
-
<dd><%= show_time(@task.ended_at) %>
|
51
|
-
<span><%= show_elapsed(@task.build_duration) %></span></dd>
|
52
|
-
<% end %>
|
53
|
-
<%= link_to 'raw', project_task_path(@project,@task, 'text'), :class => 'raw_link' %>
|
54
|
-
</dl>
|
55
|
-
<pre id="output"><%= @task.parsed_output %></pre>
|
56
|
-
<% end %>
|
57
|
-
</div>
|
58
|
-
<% end %>
|
13
|
+
<%= render :partial => 'tasks/task', :locals => {:task => @task} %>
|
data/config/database.yml
CHANGED
@@ -10,7 +10,7 @@ development:
|
|
10
10
|
# Warning: The database defined as "test" will be erased and
|
11
11
|
# re-generated from your development database when you run "rake".
|
12
12
|
# Do not set this db to the same as development or production.
|
13
|
-
test:
|
13
|
+
test: &TEST
|
14
14
|
adapter: mysql
|
15
15
|
encoding: utf8
|
16
16
|
database: ginst_test
|
@@ -27,3 +27,6 @@ production:
|
|
27
27
|
username: root
|
28
28
|
password:
|
29
29
|
socket: /tmp/mysql.sock
|
30
|
+
|
31
|
+
cucumber:
|
32
|
+
<<: *TEST
|
data/config/environment.rb
CHANGED
@@ -21,15 +21,15 @@ Rails::Initializer.run do |config|
|
|
21
21
|
config.gem 'daemons'
|
22
22
|
config.gem 'templater'
|
23
23
|
|
24
|
-
config.database_configuration_file = Ginst.data_dir+'/database.yml'
|
25
|
-
config.log_path = Ginst.data_dir+'/log/ginst.rails.log'
|
26
|
-
config.plugin_paths = [RAILS_ROOT+'/vendor/plugins', Ginst.data_dir+'/plugins']
|
24
|
+
config.database_configuration_file = Ginst.data_dir+'/database.yml' if Ginst.data_dir
|
25
|
+
config.log_path = Ginst.data_dir+'/log/ginst.rails.log' if Ginst.data_dir
|
26
|
+
config.plugin_paths = [RAILS_ROOT+'/vendor/plugins', Ginst.data_dir+'/plugins'] if Ginst.data_dir
|
27
27
|
|
28
28
|
config.reload_plugins = true if RAILS_ENV == 'development'
|
29
29
|
|
30
30
|
config.plugins = [ :authlogic, :grit, :slugify, :all ]
|
31
31
|
|
32
|
-
config.load_paths += [Ginst.data_dir+'/lib']
|
32
|
+
config.load_paths += [Ginst.data_dir+'/lib'] if Ginst.data_dir
|
33
33
|
|
34
34
|
config.time_zone = 'UTC'
|
35
35
|
|
data/config/routes.rb
CHANGED
@@ -12,11 +12,7 @@ ActionController::Routing::Routes.draw do |map|
|
|
12
12
|
|
13
13
|
|
14
14
|
map.resource :status, :controller => :status
|
15
|
-
map.
|
16
|
-
map.root :controller => "user_sessions", :action => "new" # optional, this just sets the root route
|
17
|
-
map.resource :account, :controller => "users"
|
18
|
-
map.resources :users
|
19
|
-
|
15
|
+
map.root :controller => "projects", :action => "index"
|
20
16
|
|
21
17
|
# The priority is based upon order of creation: first created -> highest priority.
|
22
18
|
|
data/ginst.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ginst}
|
8
|
-
s.version = "
|
8
|
+
s.version = "2009.11.23"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Guillermo \303\201lvarez Fern\303\241ndez"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-24}
|
13
13
|
s.default_executable = %q{ginst}
|
14
14
|
s.description = %q{GINST is the new integration system}
|
15
15
|
s.email = %q{guillermo@cientifico.net}
|
@@ -58,6 +58,7 @@ Gem::Specification.new do |s|
|
|
58
58
|
"app/views/status/show.html.erb",
|
59
59
|
"app/views/tasks/_task.html.erb",
|
60
60
|
"app/views/tasks/_task_command.html.erb",
|
61
|
+
"app/views/tasks/_task_item.html.erb",
|
61
62
|
"app/views/tasks/building.html.erb",
|
62
63
|
"app/views/tasks/index.html.erb",
|
63
64
|
"app/views/tasks/show.html.erb",
|
@@ -86,14 +87,12 @@ Gem::Specification.new do |s|
|
|
86
87
|
"db/migrate/20091025165305_create_tasks.rb",
|
87
88
|
"db/migrate/20091025165330_create_commands.rb",
|
88
89
|
"db/schema.rb",
|
89
|
-
"features/ginst.feature",
|
90
|
-
"features/step_definitions/ginst_steps.rb",
|
91
|
-
"features/support/env.rb",
|
92
90
|
"ginst.gemspec",
|
93
91
|
"lib/ginst.rb",
|
94
92
|
"lib/ginst/builder.rb",
|
95
93
|
"lib/ginst/cli.rb",
|
96
94
|
"lib/ginst/configuration.rb",
|
95
|
+
"lib/ginst/console.rb",
|
97
96
|
"lib/ginst/console_to_html.rb",
|
98
97
|
"lib/ginst/ginst_template/database.ymlt",
|
99
98
|
"lib/ginst/ginst_template/plugins/simple_build/app/controllers/simple_builds_controller.rb",
|
@@ -107,6 +106,8 @@ Gem::Specification.new do |s|
|
|
107
106
|
"lib/ginst/ginst_template/plugins/simple_build/config/build.yml",
|
108
107
|
"lib/ginst/ginst_template/plugins/simple_build/config/routes.rb",
|
109
108
|
"lib/ginst/ginst_template/plugins/simple_build/init.rb",
|
109
|
+
"lib/ginst/ginst_template/webserver.ymlt",
|
110
|
+
"lib/ginst/logger.rb",
|
110
111
|
"lib/ginst/plugin.rb",
|
111
112
|
"lib/ginst/ssh.rb",
|
112
113
|
"lib/ginst/template.rb",
|
@@ -162,9 +163,11 @@ Gem::Specification.new do |s|
|
|
162
163
|
"script/process/spawner",
|
163
164
|
"script/runner",
|
164
165
|
"script/server",
|
165
|
-
"
|
166
|
-
"
|
167
|
-
"
|
166
|
+
"tmp/.gittouch",
|
167
|
+
"tmp/cache/.gittouch",
|
168
|
+
"tmp/pids/.gittouch",
|
169
|
+
"tmp/sessions/.gittouch",
|
170
|
+
"tmp/sockets/.gittouch",
|
168
171
|
"vendor/gems/daemons-1.0.10/.specification",
|
169
172
|
"vendor/gems/daemons-1.0.10/LICENSE",
|
170
173
|
"vendor/gems/daemons-1.0.10/README",
|
@@ -4225,28 +4228,24 @@ Gem::Specification.new do |s|
|
|
4225
4228
|
s.rubyforge_project = %q{ginst}
|
4226
4229
|
s.rubygems_version = %q{1.3.5}
|
4227
4230
|
s.summary = %q{Git Integration System}
|
4228
|
-
s.test_files = [
|
4229
|
-
"spec/ginst_spec.rb",
|
4230
|
-
"spec/spec_helper.rb"
|
4231
|
-
]
|
4232
4231
|
|
4233
4232
|
if s.respond_to? :specification_version then
|
4234
4233
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
4235
4234
|
s.specification_version = 3
|
4236
4235
|
|
4237
4236
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
4238
|
-
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
4239
|
-
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
4240
4237
|
s.add_runtime_dependency(%q<sys-proctable>, [">= 0"])
|
4238
|
+
s.add_runtime_dependency(%q<mime-types>, [">= 0"])
|
4239
|
+
s.add_runtime_dependency(%q<mongrel>, [">= 0"])
|
4241
4240
|
else
|
4242
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
4243
|
-
s.add_dependency(%q<cucumber>, [">= 0"])
|
4244
4241
|
s.add_dependency(%q<sys-proctable>, [">= 0"])
|
4242
|
+
s.add_dependency(%q<mime-types>, [">= 0"])
|
4243
|
+
s.add_dependency(%q<mongrel>, [">= 0"])
|
4245
4244
|
end
|
4246
4245
|
else
|
4247
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
4248
|
-
s.add_dependency(%q<cucumber>, [">= 0"])
|
4249
4246
|
s.add_dependency(%q<sys-proctable>, [">= 0"])
|
4247
|
+
s.add_dependency(%q<mime-types>, [">= 0"])
|
4248
|
+
s.add_dependency(%q<mongrel>, [">= 0"])
|
4250
4249
|
end
|
4251
4250
|
end
|
4252
4251
|
|
data/lib/ginst.rb
CHANGED
@@ -17,13 +17,16 @@ module Ginst
|
|
17
17
|
autoload(:Configuration, 'ginst/configuration')
|
18
18
|
autoload(:CLI, 'ginst/cli')
|
19
19
|
autoload(:WebServer, 'ginst/web_server')
|
20
|
+
autoload(:Console, 'ginst/console')
|
21
|
+
autoload(:Logger, 'ginst/logger')
|
20
22
|
|
21
23
|
def self.data_dir
|
22
24
|
return @@data_dir if @@data_dir
|
23
25
|
if ENV['GINST_DATA']
|
24
26
|
@@data_dir = ENV['GINST_DATA']
|
25
27
|
else
|
26
|
-
|
28
|
+
$stderr << "Ginst need a directory to work on!!!\nPlease define GINST_DATA environment variable"
|
29
|
+
@@data_dir = nil
|
27
30
|
end
|
28
31
|
end
|
29
32
|
|
@@ -31,7 +34,7 @@ module Ginst
|
|
31
34
|
@@root
|
32
35
|
end
|
33
36
|
|
34
|
-
VERSION = File.read(root+'/VERSION')
|
37
|
+
VERSION = File.read(root+'/VERSION').strip
|
35
38
|
end
|
36
39
|
|
37
40
|
# Add vendorized gems to load path
|
data/lib/ginst/builder.rb
CHANGED
data/lib/ginst/cli.rb
CHANGED
@@ -1,27 +1,13 @@
|
|
1
|
+
require('daemons')
|
1
2
|
|
2
|
-
class Ginst::CLI
|
3
|
-
|
4
|
-
require('daemons')
|
5
|
-
|
3
|
+
class Ginst::CLI
|
6
4
|
def initialize(argv)
|
7
5
|
parse_args(argv)
|
8
6
|
end
|
9
7
|
|
10
8
|
def run
|
11
|
-
|
12
9
|
if @install
|
13
|
-
|
14
|
-
|
15
|
-
ask_yes_or_exit("#{@dir} is a valid ginst install. Overwrite?") if(valid_dir?(@dir))
|
16
|
-
launch_generator
|
17
|
-
launch_migrations
|
18
|
-
puts green("Ginst was installed")
|
19
|
-
puts green("Starting the server")
|
20
|
-
puts `#{$0} start -d #{@dir}`
|
21
|
-
sleep 4
|
22
|
-
`open http://localhost:3000 2> /dev/null`
|
23
|
-
puts "Use '#{$0} start -d #{@dir}' to start ginst."
|
24
|
-
|
10
|
+
install
|
25
11
|
elsif @daemon
|
26
12
|
if valid_dir?(@dir)
|
27
13
|
daemon(@daemon,@dir)
|
@@ -35,13 +21,13 @@ class Ginst::CLI
|
|
35
21
|
|
36
22
|
def parse_args(argv)
|
37
23
|
@action = nil
|
38
|
-
@dir = ENV["GINST_DATA"] || Dir.pwd
|
24
|
+
@dir = File.expand_path(ENV["GINST_DATA"] || Dir.pwd)
|
39
25
|
@daemon = false
|
40
26
|
@install = false
|
41
27
|
while(current_arg = ARGV.shift) do
|
42
28
|
case current_arg
|
43
29
|
when '-d'
|
44
|
-
@dir = ARGV.shift
|
30
|
+
@dir = File.expand_path(ARGV.shift)
|
45
31
|
when '-p'
|
46
32
|
@port = ARGV.shift
|
47
33
|
when '-a'
|
@@ -58,7 +44,7 @@ class Ginst::CLI
|
|
58
44
|
@daemon = current_arg
|
59
45
|
when 'install'
|
60
46
|
@install = 'install'
|
61
|
-
when '
|
47
|
+
when '--help'
|
62
48
|
show_help_and_exit
|
63
49
|
else
|
64
50
|
error_and_exit("Invalid argument: #{current_arg}")
|
@@ -83,38 +69,29 @@ class Ginst::CLI
|
|
83
69
|
end
|
84
70
|
|
85
71
|
def daemon(action,dir)
|
86
|
-
|
87
|
-
options = {
|
88
|
-
:app_name => 'ginst',
|
89
|
-
:dir_mode => :normal,
|
90
|
-
:dir => File.expand_path(@dir+'/log'),
|
91
|
-
:monitor => false,
|
92
|
-
:log_output => true,
|
93
|
-
:mode => :exec,
|
94
|
-
:ARGV => [action]
|
95
|
-
}
|
96
|
-
|
72
|
+
Dir.chdir @dir
|
97
73
|
case action
|
98
74
|
when 'development'
|
99
75
|
ENV['RAILS_ENV'] = 'development'
|
100
|
-
|
101
|
-
when 'status'
|
102
|
-
Daemons.run(script, options)
|
76
|
+
Ginst::WebServer.run
|
103
77
|
when 'console'
|
104
78
|
ENV['RAILS_ENV'] = 'development'
|
105
|
-
|
79
|
+
Ginst::Console.start
|
106
80
|
else
|
107
|
-
|
108
|
-
Daemons.run(script, options)
|
109
|
-
exit
|
110
|
-
end
|
111
|
-
Process.waitpid2(pid)
|
112
|
-
sleep 2
|
113
|
-
daemon('status',dir)
|
114
|
-
exit
|
81
|
+
Ginst::WebServer.send(action.to_sym)
|
115
82
|
end
|
116
83
|
end
|
117
84
|
|
85
|
+
def install
|
86
|
+
puts("#{green('Installing ginst')} in: #{@dir}\n")
|
87
|
+
|
88
|
+
ask_yes_or_exit("#{@dir} is a valid ginst install. Overwrite?") if(valid_dir?(@dir))
|
89
|
+
launch_generator
|
90
|
+
launch_migrations
|
91
|
+
puts green("Ginst was installed")
|
92
|
+
puts "run '#{File.basename($0)} start -d #{@dir}' to start ginst."
|
93
|
+
end
|
94
|
+
|
118
95
|
def launch_migrations
|
119
96
|
puts "#{green("Creating the database.")}"
|
120
97
|
require 'open3'
|
@@ -147,7 +124,7 @@ class Ginst::CLI
|
|
147
124
|
" run [-d dir] # Run ginst in foreground\n"+
|
148
125
|
" development [-d dir] # Start ginst in developer mode\n"+
|
149
126
|
" console [-d dir] # Start ginst console\n\n"+
|
150
|
-
"
|
127
|
+
" --help # Show this help\n\n")
|
151
128
|
exit(-1)
|
152
129
|
end
|
153
130
|
|
data/lib/ginst/logger.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
class Ginst::Logger
|
4
|
+
|
5
|
+
def initialize(file)
|
6
|
+
@filename = file
|
7
|
+
@file = File.open(file,'a')
|
8
|
+
@file.sync = true
|
9
|
+
|
10
|
+
ObjectSpace.define_finalizer(self) do
|
11
|
+
puts self.class.to_s
|
12
|
+
puts 'Cerrando log file'
|
13
|
+
@file.close
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def log(msg,acaller = nil)
|
18
|
+
acaller ||= caller
|
19
|
+
msg = format_msg(msg,acaller)
|
20
|
+
@file.write(msg)
|
21
|
+
msg
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def format_msg(msg, caller)
|
26
|
+
call = File.basename(caller.first).split(":")[0..1].join(":")
|
27
|
+
"[%s %s] %s\n" % [Time.now.to_s, call, msg]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
data/lib/ginst/template.rb
CHANGED
data/lib/ginst/web_server.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
class Ginst::WebServer
|
2
2
|
|
3
3
|
require('daemons')
|
4
|
+
require('yaml')
|
4
5
|
|
6
|
+
def self.development
|
7
|
+
execute('start')
|
8
|
+
end
|
9
|
+
|
5
10
|
def self.start
|
6
11
|
execute('start')
|
7
12
|
end
|
@@ -15,7 +20,7 @@ class Ginst::WebServer
|
|
15
20
|
end
|
16
21
|
|
17
22
|
def self.status
|
18
|
-
execute('status')
|
23
|
+
puts execute('status')
|
19
24
|
end
|
20
25
|
|
21
26
|
def self.run
|
@@ -25,8 +30,15 @@ class Ginst::WebServer
|
|
25
30
|
private
|
26
31
|
|
27
32
|
def self.execute(command)
|
28
|
-
script =
|
29
|
-
|
33
|
+
script =
|
34
|
+
if ['start','restart','run'].include? command
|
35
|
+
config = read_config
|
36
|
+
script = [Ginst.root+'/script/server', '-b',config["address"],'-p', config["port"].to_s].join(' ')
|
37
|
+
else
|
38
|
+
script = Ginst.root+'/script/server'
|
39
|
+
end
|
40
|
+
|
41
|
+
|
30
42
|
if command == 'status'
|
31
43
|
capture_output do
|
32
44
|
Daemons.run(script, generate_options_for_command(command))
|
@@ -51,15 +63,25 @@ class Ginst::WebServer
|
|
51
63
|
end
|
52
64
|
|
53
65
|
def self.generate_options_for_command(command)
|
54
|
-
|
66
|
+
argv = [command]
|
67
|
+
|
68
|
+
{
|
55
69
|
:app_name => 'ginst',
|
56
70
|
:dir_mode => :normal,
|
57
71
|
:dir => File.expand_path((Ginst.data_dir || ENV['GINST_DIR'])+'/tmp'),
|
58
72
|
:monitor => false,
|
59
73
|
:mode => :exec,
|
60
74
|
:log_output => true,
|
61
|
-
:ARGV =>
|
62
|
-
}
|
75
|
+
:ARGV => argv
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.read_config
|
80
|
+
options = {"address" => '0.0.0.0', "port" => 3000}
|
81
|
+
config_file = Ginst.data_dir+"/webserver.yml"
|
82
|
+
config_options = YAML.load(File.read(config_file)) rescue {}
|
83
|
+
options.merge(config_options)
|
63
84
|
end
|
85
|
+
|
64
86
|
end
|
65
87
|
|