yhara-ruby-station 0.0.1
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 +43 -0
- data/VERSION +1 -0
- data/bin/ruby-station +17 -0
- data/config.rb +59 -0
- data/controller/applications.rb +79 -0
- data/controller/init.rb +8 -0
- data/controller/main.rb +8 -0
- data/layout/default.xhtml +61 -0
- data/lib/ruby-station.rb +28 -0
- data/model/application.rb +60 -0
- data/model/init.rb +4 -0
- data/public/css/ramaze_error.css +90 -0
- data/public/dispatch.fcgi +11 -0
- data/public/favicon.ico +0 -0
- data/public/js/jquery.js +3549 -0
- data/public/ramaze.png +0 -0
- data/public/spinner.gif +0 -0
- data/ruby-station.gemspec +61 -0
- data/sample.config.yaml +7 -0
- data/spec/main.rb +25 -0
- data/util/gem-manager.rb +53 -0
- data/view/applications/do_install.xhtml +3 -0
- data/view/applications/install.xhtml +17 -0
- data/view/applications/uninstall.xhtml +17 -0
- data/view/index.xhtml +56 -0
- metadata +77 -0
data/public/ramaze.png
ADDED
Binary file
|
data/public/spinner.gif
ADDED
Binary file
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{ruby-station}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Yutaka HARA"]
|
9
|
+
s.date = %q{2009-07-19}
|
10
|
+
s.default_executable = %q{ruby-station}
|
11
|
+
s.description = %q{Create, Distribute, and Install Ruby applications easily}
|
12
|
+
s.email = %q{yutaka.hara/at/gmail.com}
|
13
|
+
s.executables = ["ruby-station"]
|
14
|
+
|
15
|
+
s.files = [
|
16
|
+
"Rakefile",
|
17
|
+
"VERSION",
|
18
|
+
"bin/ruby-station",
|
19
|
+
"config.rb",
|
20
|
+
"controller/applications.rb",
|
21
|
+
"controller/init.rb",
|
22
|
+
"controller/main.rb",
|
23
|
+
"layout/default.xhtml",
|
24
|
+
"lib/ruby-station.rb",
|
25
|
+
"model/application.rb",
|
26
|
+
"model/init.rb",
|
27
|
+
"public/css/ramaze_error.css",
|
28
|
+
"public/dispatch.fcgi",
|
29
|
+
"public/favicon.ico",
|
30
|
+
"public/js/jquery.js",
|
31
|
+
"public/ramaze.png",
|
32
|
+
"public/spinner.gif",
|
33
|
+
"ruby-station.gemspec",
|
34
|
+
"sample.config.yaml",
|
35
|
+
"spec/main.rb",
|
36
|
+
"util/gem-manager.rb",
|
37
|
+
"view/applications/do_install.xhtml",
|
38
|
+
"view/applications/install.xhtml",
|
39
|
+
"view/applications/uninstall.xhtml",
|
40
|
+
"view/index.xhtml"
|
41
|
+
]
|
42
|
+
s.has_rdoc = true
|
43
|
+
s.homepage = %q{http://github.com/yhara/ruby-station}
|
44
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
45
|
+
s.require_paths = ["lib"]
|
46
|
+
s.rubygems_version = %q{1.3.2}
|
47
|
+
s.summary = %q{Create, Distribute, and Install Ruby applications easily}
|
48
|
+
s.test_files = [
|
49
|
+
"spec/main.rb"
|
50
|
+
]
|
51
|
+
|
52
|
+
if s.respond_to? :specification_version then
|
53
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
54
|
+
s.specification_version = 3
|
55
|
+
|
56
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
57
|
+
else
|
58
|
+
end
|
59
|
+
else
|
60
|
+
end
|
61
|
+
end
|
data/sample.config.yaml
ADDED
data/spec/main.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'ramaze'
|
2
|
+
require 'ramaze/spec/helper'
|
3
|
+
|
4
|
+
require __DIR__('../start')
|
5
|
+
|
6
|
+
describe MainController do
|
7
|
+
behaves_like 'http', 'xpath'
|
8
|
+
ramaze :view_root => __DIR__('../view'),
|
9
|
+
:public_root => __DIR__('../public')
|
10
|
+
|
11
|
+
it 'should show start page' do
|
12
|
+
got = get('/')
|
13
|
+
got.status.should == 200
|
14
|
+
puts got.body
|
15
|
+
got.at('//title').text.strip.should ==
|
16
|
+
MainController.new.index
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should show /notemplate' do
|
20
|
+
got = get('/notemplate')
|
21
|
+
got.status.should == 200
|
22
|
+
got.at('//div').text.strip.should ==
|
23
|
+
MainController.new.notemplate
|
24
|
+
end
|
25
|
+
end
|
data/util/gem-manager.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
module GemManager
|
2
|
+
def self.installed?(gemname, version)
|
3
|
+
gem_path = File.join(Conf.gem_dir, "gems", "#{gemname}-#{version}")
|
4
|
+
exists = File.exist?(gem_path)
|
5
|
+
Ramaze::Log.info "checking existance of #{gem_path}.. #{exists}"
|
6
|
+
|
7
|
+
exists
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.install_file(path)
|
11
|
+
begin
|
12
|
+
# make symlink
|
13
|
+
newpath = "/tmp/#{File.basename(path, ".gem")}.gem"
|
14
|
+
File.symlink(path, newpath)
|
15
|
+
|
16
|
+
# install
|
17
|
+
cmd = [
|
18
|
+
Conf.gem_command, "install", newpath,
|
19
|
+
"-i", Conf.gem_dir,
|
20
|
+
"-n", Conf.gem_bin_dir,
|
21
|
+
Conf.gem_install_option
|
22
|
+
].join(" ")
|
23
|
+
Ramaze::Log.info cmd
|
24
|
+
|
25
|
+
# execute
|
26
|
+
result = `#{cmd}`
|
27
|
+
|
28
|
+
# make data dir
|
29
|
+
spec = YAML.load(`gem spec #{path}`)
|
30
|
+
data_dir = File.join(Conf.data_dir, "#{spec.name}-#{spec.version}")
|
31
|
+
unless File.directory?(data_dir)
|
32
|
+
Dir.mkdir(data_dir)
|
33
|
+
Ramaze::Log.info "made data dir for the gem: #{data_dir}"
|
34
|
+
end
|
35
|
+
|
36
|
+
[result, spec.name, spec.version]
|
37
|
+
ensure
|
38
|
+
File.unlink(newpath)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.uninstall(name, version)
|
43
|
+
cmd = [
|
44
|
+
Conf.gem_command, "uninstall", name,
|
45
|
+
"-v", version,
|
46
|
+
"-i", Conf.gem_dir,
|
47
|
+
"-n", Conf.gem_bin_dir
|
48
|
+
].join(" ")
|
49
|
+
Ramaze::Log.info cmd
|
50
|
+
|
51
|
+
`#{cmd}`
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div id="install">
|
2
|
+
<h2>アプリケーションの追加</h2>
|
3
|
+
|
4
|
+
<p>Gem「#{@filename}」をインストールしています... (#{@size} bytes)</p>
|
5
|
+
|
6
|
+
<pre id="result">
|
7
|
+
<img src='/spinner.gif'>
|
8
|
+
</pre>
|
9
|
+
|
10
|
+
<a href='/'>back</a>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<script type="text/javascript">
|
14
|
+
$(document).ready(function(){
|
15
|
+
$("#result").load("#{r(:do_install)}");
|
16
|
+
});
|
17
|
+
</script>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div id="uninstall">
|
2
|
+
<h2>アプリケーションの削除</h2>
|
3
|
+
|
4
|
+
<p>uninstalling #{@app.full_name} ..</p>
|
5
|
+
|
6
|
+
<pre id="result">
|
7
|
+
<img src='/spinner.gif'>
|
8
|
+
</pre>
|
9
|
+
|
10
|
+
<a href='/'>back</a>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<script type="text/javascript">
|
14
|
+
$(document).ready(function(){
|
15
|
+
$("#result").load("#{r(:do_uninstall, @app.id)}");
|
16
|
+
});
|
17
|
+
</script>
|
data/view/index.xhtml
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
|
2
|
+
<div id="list">
|
3
|
+
<h2>アプリケーション一覧</h2>
|
4
|
+
<?r if @applications.nil? or @applications.empty? ?>
|
5
|
+
|
6
|
+
<?r else ?>
|
7
|
+
<table>
|
8
|
+
<tr>
|
9
|
+
<th>名前</th>
|
10
|
+
<th>バージョン</th>
|
11
|
+
<th>状態</th>
|
12
|
+
<th>操作</th>
|
13
|
+
</tr>
|
14
|
+
<?r @applications.each do |app| ?>
|
15
|
+
<tr>
|
16
|
+
<?r if app.pid ?>
|
17
|
+
<td>
|
18
|
+
<a href='http://localhost:#{h app.port}' target='_blank'>#{h app.name}</a>
|
19
|
+
</td>
|
20
|
+
<td>
|
21
|
+
#{h app.version}
|
22
|
+
</td>
|
23
|
+
<td>
|
24
|
+
ON / #{Applications.a("OFF", :stop, app.id)}
|
25
|
+
</td>
|
26
|
+
<?r else ?>
|
27
|
+
<td>
|
28
|
+
#{h app.name}
|
29
|
+
</td>
|
30
|
+
<td>
|
31
|
+
#{h app.version}
|
32
|
+
</td>
|
33
|
+
<td>
|
34
|
+
<a href='#{Applications.r(:start, app.id)}' target='_blank' onclick='setTimeout(function(){window.location = window.location;}, 1000)'>
|
35
|
+
ON</a> / OFF
|
36
|
+
</td>
|
37
|
+
<?r end ?>
|
38
|
+
<td>
|
39
|
+
#{Applications.a("-", :uninstall, app.id)}
|
40
|
+
</td>
|
41
|
+
</tr>
|
42
|
+
<?r end ?>
|
43
|
+
</table>
|
44
|
+
<?r end ?>
|
45
|
+
</div>
|
46
|
+
<div id="new">
|
47
|
+
<h2>アプリケーションの追加</h2>
|
48
|
+
|
49
|
+
<form action="#{Applications.r(:install)}" method="POST" enctype="multipart/form-data">
|
50
|
+
<input type="file" name="gem">
|
51
|
+
<input type="submit" value="送信">
|
52
|
+
</form>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<div id="debug" style="display:block;">
|
56
|
+
</div>
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yhara-ruby-station
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yutaka HARA
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-07-19 00:00:00 -07:00
|
13
|
+
default_executable: ruby-station
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Create, Distribute, and Install Ruby applications easily
|
17
|
+
email: yutaka.hara/at/gmail.com
|
18
|
+
executables:
|
19
|
+
- ruby-station
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- Rakefile
|
26
|
+
- VERSION
|
27
|
+
- bin/ruby-station
|
28
|
+
- config.rb
|
29
|
+
- controller/applications.rb
|
30
|
+
- controller/init.rb
|
31
|
+
- controller/main.rb
|
32
|
+
- layout/default.xhtml
|
33
|
+
- lib/ruby-station.rb
|
34
|
+
- model/application.rb
|
35
|
+
- model/init.rb
|
36
|
+
- public/css/ramaze_error.css
|
37
|
+
- public/dispatch.fcgi
|
38
|
+
- public/favicon.ico
|
39
|
+
- public/js/jquery.js
|
40
|
+
- public/ramaze.png
|
41
|
+
- public/spinner.gif
|
42
|
+
- ruby-station.gemspec
|
43
|
+
- sample.config.yaml
|
44
|
+
- spec/main.rb
|
45
|
+
- util/gem-manager.rb
|
46
|
+
- view/applications/do_install.xhtml
|
47
|
+
- view/applications/install.xhtml
|
48
|
+
- view/applications/uninstall.xhtml
|
49
|
+
- view/index.xhtml
|
50
|
+
has_rdoc: true
|
51
|
+
homepage: http://github.com/yhara/ruby-station
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options:
|
54
|
+
- --charset=UTF-8
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
version:
|
69
|
+
requirements: []
|
70
|
+
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 1.2.0
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: Create, Distribute, and Install Ruby applications easily
|
76
|
+
test_files:
|
77
|
+
- spec/main.rb
|