bivouac 0.2.2 → 0.2.3
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/README +15 -0
- data/bin/bivouac +45 -8
- data/doc/rdoc/classes/BivouacHelpers/FormView.html +157 -122
- data/doc/rdoc/classes/BivouacHelpers/JavaScriptView.html +1 -1
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +41 -1
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/form_rb.html +1 -1
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/javascript_rb.html +1 -1
- data/examples/bivouac_sample/Rakefile +20 -0
- data/examples/bivouac_sample/app/bivouac_sample.rb +12 -4
- data/examples/bivouac_sample/app/controllers/edit_in_place.rb +17 -0
- data/examples/bivouac_sample/app/controllers/index.rb +11 -1
- data/examples/bivouac_sample/app/controllers/not_found.rb +16 -0
- data/examples/bivouac_sample/app/helpers/_helpers.rb +5 -3
- data/examples/bivouac_sample/app/views/edit_in_place.rb +52 -0
- data/examples/bivouac_sample/app/views/index.rb +21 -11
- data/examples/bivouac_sample/app/views/not_found.rb +13 -0
- data/examples/bivouac_sample/config/database.yml +3 -0
- data/examples/bivouac_sample/config/environment.rb +3 -2
- data/examples/bivouac_sample/config/postamble.rb +104 -44
- data/examples/bivouac_sample/script/generate +6 -0
- data/examples/bivouac_sample/test/test_edit_in_place.rb +22 -0
- data/examples/bivouac_sample/test/test_index.rb +22 -0
- data/lib/bivouac/commands/generate.rb +34 -13
- data/lib/bivouac/commands/generate.rb_OLD +342 -0
- data/lib/bivouac/helpers/view/goh/form.rb +33 -9
- data/lib/bivouac/helpers/view/goh/javascript.rb +1 -1
- data/lib/bivouac/template/application/postamble.rb +3 -3
- data/lib/bivouac/template/application_goh.rb +21 -3
- data/lib/bivouac/template/environment.rb +7 -2
- data/lib/bivouac/template/generate/create.rb +3 -5
- data/lib/bivouac/template/generate/migrate.rb +1 -2
- data/lib/bivouac/template/generate/migrate_begin.rb +11 -0
- data/lib/bivouac/template/generate/migrate_column.rb +1 -0
- data/lib/bivouac/template/generate/migrate_end.rb +8 -0
- data/lib/bivouac/template/generate/migration_add.rb +1 -0
- data/lib/bivouac/template/generate/migration_begin.rb +10 -0
- data/lib/bivouac/template/generate/migration_end.rb +3 -0
- data/lib/bivouac/template/generate/migration_middle.rb +3 -0
- data/lib/bivouac/template/generate/migration_remove.rb +1 -0
- data/lib/bivouac/template/static/default_layout_view.rb +33 -0
- data/lib/bivouac/template/static/not_found_controller.rb +16 -0
- data/lib/bivouac/template/static/not_found_view.rb +13 -0
- data/lib/cookies_sessions.rb +39 -0
- metadata +23 -3
data/doc/rdoc/files/README.html
CHANGED
@@ -87,7 +87,7 @@ end</strong>
|
|
87
87
|
<div id="README" class="page_shade">
|
88
88
|
<div class="page">
|
89
89
|
<div class="header">
|
90
|
-
<div class="path">README /
|
90
|
+
<div class="path">README / Tue Jun 03 16:17:16 +0200 2008</div>
|
91
91
|
</div>
|
92
92
|
|
93
93
|
<h1>Bivouac</h1>
|
@@ -130,6 +130,46 @@ href="http://code.whytheluckystiff.net/camping">camping</a>.
|
|
130
130
|
</li>
|
131
131
|
</ul>
|
132
132
|
<h2>FEATURES/PROBLEMS:</h2>
|
133
|
+
<h3>0.2.3:</h3>
|
134
|
+
<ul>
|
135
|
+
<li>Ruby 1.9… not yet !
|
136
|
+
|
137
|
+
</li>
|
138
|
+
<li>Database configuration use YAML
|
139
|
+
|
140
|
+
</li>
|
141
|
+
<li>Add not_found controller and view
|
142
|
+
|
143
|
+
</li>
|
144
|
+
<li>Remove :id column definition in migrate.rb
|
145
|
+
|
146
|
+
</li>
|
147
|
+
<li>Add helper FormView#editable_content from
|
148
|
+
|
149
|
+
<pre>
|
150
|
+
http://blog.codahale.com/2006/01/14/a-rails-howto-simplify-in-place-editing-with-scriptaculous/
|
151
|
+
Example at http://bivouac.rubyforge.org/svn/trunk/bivouac/examples/bivouac_sample/
|
152
|
+
</pre>
|
153
|
+
</li>
|
154
|
+
<li>model generator now work with column name and type. Example :
|
155
|
+
|
156
|
+
<pre>
|
157
|
+
ruby script/generate model user name:string mail:string
|
158
|
+
</pre>
|
159
|
+
</li>
|
160
|
+
<li>Add Multiple Layouts support (see <a
|
161
|
+
href="http://rubyforge.org/pipermail/camping-list/2008-May/000729.html">rubyforge.org/pipermail/camping-list/2008-May/000729.html</a>)
|
162
|
+
|
163
|
+
</li>
|
164
|
+
<li>Thin is not more the default server (because layouts don‘t work with
|
165
|
+
Thin :()
|
166
|
+
|
167
|
+
</li>
|
168
|
+
<li>Add Cookie session support. Use -S to specify session type (db or cookie -
|
169
|
+
default).
|
170
|
+
|
171
|
+
</li>
|
172
|
+
</ul>
|
133
173
|
<h3>0.2.2:</h3>
|
134
174
|
<ul>
|
135
175
|
<li>Postamble has been completely rewritten. So :
|
@@ -87,7 +87,7 @@ end</strong>
|
|
87
87
|
<div id="lib/bivouac/helpers/view/goh/form.rb" class="page_shade">
|
88
88
|
<div class="page">
|
89
89
|
<div class="header">
|
90
|
-
<div class="path">lib/bivouac/helpers/view/goh/form.rb /
|
90
|
+
<div class="path">lib/bivouac/helpers/view/goh/form.rb / Sat Apr 19 08:59:28 +0200 2008</div>
|
91
91
|
</div>
|
92
92
|
|
93
93
|
<p>
|
@@ -87,7 +87,7 @@ end</strong>
|
|
87
87
|
<div id="lib/bivouac/helpers/view/goh/javascript.rb" class="page_shade">
|
88
88
|
<div class="page">
|
89
89
|
<div class="header">
|
90
|
-
<div class="path">lib/bivouac/helpers/view/goh/javascript.rb /
|
90
|
+
<div class="path">lib/bivouac/helpers/view/goh/javascript.rb / Fri Apr 18 17:33:31 +0200 2008</div>
|
91
91
|
</div>
|
92
92
|
|
93
93
|
<p>
|
@@ -1,4 +1,11 @@
|
|
1
|
+
#
|
2
|
+
# Project BivouacSample
|
3
|
+
#
|
4
|
+
# Created using bivouac on Sat Apr 19 09:06:09 +0200 2008.
|
5
|
+
# Copyright (c) 2008 __My__. All rights reserved.
|
6
|
+
#
|
1
7
|
require 'rubygems'
|
8
|
+
require 'rake/rdoctask'
|
2
9
|
require 'camping'
|
3
10
|
require 'camping/session'
|
4
11
|
require 'bivouac'
|
@@ -46,3 +53,16 @@ namespace :db do
|
|
46
53
|
end
|
47
54
|
end
|
48
55
|
end
|
56
|
+
|
57
|
+
namespace :plugin do
|
58
|
+
desc "List plugins"
|
59
|
+
task :list do
|
60
|
+
Dir.glob( filePath( __FILE__, 'plugins/**' ) ).each do |p|
|
61
|
+
pn = p.gsub( /.*\//, "" )
|
62
|
+
print " - #{pn} : "
|
63
|
+
Rake::Task["plugin:#{pn}:desc"].invoke
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
Dir.glob( filePath( __FILE__, 'plugins/**/tasks/**.rake' ) ).each { |p| load p }
|
68
|
+
end
|
@@ -3,10 +3,12 @@
|
|
3
3
|
#
|
4
4
|
# Project BivouacSample
|
5
5
|
#
|
6
|
-
# Created using bivouac on
|
6
|
+
# Created using bivouac on Sat Apr 19 09:06:06 +0200 2008.
|
7
7
|
# Copyright (c) 2008 __My__. All rights reserved.
|
8
8
|
#
|
9
|
-
|
9
|
+
# DO NOT EDIT THIS FILE OR YOU REALLY KNOW WHAT YOU ARE DOING
|
10
|
+
# USE script/generate helper my_helper
|
11
|
+
#
|
10
12
|
require 'rubygems'
|
11
13
|
require 'camping'
|
12
14
|
require 'camping/session'
|
@@ -53,8 +55,14 @@ module BivouacSample::Controllers
|
|
53
55
|
else
|
54
56
|
type = (MIME::Types.type_for(file)[0] || '/text/plain').to_s
|
55
57
|
@headers['Content-Type'] = type
|
56
|
-
|
57
|
-
|
58
|
+
begin
|
59
|
+
@body = open( File.join( PATH, '..', 'public', file ) ).read
|
60
|
+
rescue Errno::ENOENT => e
|
61
|
+
@path = File.join '/public', file
|
62
|
+
@status = '404'
|
63
|
+
@headers['Content-Type'] = "text/html"
|
64
|
+
render :not_found
|
65
|
+
end
|
58
66
|
end
|
59
67
|
end
|
60
68
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# Project BivouacSample
|
3
|
+
#
|
4
|
+
# Created using bivouac on Fri Apr 18 17:49:46 +0200 2008.
|
5
|
+
# Copyright (c) 2008 __My__. All rights reserved.
|
6
|
+
#
|
7
|
+
|
8
|
+
module BivouacSample::Controllers
|
9
|
+
class EditInPlace < R '/edit_in_place'
|
10
|
+
def get
|
11
|
+
render :edit_in_place
|
12
|
+
end
|
13
|
+
def post
|
14
|
+
text input.value
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,7 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# Project BivouacSample
|
3
|
+
#
|
4
|
+
# Created using bivouac on Sat Apr 19 10:36:31 +0200 2008.
|
5
|
+
# Copyright (c) 2008 __My__. All rights reserved.
|
6
|
+
#
|
7
|
+
|
1
8
|
module BivouacSample::Controllers
|
2
9
|
class Index < R '/', '/index'
|
3
10
|
def get
|
4
|
-
|
11
|
+
render :index
|
12
|
+
end
|
13
|
+
def post
|
14
|
+
render :index
|
5
15
|
end
|
6
16
|
end
|
7
17
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#
|
2
|
+
# Project BivouacSample
|
3
|
+
#
|
4
|
+
# Created using bivouac on Sat Apr 19 09:06:10 +0200 2008.
|
5
|
+
# Copyright (c) 2008 __My__. All rights reserved.
|
6
|
+
#
|
7
|
+
|
8
|
+
module BivouacSample::Controllers
|
9
|
+
class NotFound
|
10
|
+
def get( path )
|
11
|
+
@status = 404
|
12
|
+
@path = path
|
13
|
+
render :not_found
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Project BivouacSample
|
3
3
|
#
|
4
|
-
# Created using bivouac on
|
4
|
+
# Created using bivouac on Sat Apr 19 09:06:07 +0200 2008.
|
5
5
|
# Copyright (c) 2008 __My__. All rights reserved.
|
6
6
|
#
|
7
7
|
# DO NOT EDIT THIS FILE OR YOU REALLY KNOW WHAT YOU ARE DOING
|
@@ -13,7 +13,6 @@ require 'bivouac/helpers/view/goh/form'
|
|
13
13
|
require 'bivouac/helpers/view/goh/scriptaculous'
|
14
14
|
require 'bivouac/helpers/view/goh/javascript'
|
15
15
|
require 'bivouac/helpers/view/goh/sound'
|
16
|
-
require 'bivouac/helpers/view/goh/tooltip'
|
17
16
|
|
18
17
|
helpers = [
|
19
18
|
BivouacHelpers::BaseView,
|
@@ -22,7 +21,10 @@ helpers = [
|
|
22
21
|
BivouacHelpers::ScriptAculoUsView,
|
23
22
|
BivouacHelpers::JavaScriptView,
|
24
23
|
BivouacHelpers::SoundView,
|
25
|
-
BivouacHelpers::TooltipView
|
26
24
|
] + viewHelperModule
|
27
25
|
|
28
26
|
BivouacSample.module_eval "class Mab < Markaby::Builder; include #{helpers.join(', ')}; end"
|
27
|
+
|
28
|
+
if controllerHelperModule.size > 0
|
29
|
+
Camping.class_eval "include #{controllerHelperModule.join(', ')}"
|
30
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#
|
2
|
+
# Project BivouacSample
|
3
|
+
#
|
4
|
+
# Created using bivouac on Fri Apr 18 17:49:47 +0200 2008.
|
5
|
+
# Copyright (c) 2008 __My__. All rights reserved.
|
6
|
+
#
|
7
|
+
|
8
|
+
module BivouacSample::Views
|
9
|
+
def edit_in_place
|
10
|
+
html do
|
11
|
+
head do
|
12
|
+
javascript_include_tag :defaults
|
13
|
+
stylesheet_link_tag "coderay"
|
14
|
+
end
|
15
|
+
body do
|
16
|
+
table :border => 1 do
|
17
|
+
tr do
|
18
|
+
td "Test this : "
|
19
|
+
td do
|
20
|
+
editable_content(
|
21
|
+
:content => {
|
22
|
+
:element => 'b',
|
23
|
+
:text => "Welcome",
|
24
|
+
:options => {
|
25
|
+
:id => "test_1",
|
26
|
+
:class => 'editable-content'
|
27
|
+
}
|
28
|
+
},
|
29
|
+
:url => R( EditInPlace ),
|
30
|
+
:ajax => {
|
31
|
+
:okText => "'Ok, change!'",
|
32
|
+
:cancelText => "'Nevermind'"
|
33
|
+
}
|
34
|
+
); text " le monde"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
tr do
|
38
|
+
td "Mais pas ça"
|
39
|
+
td "Hop"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
hr
|
44
|
+
p { span "Source du controller "; tt "app/controller/edit_in_place.rb" }
|
45
|
+
highlight_file( File.dirname( __FILE__ ) + "/../controllers/edit_in_place.rb", :id => "source0")
|
46
|
+
|
47
|
+
p { span "Source de la vue "; tt "app/views/edit_in_place.rb" }
|
48
|
+
highlight_file( __FILE__, :id => "source1" )
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -1,18 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# Project BivouacSample
|
3
|
+
#
|
4
|
+
# Created using bivouac on Sat Apr 19 10:36:32 +0200 2008.
|
5
|
+
# Copyright (c) 2008 __My__. All rights reserved.
|
6
|
+
#
|
7
|
+
|
1
8
|
module BivouacSample::Views
|
2
9
|
def index
|
3
10
|
html do
|
11
|
+
head do
|
12
|
+
title "bivouac samples"
|
13
|
+
end
|
4
14
|
body do
|
5
|
-
|
6
|
-
|
7
|
-
a
|
8
|
-
a
|
9
|
-
a
|
10
|
-
a
|
11
|
-
a
|
12
|
-
a
|
13
|
-
a
|
14
|
-
a
|
15
|
-
a
|
15
|
+
a "Autocomplete", :href => R(Autocomplete); br
|
16
|
+
a "Drag'n'Drop", :href => R(DragAndDrop); br
|
17
|
+
a "Edit In Place", :href => R(EditInPlace); br
|
18
|
+
a "Observe", :href => R(Observe); br
|
19
|
+
a "Periodically Call", :href => R(PeriodicallyCall); br
|
20
|
+
a "Remote Form", :href => R(RemoteForm); br
|
21
|
+
a "Remote Link", :href => R(RemoteLink); br
|
22
|
+
a "Sound", :href => R(Sound); br
|
23
|
+
a "Submit Remote", :href => R(SubmitRemote); br
|
24
|
+
a "Toggle", :href => R(Toggle); br
|
25
|
+
a "Toggle Sortable", :href => R(ToggleSortable); br
|
16
26
|
end
|
17
27
|
end
|
18
28
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#
|
2
|
+
# Project BivouacSample
|
3
|
+
#
|
4
|
+
# Created using bivouac on Sat Apr 19 09:06:10 +0200 2008.
|
5
|
+
# Copyright (c) 2008 __My__. All rights reserved.
|
6
|
+
#
|
7
|
+
|
8
|
+
module BivouacSample::Views
|
9
|
+
def not_found
|
10
|
+
h1.header { "BivouacSample::Views#not_found" }
|
11
|
+
p "Sorry baby, #{@path} does nor exist !"
|
12
|
+
end
|
13
|
+
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
#
|
2
2
|
# Project BivouacSample
|
3
3
|
#
|
4
|
-
# Created using bivouac on
|
4
|
+
# Created using bivouac on Sat Apr 19 09:06:04 +0200 2008.
|
5
5
|
# Copyright (c) 2008 __My__. All rights reserved.
|
6
6
|
#
|
7
7
|
|
8
8
|
require 'ostruct'
|
9
|
+
require 'yaml'
|
9
10
|
|
10
11
|
module Bivouac
|
11
12
|
class Environment
|
@@ -21,7 +22,7 @@ module Bivouac
|
|
21
22
|
:port => 3301,
|
22
23
|
|
23
24
|
# Database configuration
|
24
|
-
:db => {
|
25
|
+
:db => open("#{File.dirname( __FILE__ )}/database.yml") {|f| YAML.load(f)},
|
25
26
|
|
26
27
|
# Name of the application
|
27
28
|
# DO NOT CHANGE IT, OR YOU REALLY KNOW WHAT YOU ARE DOING!
|
@@ -1,10 +1,14 @@
|
|
1
1
|
#
|
2
2
|
# Project BivouacSample
|
3
3
|
#
|
4
|
-
# Created using bivouac on
|
4
|
+
# Created using bivouac on Sat Apr 19 09:06:06 +0200 2008.
|
5
5
|
# Copyright (c) 2008 __My__. All rights reserved.
|
6
6
|
#
|
7
|
+
# DO NOT EDIT THIS FILE OR YOU REALLY KNOW WHAT YOU ARE DOING
|
8
|
+
# USE script/generate helper my_helper
|
9
|
+
#
|
7
10
|
|
11
|
+
## If the app run on Windows, check if win32/process is installed
|
8
12
|
windows_process = false
|
9
13
|
if /Windows/.match( ENV['OS'] )
|
10
14
|
begin
|
@@ -21,54 +25,103 @@ DIRNAME = File.expand_path( File.dirname(__FILE__) )
|
|
21
25
|
SimpleDaemon::WORKING_DIRECTORY = DIRNAME + "/../log/"
|
22
26
|
|
23
27
|
class BivouacSampleDaemon < SimpleDaemon::Base
|
28
|
+
begin
|
29
|
+
begin
|
30
|
+
require 'thin'
|
31
|
+
@@loaded_server = 'thin'
|
32
|
+
rescue LoadError
|
33
|
+
require 'mongrel/camping'
|
34
|
+
@@loaded_server = 'mongrel'
|
35
|
+
end
|
36
|
+
rescue LoadError
|
37
|
+
require 'webrick/httpserver'
|
38
|
+
require 'camping/webrick'
|
39
|
+
@@loaded_server = 'webrick'
|
40
|
+
end
|
41
|
+
|
24
42
|
@@server = nil
|
25
|
-
@@
|
43
|
+
@@force_use = nil
|
44
|
+
@@server_ip = nil
|
45
|
+
@@server_port = nil
|
26
46
|
|
27
47
|
def self.use=(x)
|
28
|
-
@@
|
48
|
+
@@force_use=x
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.ip=(x)
|
52
|
+
@@server_ip=x
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.port=(x)
|
56
|
+
@@server_port=x
|
29
57
|
end
|
30
58
|
|
31
59
|
def self.start
|
60
|
+
## Load configuration
|
32
61
|
config = Bivouac::Environment.new( )
|
33
62
|
|
63
|
+
## Initialize database connection
|
34
64
|
database_connection = config.environment.db
|
35
65
|
if database_connection[:adapter] =~ /sqlite/
|
36
66
|
database_connection[:database] = DIRNAME + "/../" + database_connection[:database]
|
37
67
|
end
|
38
68
|
BivouacSample::Models::Base.establish_connection database_connection
|
69
|
+
|
70
|
+
## Define log
|
39
71
|
BivouacSample::Models::Base.logger = Logger.new(DIRNAME + "/../log/BivouacSample.log")
|
40
|
-
|
72
|
+
|
73
|
+
## Migrate database if needed
|
41
74
|
BivouacSample.create if BivouacSample.respond_to? :create
|
42
75
|
|
76
|
+
## Initialize trap
|
43
77
|
trap(:INT) do
|
44
78
|
stop
|
45
79
|
end
|
46
80
|
|
81
|
+
## Set server to use
|
82
|
+
if @@force_use.nil?
|
83
|
+
@@use_server = @@loaded_server
|
84
|
+
else
|
85
|
+
@@use_server = @@force_use
|
86
|
+
end
|
87
|
+
|
88
|
+
## Set ip and port
|
89
|
+
@@server_port = config.environment.port if @@server_port.nil?
|
90
|
+
@@server_ip = config.environment.address if @@server_ip.nil?
|
91
|
+
|
47
92
|
begin
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
93
|
+
case @@use_server
|
94
|
+
when 'thin'
|
95
|
+
if @@loaded_server != @@use_server
|
96
|
+
require 'thin'
|
97
|
+
end
|
98
|
+
|
99
|
+
# Rack::Handler::Thin.run Rack::Adapter::Camping.new( BivouacSample ), :Host => @@server_ip, :Port => @@server_port
|
100
|
+
@@server = Thin::Server.new( @@server_ip, @@server_port.to_i, Rack::Adapter::Camping.new( BivouacSample ) )
|
101
|
+
puts "** BivouacSample is running at http://#{@@server_ip}:#{@@server_port}"
|
102
|
+
@@server.start
|
103
|
+
when 'mongrel'
|
104
|
+
if @@loaded_server != @@use_server
|
55
105
|
require 'mongrel/camping'
|
56
|
-
|
57
|
-
@@server = Mongrel::Camping.start( config.environment.address, config.environment.port, "/", BivouacSample)
|
58
|
-
puts "** BivouacSample is running at http://#{config.environment.address}:#{config.environment.port}"
|
59
|
-
@@server.run.join
|
60
106
|
end
|
107
|
+
|
108
|
+
@@server = Mongrel::Camping.start( @@server_ip, @@server_port, "/", BivouacSample)
|
109
|
+
puts "** BivouacSample is running at http://#{@@server_ip}:#{@@server_port}"
|
110
|
+
@@server.run.join
|
111
|
+
when 'webrick'
|
112
|
+
if @@loaded_server != @@use_server
|
113
|
+
require 'webrick/httpserver'
|
114
|
+
require 'camping/webrick'
|
115
|
+
end
|
116
|
+
|
117
|
+
@@server = WEBrick::HTTPServer.new :BindAddress => @@server_ip, :Port => @@server_port
|
118
|
+
puts "** BivouacSample is running at http://#{@@server_ip}:#{@@server_port}"
|
119
|
+
@@server.mount "/", WEBrick::CampingHandler, BivouacSample
|
120
|
+
@@server.start
|
61
121
|
else
|
62
|
-
|
122
|
+
puts "Don't know how to use server `#{@@use_server}'!"
|
123
|
+
exit 0
|
63
124
|
end
|
64
|
-
rescue LoadError => e
|
65
|
-
require 'webrick/httpserver'
|
66
|
-
require 'camping/webrick'
|
67
|
-
|
68
|
-
@@server = WEBrick::HTTPServer.new :BindAddress => config.environment.address, :Port => config.environment.port
|
69
|
-
puts "** BivouacSample is running at http://#{config.environment.address}:#{config.environment.port}"
|
70
|
-
@@server.mount "/", WEBrick::CampingHandler, BivouacSample
|
71
|
-
@@server.start
|
72
125
|
end
|
73
126
|
end
|
74
127
|
|
@@ -80,16 +133,8 @@ class BivouacSampleDaemon < SimpleDaemon::Base
|
|
80
133
|
end
|
81
134
|
@@server = nil
|
82
135
|
end
|
83
|
-
|
84
|
-
|
85
|
-
while ARGV.size > 0
|
86
|
-
deamonize = ARGV.shift
|
87
|
-
case deamonize
|
88
|
-
when 'webrick'
|
89
|
-
BivouacSampleDaemon.use='webrick'
|
90
|
-
when '-c'
|
91
|
-
ARGV.clear
|
92
|
-
|
136
|
+
|
137
|
+
def self.console
|
93
138
|
include BivouacSample::Models
|
94
139
|
|
95
140
|
config = Bivouac::Environment.new( )
|
@@ -106,24 +151,39 @@ while ARGV.size > 0
|
|
106
151
|
ENV['IRBRC'] = ".irbrc"
|
107
152
|
end
|
108
153
|
IRB.start
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
while ARGV.size > 0
|
158
|
+
deamonize = ARGV.shift
|
159
|
+
case deamonize
|
160
|
+
when 'webrick'
|
161
|
+
BivouacSampleDaemon.use='webrick'
|
162
|
+
when 'mongrel'
|
163
|
+
BivouacSampleDaemon.use='mongrel'
|
164
|
+
when 'thin'
|
165
|
+
BivouacSampleDaemon.use='thin'
|
166
|
+
when '-c'
|
167
|
+
ARGV.clear
|
168
|
+
BivouacSampleDaemon.console
|
169
|
+
break
|
170
|
+
when '-h'
|
171
|
+
puts "Usage: server [thin|mongrel|webrick] [option]"
|
172
|
+
puts " -p port : Runs Bivouac on the specified port (default 3301)"
|
173
|
+
puts " -b ip : Binds Bivouac to the specified ip (default 0.0.0.0)"
|
174
|
+
puts " -d start|stop|restart : Make server run as a Daemon."
|
109
175
|
break
|
176
|
+
when '-p'
|
177
|
+
BivouacSampleDaemon.port=ARGV.shift
|
178
|
+
when '-b'
|
179
|
+
BivouacSampleDaemon.ip=ARGV.shift
|
110
180
|
when '-d'
|
111
181
|
if /Windows/.match( ENV['OS'] ) and windows_process == false
|
112
182
|
warn "You must install `win32-process' to daemonize this app."
|
113
183
|
exit 1
|
114
184
|
end
|
115
|
-
|
116
185
|
BivouacSampleDaemon.daemonize
|
117
186
|
break
|
118
|
-
when '-h'
|
119
|
-
begin
|
120
|
-
require 'mongrel/camping'
|
121
|
-
puts "=> Booting Mongrel (use 'script/server webrick [options]' to force WEBrick)"
|
122
|
-
rescue LoadError => e
|
123
|
-
puts "=> Booting WEBrick"
|
124
|
-
end
|
125
|
-
puts "script/server [-d start|stop|restart] [-h]"
|
126
|
-
exit
|
127
187
|
when '--'
|
128
188
|
BivouacSampleDaemon.start
|
129
189
|
break
|
@@ -1,3 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rubygems'
|
3
|
+
|
4
|
+
def filePath( from, *data )
|
5
|
+
File.join File.expand_path(File.dirname(from)), data
|
6
|
+
end
|
7
|
+
|
8
|
+
Dir.glob( filePath( __FILE__, '../plugins/**/generators/*.rb' ) ).each { |p| require p }
|
3
9
|
require 'bivouac/commands/generate'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# Project BivouacSample
|
3
|
+
#
|
4
|
+
# Created using bivouac on Fri Apr 18 17:49:47 +0200 2008.
|
5
|
+
# Copyright (c) 2008 __My__. All rights reserved.
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'rubygems'
|
9
|
+
require 'mosquito'
|
10
|
+
|
11
|
+
ENV['BIVOUAC_ROOT'] = File.expand_path( File.dirname(__FILE__) + "/../" )
|
12
|
+
require ENV['BIVOUAC_ROOT'] + "/app/bivouac_sample"
|
13
|
+
|
14
|
+
BivouacSample.create if BivouacSample.respond_to? :create
|
15
|
+
include BivouacSample::Models
|
16
|
+
|
17
|
+
class TestBivouacSample < Camping::FunctionalTest
|
18
|
+
def test_edit_in_place
|
19
|
+
get '/edit_in_place'
|
20
|
+
assert_response :success
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# Project BivouacSample
|
3
|
+
#
|
4
|
+
# Created using bivouac on Sat Apr 19 10:36:32 +0200 2008.
|
5
|
+
# Copyright (c) 2008 __My__. All rights reserved.
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'rubygems'
|
9
|
+
require 'mosquito'
|
10
|
+
|
11
|
+
ENV['BIVOUAC_ROOT'] = File.expand_path( File.dirname(__FILE__) + "/../" )
|
12
|
+
require ENV['BIVOUAC_ROOT'] + "/app/bivouac_sample"
|
13
|
+
|
14
|
+
BivouacSample.create if BivouacSample.respond_to? :create
|
15
|
+
include BivouacSample::Models
|
16
|
+
|
17
|
+
class TestBivouacSample < Camping::FunctionalTest
|
18
|
+
def test_index
|
19
|
+
get '/index'
|
20
|
+
assert_response :success
|
21
|
+
end
|
22
|
+
end
|