muding 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +11 -0
- data/MANIFEST +77 -0
- data/MIT-LICENSE +22 -0
- data/README +21 -0
- data/bin/console +4 -0
- data/bin/destroy +4 -0
- data/bin/generate +4 -0
- data/bin/muding +16 -0
- data/bin/server +5 -0
- data/configs/boot.rb +4 -0
- data/configs/databases/mysql.yml +47 -0
- data/configs/databases/oracle.yml +30 -0
- data/configs/databases/postgresql.yml +44 -0
- data/configs/databases/sqlite2.yml +16 -0
- data/configs/databases/sqlite3.yml +16 -0
- data/doc/README_FOR_MUD +3 -0
- data/fresh_rakefile +4 -0
- data/helpers/mud.rb +8 -0
- data/helpers/mud_helper.rb +4 -0
- data/helpers/test_helper.rb +29 -0
- data/lib/acts/container.rb +70 -0
- data/lib/acts/expireable.rb +82 -0
- data/lib/commands/destroy.rb +7 -0
- data/lib/commands/generate.rb +7 -0
- data/lib/commands/server.rb +45 -0
- data/lib/commands/update.rb +5 -0
- data/lib/controller.rb +132 -0
- data/lib/handle.rb +42 -0
- data/lib/model.rb +11 -0
- data/lib/muding.rb +46 -0
- data/lib/muding_generator.rb +22 -0
- data/lib/muding_generator/base.rb +162 -0
- data/lib/muding_generator/commands.rb +519 -0
- data/lib/muding_generator/generators/applications/app/USAGE +14 -0
- data/lib/muding_generator/generators/applications/app/app_generator.rb +132 -0
- data/lib/muding_generator/generators/components/controller/USAGE +30 -0
- data/lib/muding_generator/generators/components/controller/controller_generator.rb +38 -0
- data/lib/muding_generator/generators/components/controller/templates/controller.rb +7 -0
- data/lib/muding_generator/generators/components/controller/templates/functional_test.rb +18 -0
- data/lib/muding_generator/generators/components/controller/templates/helper.rb +2 -0
- data/lib/muding_generator/generators/components/controller/templates/view.rhtml +2 -0
- data/lib/muding_generator/generators/components/migration/USAGE +14 -0
- data/lib/muding_generator/generators/components/migration/migration_generator.rb +7 -0
- data/lib/muding_generator/generators/components/migration/templates/migration.rb +7 -0
- data/lib/muding_generator/generators/components/model/USAGE +19 -0
- data/lib/muding_generator/generators/components/model/model_generator.rb +34 -0
- data/lib/muding_generator/generators/components/model/templates/fixtures.yml +5 -0
- data/lib/muding_generator/generators/components/model/templates/migration.rb +11 -0
- data/lib/muding_generator/generators/components/model/templates/model.rb +2 -0
- data/lib/muding_generator/generators/components/model/templates/unit_test.rb +10 -0
- data/lib/muding_generator/lookup.rb +210 -0
- data/lib/muding_generator/manifest.rb +53 -0
- data/lib/muding_generator/options.rb +140 -0
- data/lib/muding_generator/scripts.rb +83 -0
- data/lib/muding_generator/scripts/destroy.rb +7 -0
- data/lib/muding_generator/scripts/generate.rb +7 -0
- data/lib/muding_generator/scripts/update.rb +12 -0
- data/lib/muding_generator/simple_logger.rb +46 -0
- data/lib/muding_generator/spec.rb +44 -0
- data/lib/ruby_version_check.rb +12 -0
- data/lib/tasks/migrate.rake +33 -0
- metadata +149 -0
data/CHANGELOG
ADDED
data/MANIFEST
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
MIT-LICENSE
|
2
|
+
CHANGELOG
|
3
|
+
MANIFEST
|
4
|
+
README
|
5
|
+
fresh_rakefile
|
6
|
+
bin/
|
7
|
+
bin/muding
|
8
|
+
bin/server
|
9
|
+
bin/generate
|
10
|
+
bin/console
|
11
|
+
bin/destroy
|
12
|
+
configs/
|
13
|
+
configs/boot.rb
|
14
|
+
configs/databases/
|
15
|
+
configs/databases/mysql.yml
|
16
|
+
configs/databases/oracle.yml
|
17
|
+
configs/databases/postgresql.yml
|
18
|
+
configs/databases/sqlite2.yml
|
19
|
+
configs/databases/sqlite3.yml
|
20
|
+
doc/
|
21
|
+
doc/README_FOR_MUD
|
22
|
+
helpers/
|
23
|
+
helpers/mud.rb
|
24
|
+
helpers/mud_helper.rb
|
25
|
+
helpers/test_helper.rb
|
26
|
+
lib/
|
27
|
+
lib/controller.rb
|
28
|
+
lib/handle.rb
|
29
|
+
lib/model.rb
|
30
|
+
lib/muding.rb
|
31
|
+
lib/muding_generator.rb
|
32
|
+
lib/ruby_version_check.rb
|
33
|
+
lib/tasks/migrate.rake
|
34
|
+
lib/acts/expireable.rb
|
35
|
+
lib/acts/container.rb
|
36
|
+
lib/commands/
|
37
|
+
lib/commands/server.rb
|
38
|
+
lib/commands/destroy.rb
|
39
|
+
lib/commands/generate.rb
|
40
|
+
lib/commands/update.rb
|
41
|
+
lib/muding_generator/
|
42
|
+
lib/muding_generator/base.rb
|
43
|
+
lib/muding_generator/commands.rb
|
44
|
+
lib/muding_generator/lookup.rb
|
45
|
+
lib/muding_generator/manifest.rb
|
46
|
+
lib/muding_generator/options.rb
|
47
|
+
lib/muding_generator/scripts.rb
|
48
|
+
lib/muding_generator/simple_logger.rb
|
49
|
+
lib/muding_generator/spec.rb
|
50
|
+
lib/muding_generator/generators/
|
51
|
+
lib/muding_generator/generators/applications/
|
52
|
+
lib/muding_generator/generators/applications/app/
|
53
|
+
lib/muding_generator/generators/applications/app/app_generator.rb
|
54
|
+
lib/muding_generator/generators/applications/app/USAGE
|
55
|
+
lib/muding_generator/generators/components/
|
56
|
+
lib/muding_generator/generators/components/controller/
|
57
|
+
lib/muding_generator/generators/components/controller/controller_generator.rb
|
58
|
+
lib/muding_generator/generators/components/controller/USAGE
|
59
|
+
lib/muding_generator/generators/components/controller/templates/controller.rb
|
60
|
+
lib/muding_generator/generators/components/controller/templates/functional_test.rb
|
61
|
+
lib/muding_generator/generators/components/controller/templates/helper.rb
|
62
|
+
lib/muding_generator/generators/components/controller/templates/view.rhtml
|
63
|
+
lib/muding_generator/generators/components/migration/
|
64
|
+
lib/muding_generator/generators/components/migration/migration_generator.rb
|
65
|
+
lib/muding_generator/generators/components/migration/USAGE
|
66
|
+
lib/muding_generator/generators/components/migration/templates/migration.rb
|
67
|
+
lib/muding_generator/generators/components/model/
|
68
|
+
lib/muding_generator/generators/components/model/model_generator.rb
|
69
|
+
lib/muding_generator/generators/components/model/USAGE
|
70
|
+
lib/muding_generator/generators/components/model/templates/
|
71
|
+
lib/muding_generator/generators/components/model/templates/fixtures.yml
|
72
|
+
lib/muding_generator/generators/components/model/templates/migration.rb
|
73
|
+
lib/muding_generator/generators/components/model/templates/model.rb
|
74
|
+
lib/muding_generator/generators/components/model/templates/unit_test.rb
|
75
|
+
lib/muding_generator/scripts/destroy.rb
|
76
|
+
lib/muding_generator/scripts/generate.rb
|
77
|
+
lib/muding_generator/scripts/update.rb
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2004 Ryan Thomas Mulligan
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
|
data/README
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
muding
|
2
|
+
http://rubyforge.org/projects/muding/
|
3
|
+
ryantmulligan@gmail.com
|
4
|
+
|
5
|
+
** DESCRIPTION:
|
6
|
+
|
7
|
+
muding is a development framework for building multi-user environments.
|
8
|
+
The purpose of the framework is to separate the lower level functionality
|
9
|
+
common to all multi-user environments into a separate framework that can
|
10
|
+
be developed through open-source. Developers using the framework can then
|
11
|
+
build their multi-user environment on top of the framework, and update the
|
12
|
+
framework code independantly of their own code.
|
13
|
+
|
14
|
+
** SETUP:
|
15
|
+
muding mudname
|
16
|
+
- creates a new directory at your current path for the mud you are
|
17
|
+
developing
|
18
|
+
|
19
|
+
** INSTALL:
|
20
|
+
|
21
|
+
sudo gem install muding
|
data/bin/console
ADDED
data/bin/destroy
ADDED
data/bin/generate
ADDED
data/bin/muding
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../lib/ruby_version_check'
|
2
|
+
|
3
|
+
Signal.trap("INT") { puts; exit }
|
4
|
+
|
5
|
+
freeze = ARGV.any? { |option| %w(--freeze -f).include?(option) }
|
6
|
+
app_path = ARGV.first
|
7
|
+
|
8
|
+
require File.dirname(__FILE__) + '/../lib/muding_generator'
|
9
|
+
|
10
|
+
require 'muding_generator/scripts/generate'
|
11
|
+
Muding::Generator::Base.use_application_sources!
|
12
|
+
Muding::Generator::Scripts::Generate.new.run(ARGV, :generator => 'app')
|
13
|
+
|
14
|
+
Dir.chdir(app_path) { `rake muding:freeze:gems`; puts "froze" } if freeze
|
15
|
+
|
16
|
+
|
data/bin/server
ADDED
data/configs/boot.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# MySQL (default setup). Versions 4.1 and 5.0 are recommended.
|
2
|
+
#
|
3
|
+
# Install the MySQL driver:
|
4
|
+
# gem install mysql
|
5
|
+
# On MacOS X:
|
6
|
+
# gem install mysql -- --include=/usr/local/lib
|
7
|
+
# On Windows:
|
8
|
+
# There is no gem for Windows. Install mysql.so from RubyForApache.
|
9
|
+
# http://rubyforge.org/projects/rubyforapache
|
10
|
+
#
|
11
|
+
# And be sure to use new-style password hashing:
|
12
|
+
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
|
13
|
+
development:
|
14
|
+
adapter: mysql
|
15
|
+
database: <%= app_name %>_development
|
16
|
+
username: root
|
17
|
+
password:
|
18
|
+
<% if socket -%>
|
19
|
+
socket: <%= socket %>
|
20
|
+
<% else -%>
|
21
|
+
host: localhost
|
22
|
+
<% end -%>
|
23
|
+
|
24
|
+
# Warning: The database defined as 'test' will be erased and
|
25
|
+
# re-generated from your development database when you run 'rake'.
|
26
|
+
# Do not set this db to the same as development or production.
|
27
|
+
test:
|
28
|
+
adapter: mysql
|
29
|
+
database: <%= app_name %>_test
|
30
|
+
username: root
|
31
|
+
password:
|
32
|
+
<% if socket -%>
|
33
|
+
socket: <%= socket %>
|
34
|
+
<% else -%>
|
35
|
+
host: localhost
|
36
|
+
<% end -%>
|
37
|
+
|
38
|
+
production:
|
39
|
+
adapter: mysql
|
40
|
+
database: <%= app_name %>_production
|
41
|
+
username: root
|
42
|
+
password:
|
43
|
+
<% if socket -%>
|
44
|
+
socket: <%= socket %>
|
45
|
+
<% else -%>
|
46
|
+
host: localhost
|
47
|
+
<% end -%>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Oracle/OCI 8i, 9, 10g
|
2
|
+
#
|
3
|
+
# Requires Ruby/OCI8:
|
4
|
+
# http://rubyforge.org/projects/ruby-oci8/
|
5
|
+
#
|
6
|
+
# Specify your database using any valid connection syntax, such as a
|
7
|
+
# tnsnames.ora service name, or a sql connect url string of the form:
|
8
|
+
#
|
9
|
+
# //host:[port][/service name]
|
10
|
+
|
11
|
+
development:
|
12
|
+
adapter: oracle
|
13
|
+
database: <%= app_name %>_development
|
14
|
+
username: <%= app_name %>
|
15
|
+
password:
|
16
|
+
|
17
|
+
# Warning: The database defined as 'test' will be erased and
|
18
|
+
# re-generated from your development database when you run 'rake'.
|
19
|
+
# Do not set this db to the same as development or production.
|
20
|
+
test:
|
21
|
+
adapter: oracle
|
22
|
+
database: <%= app_name %>_test
|
23
|
+
username: <%= app_name %>
|
24
|
+
password:
|
25
|
+
|
26
|
+
production:
|
27
|
+
adapter: oracle
|
28
|
+
database: <%= app_name %>_production
|
29
|
+
username: <%= app_name %>
|
30
|
+
password:
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# PostgreSQL versions 7.4 - 8.1
|
2
|
+
#
|
3
|
+
# Get the C bindings:
|
4
|
+
# gem install postgres
|
5
|
+
# or use the pure-Ruby bindings on Windows:
|
6
|
+
# gem install postgres-pr
|
7
|
+
development:
|
8
|
+
adapter: postgresql
|
9
|
+
database: <%= app_name %>_development
|
10
|
+
username: <%= app_name %>
|
11
|
+
password:
|
12
|
+
|
13
|
+
# Connect on a TCP socket. Omitted by default since the client uses a
|
14
|
+
# domain socket that doesn't need configuration. Windows does not have
|
15
|
+
# domain sockets, so uncomment these lines.
|
16
|
+
#host: localhost
|
17
|
+
#port: 5432
|
18
|
+
|
19
|
+
# Schema search path. The server defaults to $user,public
|
20
|
+
#schema_search_path: myapp,sharedapp,public
|
21
|
+
|
22
|
+
# Character set encoding. The server defaults to sql_ascii.
|
23
|
+
#encoding: UTF8
|
24
|
+
|
25
|
+
# Minimum log levels, in increasing order:
|
26
|
+
# debug5, debug4, debug3, debug2, debug1,
|
27
|
+
# info, notice, warning, error, log, fatal, or panic
|
28
|
+
# The server defaults to notice.
|
29
|
+
#min_messages: warning
|
30
|
+
|
31
|
+
# Warning: The database defined as 'test' will be erased and
|
32
|
+
# re-generated from your development database when you run 'rake'.
|
33
|
+
# Do not set this db to the same as development or production.
|
34
|
+
test:
|
35
|
+
adapter: postgresql
|
36
|
+
database: <%= app_name %>_test
|
37
|
+
username: <%= app_name %>
|
38
|
+
password:
|
39
|
+
|
40
|
+
production:
|
41
|
+
adapter: postgresql
|
42
|
+
database: <%= app_name %>_production
|
43
|
+
username: <%= app_name %>
|
44
|
+
password:
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# SQLite version 2.x
|
2
|
+
# gem install sqlite-ruby
|
3
|
+
development:
|
4
|
+
adapter: sqlite
|
5
|
+
database: db/development.sqlite2
|
6
|
+
|
7
|
+
# Warning: The database defined as 'test' will be erased and
|
8
|
+
# re-generated from your development database when you run 'rake'.
|
9
|
+
# Do not set this db to the same as development or production.
|
10
|
+
test:
|
11
|
+
adapter: sqlite
|
12
|
+
database: db/test.sqlite2
|
13
|
+
|
14
|
+
production:
|
15
|
+
adapter: sqlite
|
16
|
+
database: db/production.sqlite2
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3-ruby
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: db/development.sqlite3
|
6
|
+
|
7
|
+
# Warning: The database defined as 'test' will be erased and
|
8
|
+
# re-generated from your development database when you run 'rake'.
|
9
|
+
# Do not set this db to the same as development or production.
|
10
|
+
test:
|
11
|
+
adapter: sqlite3
|
12
|
+
database: db/test.sqlite3
|
13
|
+
|
14
|
+
production:
|
15
|
+
adapter: sqlite3
|
16
|
+
database: db/production.sqlite3
|
data/doc/README_FOR_MUD
ADDED
data/fresh_rakefile
ADDED
data/helpers/mud.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
3
|
+
require 'test_help'
|
4
|
+
|
5
|
+
class Test::Unit::TestCase
|
6
|
+
# Transactional fixtures accelerate your tests by wrapping each test method
|
7
|
+
# in a transaction that's rolled back on completion. This ensures that the
|
8
|
+
# test database remains unchanged so your fixtures don't have to be reloaded
|
9
|
+
# between every test method. Fewer database queries means faster tests.
|
10
|
+
#
|
11
|
+
# Read Mike Clark's excellent walkthrough at
|
12
|
+
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
13
|
+
#
|
14
|
+
# Every Active Record database supports transactions except MyISAM tables
|
15
|
+
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
16
|
+
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
17
|
+
# is recommended.
|
18
|
+
self.use_transactional_fixtures = true
|
19
|
+
|
20
|
+
# Instantiated fixtures are slow, but give you @david where otherwise you
|
21
|
+
# would need people(:david). If you don't want to migrate your existing
|
22
|
+
# test cases which use the @david style and don't mind the speed hit (each
|
23
|
+
# instantiated fixtures translates to a database query per test method),
|
24
|
+
# then set this back to true.
|
25
|
+
self.use_instantiated_fixtures = false
|
26
|
+
|
27
|
+
# Add more helper methods to be used by all tests here...
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Acts #:nodoc:
|
2
|
+
module Container
|
3
|
+
def self.included(base) # :nodoc:
|
4
|
+
base.extend ClassMethods
|
5
|
+
end
|
6
|
+
|
7
|
+
module ClassMethods
|
8
|
+
def acts_as_container(options = {})
|
9
|
+
#future options...
|
10
|
+
#number limit
|
11
|
+
#size limit
|
12
|
+
#size of container
|
13
|
+
config = {:containables => []}
|
14
|
+
config.update options if options.is_a?(Hash)
|
15
|
+
cattr_accessor :containables
|
16
|
+
|
17
|
+
self.containables = config[:containables]
|
18
|
+
|
19
|
+
unless container?
|
20
|
+
config[:containables].each do |containable|
|
21
|
+
has_many containable, :as => :container, :dependent => :nullify
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
include InstanceMethods
|
26
|
+
end
|
27
|
+
|
28
|
+
def container?
|
29
|
+
self.included_modules.include?(InstanceMethods)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
module InstanceMethods
|
34
|
+
def self.included(base) # :nodoc:
|
35
|
+
base.extend ClassMethods
|
36
|
+
end
|
37
|
+
|
38
|
+
def contents
|
39
|
+
contents = []
|
40
|
+
self.containables.each do |containable|
|
41
|
+
contents += self.send(containable)
|
42
|
+
end
|
43
|
+
contents
|
44
|
+
end
|
45
|
+
|
46
|
+
def <<(content)
|
47
|
+
self.containables.each do |containable|
|
48
|
+
begin
|
49
|
+
self.send(containable).<< content
|
50
|
+
return # if it successfully adds we are done with this method.
|
51
|
+
|
52
|
+
# there is probably a better way to do this. right now if it can't be added to the container
|
53
|
+
# we just catch that exception and keep going until we iterate through all the possibilities
|
54
|
+
rescue ActiveRecord::AssociationTypeMismatch
|
55
|
+
next
|
56
|
+
end
|
57
|
+
end
|
58
|
+
raise Exception.new("Unable to add content to container. Object type did not match any containable type.")
|
59
|
+
end
|
60
|
+
|
61
|
+
def message(message_string)
|
62
|
+
self.handle.message(message_string) if self.respond_to?(:handle)
|
63
|
+
|
64
|
+
self.contents.each do |content|
|
65
|
+
content.message(message_string)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|