reactive 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/MIT-LICENSE +21 -0
- data/Manifest.txt +60 -0
- data/README.txt +130 -0
- data/Rakefile +14 -0
- data/app_generators/reactive/USAGE +11 -0
- data/app_generators/reactive/reactive_generator.rb +160 -0
- data/app_generators/reactive/templates/README +130 -0
- data/app_generators/reactive/templates/Rakefile +10 -0
- data/app_generators/reactive/templates/app/controllers/application_controller.rb +2 -0
- data/app_generators/reactive/templates/app/helpers/application_helper.rb +2 -0
- data/app_generators/reactive/templates/config/boot.rb +94 -0
- data/app_generators/reactive/templates/config/databases/frontbase.yml +28 -0
- data/app_generators/reactive/templates/config/databases/mysql.yml +54 -0
- data/app_generators/reactive/templates/config/databases/oracle.yml +39 -0
- data/app_generators/reactive/templates/config/databases/postgresql.yml +48 -0
- data/app_generators/reactive/templates/config/databases/sqlite2.yml +16 -0
- data/app_generators/reactive/templates/config/databases/sqlite3.yml +19 -0
- data/app_generators/reactive/templates/config/empty.log +0 -0
- data/app_generators/reactive/templates/config/environment.rb +11 -0
- data/app_generators/reactive/templates/script/destroy +12 -0
- data/app_generators/reactive/templates/script/generate +12 -0
- data/app_generators/reactive/templates/script/run +5 -0
- data/app_generators/reactive/templates/script/win_script.cmd +1 -0
- data/bin/reactive +16 -0
- data/lib/code_statistics.rb +107 -0
- data/lib/controller.rb +23 -0
- data/lib/controller/base.rb +442 -0
- data/lib/controller/filters.rb +767 -0
- data/lib/controller/flash.rb +161 -0
- data/lib/controller/helpers.rb +204 -0
- data/lib/controller/layout.rb +326 -0
- data/lib/dispatcher.rb +46 -0
- data/lib/generated_attribute.rb +40 -0
- data/lib/initializer.rb +425 -0
- data/lib/named_base_generator.rb +92 -0
- data/lib/reactive.rb +6 -0
- data/lib/request.rb +17 -0
- data/lib/source_annotation_extractor.rb +62 -0
- data/lib/tasks/annotations.rake +23 -0
- data/lib/tasks/databases.rake +347 -0
- data/lib/tasks/log.rake +9 -0
- data/lib/tasks/misc.rake +5 -0
- data/lib/tasks/reactive.rb +16 -0
- data/lib/tasks/statistics.rake +17 -0
- data/lib/tasks/testing.rake +118 -0
- data/lib/version.rb +9 -0
- data/lib/view.rb +1 -0
- data/lib/view/base.rb +33 -0
- data/reactive_generators/model/USAGE +27 -0
- data/reactive_generators/model/model_generator.rb +52 -0
- data/reactive_generators/model/templates/fixtures.yml +19 -0
- data/reactive_generators/model/templates/migration.rb +16 -0
- data/reactive_generators/model/templates/model.rb +2 -0
- data/reactive_generators/model/templates/unit_test.rb +8 -0
- data/reactive_generators/scaffold/USAGE +26 -0
- data/reactive_generators/scaffold/scaffold_generator.rb +75 -0
- data/reactive_generators/scaffold/templates/controller.rb +51 -0
- data/reactive_generators/scaffold/templates/functional_test.rb +49 -0
- data/reactive_generators/scaffold/templates/helper.rb +2 -0
- metadata +142 -0
data/History.txt
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2008 Pascal Hurni
|
2
|
+
Copyright (c) 2004-2007 David Heinemeier Hansson
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
History.txt
|
2
|
+
MIT-LICENSE
|
3
|
+
Manifest.txt
|
4
|
+
README.txt
|
5
|
+
Rakefile
|
6
|
+
app_generators/reactive/USAGE
|
7
|
+
app_generators/reactive/reactive_generator.rb
|
8
|
+
app_generators/reactive/templates/README
|
9
|
+
app_generators/reactive/templates/Rakefile
|
10
|
+
app_generators/reactive/templates/app/controllers/application_controller.rb
|
11
|
+
app_generators/reactive/templates/app/helpers/application_helper.rb
|
12
|
+
app_generators/reactive/templates/config/boot.rb
|
13
|
+
app_generators/reactive/templates/config/databases/frontbase.yml
|
14
|
+
app_generators/reactive/templates/config/databases/mysql.yml
|
15
|
+
app_generators/reactive/templates/config/databases/oracle.yml
|
16
|
+
app_generators/reactive/templates/config/databases/postgresql.yml
|
17
|
+
app_generators/reactive/templates/config/databases/sqlite2.yml
|
18
|
+
app_generators/reactive/templates/config/databases/sqlite3.yml
|
19
|
+
app_generators/reactive/templates/config/empty.log
|
20
|
+
app_generators/reactive/templates/config/environment.rb
|
21
|
+
app_generators/reactive/templates/script/destroy
|
22
|
+
app_generators/reactive/templates/script/generate
|
23
|
+
app_generators/reactive/templates/script/run
|
24
|
+
app_generators/reactive/templates/script/win_script.cmd
|
25
|
+
bin/reactive
|
26
|
+
lib/code_statistics.rb
|
27
|
+
lib/controller.rb
|
28
|
+
lib/controller/base.rb
|
29
|
+
lib/controller/filters.rb
|
30
|
+
lib/controller/flash.rb
|
31
|
+
lib/controller/helpers.rb
|
32
|
+
lib/controller/layout.rb
|
33
|
+
lib/dispatcher.rb
|
34
|
+
lib/generated_attribute.rb
|
35
|
+
lib/initializer.rb
|
36
|
+
lib/named_base_generator.rb
|
37
|
+
lib/reactive.rb
|
38
|
+
lib/request.rb
|
39
|
+
lib/source_annotation_extractor.rb
|
40
|
+
lib/tasks/annotations.rake
|
41
|
+
lib/tasks/databases.rake
|
42
|
+
lib/tasks/log.rake
|
43
|
+
lib/tasks/misc.rake
|
44
|
+
lib/tasks/reactive.rb
|
45
|
+
lib/tasks/statistics.rake
|
46
|
+
lib/tasks/testing.rake
|
47
|
+
lib/version.rb
|
48
|
+
lib/view.rb
|
49
|
+
lib/view/base.rb
|
50
|
+
reactive_generators/model/USAGE
|
51
|
+
reactive_generators/model/model_generator.rb
|
52
|
+
reactive_generators/model/templates/fixtures.yml
|
53
|
+
reactive_generators/model/templates/migration.rb
|
54
|
+
reactive_generators/model/templates/model.rb
|
55
|
+
reactive_generators/model/templates/unit_test.rb
|
56
|
+
reactive_generators/scaffold/USAGE
|
57
|
+
reactive_generators/scaffold/scaffold_generator.rb
|
58
|
+
reactive_generators/scaffold/templates/controller.rb
|
59
|
+
reactive_generators/scaffold/templates/functional_test.rb
|
60
|
+
reactive_generators/scaffold/templates/helper.rb
|
data/README.txt
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
== Welcome to Reactive
|
2
|
+
|
3
|
+
Please visit www.ruby-reactive.org for further informations.
|
4
|
+
|
5
|
+
== Description:
|
6
|
+
|
7
|
+
Reactive is a desktop application framework that gives everything
|
8
|
+
needed to create database-backed applications according to the
|
9
|
+
Model-View-Control pattern of separation.
|
10
|
+
|
11
|
+
Reactive is highly inspired and also uses code of Rails, the famous
|
12
|
+
Web-Framework for ruby.
|
13
|
+
|
14
|
+
In Reactive, the model is handled by what's called an object-relational mapping
|
15
|
+
layer. Reactive doesn't impose any ORM, you may choose the one you like but
|
16
|
+
Reactive defaults to Active Record. This means it has baked in support for it,
|
17
|
+
without forcing you to use it.
|
18
|
+
|
19
|
+
The view part is independant of Reactive, this means that the application has
|
20
|
+
to choose a view provider and feed it into Reactive. This leads to complete
|
21
|
+
freedom for the GUI part. View providers are packaged as gems, so that it is
|
22
|
+
easy for the developer to choose and install them. Look for reactive_view_*
|
23
|
+
to discover some view providers (at this early alpha stage, only reactive_view_wx
|
24
|
+
is available)
|
25
|
+
|
26
|
+
The controller is part of Reactive and is loosely coupled to the view. Simple
|
27
|
+
convention set up the link.
|
28
|
+
|
29
|
+
|
30
|
+
== Getting Started
|
31
|
+
|
32
|
+
1. At the command prompt, start a new Reactive application using the <tt>reactive</tt> command
|
33
|
+
and your application name. Ex: reactive myapp -w wx
|
34
|
+
2. Change directory into myapp and start the application: <tt>script/run</tt>
|
35
|
+
3. Welcome into your new application!
|
36
|
+
|
37
|
+
|
38
|
+
== Debugging Reactive
|
39
|
+
|
40
|
+
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
41
|
+
will help you debug it and get it back on the reactive.
|
42
|
+
|
43
|
+
First area to check is the application log files. Have "tail -f" commands running
|
44
|
+
on the development.log. Reactive will automatically display debugging
|
45
|
+
and runtime information to these files.
|
46
|
+
|
47
|
+
You can also log your own messages directly into the log file from your code using
|
48
|
+
the Ruby logger class from inside your controllers. Example:
|
49
|
+
|
50
|
+
class WeblogController < ApplicationController
|
51
|
+
def destroy
|
52
|
+
@weblog = Weblog.find(params[:id])
|
53
|
+
@weblog.destroy
|
54
|
+
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
The result will be a message in your log file along the lines of:
|
59
|
+
|
60
|
+
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
|
61
|
+
|
62
|
+
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
63
|
+
|
64
|
+
Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
|
65
|
+
|
66
|
+
* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
|
67
|
+
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
68
|
+
|
69
|
+
These two online (and free) books will bring you up to speed on the Ruby language
|
70
|
+
and also on programming in general.
|
71
|
+
|
72
|
+
|
73
|
+
== Debugger
|
74
|
+
|
75
|
+
|
76
|
+
== Console
|
77
|
+
|
78
|
+
|
79
|
+
== Description of Contents
|
80
|
+
|
81
|
+
app
|
82
|
+
Holds all the code that's specific to this particular application.
|
83
|
+
|
84
|
+
app/controllers
|
85
|
+
Holds controllers that should be named like products_controller.rb.
|
86
|
+
All controllers should descend from ApplicationController
|
87
|
+
which itself descends from Reactive::Controller::Base.
|
88
|
+
|
89
|
+
app/models
|
90
|
+
Holds models that should be named like post.rb.
|
91
|
+
Most models will descend from ActiveRecord::Base if you chose this ORM.
|
92
|
+
|
93
|
+
app/views
|
94
|
+
Holds the code or template files for the view that should be named like
|
95
|
+
products/index.rb for the ProductsController#index action. The master views are
|
96
|
+
pure Ruby code.
|
97
|
+
|
98
|
+
app/helpers
|
99
|
+
Holds view helpers that should be named like products_helper.rb. These are generated
|
100
|
+
for you automatically when using script/generate for views. Helpers can be used to
|
101
|
+
wrap functionality for your views into methods.
|
102
|
+
|
103
|
+
assets
|
104
|
+
Contains specific application files, like icons and help files.
|
105
|
+
|
106
|
+
config
|
107
|
+
Configuration files for the Reactive environment, the database, and other dependencies.
|
108
|
+
|
109
|
+
db
|
110
|
+
Contains the database schema in schema.rb. db/migrate contains all
|
111
|
+
the sequence of Migrations for your schema.
|
112
|
+
|
113
|
+
doc
|
114
|
+
This directory is where your application documentation will be stored when generated
|
115
|
+
using <tt>rake doc:app</tt>
|
116
|
+
|
117
|
+
lib
|
118
|
+
Application specific libraries. Basically, any kind of custom code that doesn't
|
119
|
+
belong under controllers, models, or helpers. This directory is in the load path.
|
120
|
+
|
121
|
+
script
|
122
|
+
Helper scripts for automation and generation.
|
123
|
+
|
124
|
+
test
|
125
|
+
Unit and functional tests along with fixtures. When using the script/generate scripts, template
|
126
|
+
test files will be generated for you and placed in this directory.
|
127
|
+
|
128
|
+
gems
|
129
|
+
Alternate gem repository. You may install dependent gems into this directory. This is used for
|
130
|
+
the plugin system.
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require './lib/version.rb'
|
6
|
+
|
7
|
+
Hoe.new('reactive', Reactive::VERSION::STRING) do |p|
|
8
|
+
p.developer('Pascal Hurni', 'phi@ruby-reactive.org')
|
9
|
+
p.url = 'www.ruby-reactive.org'
|
10
|
+
p.extra_deps << ['activesupport', '>= 1.4.0']
|
11
|
+
p.extra_deps << ['rubigen', '>= 1.0.0']
|
12
|
+
end
|
13
|
+
|
14
|
+
# vim: syntax=Ruby
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Description:
|
2
|
+
The 'reactive' command creates a new Reactive application with a default
|
3
|
+
directory structure and configuration at the path you specify.
|
4
|
+
Used without arguments and within an application path, it starts the app.
|
5
|
+
|
6
|
+
Example:
|
7
|
+
reactive ~/Code/Ruby/mysales -w wx
|
8
|
+
|
9
|
+
This generates a skeletal Reactive application in ~/Code/Ruby/mysales
|
10
|
+
with wx as the view provider.
|
11
|
+
See the README in the newly created application to get going.
|
@@ -0,0 +1,160 @@
|
|
1
|
+
class ReactiveGenerator < RubiGen::Base
|
2
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
3
|
+
Config::CONFIG['ruby_install_name']) unless defined? DEFAULT_SHEBANG
|
4
|
+
|
5
|
+
|
6
|
+
DATABASES = %w(mysql oracle postgresql sqlite2 sqlite3 frontbase none)
|
7
|
+
|
8
|
+
default_options :shebang => DEFAULT_SHEBANG, :database => (ENV["REACTIVE_DEFAULT_DATABASE"] || "mysql"), :view_provider => ENV["REACTIVE_DEFAULT_VIEW_PROVIDER"]
|
9
|
+
|
10
|
+
attr_reader :app_name, :database, :view_provider
|
11
|
+
|
12
|
+
def initialize(runtime_args, runtime_options = {})
|
13
|
+
super
|
14
|
+
usage if args.empty?
|
15
|
+
usage("Sorry, ActiveRecord is not available, can't configure for: #{options[:database] || default_options[:database]}") if options[:database].to_s.downcase != 'none' && !has_activerecord?
|
16
|
+
usage("Databases supported for preconfiguration are: #{DATABASES.join(", ")}\nYou may also disable ActiveRecord by passing: none") if (options[:database] && !DATABASES.include?(options[:database]))
|
17
|
+
@destination_root = args.shift
|
18
|
+
@app_name = File.basename(File.expand_path(@destination_root))
|
19
|
+
extract_options
|
20
|
+
end
|
21
|
+
|
22
|
+
def manifest
|
23
|
+
script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
|
24
|
+
|
25
|
+
record do |m|
|
26
|
+
# Root directory and all subdirectories.
|
27
|
+
m.directory ''
|
28
|
+
BASEDIRS.each { |path| m.directory path }
|
29
|
+
|
30
|
+
# copy skeleton
|
31
|
+
m.file_copy_each %w( Rakefile README )
|
32
|
+
m.file_copy_each %w( application_controller.rb ), "app/controllers"
|
33
|
+
m.file_copy_each %w( application_helper.rb ), "app/helpers"
|
34
|
+
#m.file_copy_each %w( development.rb production.rb test.rb ), "config/environments"
|
35
|
+
|
36
|
+
# Configs
|
37
|
+
m.file "config/boot.rb", "config/boot.rb"
|
38
|
+
m.template "config/environment.rb", "config/environment.rb"
|
39
|
+
m.template "config/databases/#{@database}.yml", "config/database.yml", :assigns => {
|
40
|
+
:app_name => @app_name,
|
41
|
+
:socket => @database == "mysql" ? mysql_socket_location : nil
|
42
|
+
} if @database
|
43
|
+
|
44
|
+
# Logs
|
45
|
+
%w( production development test ).each { |file|
|
46
|
+
m.file "config/empty.log", "log/#{file}.log", :chmod => 0666
|
47
|
+
}
|
48
|
+
|
49
|
+
# Scripts
|
50
|
+
m.directory "script"
|
51
|
+
|
52
|
+
%w( generate destroy run ).each do |file|
|
53
|
+
m.template "script/#{file}", "script/#{file}", script_options
|
54
|
+
m.template "script/win_script.cmd", "script/#{file}.cmd", :assigns => { :filename => file } if windows
|
55
|
+
end
|
56
|
+
|
57
|
+
# View
|
58
|
+
if view_provider
|
59
|
+
view_provider_fullname = "reactive_view_#{view_provider}"
|
60
|
+
require view_provider_fullname
|
61
|
+
view_provider_path = Gem.loaded_specs[view_provider_fullname].full_gem_path
|
62
|
+
self.class.append_sources(RubiGen::PathFilteredSource.new(:RubyGems, view_provider_path, :reactive))
|
63
|
+
m.dependency "application_view", [@destination_root, @app_name], :shebang => options[:shebang], :collision => :force
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def windows
|
69
|
+
(RUBY_PLATFORM =~ /dos|win32|cygwin/i) || (RUBY_PLATFORM =~ /(:?mswin|mingw)/)
|
70
|
+
end
|
71
|
+
|
72
|
+
def has_activerecord?
|
73
|
+
require 'activerecord'
|
74
|
+
true
|
75
|
+
rescue LoadError
|
76
|
+
false
|
77
|
+
end
|
78
|
+
|
79
|
+
protected
|
80
|
+
def banner
|
81
|
+
<<-EOS
|
82
|
+
Creates a Reactive application stub.
|
83
|
+
|
84
|
+
Usage: #{spec.name} path_to_your_app [options]
|
85
|
+
EOS
|
86
|
+
end
|
87
|
+
|
88
|
+
def add_options!(opts)
|
89
|
+
# opts.separator ''
|
90
|
+
# opts.separator 'Options:'
|
91
|
+
# # For each option below, place the default
|
92
|
+
# # at the top of the file next to "default_options"
|
93
|
+
# opts.on("-r", "--ruby=path", String,
|
94
|
+
# "Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).",
|
95
|
+
# "Default: #{DEFAULT_SHEBANG}") { |options[:shebang]| }
|
96
|
+
opts.separator ''
|
97
|
+
opts.separator 'Options:'
|
98
|
+
opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
99
|
+
|
100
|
+
opts.on("-w", "--view=name", String,
|
101
|
+
"Specify the view provider.",
|
102
|
+
"Defaults to the env variable REACTIVE_DEFAULT_VIEW_PROVIDER") { |v| options[:view_provider] = v }
|
103
|
+
opts.on("-d", "--database=name", String,
|
104
|
+
"Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite2/sqlite3).", "Pass none to disable ActiveRecord.",
|
105
|
+
"Default: mysql (or the env variable REACTIVE_DEFAULT_DATABASE)") { |v| options[:database] = v }
|
106
|
+
end
|
107
|
+
|
108
|
+
def extract_options
|
109
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
110
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
111
|
+
# raw instance variable value.
|
112
|
+
# @author = options[:author]
|
113
|
+
@view_provider = options[:view_provider] || default_options[:view_provider]
|
114
|
+
|
115
|
+
until @view_provider
|
116
|
+
puts "You didn't chose a view provider, it doesn't prevent you from generating an application, but it will not run until you manually add one in the environment.rb file."
|
117
|
+
print "Continue anyway? [Yn] "
|
118
|
+
answer = gets
|
119
|
+
break if answer =~ /^y/i
|
120
|
+
exit if answer =~ /^n/i
|
121
|
+
end
|
122
|
+
|
123
|
+
@database = options[:database] || default_options[:database]
|
124
|
+
@database = nil if @database.downcase == 'none'
|
125
|
+
end
|
126
|
+
|
127
|
+
def mysql_socket_location
|
128
|
+
MYSQL_SOCKET_LOCATIONS.find { |f| File.exist?(f) } unless RUBY_PLATFORM =~ /(:?mswin|mingw)/
|
129
|
+
end
|
130
|
+
|
131
|
+
# Installation skeleton. Intermediate directories are automatically
|
132
|
+
# created so don't sweat their absence here.
|
133
|
+
BASEDIRS = %w(
|
134
|
+
app/controllers
|
135
|
+
app/models
|
136
|
+
app/helpers
|
137
|
+
app/views
|
138
|
+
config/environments
|
139
|
+
config/initializers
|
140
|
+
lib
|
141
|
+
log
|
142
|
+
script
|
143
|
+
test/unit
|
144
|
+
gems
|
145
|
+
assets
|
146
|
+
)
|
147
|
+
|
148
|
+
MYSQL_SOCKET_LOCATIONS = [
|
149
|
+
"/tmp/mysql.sock", # default
|
150
|
+
"/var/run/mysqld/mysqld.sock", # debian/gentoo
|
151
|
+
"/var/tmp/mysql.sock", # freebsd
|
152
|
+
"/var/lib/mysql/mysql.sock", # fedora
|
153
|
+
"/opt/local/lib/mysql/mysql.sock", # fedora
|
154
|
+
"/opt/local/var/run/mysqld/mysqld.sock", # mac + darwinports + mysql
|
155
|
+
"/opt/local/var/run/mysql4/mysqld.sock", # mac + darwinports + mysql4
|
156
|
+
"/opt/local/var/run/mysql5/mysqld.sock", # mac + darwinports + mysql5
|
157
|
+
"/opt/lampp/var/mysql/mysql.sock" # xampp for linux
|
158
|
+
]
|
159
|
+
|
160
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
== Welcome to Reactive
|
2
|
+
|
3
|
+
Please visit www.ruby-reactive.org for further informations.
|
4
|
+
|
5
|
+
== Description:
|
6
|
+
|
7
|
+
Reactive is a desktop application framework that gives everything
|
8
|
+
needed to create database-backed applications according to the
|
9
|
+
Model-View-Control pattern of separation.
|
10
|
+
|
11
|
+
Reactive is highly inspired and also uses code of Rails, the famous
|
12
|
+
Web-Framework for ruby.
|
13
|
+
|
14
|
+
In Reactive, the model is handled by what's called an object-relational mapping
|
15
|
+
layer. Reactive doesn't impose any ORM, you may choose the one you like but
|
16
|
+
Reactive defaults to Active Record. This means it has baked in support for it,
|
17
|
+
without forcing you to use it.
|
18
|
+
|
19
|
+
The view part is independant of Reactive, this means that the application has
|
20
|
+
to choose a view provider and feed it into Reactive. This leads to complete
|
21
|
+
freedom for the GUI part. View providers are packaged as gems, so that it is
|
22
|
+
easy for the developer to choose and install them. Look for reactive_view_*
|
23
|
+
to discover some view providers (at this early alpha stage, only reactive_view_wx
|
24
|
+
is available)
|
25
|
+
|
26
|
+
The controller is part of Reactive and is loosely coupled to the view. Simple
|
27
|
+
convention set up the link.
|
28
|
+
|
29
|
+
|
30
|
+
== Getting Started
|
31
|
+
|
32
|
+
1. At the command prompt, start a new Reactive application using the <tt>reactive</tt> command
|
33
|
+
and your application name. Ex: reactive myapp -w wx
|
34
|
+
2. Change directory into myapp and start the application: <tt>script/run</tt>
|
35
|
+
3. Welcome into your new application!
|
36
|
+
|
37
|
+
|
38
|
+
== Debugging Reactive
|
39
|
+
|
40
|
+
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
41
|
+
will help you debug it and get it back on the reactive.
|
42
|
+
|
43
|
+
First area to check is the application log files. Have "tail -f" commands running
|
44
|
+
on the development.log. Reactive will automatically display debugging
|
45
|
+
and runtime information to these files.
|
46
|
+
|
47
|
+
You can also log your own messages directly into the log file from your code using
|
48
|
+
the Ruby logger class from inside your controllers. Example:
|
49
|
+
|
50
|
+
class WeblogController < ApplicationController
|
51
|
+
def destroy
|
52
|
+
@weblog = Weblog.find(params[:id])
|
53
|
+
@weblog.destroy
|
54
|
+
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
The result will be a message in your log file along the lines of:
|
59
|
+
|
60
|
+
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
|
61
|
+
|
62
|
+
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
63
|
+
|
64
|
+
Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
|
65
|
+
|
66
|
+
* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
|
67
|
+
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
68
|
+
|
69
|
+
These two online (and free) books will bring you up to speed on the Ruby language
|
70
|
+
and also on programming in general.
|
71
|
+
|
72
|
+
|
73
|
+
== Debugger
|
74
|
+
|
75
|
+
|
76
|
+
== Console
|
77
|
+
|
78
|
+
|
79
|
+
== Description of Contents
|
80
|
+
|
81
|
+
app
|
82
|
+
Holds all the code that's specific to this particular application.
|
83
|
+
|
84
|
+
app/controllers
|
85
|
+
Holds controllers that should be named like products_controller.rb.
|
86
|
+
All controllers should descend from ApplicationController
|
87
|
+
which itself descends from Reactive::Controller::Base.
|
88
|
+
|
89
|
+
app/models
|
90
|
+
Holds models that should be named like post.rb.
|
91
|
+
Most models will descend from ActiveRecord::Base if you chose this ORM.
|
92
|
+
|
93
|
+
app/views
|
94
|
+
Holds the code or template files for the view that should be named like
|
95
|
+
products/index.rb for the ProductsController#index action. The master views are
|
96
|
+
pure Ruby code.
|
97
|
+
|
98
|
+
app/helpers
|
99
|
+
Holds view helpers that should be named like products_helper.rb. These are generated
|
100
|
+
for you automatically when using script/generate for views. Helpers can be used to
|
101
|
+
wrap functionality for your views into methods.
|
102
|
+
|
103
|
+
assets
|
104
|
+
Contains specific application files, like icons and help files.
|
105
|
+
|
106
|
+
config
|
107
|
+
Configuration files for the Reactive environment, the database, and other dependencies.
|
108
|
+
|
109
|
+
db
|
110
|
+
Contains the database schema in schema.rb. db/migrate contains all
|
111
|
+
the sequence of Migrations for your schema.
|
112
|
+
|
113
|
+
doc
|
114
|
+
This directory is where your application documentation will be stored when generated
|
115
|
+
using <tt>rake doc:app</tt>
|
116
|
+
|
117
|
+
lib
|
118
|
+
Application specific libraries. Basically, any kind of custom code that doesn't
|
119
|
+
belong under controllers, models, or helpers. This directory is in the load path.
|
120
|
+
|
121
|
+
script
|
122
|
+
Helper scripts for automation and generation.
|
123
|
+
|
124
|
+
test
|
125
|
+
Unit and functional tests along with fixtures. When using the script/generate scripts, template
|
126
|
+
test files will be generated for you and placed in this directory.
|
127
|
+
|
128
|
+
gems
|
129
|
+
Alternate gem repository. You may install dependent gems into this directory. This is used for
|
130
|
+
the plugin system.
|