rocketstarter 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +7 -0
- data/lib/rocketstarter/rocket_starter_core.rb +3 -3
- data/lib/rocketstarter/rocket_starter_options.rb +4 -3
- data/lib/rocketstarter/version.rb +2 -2
- data/spec/rocketstarter_spec.rb +89 -5
- data/spec/spec_helper.rb +148 -0
- data/website/index.html +7 -2
- data/website/index.txt +4 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 0.1.0 2008-07-10
|
2
|
+
|
3
|
+
* update project status to beta.
|
4
|
+
* add rspec files.(but basic test only)
|
5
|
+
* don't use -g option with rails command when a git repository is empty.
|
6
|
+
* fix some bugs.
|
7
|
+
|
1
8
|
== 0.0.3 2008-06-30
|
2
9
|
|
3
10
|
* change default of plugin-list name from "$HOME/useful_plugins" to "$HOME/.rocket_starter_pluginlist".
|
@@ -168,7 +168,7 @@ put gitignore files
|
|
168
168
|
when "git"
|
169
169
|
exec_shell_command "mkdir rails docs"
|
170
170
|
managed_chdir("#{@scm_root}/rails")
|
171
|
-
rails_option = "
|
171
|
+
rails_option = ""
|
172
172
|
else
|
173
173
|
exec_shell_command "mkdir rails docs"
|
174
174
|
managed_chdir("#{@scm_root}/rails")
|
@@ -283,12 +283,12 @@ put gitignore files
|
|
283
283
|
|
284
284
|
def managed_chdir(path)
|
285
285
|
notice("change directory to " + path)
|
286
|
-
Dir::chdir(path)
|
286
|
+
Dir::chdir(path) unless @options[:emulate]
|
287
287
|
end
|
288
288
|
|
289
289
|
def set_scm_password
|
290
290
|
@scm_password = ""
|
291
|
-
@scm_password = '--password=' + @options[:scmpassword] if @options[:scmpassword]
|
291
|
+
@scm_password = '--password="' + @options[:scmpassword] + '"' if @options[:scmpassword]
|
292
292
|
end
|
293
293
|
|
294
294
|
def get_current_directory
|
@@ -104,7 +104,7 @@ class Rocket_starter_options < Hash
|
|
104
104
|
@@command_line_params[:createdb] = true
|
105
105
|
end
|
106
106
|
|
107
|
-
opts.on( '--dbpassword', 'write password to config/database.yml file' ) do |p|
|
107
|
+
opts.on( '--dbpassword=password', 'write password to config/database.yml file' ) do |p|
|
108
108
|
@@command_line_params[:dbpassword] = p
|
109
109
|
end
|
110
110
|
|
@@ -182,7 +182,8 @@ class Rocket_starter_options < Hash
|
|
182
182
|
File.open(self[:rocket_starter_conf_path], "w") do |yamlfile|
|
183
183
|
yamlfile.puts "# Rocket_starter conf file"
|
184
184
|
yamlfile.puts ""
|
185
|
-
|
185
|
+
output = Rocket_starter_options::static_default_values.merge(@@command_line_params)
|
186
|
+
yamlfile.puts output.to_yaml
|
186
187
|
end
|
187
188
|
puts "Put template yaml file to #{self[:rocket_starter_conf_path]}"
|
188
189
|
rescue
|
@@ -196,7 +197,7 @@ class Rocket_starter_options < Hash
|
|
196
197
|
Rocket_starter_options::error_with_show_usage "plugin list path is empty. set --pluginlist_path paramater." if "" == self[:pluginlist_path]
|
197
198
|
|
198
199
|
unless "y" == Readline.readline("Would a template of plugin list file put to #{self[:pluginlist_path]}? [y/N] > ").downcase
|
199
|
-
puts "Set your plugin list path to --
|
200
|
+
puts "Set your plugin list path to --listpath paramater."
|
200
201
|
exit
|
201
202
|
end
|
202
203
|
|
data/spec/rocketstarter_spec.rb
CHANGED
@@ -1,11 +1,95 @@
|
|
1
|
+
# This file was wrote by Japanese with UTF8
|
2
|
+
# This spec needs sandbox directory, please make "~/sandbox/rocketstarter" directory first!
|
3
|
+
|
1
4
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
5
|
+
require "~/Sources/secret.rb"
|
6
|
+
|
2
7
|
|
3
|
-
|
4
|
-
|
5
|
-
|
8
|
+
describe "のspec用のメソッドが動作するとき:" do
|
9
|
+
it "Hash.includes_hash?を使うと、ハッシュを含むかどうかがわかる事" do
|
10
|
+
target = {"1" => "a", "2" => "b", "3" => "c"}
|
11
|
+
target.includes_hash?(target).should be_true
|
12
|
+
target.includes_hash?({"1" => "a"}).should be_true
|
13
|
+
target.includes_hash?({"5" => "a"}).should be_false
|
14
|
+
target.includes_hash?(target.merge({"4" => "d"})).should be_false
|
15
|
+
end
|
6
16
|
|
7
|
-
it "
|
8
|
-
|
17
|
+
it "build_option_stringはハッシュからパラメータ用文字列を生成できる事" do
|
18
|
+
options = {
|
19
|
+
"bystring" => "string",
|
20
|
+
"byflag" => "true",
|
21
|
+
"project" => "testproj",
|
22
|
+
}
|
23
|
+
build_option_string(options).should == " --project=testproj --byflag --bystring=string"
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'options.delete("project")を使うと、プロジェクト名を取り出し、ハッシュからは抜ける事' do
|
27
|
+
options = {
|
28
|
+
"bystring" => "string",
|
29
|
+
"byflag" => "true",
|
30
|
+
"project" => "testproj",
|
31
|
+
}
|
32
|
+
project_name = options.delete("project")
|
33
|
+
project_name.should == "testproj"
|
34
|
+
build_option_string(options).should == " --byflag --bystring=string"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "のspecが実行された場合:" do
|
39
|
+
before do
|
40
|
+
move_to_sandbox
|
41
|
+
clean_up_sandbox
|
9
42
|
end
|
10
43
|
|
44
|
+
it "sandboxに移動できる事" do
|
45
|
+
move_to_sandbox.should be_true
|
46
|
+
end
|
47
|
+
|
48
|
+
it "sandboxをclean upできる事" do
|
49
|
+
clean_up_sandbox.should be_true
|
50
|
+
end
|
51
|
+
|
11
52
|
end
|
53
|
+
|
54
|
+
|
55
|
+
describe "に--initオプションを付けた場合:" do
|
56
|
+
before do
|
57
|
+
move_to_sandbox
|
58
|
+
clean_up_sandbox
|
59
|
+
setup_config_directory
|
60
|
+
end
|
61
|
+
|
62
|
+
it "最初はconfigファイルとプラグインリストファイルが無い事" do
|
63
|
+
FileTest::file?(path_of_config_file).should be_false
|
64
|
+
end
|
65
|
+
|
66
|
+
it "--initを付けるとconfigファイルとプラグインリストファイルのテンプレートが生成される事" do
|
67
|
+
setup_config_file.should be_true
|
68
|
+
FileTest::file?(path_of_config_file).should be_true
|
69
|
+
FileTest::file?(path_of_plugin_list_file).should be_true
|
70
|
+
end
|
71
|
+
|
72
|
+
it "最初の初期化時はファイルを上書きしない事" do
|
73
|
+
setup_config_file.should be_true
|
74
|
+
FileTest::file?(path_of_config_file).should be_true
|
75
|
+
FileTest::file?(path_of_plugin_list_file).should be_true
|
76
|
+
end
|
77
|
+
|
78
|
+
it "2回目の初期化時はファイルの上書き確認が表示される事" do
|
79
|
+
setup_config_file.should be_true
|
80
|
+
setup_config_file(nil, 4).should be_true
|
81
|
+
FileTest::file?(path_of_config_file).should be_true
|
82
|
+
FileTest::file?(path_of_plugin_list_file).should be_true
|
83
|
+
end
|
84
|
+
|
85
|
+
it "--init時に他のパラメータを付けておくと、デフォルトではなく、パラメータを保存する事" do
|
86
|
+
options = {
|
87
|
+
"database" => "sqlite3",
|
88
|
+
"verbose" => "true",
|
89
|
+
}
|
90
|
+
|
91
|
+
setup_config_file(options).should be_true
|
92
|
+
parse_setting.includes_hash?(options).should be_true
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
data/spec/spec_helper.rb
CHANGED
@@ -8,3 +8,151 @@ end
|
|
8
8
|
|
9
9
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
10
10
|
require 'rocketstarter'
|
11
|
+
|
12
|
+
|
13
|
+
def move_to_sandbox
|
14
|
+
sandbox_path = test_dir
|
15
|
+
unless FileTest::directory?(sandbox_path)
|
16
|
+
puts 'This spec needs a sandbox directory at ' + sandbox_path
|
17
|
+
puts 'If you want to countinue, please make it first!'
|
18
|
+
return false
|
19
|
+
end
|
20
|
+
Dir::chdir(sandbox_path)
|
21
|
+
if sandbox_path == Dir::pwd
|
22
|
+
return true
|
23
|
+
else
|
24
|
+
return false
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def clean_up_sandbox
|
29
|
+
`rm -rf ./gitproj`
|
30
|
+
return false unless 0 == $?
|
31
|
+
`rm -rf ./svnproj`
|
32
|
+
return false unless 0 == $?
|
33
|
+
`rm -rf ./setting`
|
34
|
+
return false unless 0 == $?
|
35
|
+
return true
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_dir
|
39
|
+
ENV["HOME"] + "/sandbox/rocketstarter"
|
40
|
+
end
|
41
|
+
|
42
|
+
def path_of_config_file
|
43
|
+
test_dir + "/setting/rocketstarter"
|
44
|
+
end
|
45
|
+
|
46
|
+
def path_of_plugin_list_file
|
47
|
+
test_dir + "/setting/pluginlist"
|
48
|
+
end
|
49
|
+
|
50
|
+
def path_of_program
|
51
|
+
"/opt/local/bin/rocketstarter"
|
52
|
+
end
|
53
|
+
|
54
|
+
def setup_config_directory
|
55
|
+
Dir.mkdir("setting")
|
56
|
+
end
|
57
|
+
|
58
|
+
def build_option_string(options)
|
59
|
+
option_string = ""
|
60
|
+
options.each_pair do |key, value|
|
61
|
+
if "true" == value or "false" == value
|
62
|
+
option_string << " --#{key}"
|
63
|
+
else
|
64
|
+
option_string << " --#{key}=#{value}"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
option_string
|
68
|
+
end
|
69
|
+
|
70
|
+
def setup_config_file(options = nil, how_many = 2)
|
71
|
+
option_string = ""
|
72
|
+
if options
|
73
|
+
option_string = build_option_string(options)
|
74
|
+
end
|
75
|
+
commandline = "|#{path_of_program} --init --conf=#{path_of_config_file} --listpath=#{path_of_plugin_list_file} #{option_string}"
|
76
|
+
open(commandline, "r+") do |rs|
|
77
|
+
how_many.times do
|
78
|
+
rs.puts "y"
|
79
|
+
end
|
80
|
+
# rs.puts "y" # ask to create for config
|
81
|
+
# rs.puts "y" # ask to over write for config
|
82
|
+
# rs.puts "y" # ask to create for plugin list
|
83
|
+
# rs.puts "y" # ask to over write for plugin list
|
84
|
+
end
|
85
|
+
return true
|
86
|
+
end
|
87
|
+
|
88
|
+
=begin
|
89
|
+
/Users/maimuzo/sandbox/rocketstarter/setting% rocketstarter --check
|
90
|
+
current variables
|
91
|
+
scmtype:svn
|
92
|
+
skip_plugins:false
|
93
|
+
emulate:false
|
94
|
+
log_file:/Users/maimuzo/rocket_starter.log
|
95
|
+
check:true
|
96
|
+
scmuri:
|
97
|
+
verbose:true
|
98
|
+
pluginlist_path:/Users/maimuzo/.rocket_starter_pluginlist
|
99
|
+
external:false
|
100
|
+
scmpassword:mogemoge
|
101
|
+
ignoredatabase:true
|
102
|
+
logging:true
|
103
|
+
createdb:true
|
104
|
+
rapt:true
|
105
|
+
skip_commit_for_plugins:false
|
106
|
+
rocket_starter_conf_path:/Users/maimuzo/.rocket_starter
|
107
|
+
project:--check
|
108
|
+
database:mysql
|
109
|
+
sudo:false
|
110
|
+
skip_netbeans:false
|
111
|
+
dbpassword:
|
112
|
+
init:false
|
113
|
+
|
114
|
+
=end
|
115
|
+
|
116
|
+
def parse_setting
|
117
|
+
parsed_param = {}
|
118
|
+
result = `#{path_of_program} --check --conf=#{path_of_config_file}`
|
119
|
+
return false unless 0 == $?
|
120
|
+
result.each do |line|
|
121
|
+
temp = line.scan(/^(.+):(.+)$/)
|
122
|
+
parsed_param[temp[0][0]] = temp[0][1] if temp.size > 0
|
123
|
+
end
|
124
|
+
parsed_param
|
125
|
+
end
|
126
|
+
|
127
|
+
class Hash
|
128
|
+
def includes_hash?(target)
|
129
|
+
result = target.reject do |key, value|
|
130
|
+
!self[key].nil? and value == self[key]
|
131
|
+
end
|
132
|
+
result.empty?
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def create_repos_with(options)
|
137
|
+
project_name = options.delete("project")
|
138
|
+
option_string = build_option_string(options)
|
139
|
+
result = `#{path_of_program} #{project_name} --conf=#{path_of_config_file} #{option_string}`
|
140
|
+
return false unless 0 == $?
|
141
|
+
result
|
142
|
+
end
|
143
|
+
|
144
|
+
def clean_up_at_svn_repository(secret)
|
145
|
+
begin
|
146
|
+
uri = secret["scmuri"]
|
147
|
+
password = secret["scmpassword"]
|
148
|
+
`svn delete #{uri}/trunk -m "clean up trunk for test" --password #{password}`
|
149
|
+
raise "command error" unless 0 == $?
|
150
|
+
`svn delete #{uri}/branches -m "clean up branches for test" --password #{password}`
|
151
|
+
raise "command error" unless 0 == $?
|
152
|
+
`svn delete #{uri}/tags -m "clean up tags for test" --password #{password}`
|
153
|
+
raise "command error" unless 0 == $?
|
154
|
+
rescue
|
155
|
+
puts "This message was showed when the subversion repository is empty. In this case is no probrem."
|
156
|
+
return false
|
157
|
+
end
|
158
|
+
end
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>rocket starter</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rocketstarter"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/rocketstarter" class="numbers">0.0
|
36
|
+
<a href="http://rubyforge.org/projects/rocketstarter" class="numbers">0.1.0</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ ‘rocketstarter’</h1>
|
39
39
|
|
@@ -63,6 +63,11 @@ If you want, you can use the git and the RaPT gem and a list of plugins.<br /></
|
|
63
63
|
</ul>
|
64
64
|
|
65
65
|
|
66
|
+
<h2>Live video</h2>
|
67
|
+
|
68
|
+
|
69
|
+
<p><a target="_blank" href="http://www.nicovideo.jp/watch/sm3792334">GemCast.1 Rocketstarter live video(Japanese)</a></p><iframe width="312" height="176" src="http://ext.nicovideo.jp/thumb/sm3792334" scrolling="no" style="border:solid 1px #CCC;" frameborder="0"></iframe>
|
70
|
+
|
66
71
|
<h2>Installing</h2>
|
67
72
|
|
68
73
|
|
@@ -183,7 +188,7 @@ rake install_gem</pre>
|
|
183
188
|
|
184
189
|
<p>Comments are welcome. Send an email to <a href="mailto:maimuzo@gmail.com">maimuzo</a> via the <a href="http://groups.google.com/group/rocket-starter">forum</a></p>
|
185
190
|
<p class="coda">
|
186
|
-
<a href="maimuzo@gmail.com">Yusuke Ohmichi(maimuzo)</a>,
|
191
|
+
<a href="maimuzo@gmail.com">Yusuke Ohmichi(maimuzo)</a>, 11th July 2008<br>
|
187
192
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
188
193
|
</p>
|
189
194
|
</div>
|
data/website/index.txt
CHANGED
@@ -20,6 +20,10 @@ h2. Features
|
|
20
20
|
* write password to config/database.yml<br />
|
21
21
|
* create databases before finish by 'rake db:create:all' command<br />
|
22
22
|
|
23
|
+
h2. Live video
|
24
|
+
|
25
|
+
<p><a target="_blank" href="http://www.nicovideo.jp/watch/sm3792334">GemCast.1 Rocketstarter live video(Japanese)</a></p><iframe width="312" height="176" src="http://ext.nicovideo.jp/thumb/sm3792334" scrolling="no" style="border:solid 1px #CCC;" frameborder="0"></iframe>
|
26
|
+
|
23
27
|
h2. Installing
|
24
28
|
|
25
29
|
<pre syntax="ruby">gem install rocketstarter</pre>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocketstarter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yusuke Ohmichi(maimuzo)
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
KWTqcg==
|
31
31
|
-----END CERTIFICATE-----
|
32
32
|
|
33
|
-
date: 2008-
|
33
|
+
date: 2008-07-11 00:00:00 +09:00
|
34
34
|
default_executable:
|
35
35
|
dependencies: []
|
36
36
|
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements: []
|
136
136
|
|
137
137
|
rubyforge_project: rocketstarter
|
138
|
-
rubygems_version: 1.
|
138
|
+
rubygems_version: 1.2.0
|
139
139
|
signing_key:
|
140
140
|
specification_version: 2
|
141
141
|
summary: When you want to create new rails applications, the Rocket-starter can set up basic directories and svn/git repositories for your applications.
|
metadata.gz.sig
CHANGED
Binary file
|