advertnet 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +674 -0
- data/README +257 -0
- data/Rakefile +10 -0
- data/app/controllers/application.rb +40 -0
- data/app/controllers/container_controller.rb +83 -0
- data/app/controllers/content_controller.rb +61 -0
- data/app/controllers/furnitures_controller.rb +87 -0
- data/app/controllers/networks_controller.rb +269 -0
- data/app/controllers/objects_in_world_controller.rb +27 -0
- data/app/controllers/panels_controller.rb +186 -0
- data/app/helpers/application_helper.rb +31 -0
- data/app/helpers/container_helper.rb +2 -0
- data/app/helpers/content_helper.rb +2 -0
- data/app/helpers/furnitures_helper.rb +2 -0
- data/app/helpers/network_helper.rb +2 -0
- data/app/helpers/networks_helper.rb +2 -0
- data/app/helpers/objects_in_world_helper.rb +2 -0
- data/app/helpers/panels_helper.rb +2 -0
- data/app/models/container.rb +51 -0
- data/app/models/furniture.rb +60 -0
- data/app/models/mailer.rb +22 -0
- data/app/models/network.rb +38 -0
- data/app/models/object_in_world.rb +60 -0
- data/app/models/object_off_world.rb +77 -0
- data/app/models/panel.rb +136 -0
- data/app/models/panel_revision.rb +108 -0
- data/app/views/container/list.rhtml +27 -0
- data/app/views/container/show.rhtml +8 -0
- data/app/views/content/_form.rhtml +12 -0
- data/app/views/content/edit.rhtml +8 -0
- data/app/views/content/list.rhtml +26 -0
- data/app/views/content/new.rhtml +8 -0
- data/app/views/furnitures/list.rhtml +51 -0
- data/app/views/furnitures/show.rhtml +7 -0
- data/app/views/layouts/default.rhtml +30 -0
- data/app/views/mailer/avtouch.rhtml +1 -0
- data/app/views/networks/_form.rhtml +11 -0
- data/app/views/networks/_parameters_form.rhtml +8 -0
- data/app/views/networks/edit.rhtml +9 -0
- data/app/views/networks/list.rhtml +25 -0
- data/app/views/networks/new.rhtml +8 -0
- data/app/views/networks/show.rhtml +72 -0
- data/app/views/networks/show_parameters_form.rjs +5 -0
- data/app/views/objects_in_world/list.rhtml +30 -0
- data/app/views/objects_in_world/show.rhtml +8 -0
- data/app/views/panels/list.rhtml +48 -0
- data/app/views/panels/show.rhtml +8 -0
- data/bin/advertnet-install +144 -0
- data/config/boot.rb +45 -0
- data/config/database.yml.default +43 -0
- data/config/environment.rb +67 -0
- data/config/environments/development.rb +21 -0
- data/config/environments/production.rb +21 -0
- data/config/environments/test.rb +19 -0
- data/config/routes.rb +23 -0
- data/db/migrate/001_create_networks.rb +14 -0
- data/db/migrate/002_create_furnitures.rb +17 -0
- data/db/migrate/003_create_containers.rb +16 -0
- data/db/migrate/004_create_objects_in_world.rb +16 -0
- data/db/migrate/005_create_objects_off_world.rb +16 -0
- data/db/migrate/006_create_panels.rb +17 -0
- data/db/migrate/007_join_objects_in_world_panels.rb +17 -0
- data/db/migrate/008_join_objects_off_world_panels.rb +17 -0
- data/db/migrate/009_add_sessions.rb +19 -0
- data/db/migrate/010_add_or_rename_fields.rb +25 -0
- data/db/migrate/011_move_texture_to_object_in_world.rb +25 -0
- data/db/migrate/012_add_permanent_furniture_id.rb +18 -0
- data/db/migrate/013_create_panel_revisions.rb +42 -0
- data/db/schema.rb +102 -0
- data/doc/README_FOR_APP +108 -0
- data/lib/advertnet.rb +13 -0
- data/lib/second_life_validators.rb +89 -0
- data/lib/tasks/documentation.rake +16 -0
- data/lib/tasks/extract_fixtures.rake +23 -0
- data/lib/tasks/load_exported_fixtures.rake +14 -0
- data/public/404.html +30 -0
- data/public/500.html +30 -0
- data/public/dispatch.cgi +10 -0
- data/public/dispatch.fcgi +24 -0
- data/public/dispatch.rb +10 -0
- data/public/favicon.ico +0 -0
- data/public/images/rails.png +0 -0
- data/public/javascripts/application.js +2 -0
- data/public/javascripts/controls.js +833 -0
- data/public/javascripts/dragdrop.js +942 -0
- data/public/javascripts/effects.js +1088 -0
- data/public/javascripts/prototype.js +2515 -0
- data/public/robots.txt +1 -0
- data/public/stylesheets/application.css +25 -0
- data/public/stylesheets/scaffold.css +74 -0
- data/script/about +3 -0
- data/script/breakpointer +3 -0
- data/script/console +3 -0
- data/script/destroy +3 -0
- data/script/generate +3 -0
- data/script/performance/benchmarker +3 -0
- data/script/performance/profiler +3 -0
- data/script/plugin +3 -0
- data/script/process/inspector +3 -0
- data/script/process/reaper +3 -0
- data/script/process/spawner +3 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- data/test/fixtures/containers.yml +44 -0
- data/test/fixtures/furnitures.yml +47 -0
- data/test/fixtures/mailer/avtouch +1 -0
- data/test/fixtures/networks.yml +31 -0
- data/test/fixtures/objects_in_world.yml +71 -0
- data/test/fixtures/objects_in_world_panels.yml +43 -0
- data/test/fixtures/objects_off_world.yml +55 -0
- data/test/fixtures/objects_off_world_panels.yml +20 -0
- data/test/fixtures/panel_revisions.yml +28 -0
- data/test/fixtures/panels.yml +79 -0
- data/test/functional/container_controller_test.rb +167 -0
- data/test/functional/content_controller_test.rb +91 -0
- data/test/functional/furnitures_controller_test.rb +134 -0
- data/test/functional/networks_controller_test.rb +248 -0
- data/test/functional/objects_in_world_controller_test.rb +42 -0
- data/test/functional/panels_controller_test.rb +173 -0
- data/test/test_helper.rb +53 -0
- data/test/unit/container_test.rb +53 -0
- data/test/unit/furniture_test.rb +68 -0
- data/test/unit/mailer_test.rb +40 -0
- data/test/unit/network_test.rb +42 -0
- data/test/unit/object_in_world_test.rb +33 -0
- data/test/unit/object_off_world_test.rb +26 -0
- data/test/unit/panel_revision_test.rb +148 -0
- data/test/unit/panel_test.rb +63 -0
- data/vendor/plugins/annotate_models/ChangeLog +46 -0
- data/vendor/plugins/annotate_models/README +31 -0
- data/vendor/plugins/annotate_models/lib/annotate_models.rb +132 -0
- data/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake +7 -0
- data/vendor/plugins/foreign_key_migrations/CHANGELOG +99 -0
- data/vendor/plugins/foreign_key_migrations/MIT-LICENSE +20 -0
- data/vendor/plugins/foreign_key_migrations/README +87 -0
- data/vendor/plugins/foreign_key_migrations/about.yml +5 -0
- data/vendor/plugins/foreign_key_migrations/init.rb +3 -0
- data/vendor/plugins/foreign_key_migrations/install.rb +1 -0
- data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/base.rb +22 -0
- data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/connection_adapters/abstract_adapter.rb +22 -0
- data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/connection_adapters/table_definition.rb +28 -0
- data/vendor/plugins/redhillonrails_core/CHANGELOG +154 -0
- data/vendor/plugins/redhillonrails_core/MIT-LICENSE +20 -0
- data/vendor/plugins/redhillonrails_core/README +139 -0
- data/vendor/plugins/redhillonrails_core/init.rb +19 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/base.rb +54 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/abstract_adapter.rb +31 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/column.rb +21 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/foreign_key_definition.rb +26 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/index_definition.rb +11 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/mysql_adapter.rb +82 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/mysql_column.rb +8 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/postgresql_adapter.rb +107 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/schema_statements.rb +23 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/sqlite3_adapter.rb +9 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/table_definition.rb +27 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/schema.rb +27 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/schema_dumper.rb +47 -0
- metadata +290 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
module RedHillConsulting::Core::ActiveRecord::ConnectionAdapters
|
2
|
+
module AbstractAdapter
|
3
|
+
def self.included(base)
|
4
|
+
base.module_eval do
|
5
|
+
alias_method_chain :drop_table, :redhillonrails_core
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def foreign_keys(table_name, name = nil)
|
10
|
+
[]
|
11
|
+
end
|
12
|
+
|
13
|
+
def reverse_foreign_keys(table_name, name = nil)
|
14
|
+
[]
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_foreign_key(table_name, column_names, references_table_name, references_column_names, options = {})
|
18
|
+
foreign_key = ForeignKeyDefinition.new(options[:name], table_name, column_names, ActiveRecord::Migrator.proper_table_name(references_table_name), references_column_names, options[:on_update], options[:on_delete], options[:deferrable])
|
19
|
+
execute "ALTER TABLE #{table_name} ADD #{foreign_key}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def remove_foreign_key(table_name, foreign_key_name)
|
23
|
+
execute "ALTER TABLE #{table_name} DROP CONSTRAINT #{foreign_key_name}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def drop_table_with_redhillonrails_core(name, options = {})
|
27
|
+
reverse_foreign_keys(name).each { |foreign_key| remove_foreign_key(foreign_key.table_name, foreign_key.name) }
|
28
|
+
drop_table_without_redhillonrails_core(name, options)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module RedHillConsulting::Core::ActiveRecord::ConnectionAdapters
|
2
|
+
module Column
|
3
|
+
attr_accessor :unique_scope
|
4
|
+
attr_accessor :case_sensitive
|
5
|
+
alias case_sensitive? case_sensitive
|
6
|
+
|
7
|
+
def unique?
|
8
|
+
!unique_scope.nil?
|
9
|
+
end
|
10
|
+
|
11
|
+
def required_on
|
12
|
+
if null
|
13
|
+
nil
|
14
|
+
elsif default.nil?
|
15
|
+
:save
|
16
|
+
else
|
17
|
+
:update
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module RedHillConsulting::Core::ActiveRecord::ConnectionAdapters
|
2
|
+
class ForeignKeyDefinition < Struct.new(:name, :table_name, :column_names, :references_table_name, :references_column_names, :on_update, :on_delete, :deferrable)
|
3
|
+
ACTIONS = { :cascade => "CASCADE", :restrict => "RESTRICT", :set_null => "SET NULL", :set_default => "SET DEFAULT", :no_action => "NO ACTION" }.freeze
|
4
|
+
|
5
|
+
def to_dump
|
6
|
+
dump = "add_foreign_key"
|
7
|
+
dump << " #{table_name.inspect}, [#{column_names.collect{ |name| name.inspect }.join(', ')}]"
|
8
|
+
dump << ", #{references_table_name.inspect}, [#{references_column_names.collect{ |name| name.inspect }.join(', ')}]"
|
9
|
+
dump << ", :on_update => :#{on_update}" if on_update
|
10
|
+
dump << ", :on_delete => :#{on_delete}" if on_delete
|
11
|
+
dump << ", :deferrable => #{deferrable}" if deferrable
|
12
|
+
dump << ", :name => #{name.inspect}" if name
|
13
|
+
dump
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_sql
|
17
|
+
sql = name ? "CONSTRAINT #{name} " : ""
|
18
|
+
sql << "FOREIGN KEY (#{Array(column_names).join(", ")}) REFERENCES #{references_table_name} (#{Array(references_column_names).join(", ")})"
|
19
|
+
sql << " ON UPDATE #{ACTIONS[on_update]}" if on_update
|
20
|
+
sql << " ON DELETE #{ACTIONS[on_delete]}" if on_delete
|
21
|
+
sql << " DEFERRABLE" if deferrable
|
22
|
+
sql
|
23
|
+
end
|
24
|
+
alias :to_s :to_sql
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module RedHillConsulting::Core::ActiveRecord::ConnectionAdapters
|
2
|
+
module IndexDefinition
|
3
|
+
def case_sensitive?
|
4
|
+
@case_sensitive.nil? ? true : @case_sensitive
|
5
|
+
end
|
6
|
+
|
7
|
+
def case_sensitive=(case_sensitive)
|
8
|
+
@case_sensitive = case_sensitive
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module RedHillConsulting::Core::ActiveRecord::ConnectionAdapters
|
2
|
+
module MysqlAdapter
|
3
|
+
def self.included(base)
|
4
|
+
base.class_eval do
|
5
|
+
alias_method_chain :remove_column, :redhillonrails_core
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def set_table_comment(table_name, comment)
|
10
|
+
execute "ALTER TABLE #{table_name} COMMENT='#{quote_string(comment)}'"
|
11
|
+
end
|
12
|
+
|
13
|
+
def clear_table_comment(table_name)
|
14
|
+
execute "ALTER TABLE #{table_name} COMMENT=''"
|
15
|
+
end
|
16
|
+
|
17
|
+
def remove_foreign_key(table_name, foreign_key_name)
|
18
|
+
execute "ALTER TABLE #{table_name} DROP FOREIGN KEY #{foreign_key_name}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def remove_column_with_redhillonrails_core(table_name, column_name)
|
22
|
+
foreign_keys(table_name).select { |foreign_key| foreign_key.column_names.include?(column_name.to_s) }.each do |foreign_key|
|
23
|
+
remove_foreign_key(table_name, foreign_key.name)
|
24
|
+
end
|
25
|
+
remove_column_without_redhillonrails_core(table_name, column_name)
|
26
|
+
end
|
27
|
+
|
28
|
+
def foreign_keys(table_name, name = nil)
|
29
|
+
results = execute("SHOW CREATE TABLE `#{table_name}`", name)
|
30
|
+
|
31
|
+
foreign_keys = []
|
32
|
+
|
33
|
+
results.each do |row|
|
34
|
+
row[1].each do |line|
|
35
|
+
if line =~ /^ CONSTRAINT [`"](.+?)[`"] FOREIGN KEY \([`"](.+?)[`"]\) REFERENCES [`"](.+?)[`"] \((.+?)\)( ON DELETE (.+?))?( ON UPDATE (.+?))?,?$/
|
36
|
+
name = $1
|
37
|
+
column_names = $2
|
38
|
+
references_table_name = $3
|
39
|
+
references_column_names = $4
|
40
|
+
on_update = $8
|
41
|
+
on_delete = $6
|
42
|
+
on_update = on_update.downcase.gsub(' ', '_').to_sym if on_update
|
43
|
+
on_delete = on_delete.downcase.gsub(' ', '_').to_sym if on_delete
|
44
|
+
|
45
|
+
foreign_keys << ForeignKeyDefinition.new(name,
|
46
|
+
table_name, column_names.gsub('`', '').split(', '),
|
47
|
+
references_table_name, references_column_names.gsub('`', '').split(', '),
|
48
|
+
on_update, on_delete)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
foreign_keys
|
54
|
+
end
|
55
|
+
|
56
|
+
def reverse_foreign_keys(table_name, name = nil)
|
57
|
+
results = execute(<<-SQL, name)
|
58
|
+
SELECT constraint_name, table_name, column_name, referenced_table_name, referenced_column_name
|
59
|
+
FROM information_schema.key_column_usage
|
60
|
+
WHERE table_schema = SCHEMA()
|
61
|
+
AND referenced_table_schema = table_schema
|
62
|
+
AND referenced_table_name = '#{table_name}'
|
63
|
+
ORDER BY constraint_name, ordinal_position;
|
64
|
+
SQL
|
65
|
+
|
66
|
+
current_foreign_key = nil
|
67
|
+
foreign_keys = []
|
68
|
+
|
69
|
+
results.each do |row|
|
70
|
+
if current_foreign_key != row[0]
|
71
|
+
foreign_keys << ForeignKeyDefinition.new(row[0], row[1], [], row[3], [])
|
72
|
+
current_foreign_key = row[0]
|
73
|
+
end
|
74
|
+
|
75
|
+
foreign_keys.last.column_names << row[2]
|
76
|
+
foreign_keys.last.references_column_names << row[4]
|
77
|
+
end
|
78
|
+
|
79
|
+
foreign_keys
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
module RedHillConsulting::Core::ActiveRecord::ConnectionAdapters
|
2
|
+
module PostgresqlAdapter
|
3
|
+
def self.included(base)
|
4
|
+
base.class_eval do
|
5
|
+
alias_method_chain :indexes, :redhillonrails_core
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def set_table_comment(table_name, comment)
|
10
|
+
execute "COMMENT ON TABLE #{table_name} IS '#{quote_string(comment)}'"
|
11
|
+
end
|
12
|
+
|
13
|
+
def clear_table_comment(table_name)
|
14
|
+
execute "COMMENT ON TABLE #{table_name} IS NULL"
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_index(table_name, column_name, options = {})
|
18
|
+
column_names = Array(column_name)
|
19
|
+
index_name = index_name(table_name, :column => column_names)
|
20
|
+
|
21
|
+
if Hash === options # legacy support, since this param was a string
|
22
|
+
index_type = options[:unique] ? "UNIQUE" : ""
|
23
|
+
index_name = options[:name] || index_name
|
24
|
+
else
|
25
|
+
index_type = options
|
26
|
+
end
|
27
|
+
|
28
|
+
quoted_column_names = column_names.map { |e| options[:case_sensitive] == false && e.to_s !~ /_id$/ ? "LOWER(#{quote_column_name(e)})" : quote_column_name(e) }
|
29
|
+
|
30
|
+
execute "CREATE #{index_type} INDEX #{quote_column_name(index_name)} ON #{table_name} (#{quoted_column_names.join(", ")})"
|
31
|
+
end
|
32
|
+
|
33
|
+
def indexes_with_redhillonrails_core(table_name, name = nil)
|
34
|
+
indexes = indexes_without_redhillonrails_core(table_name, name)
|
35
|
+
result = query(<<-SQL, name)
|
36
|
+
SELECT c2.relname, i.indisunique, pg_catalog.pg_get_indexdef(i.indexrelid, 0, true)
|
37
|
+
FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i
|
38
|
+
WHERE c.relname = '#{table_name}'
|
39
|
+
AND c.oid = i.indrelid AND i.indexrelid = c2.oid
|
40
|
+
AND i.indisprimary = 'f'
|
41
|
+
AND i.indexprs IS NOT NULL
|
42
|
+
ORDER BY 1
|
43
|
+
SQL
|
44
|
+
|
45
|
+
result.each do |row|
|
46
|
+
if row[2]=~ /\((.*LOWER\(.*::text\).*)\)$/i
|
47
|
+
indexes.delete_if { |index| index.name == row[0] }
|
48
|
+
column_names = $1.split(", ").map { |name| name =~ /^LOWER\((.*)::text\)$/i ? $1 : name }
|
49
|
+
index = ActiveRecord::ConnectionAdapters::IndexDefinition.new(table_name, row[0], row[1] == "t", column_names)
|
50
|
+
index.case_sensitive = false
|
51
|
+
indexes << index
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
indexes
|
56
|
+
end
|
57
|
+
|
58
|
+
def foreign_keys(table_name, name = nil)
|
59
|
+
load_foreign_keys(<<-SQL, name)
|
60
|
+
SELECT f.conname, pg_get_constraintdef(f.oid), t.relname
|
61
|
+
FROM pg_class t, pg_constraint f
|
62
|
+
WHERE f.conrelid = t.oid
|
63
|
+
AND f.contype = 'f'
|
64
|
+
AND t.relname = '#{table_name}'
|
65
|
+
SQL
|
66
|
+
end
|
67
|
+
|
68
|
+
def reverse_foreign_keys(table_name, name = nil)
|
69
|
+
load_foreign_keys(<<-SQL, name)
|
70
|
+
SELECT f.conname, pg_get_constraintdef(f.oid), t2.relname
|
71
|
+
FROM pg_class t, pg_class t2, pg_constraint f
|
72
|
+
WHERE f.confrelid = t.oid
|
73
|
+
AND f.conrelid = t2.oid
|
74
|
+
AND f.contype = 'f'
|
75
|
+
AND t.relname = '#{table_name}'
|
76
|
+
SQL
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
def load_foreign_keys(sql, name = nil)
|
82
|
+
foreign_keys = []
|
83
|
+
|
84
|
+
query(sql, name).each do |row|
|
85
|
+
if row[1] =~ /^FOREIGN KEY \((.+?)\) REFERENCES (.+?)\((.+?)\)( ON UPDATE (.+?))?( ON DELETE (.+?))?( (DEFERRABLE|NOT DEFERRABLE))?$/
|
86
|
+
name = row[0]
|
87
|
+
from_table_name = row[2]
|
88
|
+
column_names = $1
|
89
|
+
references_table_name = $2
|
90
|
+
references_column_names = $3
|
91
|
+
on_update = $5
|
92
|
+
on_delete = $7
|
93
|
+
deferrable = $9 == "DEFERRABLE"
|
94
|
+
on_update = on_update.downcase.gsub(' ', '_').to_sym if on_update
|
95
|
+
on_delete = on_delete.downcase.gsub(' ', '_').to_sym if on_delete
|
96
|
+
|
97
|
+
foreign_keys << ForeignKeyDefinition.new(name,
|
98
|
+
from_table_name, column_names.split(', '),
|
99
|
+
references_table_name.sub(/^"(.*)"$/, '\1'), references_column_names.split(', '),
|
100
|
+
on_update, on_delete, deferrable)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
foreign_keys
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module RedHillConsulting::Core::ActiveRecord::ConnectionAdapters
|
2
|
+
module SchemaStatements
|
3
|
+
def self.included(base)
|
4
|
+
base.module_eval do
|
5
|
+
alias_method_chain :create_table, :redhillonrails_core
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def create_table_with_redhillonrails_core(name, options = {}, &block)
|
10
|
+
if options.include?(:comment)
|
11
|
+
options = options.dup
|
12
|
+
comment = options.delete(:comment)
|
13
|
+
end
|
14
|
+
|
15
|
+
create_table_without_redhillonrails_core(name, options) do |table_defintion|
|
16
|
+
table_defintion.name = name
|
17
|
+
yield table_defintion
|
18
|
+
end
|
19
|
+
|
20
|
+
set_table_comment(name, comment) if comment
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module RedHillConsulting::Core::ActiveRecord::ConnectionAdapters
|
2
|
+
module Sqlite3Adapter
|
3
|
+
def add_foreign_key(table_name, column_names, references_table_name, references_column_names, options = {})
|
4
|
+
end
|
5
|
+
|
6
|
+
def remove_foreign_key(table_name, foreign_key_name)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module RedHillConsulting::Core::ActiveRecord::ConnectionAdapters
|
2
|
+
module TableDefinition
|
3
|
+
def self.included(base)
|
4
|
+
base.class_eval do
|
5
|
+
attr_accessor :name
|
6
|
+
alias_method_chain :initialize, :redhillonrails_core
|
7
|
+
alias_method_chain :to_sql, :redhillonrails_core
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize_with_redhillonrails_core(*args)
|
12
|
+
initialize_without_redhillonrails_core(*args)
|
13
|
+
@foreign_keys = []
|
14
|
+
end
|
15
|
+
|
16
|
+
def foreign_key(column_names, references_table_name, references_column_names, options = {})
|
17
|
+
@foreign_keys << ForeignKeyDefinition.new(options[:name], nil, column_names, ActiveRecord::Migrator.proper_table_name(references_table_name), references_column_names, options[:on_update], options[:on_delete], options[:deferrable])
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_sql_with_redhillonrails_core
|
22
|
+
sql = to_sql_without_redhillonrails_core
|
23
|
+
sql << ', ' << @foreign_keys * ', ' unless @foreign_keys.empty? || ActiveRecord::Schema.defining?
|
24
|
+
sql
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module RedHillConsulting::Core::ActiveRecord
|
2
|
+
module Schema
|
3
|
+
def self.included(base)
|
4
|
+
base.extend(ClassMethods)
|
5
|
+
end
|
6
|
+
|
7
|
+
module ClassMethods
|
8
|
+
def self.extended(base)
|
9
|
+
class << base
|
10
|
+
attr_accessor :defining
|
11
|
+
alias :defining? :defining
|
12
|
+
|
13
|
+
alias_method_chain :define, :redhillonrails_core
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def define_with_redhillonrails_core(info={}, &block)
|
18
|
+
begin
|
19
|
+
self.defining = true
|
20
|
+
define_without_redhillonrails_core(info, &block)
|
21
|
+
ensure
|
22
|
+
self.defining = false
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/schema_dumper.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
module RedHillConsulting::Core::ActiveRecord
|
2
|
+
module SchemaDumper
|
3
|
+
def self.included(base)
|
4
|
+
base.class_eval do
|
5
|
+
private
|
6
|
+
alias_method_chain :tables, :redhillonrails_core
|
7
|
+
alias_method_chain :indexes, :redhillonrails_core
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def tables_with_redhillonrails_core(stream)
|
14
|
+
@foreign_keys = StringIO.new
|
15
|
+
begin
|
16
|
+
tables_without_redhillonrails_core(stream)
|
17
|
+
@foreign_keys.rewind
|
18
|
+
stream.print @foreign_keys.read
|
19
|
+
ensure
|
20
|
+
@foreign_keys = nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def indexes_with_redhillonrails_core(table, stream)
|
25
|
+
indexes = @connection.indexes(table)
|
26
|
+
indexes.each do |index|
|
27
|
+
stream.print " add_index #{index.table.inspect}, #{index.columns.inspect}, :name => #{index.name.inspect}"
|
28
|
+
stream.print ", :unique => true" if index.unique
|
29
|
+
stream.print ", :case_sensitive => false" unless index.case_sensitive?
|
30
|
+
stream.puts
|
31
|
+
end
|
32
|
+
stream.puts unless indexes.empty?
|
33
|
+
|
34
|
+
foreign_keys(table, @foreign_keys)
|
35
|
+
end
|
36
|
+
|
37
|
+
def foreign_keys(table, stream)
|
38
|
+
foreign_keys = @connection.foreign_keys(table)
|
39
|
+
foreign_keys.each do |foreign_key|
|
40
|
+
stream.print " "
|
41
|
+
stream.print foreign_key.to_dump
|
42
|
+
stream.puts
|
43
|
+
end
|
44
|
+
stream.puts unless foreign_keys.empty?
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
metadata
ADDED
@@ -0,0 +1,290 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.0
|
3
|
+
specification_version: 1
|
4
|
+
name: advertnet
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 1.0.0
|
7
|
+
date: 2007-10-18 00:00:00 +02:00
|
8
|
+
summary: A tool for managing multiple networks of advertising boards
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: ffarid@pragmatic-source.com
|
12
|
+
homepage:
|
13
|
+
rubyforge_project:
|
14
|
+
description: AdvertNet is a Rails application that manages a network of advertising boards. The boards are attached to urban furnitures and can belong to different networks. You must first run the 'advertnet-install' binary to deploy the Rails application, and then configure its database before using it.
|
15
|
+
autorequire:
|
16
|
+
default_executable: advertnet-install
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- Farzad FARID
|
31
|
+
files:
|
32
|
+
- LICENSE
|
33
|
+
- bin
|
34
|
+
- log
|
35
|
+
- components
|
36
|
+
- lib
|
37
|
+
- doc
|
38
|
+
- test
|
39
|
+
- script
|
40
|
+
- Rakefile
|
41
|
+
- vendor
|
42
|
+
- public
|
43
|
+
- config
|
44
|
+
- README
|
45
|
+
- app
|
46
|
+
- tmp
|
47
|
+
- db
|
48
|
+
- bin/advertnet-install
|
49
|
+
- lib/advertnet.rb
|
50
|
+
- lib/second_life_validators.rb
|
51
|
+
- lib/tasks
|
52
|
+
- lib/tasks/documentation.rake
|
53
|
+
- lib/tasks/extract_fixtures.rake
|
54
|
+
- lib/tasks/load_exported_fixtures.rake
|
55
|
+
- doc/README_FOR_APP
|
56
|
+
- test/fixtures
|
57
|
+
- test/integration
|
58
|
+
- test/test_helper.rb
|
59
|
+
- test/mocks
|
60
|
+
- test/unit
|
61
|
+
- test/functional
|
62
|
+
- test/fixtures/furnitures.yml
|
63
|
+
- test/fixtures/containers.yml
|
64
|
+
- test/fixtures/objects_off_world_panels.yml
|
65
|
+
- test/fixtures/panels.yml
|
66
|
+
- test/fixtures/objects_off_world.yml
|
67
|
+
- test/fixtures/mailer
|
68
|
+
- test/fixtures/objects_in_world.yml
|
69
|
+
- test/fixtures/objects_in_world_panels.yml
|
70
|
+
- test/fixtures/panel_revisions.yml
|
71
|
+
- test/fixtures/networks.yml
|
72
|
+
- test/fixtures/mailer/avtouch
|
73
|
+
- test/mocks/test
|
74
|
+
- test/mocks/development
|
75
|
+
- test/unit/network_test.rb
|
76
|
+
- test/unit/panel_test.rb
|
77
|
+
- test/unit/object_off_world_test.rb
|
78
|
+
- test/unit/object_in_world_test.rb
|
79
|
+
- test/unit/container_test.rb
|
80
|
+
- test/unit/furniture_test.rb
|
81
|
+
- test/unit/panel_revision_test.rb
|
82
|
+
- test/unit/mailer_test.rb
|
83
|
+
- test/functional/container_controller_test.rb
|
84
|
+
- test/functional/panels_controller_test.rb
|
85
|
+
- test/functional/furnitures_controller_test.rb
|
86
|
+
- test/functional/objects_in_world_controller_test.rb
|
87
|
+
- test/functional/content_controller_test.rb
|
88
|
+
- test/functional/networks_controller_test.rb
|
89
|
+
- script/plugin
|
90
|
+
- script/about
|
91
|
+
- script/server
|
92
|
+
- script/generate
|
93
|
+
- script/process
|
94
|
+
- script/runner
|
95
|
+
- script/console
|
96
|
+
- script/destroy
|
97
|
+
- script/breakpointer
|
98
|
+
- script/performance
|
99
|
+
- script/process/inspector
|
100
|
+
- script/process/spawner
|
101
|
+
- script/process/reaper
|
102
|
+
- script/performance/benchmarker
|
103
|
+
- script/performance/profiler
|
104
|
+
- vendor/plugins
|
105
|
+
- vendor/plugins/redhillonrails_core
|
106
|
+
- vendor/plugins/annotate_models
|
107
|
+
- vendor/plugins/foreign_key_migrations
|
108
|
+
- vendor/plugins/redhillonrails_core/MIT-LICENSE
|
109
|
+
- vendor/plugins/redhillonrails_core/CHANGELOG
|
110
|
+
- vendor/plugins/redhillonrails_core/lib
|
111
|
+
- vendor/plugins/redhillonrails_core/README
|
112
|
+
- vendor/plugins/redhillonrails_core/init.rb
|
113
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting
|
114
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core
|
115
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record
|
116
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters
|
117
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/schema_dumper.rb
|
118
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/schema.rb
|
119
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/base.rb
|
120
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/postgresql_adapter.rb
|
121
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/column.rb
|
122
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/mysql_adapter.rb
|
123
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/sqlite3_adapter.rb
|
124
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/table_definition.rb
|
125
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/mysql_column.rb
|
126
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/schema_statements.rb
|
127
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/abstract_adapter.rb
|
128
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/index_definition.rb
|
129
|
+
- vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/foreign_key_definition.rb
|
130
|
+
- vendor/plugins/annotate_models/lib
|
131
|
+
- vendor/plugins/annotate_models/ChangeLog
|
132
|
+
- vendor/plugins/annotate_models/tasks
|
133
|
+
- vendor/plugins/annotate_models/README
|
134
|
+
- vendor/plugins/annotate_models/lib/annotate_models.rb
|
135
|
+
- vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake
|
136
|
+
- vendor/plugins/foreign_key_migrations/MIT-LICENSE
|
137
|
+
- vendor/plugins/foreign_key_migrations/CHANGELOG
|
138
|
+
- vendor/plugins/foreign_key_migrations/install.rb
|
139
|
+
- vendor/plugins/foreign_key_migrations/lib
|
140
|
+
- vendor/plugins/foreign_key_migrations/README
|
141
|
+
- vendor/plugins/foreign_key_migrations/init.rb
|
142
|
+
- vendor/plugins/foreign_key_migrations/about.yml
|
143
|
+
- vendor/plugins/foreign_key_migrations/lib/red_hill_consulting
|
144
|
+
- vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations
|
145
|
+
- vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record
|
146
|
+
- vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/connection_adapters
|
147
|
+
- vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/base.rb
|
148
|
+
- vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/connection_adapters/table_definition.rb
|
149
|
+
- vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/connection_adapters/abstract_adapter.rb
|
150
|
+
- public/robots.txt
|
151
|
+
- public/javascripts
|
152
|
+
- public/dispatch.cgi
|
153
|
+
- public/stylesheets
|
154
|
+
- public/500.html
|
155
|
+
- public/images
|
156
|
+
- public/404.html
|
157
|
+
- public/favicon.ico
|
158
|
+
- public/dispatch.rb
|
159
|
+
- public/dispatch.fcgi
|
160
|
+
- public/javascripts/dragdrop.js
|
161
|
+
- public/javascripts/controls.js
|
162
|
+
- public/javascripts/application.js
|
163
|
+
- public/javascripts/prototype.js
|
164
|
+
- public/javascripts/effects.js
|
165
|
+
- public/stylesheets/application.css
|
166
|
+
- public/stylesheets/scaffold.css
|
167
|
+
- public/images/rails.png
|
168
|
+
- config/boot.rb
|
169
|
+
- config/routes.rb
|
170
|
+
- config/environments
|
171
|
+
- config/database.yml.default
|
172
|
+
- config/environment.rb
|
173
|
+
- config/environments/development.rb
|
174
|
+
- config/environments/production.rb
|
175
|
+
- config/environments/test.rb
|
176
|
+
- app/helpers
|
177
|
+
- app/models
|
178
|
+
- app/controllers
|
179
|
+
- app/views
|
180
|
+
- app/helpers/network_helper.rb
|
181
|
+
- app/helpers/objects_in_world_helper.rb
|
182
|
+
- app/helpers/content_helper.rb
|
183
|
+
- app/helpers/application_helper.rb
|
184
|
+
- app/helpers/networks_helper.rb
|
185
|
+
- app/helpers/container_helper.rb
|
186
|
+
- app/helpers/furnitures_helper.rb
|
187
|
+
- app/helpers/panels_helper.rb
|
188
|
+
- app/models/network.rb
|
189
|
+
- app/models/mailer.rb
|
190
|
+
- app/models/panel.rb
|
191
|
+
- app/models/container.rb
|
192
|
+
- app/models/panel_revision.rb
|
193
|
+
- app/models/object_in_world.rb
|
194
|
+
- app/models/object_off_world.rb
|
195
|
+
- app/models/furniture.rb
|
196
|
+
- app/controllers/furnitures_controller.rb
|
197
|
+
- app/controllers/application.rb
|
198
|
+
- app/controllers/panels_controller.rb
|
199
|
+
- app/controllers/objects_in_world_controller.rb
|
200
|
+
- app/controllers/content_controller.rb
|
201
|
+
- app/controllers/networks_controller.rb
|
202
|
+
- app/controllers/container_controller.rb
|
203
|
+
- app/views/content
|
204
|
+
- app/views/furnitures
|
205
|
+
- app/views/mailer
|
206
|
+
- app/views/objects_in_world
|
207
|
+
- app/views/container
|
208
|
+
- app/views/networks
|
209
|
+
- app/views/layouts
|
210
|
+
- app/views/panels
|
211
|
+
- app/views/content/list.rhtml
|
212
|
+
- app/views/content/new.rhtml
|
213
|
+
- app/views/content/edit.rhtml
|
214
|
+
- app/views/content/_form.rhtml
|
215
|
+
- app/views/furnitures/list.rhtml
|
216
|
+
- app/views/furnitures/show.rhtml
|
217
|
+
- app/views/mailer/avtouch.rhtml
|
218
|
+
- app/views/objects_in_world/list.rhtml
|
219
|
+
- app/views/objects_in_world/show.rhtml
|
220
|
+
- app/views/container/list.rhtml
|
221
|
+
- app/views/container/show.rhtml
|
222
|
+
- app/views/networks/list.rhtml
|
223
|
+
- app/views/networks/_parameters_form.rhtml
|
224
|
+
- app/views/networks/new.rhtml
|
225
|
+
- app/views/networks/edit.rhtml
|
226
|
+
- app/views/networks/_form.rhtml
|
227
|
+
- app/views/networks/show_parameters_form.rjs
|
228
|
+
- app/views/networks/show.rhtml
|
229
|
+
- app/views/layouts/default.rhtml
|
230
|
+
- app/views/panels/list.rhtml
|
231
|
+
- app/views/panels/show.rhtml
|
232
|
+
- tmp/sockets
|
233
|
+
- tmp/pids
|
234
|
+
- tmp/cache
|
235
|
+
- tmp/sessions
|
236
|
+
- db/exported_fixtures
|
237
|
+
- db/migrate
|
238
|
+
- db/schema.rb
|
239
|
+
- db/migrate/006_create_panels.rb
|
240
|
+
- db/migrate/009_add_sessions.rb
|
241
|
+
- db/migrate/012_add_permanent_furniture_id.rb
|
242
|
+
- db/migrate/007_join_objects_in_world_panels.rb
|
243
|
+
- db/migrate/011_move_texture_to_object_in_world.rb
|
244
|
+
- db/migrate/003_create_containers.rb
|
245
|
+
- db/migrate/002_create_furnitures.rb
|
246
|
+
- db/migrate/013_create_panel_revisions.rb
|
247
|
+
- db/migrate/008_join_objects_off_world_panels.rb
|
248
|
+
- db/migrate/005_create_objects_off_world.rb
|
249
|
+
- db/migrate/004_create_objects_in_world.rb
|
250
|
+
- db/migrate/010_add_or_rename_fields.rb
|
251
|
+
- db/migrate/001_create_networks.rb
|
252
|
+
test_files: []
|
253
|
+
|
254
|
+
rdoc_options:
|
255
|
+
- --title
|
256
|
+
- Advertnet -- An advertising boards management tool
|
257
|
+
- --main
|
258
|
+
- README
|
259
|
+
- --charset
|
260
|
+
- utf-8
|
261
|
+
- --exclude
|
262
|
+
- lib
|
263
|
+
extra_rdoc_files:
|
264
|
+
- README
|
265
|
+
executables:
|
266
|
+
- advertnet-install
|
267
|
+
extensions: []
|
268
|
+
|
269
|
+
requirements:
|
270
|
+
- MySQL 5.0
|
271
|
+
- A Second Life environment
|
272
|
+
dependencies:
|
273
|
+
- !ruby/object:Gem::Dependency
|
274
|
+
name: rails
|
275
|
+
version_requirement:
|
276
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
277
|
+
requirements:
|
278
|
+
- - ">="
|
279
|
+
- !ruby/object:Gem::Version
|
280
|
+
version: 1.2.3
|
281
|
+
version:
|
282
|
+
- !ruby/object:Gem::Dependency
|
283
|
+
name: rake
|
284
|
+
version_requirement:
|
285
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
286
|
+
requirements:
|
287
|
+
- - ">="
|
288
|
+
- !ruby/object:Gem::Version
|
289
|
+
version: 0.7.3
|
290
|
+
version:
|