bivouac 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README +6 -7
- data/bin/bivouac +1 -1
- data/doc/rdoc/classes/BivouacHelpers/BaseView.html +178 -0
- data/doc/rdoc/classes/BivouacHelpers/FormView.html +398 -0
- data/doc/rdoc/classes/BivouacHelpers/HtmlView.html +305 -0
- data/doc/rdoc/classes/BivouacHelpers/JavaScriptView.html +573 -0
- data/doc/rdoc/classes/BivouacHelpers/ScriptAculoUsView.html +258 -0
- data/doc/rdoc/classes/BivouacHelpers/TooltipView.html +158 -0
- data/doc/rdoc/classes/BivouacHelpers.html +117 -0
- data/doc/rdoc/classes/JavaScriptGenerator.html +564 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/AUTHORS.html +109 -0
- data/doc/rdoc/files/COPYING.html +533 -0
- data/doc/rdoc/files/README.html +427 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/base_rb.html +109 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/form_rb.html +109 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/html_rb.html +109 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/javascript_rb.html +113 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/scriptaculous_rb.html +113 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/tooltip_rb.html +109 -0
- data/doc/rdoc/index.html +10 -0
- data/doc/rdoc/permalink.gif +0 -0
- data/doc/rdoc/rdoc-style.css +106 -0
- data/doc/rdoc/rubyfr.png +0 -0
- data/examples/bivouac_sample/Rakefile +48 -0
- data/examples/bivouac_sample/app/bivouac_sample.rb +15 -7
- data/examples/bivouac_sample/app/controllers/index.rb +2 -2
- data/examples/bivouac_sample/app/controllers/sound.rb +10 -0
- data/examples/bivouac_sample/app/helpers/_helpers.rb +6 -3
- data/examples/bivouac_sample/app/views/sound.rb +16 -0
- data/examples/bivouac_sample/config/environment.rb +5 -2
- data/examples/bivouac_sample/config/postamble.rb +89 -18
- data/examples/bivouac_sample/public/javascripts/builder.js +12 -7
- data/examples/bivouac_sample/public/javascripts/controls.js +485 -355
- data/examples/bivouac_sample/public/javascripts/dragdrop.js +82 -52
- data/examples/bivouac_sample/public/javascripts/effects.js +361 -329
- data/examples/bivouac_sample/public/javascripts/prototype.js +2826 -1120
- data/examples/bivouac_sample/public/javascripts/scriptaculous.js +15 -8
- data/examples/bivouac_sample/public/javascripts/slider.js +40 -43
- data/examples/bivouac_sample/public/javascripts/sound.js +55 -0
- data/examples/bivouac_sample/public/javascripts/unittest.js +16 -12
- data/examples/bivouac_sample/public/sound/sword.mp3 +0 -0
- data/examples/bivouac_sample/script/console +6 -0
- data/examples/bivouac_sample/script/plugin +3 -0
- data/examples/bivouac_sample/script/server +2 -1
- data/examples/bivouac_sample/test/test_sound.rb +15 -0
- data/lib/bivouac/helpers/view/goh/sound.rb +38 -0
- data/lib/bivouac/template/application/helpers_goh.rb +2 -0
- data/lib/bivouac/template/static/builder.js +12 -7
- data/lib/bivouac/template/static/controls.js +485 -355
- data/lib/bivouac/template/static/dragdrop.js +82 -52
- data/lib/bivouac/template/static/effects.js +361 -329
- data/lib/bivouac/template/static/prototype.js +2826 -1120
- data/lib/bivouac/template/static/scriptaculous.js +15 -8
- data/lib/bivouac/template/static/slider.js +40 -43
- data/lib/bivouac/template/static/sound.js +55 -0
- data/lib/bivouac/template/static/unittest.js +16 -12
- metadata +45 -2
@@ -1,8 +1,8 @@
|
|
1
1
|
#
|
2
2
|
# Project BivouacSample
|
3
3
|
#
|
4
|
-
# Created using bivouac on
|
5
|
-
# Copyright (c)
|
4
|
+
# Created using bivouac on Sun Mar 23 20:30:14 +0100 2008.
|
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
|
8
8
|
# USE script/generate helper my_helper
|
@@ -12,6 +12,7 @@ require 'bivouac/helpers/view/goh/html'
|
|
12
12
|
require 'bivouac/helpers/view/goh/form'
|
13
13
|
require 'bivouac/helpers/view/goh/scriptaculous'
|
14
14
|
require 'bivouac/helpers/view/goh/javascript'
|
15
|
+
require 'bivouac/helpers/view/goh/sound'
|
15
16
|
require 'bivouac/helpers/view/goh/tooltip'
|
16
17
|
|
17
18
|
helpers = [
|
@@ -20,6 +21,8 @@ helpers = [
|
|
20
21
|
BivouacHelpers::FormView,
|
21
22
|
BivouacHelpers::ScriptAculoUsView,
|
22
23
|
BivouacHelpers::JavaScriptView,
|
24
|
+
BivouacHelpers::SoundView,
|
23
25
|
BivouacHelpers::TooltipView
|
24
|
-
]
|
26
|
+
] + viewHelperModule
|
27
|
+
|
25
28
|
BivouacSample.module_eval "class Mab < Markaby::Builder; include #{helpers.join(', ')}; end"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module BivouacSample::Views
|
2
|
+
def sound
|
3
|
+
html do
|
4
|
+
head do
|
5
|
+
javascript_include_tag :defaults
|
6
|
+
end
|
7
|
+
body do
|
8
|
+
h1 "Sound"
|
9
|
+
a "play sound (parallel)", :href => "#", :onclick => play_sound_js( "sound/sword.mp3" ); br
|
10
|
+
a "play sound (overwrite)", :href => "#", :onclick => play_sound_js( "sound/sword.mp3", :replace => true ); br
|
11
|
+
a "Mute", :href => "#", :onclick => disable_sound_js
|
12
|
+
a "Enable sounds", :href => "#", :onclick => enable_sound_js
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#
|
2
2
|
# Project BivouacSample
|
3
3
|
#
|
4
|
-
# Created using bivouac on
|
5
|
-
# Copyright (c)
|
4
|
+
# Created using bivouac on Sun Mar 23 20:30:12 +0100 2008.
|
5
|
+
# Copyright (c) 2008 __My__. All rights reserved.
|
6
6
|
#
|
7
7
|
|
8
8
|
require 'ostruct'
|
@@ -20,6 +20,9 @@ module Bivouac
|
|
20
20
|
# Application port
|
21
21
|
:port => 3301,
|
22
22
|
|
23
|
+
# Database configuration
|
24
|
+
:db => {:database=>"db/bivouac_sample.db", :adapter=>"sqlite3"},
|
25
|
+
|
23
26
|
# Name of the application
|
24
27
|
# DO NOT CHANGE IT, OR YOU REALLY KNOW WHAT YOU ARE DOING!
|
25
28
|
:appname => "BivouacSample",
|
@@ -1,23 +1,43 @@
|
|
1
1
|
#
|
2
2
|
# Project BivouacSample
|
3
3
|
#
|
4
|
-
# Created using bivouac on
|
5
|
-
# Copyright (c)
|
4
|
+
# Created using bivouac on Sun Mar 23 20:30:13 +0100 2008.
|
5
|
+
# Copyright (c) 2008 __My__. All rights reserved.
|
6
6
|
#
|
7
7
|
|
8
|
+
windows_process = false
|
9
|
+
if /Windows/.match( ENV['OS'] )
|
10
|
+
begin
|
11
|
+
require 'win32/process'
|
12
|
+
windows_process = true
|
13
|
+
rescue LoadError => e
|
14
|
+
warn "`win32-process' is not installed!"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
8
18
|
require 'simple-daemon'
|
9
19
|
|
10
20
|
DIRNAME = File.expand_path( File.dirname(__FILE__) )
|
11
|
-
SimpleDaemon::
|
21
|
+
SimpleDaemon::WORKING_DIRECTORY = DIRNAME + "/../log/"
|
22
|
+
|
12
23
|
class BivouacSampleDaemon < SimpleDaemon::Base
|
13
24
|
@@server = nil
|
25
|
+
@@use = nil
|
26
|
+
|
27
|
+
def self.use=(x)
|
28
|
+
@@use=x
|
29
|
+
end
|
14
30
|
|
15
31
|
def self.start
|
16
32
|
config = Bivouac::Environment.new( )
|
17
33
|
|
18
|
-
|
34
|
+
database_connection = config.environment.db
|
35
|
+
if database_connection[:adapter] =~ /sqlite/
|
36
|
+
database_connection[:database] = DIRNAME + "/../" + database_connection[:database]
|
37
|
+
end
|
38
|
+
BivouacSample::Models::Base.establish_connection database_connection
|
19
39
|
BivouacSample::Models::Base.logger = Logger.new(DIRNAME + "/../log/BivouacSample.log")
|
20
|
-
# BivouacSample::Models::Base.threaded_connections = false
|
40
|
+
# -- DON'T WORK WITH RAILS 2 -- # BivouacSample::Models::Base.threaded_connections = false
|
21
41
|
BivouacSample.create if BivouacSample.respond_to? :create
|
22
42
|
|
23
43
|
trap(:INT) do
|
@@ -25,11 +45,22 @@ class BivouacSampleDaemon < SimpleDaemon::Base
|
|
25
45
|
end
|
26
46
|
|
27
47
|
begin
|
28
|
-
|
48
|
+
if @@use.nil?
|
49
|
+
begin
|
50
|
+
require 'thin'
|
51
|
+
|
52
|
+
Rack::Handler::Thin.run Rack::Adapter::Camping.new( BivouacSample ), :Host => config.environment.address, :Port => config.environment.port
|
53
|
+
puts "** BivouacSample is running at http://#{config.environment.address}:#{config.environment.port}"
|
54
|
+
rescue LoadError
|
55
|
+
require 'mongrel/camping'
|
29
56
|
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
+
end
|
61
|
+
else
|
62
|
+
raise LoadError, "I want to use WEBrick please!"
|
63
|
+
end
|
33
64
|
rescue LoadError => e
|
34
65
|
require 'webrick/httpserver'
|
35
66
|
require 'camping/webrick'
|
@@ -37,6 +68,7 @@ class BivouacSampleDaemon < SimpleDaemon::Base
|
|
37
68
|
@@server = WEBrick::HTTPServer.new :BindAddress => config.environment.address, :Port => config.environment.port
|
38
69
|
puts "** BivouacSample is running at http://#{config.environment.address}:#{config.environment.port}"
|
39
70
|
@@server.mount "/", WEBrick::CampingHandler, BivouacSample
|
71
|
+
@@server.start
|
40
72
|
end
|
41
73
|
end
|
42
74
|
|
@@ -50,13 +82,52 @@ class BivouacSampleDaemon < SimpleDaemon::Base
|
|
50
82
|
end
|
51
83
|
end
|
52
84
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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
|
+
|
93
|
+
include BivouacSample::Models
|
94
|
+
|
95
|
+
config = Bivouac::Environment.new( )
|
96
|
+
database_connection = config.environment.db
|
97
|
+
if database_connection[:adapter] =~ /sqlite/
|
98
|
+
database_connection[:database] = DIRNAME + "/../" + database_connection[:database]
|
99
|
+
end
|
100
|
+
BivouacSample::Models::Base.establish_connection database_connection
|
101
|
+
BivouacSample.create if BivouacSample.respond_to? :create
|
102
|
+
|
103
|
+
require 'irb'
|
104
|
+
require 'irb/completion'
|
105
|
+
if File.exists? ".irbrc"
|
106
|
+
ENV['IRBRC'] = ".irbrc"
|
107
|
+
end
|
108
|
+
IRB.start
|
109
|
+
break
|
110
|
+
when '-d'
|
111
|
+
if /Windows/.match( ENV['OS'] ) and windows_process == false
|
112
|
+
warn "You must install `win32-process' to daemonize this app."
|
113
|
+
exit 1
|
114
|
+
end
|
115
|
+
|
116
|
+
BivouacSampleDaemon.daemonize
|
117
|
+
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
|
+
when '--'
|
128
|
+
BivouacSampleDaemon.start
|
129
|
+
break
|
130
|
+
else
|
131
|
+
puts "Ignore unknown option '#{deamonize}' !"
|
132
|
+
end
|
62
133
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
// script.aculo.us builder.js v1.
|
1
|
+
// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
2
2
|
|
3
|
-
// Copyright (c) 2005
|
3
|
+
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
4
4
|
//
|
5
5
|
// script.aculo.us is freely distributable under the terms of an MIT-style license.
|
6
6
|
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
@@ -48,7 +48,8 @@ var Builder = {
|
|
48
48
|
// attributes (or text)
|
49
49
|
if(arguments[1])
|
50
50
|
if(this._isStringOrNumber(arguments[1]) ||
|
51
|
-
(arguments[1] instanceof Array)
|
51
|
+
(arguments[1] instanceof Array) ||
|
52
|
+
arguments[1].tagName) {
|
52
53
|
this._children(element, arguments[1]);
|
53
54
|
} else {
|
54
55
|
var attrs = this._attributes(arguments[1]);
|
@@ -66,7 +67,7 @@ var Builder = {
|
|
66
67
|
}
|
67
68
|
if(element.tagName.toUpperCase() != elementName)
|
68
69
|
element = parentElement.getElementsByTagName(elementName)[0];
|
69
|
-
|
70
|
+
}
|
70
71
|
}
|
71
72
|
|
72
73
|
// text, or array of children
|
@@ -88,10 +89,14 @@ var Builder = {
|
|
88
89
|
var attrs = [];
|
89
90
|
for(attribute in attributes)
|
90
91
|
attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
|
91
|
-
'="' + attributes[attribute].toString().escapeHTML() + '"');
|
92
|
+
'="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'"') + '"');
|
92
93
|
return attrs.join(" ");
|
93
94
|
},
|
94
95
|
_children: function(element, children) {
|
96
|
+
if(children.tagName) {
|
97
|
+
element.appendChild(children);
|
98
|
+
return;
|
99
|
+
}
|
95
100
|
if(typeof children=='object') { // array can hold nodes and text
|
96
101
|
children.flatten().each( function(e) {
|
97
102
|
if(typeof e=='object')
|
@@ -101,8 +106,8 @@ var Builder = {
|
|
101
106
|
element.appendChild(Builder._text(e));
|
102
107
|
});
|
103
108
|
} else
|
104
|
-
if(Builder._isStringOrNumber(children))
|
105
|
-
|
109
|
+
if(Builder._isStringOrNumber(children))
|
110
|
+
element.appendChild(Builder._text(children));
|
106
111
|
},
|
107
112
|
_isStringOrNumber: function(param) {
|
108
113
|
return(typeof param=='string' || typeof param=='number');
|