wontomedia 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. data/COPYING +661 -0
  2. data/COPYING.DOCUMENTATION +450 -0
  3. data/LICENSE +661 -0
  4. data/README.markdown +56 -0
  5. data/Rakefile +185 -0
  6. data/VERSION.yml +4 -0
  7. data/app/controllers/admin_controller.rb +144 -0
  8. data/app/controllers/application_controller.rb +29 -0
  9. data/app/controllers/connections_controller.rb +150 -0
  10. data/app/controllers/items_controller.rb +365 -0
  11. data/app/helpers/connections_helper.rb +67 -0
  12. data/app/helpers/format_helper.rb +154 -0
  13. data/app/helpers/items_helper.rb +105 -0
  14. data/app/models/category_item.rb +23 -0
  15. data/app/models/connection.rb +210 -0
  16. data/app/models/individual_item.rb +23 -0
  17. data/app/models/item.rb +86 -0
  18. data/app/models/property_item.rb +23 -0
  19. data/app/models/qualified_item.rb +23 -0
  20. data/app/views/admin/index.html.erb +74 -0
  21. data/app/views/connections/_index_outbound_links.html.erb +48 -0
  22. data/app/views/connections/_spo_select_controls.html.erb +151 -0
  23. data/app/views/connections/edit.html.erb +70 -0
  24. data/app/views/connections/index.html.erb +84 -0
  25. data/app/views/connections/new.html.erb +61 -0
  26. data/app/views/connections/show.html.erb +110 -0
  27. data/app/views/items/_active_content.html.erb +26 -0
  28. data/app/views/items/_content_examples.html.erb +55 -0
  29. data/app/views/items/_core_tasks.html.erb +23 -0
  30. data/app/views/items/_form_fields.html.erb +69 -0
  31. data/app/views/items/_list_outbound_links.html.erb +58 -0
  32. data/app/views/items/_screen_select.html.erb +24 -0
  33. data/app/views/items/_show_outbound_links.html.erb +70 -0
  34. data/app/views/items/_topic_list.html.erb +26 -0
  35. data/app/views/items/_type_select.html.erb +47 -0
  36. data/app/views/items/edit.html.erb +63 -0
  37. data/app/views/items/index.html.erb +74 -0
  38. data/app/views/items/new.html.erb +124 -0
  39. data/app/views/items/newpop.html.erb +58 -0
  40. data/app/views/items/show.html.erb +209 -0
  41. data/app/views/layouts/_amazon_ads.html.erb +55 -0
  42. data/app/views/layouts/_glossary_help_box.html.erb +43 -0
  43. data/app/views/layouts/_google_ads.html.erb +40 -0
  44. data/app/views/layouts/_language_select.html.erb +24 -0
  45. data/app/views/layouts/_login_controls.html.erb +24 -0
  46. data/app/views/layouts/_master_help.html.erb +24 -0
  47. data/app/views/layouts/_navigation_menu.html.erb +39 -0
  48. data/app/views/layouts/_search_box.html.erb +27 -0
  49. data/app/views/layouts/_status_msgs.html.erb +25 -0
  50. data/app/views/layouts/application.html.erb +67 -0
  51. data/app/views/layouts/base.html.erb +93 -0
  52. data/app/views/layouts/home.html.erb +67 -0
  53. data/app/views/layouts/popup.html.erb +23 -0
  54. data/assets/wontomedia-sample.rb +47 -0
  55. data/config/asset_packages.yml +44 -0
  56. data/config/boot.rb +110 -0
  57. data/config/cucumber.yml +65 -0
  58. data/config/database-mysql-development.yml +47 -0
  59. data/config/database-mysql.yml +26 -0
  60. data/config/environment.rb +94 -0
  61. data/config/environments/cucumber.rb +29 -0
  62. data/config/environments/development.rb +26 -0
  63. data/config/environments/production.rb +33 -0
  64. data/config/environments/test.rb +31 -0
  65. data/config/initializers/inflections.rb +19 -0
  66. data/config/initializers/mime_types.rb +14 -0
  67. data/config/initializers/new_rails_defaults.rb +26 -0
  68. data/config/locales/en.yml +14 -0
  69. data/config/routes.rb +37 -0
  70. data/db/fixtures/connections.yml +96 -0
  71. data/db/fixtures/items.yml +277 -0
  72. data/db/migrate/20090312212805_create_items.rb +31 -0
  73. data/db/migrate/20090406221320_create_connections.rb +32 -0
  74. data/db/migrate/20090411014503_add_type_for_item_subclasses.rb +29 -0
  75. data/db/migrate/20090415142152_rename_item_type.rb +31 -0
  76. data/db/migrate/20090518022918_rename_object_and_self.rb +33 -0
  77. data/db/migrate/20090529171442_add_flags_to_items.rb +27 -0
  78. data/db/migrate/20090529171508_add_flags_to_connections.rb +27 -0
  79. data/db/migrate/20090605213800_flags_columns_not_null.rb +29 -0
  80. data/db/migrate/20090605215028_flags_columns_default_zero.rb +29 -0
  81. data/db/schema.rb +30 -0
  82. data/default-custom/app/views/items/_home_extern_list.html.erb +32 -0
  83. data/default-custom/app/views/items/_home_introductory_text.html.erb +70 -0
  84. data/default-custom/app/views/items/home.html.erb +77 -0
  85. data/default-custom/public/images/logo.png +0 -0
  86. data/default-custom/public/images/logo.svg +74 -0
  87. data/default-custom/public/stylesheets/wm.css +301 -0
  88. data/doc/README.markdown +44 -0
  89. data/doc/README_FOR_APP +82 -0
  90. data/doc/customization.markdown +93 -0
  91. data/doc/scripts/rake-customize.markdown +83 -0
  92. data/lib/helpers/connection_helper.rb +41 -0
  93. data/lib/helpers/item_helper.rb +141 -0
  94. data/lib/helpers/tripple_navigation.rb +158 -0
  95. data/lib/tasks/cucumber.rake +83 -0
  96. data/lib/tasks/customize.rake +70 -0
  97. data/lib/tasks/db.rake +65 -0
  98. data/lib/tasks/javascript_testing_tasks.rake +176 -0
  99. data/public/404.html +50 -0
  100. data/public/422.html +50 -0
  101. data/public/500.html +53 -0
  102. data/public/dispatch.cgi +20 -0
  103. data/public/dispatch.fcgi +34 -0
  104. data/public/dispatch.rb +20 -0
  105. data/public/favicon.ico +0 -0
  106. data/public/images/blank_error_icon.png +0 -0
  107. data/public/images/blank_status_icon.png +0 -0
  108. data/public/images/error_error_icon.png +0 -0
  109. data/public/images/error_status_icon.png +0 -0
  110. data/public/images/good_status_icon.png +0 -0
  111. data/public/images/help_icon.png +0 -0
  112. data/public/images/twitter_icon.png +0 -0
  113. data/public/images/warn_error_icon.png +0 -0
  114. data/public/images/working_status_icon.gif +0 -0
  115. data/public/javascripts/application.js +56 -0
  116. data/public/javascripts/controls.js +963 -0
  117. data/public/javascripts/dragdrop.js +973 -0
  118. data/public/javascripts/effects.js +1128 -0
  119. data/public/javascripts/event.simulate.js +64 -0
  120. data/public/javascripts/fancybox.js +43 -0
  121. data/public/javascripts/forConnectionsForms.js +218 -0
  122. data/public/javascripts/forItemsForms.js +511 -0
  123. data/public/javascripts/itemCreatePopup.js +115 -0
  124. data/public/javascripts/itemTitleToName.js +119 -0
  125. data/public/javascripts/jquery.js +4376 -0
  126. data/public/javascripts/modalbox.js +502 -0
  127. data/public/javascripts/prototype.js +4320 -0
  128. data/public/javascripts/reconcileJQueryAndPrototype.js +19 -0
  129. data/public/robots.txt +7 -0
  130. data/public/stylesheets/blank.gif +0 -0
  131. data/public/stylesheets/fancy_close.png +0 -0
  132. data/public/stylesheets/fancy_loading.png +0 -0
  133. data/public/stylesheets/fancy_nav_left.png +0 -0
  134. data/public/stylesheets/fancy_nav_right.png +0 -0
  135. data/public/stylesheets/fancy_shadow_e.png +0 -0
  136. data/public/stylesheets/fancy_shadow_n.png +0 -0
  137. data/public/stylesheets/fancy_shadow_ne.png +0 -0
  138. data/public/stylesheets/fancy_shadow_nw.png +0 -0
  139. data/public/stylesheets/fancy_shadow_s.png +0 -0
  140. data/public/stylesheets/fancy_shadow_se.png +0 -0
  141. data/public/stylesheets/fancy_shadow_sw.png +0 -0
  142. data/public/stylesheets/fancy_shadow_w.png +0 -0
  143. data/public/stylesheets/fancy_title_left.png +0 -0
  144. data/public/stylesheets/fancy_title_main.png +0 -0
  145. data/public/stylesheets/fancy_title_over.png +0 -0
  146. data/public/stylesheets/fancy_title_right.png +0 -0
  147. data/public/stylesheets/fancybox.css +333 -0
  148. data/public/stylesheets/modalbox.css +110 -0
  149. data/public/stylesheets/scaffold.css +36 -0
  150. data/public/stylesheets/spinner.gif +0 -0
  151. data/script/about +4 -0
  152. data/script/console +3 -0
  153. data/script/cucumber +10 -0
  154. data/script/dbconsole +3 -0
  155. data/script/destroy +3 -0
  156. data/script/generate +3 -0
  157. data/script/performance/benchmarker +3 -0
  158. data/script/performance/profiler +3 -0
  159. data/script/performance/request +3 -0
  160. data/script/plugin +3 -0
  161. data/script/process/inspector +3 -0
  162. data/script/process/reaper +3 -0
  163. data/script/process/spawner +3 -0
  164. data/script/runner +3 -0
  165. data/script/server +3 -0
  166. data/vendor/plugins/asset_packager/CHANGELOG +122 -0
  167. data/vendor/plugins/asset_packager/README +178 -0
  168. data/vendor/plugins/asset_packager/Rakefile +22 -0
  169. data/vendor/plugins/asset_packager/about.yml +8 -0
  170. data/vendor/plugins/asset_packager/init.rb +2 -0
  171. data/vendor/plugins/asset_packager/install.rb +1 -0
  172. data/vendor/plugins/asset_packager/lib/jsmin.rb +205 -0
  173. data/vendor/plugins/asset_packager/lib/synthesis/asset_package.rb +212 -0
  174. data/vendor/plugins/asset_packager/lib/synthesis/asset_package_helper.rb +39 -0
  175. data/vendor/plugins/asset_packager/tasks/asset_packager_tasks.rake +23 -0
  176. data/vendor/plugins/asset_packager/test/asset_package_helper_development_test.rb +100 -0
  177. data/vendor/plugins/asset_packager/test/asset_package_helper_production_test.rb +140 -0
  178. data/vendor/plugins/asset_packager/test/asset_packager_test.rb +92 -0
  179. data/vendor/plugins/asset_packager/test/asset_packages.yml +20 -0
  180. data/vendor/plugins/asset_packager/test/assets/javascripts/application.js +2 -0
  181. data/vendor/plugins/asset_packager/test/assets/javascripts/bar.js +4 -0
  182. data/vendor/plugins/asset_packager/test/assets/javascripts/controls.js +815 -0
  183. data/vendor/plugins/asset_packager/test/assets/javascripts/dragdrop.js +913 -0
  184. data/vendor/plugins/asset_packager/test/assets/javascripts/effects.js +958 -0
  185. data/vendor/plugins/asset_packager/test/assets/javascripts/foo.js +4 -0
  186. data/vendor/plugins/asset_packager/test/assets/javascripts/prototype.js +2006 -0
  187. data/vendor/plugins/asset_packager/test/assets/stylesheets/bar.css +16 -0
  188. data/vendor/plugins/asset_packager/test/assets/stylesheets/foo.css +16 -0
  189. data/vendor/plugins/asset_packager/test/assets/stylesheets/header.css +16 -0
  190. data/vendor/plugins/asset_packager/test/assets/stylesheets/screen.css +16 -0
  191. data/vendor/plugins/asset_packager/test/assets/stylesheets/subdir/bar.css +16 -0
  192. data/vendor/plugins/asset_packager/test/assets/stylesheets/subdir/foo.css +16 -0
  193. metadata +265 -0
@@ -0,0 +1,83 @@
1
+ # WontoMedia - a wontology web application
2
+ # Copyright (C) 2010 - Glen E. Ivey
3
+ # www.wontology.com
4
+ #
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Affero General Public License version
7
+ # 3 as published by the Free Software Foundation.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program in the file COPYING and/or LICENSE. If not,
16
+ # see <http://www.gnu.org/licenses/>.
17
+
18
+
19
+ # Find vendored gem or plugin of cucumber
20
+ vendored_cucumber_dir =
21
+ Dir["#{RAILS_ROOT}/vendor/{gems,plugins}/cucumber*"].first
22
+ $LOAD_PATH.unshift("#{vendored_cucumber_dir}/lib") unless
23
+ vendored_cucumber_dir.nil?
24
+
25
+ unless ARGV.any? {|a| a =~ /^gems/}
26
+
27
+ begin
28
+ require 'cucumber/rake/task'
29
+
30
+ # Use vendored cucumber binary if possible. If it's not vendored,
31
+ # Cucumber::Rake::Task will automatically use installed gem's cucumber binary
32
+ vendored_cucumber_binary =
33
+ "#{vendored_cucumber_dir}/bin/cucumber" unless vendored_cucumber_dir.nil?
34
+
35
+ namespace :cucumber do
36
+ Cucumber::Rake::Task.new({:static_ok => 'db:test:prepare'},
37
+ 'Run non-Selenium features that should pass') do |t|
38
+ t.binary = vendored_cucumber_binary
39
+ t.fork = false
40
+ t.profile = "static_acceptance"
41
+ end
42
+
43
+ Cucumber::Rake::Task.new({:dynamic_ok => 'db:test:prepare'},
44
+ 'Run need-Selenium-to-test features that should pass') do |t|
45
+ t.binary = vendored_cucumber_binary
46
+ t.fork = false
47
+ t.profile = "dynamic_acceptance"
48
+ end
49
+
50
+ Cucumber::Rake::Task.new({:static_wip => 'db:test:prepare'},
51
+ 'Run non-Selenium features that are being worked on') do |t|
52
+ t.binary = vendored_cucumber_binary
53
+ t.fork = false
54
+ t.profile = "static_unfinished"
55
+ end
56
+
57
+ Cucumber::Rake::Task.new({:dynamic_wip => 'db:test:prepare'},
58
+ 'Run need-Selenium-to-test features that are being worked on') do |t|
59
+ t.binary = vendored_cucumber_binary
60
+ t.fork = false
61
+ t.profile = "dynamic_unfinished"
62
+ end
63
+
64
+ desc 'Run features that should pass'
65
+ task :ok => [:static_ok, :dynamic_ok]
66
+ desc 'Run features that are being worked on'
67
+ task :wip => [:static_wip, :dynamic_wip]
68
+ desc 'Run all features'
69
+ task :all => [:ok, :wip]
70
+ end
71
+
72
+ desc 'Alias for cucumber:ok'
73
+ task :cucumber => 'cucumber:ok'
74
+ task :default => :cucumber
75
+
76
+ rescue LoadError
77
+ desc 'cucumber rake task not available (cucumber not installed)'
78
+ task :cucumber do
79
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
80
+ end
81
+ end
82
+
83
+ end
@@ -0,0 +1,70 @@
1
+ # WontoMedia - a wontology web application
2
+ # Copyright (C) 2010 - Glen E. Ivey
3
+ # www.wontology.com
4
+ #
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Affero General Public License version
7
+ # 3 as published by the Free Software Foundation.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program in the file COPYING and/or LICENSE. If not,
16
+ # see <http://www.gnu.org/licenses/>.
17
+
18
+
19
+ # see wontomedia/doc/script/rake-customize.markdown for usage
20
+
21
+ desc "This creates symbolic links to customization files in other directories"
22
+ task :customize, :path_list do |t, args|
23
+
24
+ # first, clear out all symbolic links from any previous
25
+ # configurations--we don't want to leave any old ones lying around
26
+ # pointing into customization directories we aren't currently using.
27
+ FileList[ "*", "**/*"].
28
+ exclude do |maybe_not_link|
29
+ !File.symlink?(maybe_not_link)
30
+ end.
31
+ each do |link_to_delete|
32
+ File.delete link_to_delete
33
+ end
34
+
35
+ # now, build new links
36
+ paths = args[:path_list].split(':')
37
+ paths.each do |p|
38
+ path = File.expand_path(p)
39
+ Dir[ File.join( path, "**", "*" ) ].each do |from_p|
40
+ if File.file?( from_p )
41
+ from_absolute = File.expand_path(from_p)
42
+ from_path = File.dirname( from_absolute )
43
+ file_name = File.basename( from_absolute )
44
+
45
+ sublength = (from_path.length - path.length) - 1
46
+ relative = from_path[ -sublength, sublength ]
47
+ to_absolute = File.expand_path( relative )
48
+ to_name = File.join( to_absolute, file_name )
49
+
50
+ if File.exists?( to_name )
51
+ unless File.symlink?( to_name )
52
+ puts "WARNING: replacing regular file '#{to_name}' "\
53
+ " with symbolic link."
54
+ end
55
+ File.delete( to_name )
56
+ end
57
+
58
+ path_so_far = File.expand_path( '.' )
59
+ relative.split( File::SEPARATOR ).each do |dir_name|
60
+ path_so_far = File.join( path_so_far, dir_name )
61
+ unless File.exists?( path_so_far )
62
+ Dir.mkdir( path_so_far )
63
+ end
64
+ end
65
+ File.symlink( from_absolute, to_name )
66
+ end
67
+ end
68
+ end
69
+ end
70
+
@@ -0,0 +1,65 @@
1
+ # WontoMedia - a wontology web application
2
+ # Copyright (C) 2010 - Glen E. Ivey
3
+ # www.wontology.com
4
+ #
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Affero General Public License version
7
+ # 3 as published by the Free Software Foundation.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program in the file COPYING and/or LICENSE. If not,
16
+ # see <http://www.gnu.org/licenses/>.
17
+
18
+
19
+ require 'active_record'
20
+ require 'active_record/fixtures'
21
+
22
+
23
+ namespace :db do
24
+ desc "Load YAML seed data from db/fixtures"
25
+ task :seed => :environment do
26
+ load_all_YAML_globbed_from(
27
+ File.join( RAILS_ROOT, 'db', 'fixtures', '**', '*.yml' ))
28
+ end
29
+
30
+ desc "This drops the db, builds the db, and seeds the data."
31
+ task :reseed => [:environment, 'db:reset', 'db:seed']
32
+
33
+ desc "Load YAML developtment test data from test/fixtures"
34
+ task :test_fixtures => :environment do
35
+ load_all_YAML_globbed_from(
36
+ File.join( RAILS_ROOT, 'test', 'fixtures', '**', '*.yml' ))
37
+ end
38
+ end
39
+
40
+ def load_all_YAML_globbed_from(pattern)
41
+ ensure_ActiveRecord_available
42
+ Dir.glob(pattern).each do |path|
43
+ load_YAML_from path
44
+ end
45
+ end
46
+
47
+ def ensure_ActiveRecord_available
48
+ unless ActiveRecord::Base.connected?
49
+ ActiveRecord::Base.establish_connection(
50
+ ActiveRecord::Base.configurations[RAILS_ENV] )
51
+ end
52
+ end
53
+
54
+ def load_YAML_from(path)
55
+ path =~ %r%([^/_]+)\.yml$%
56
+ table = $1
57
+ path.sub!(/\.yml$/, "")
58
+
59
+ begin
60
+ f = Fixtures.new( ActiveRecord::Base.connection, table, nil, path )
61
+ f.insert_fixtures
62
+ rescue ActiveRecord::StatementInvalid
63
+ # must have already loaded this data
64
+ end
65
+ end
@@ -0,0 +1,176 @@
1
+ # WontoMedia - a wontology web application
2
+ # Copyright (C) 2010 - Glen E. Ivey
3
+ # www.wontology.com
4
+ #
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Affero General Public License version
7
+ # 3 as published by the Free Software Foundation.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program in the file COPYING and/or LICENSE. If not,
16
+ # see <http://www.gnu.org/licenses/>.
17
+
18
+
19
+ #### This file originated from the same-named file in the Blue Ridge
20
+ #### package at GitHub http://github.com/relevance/blue-ridge/tree/master
21
+ #### as of the 8th of May, 2009. It's original license notice is
22
+ #### below. If you want to use this source without incurring the
23
+ #### requirements of the AGPL present on our changes, please go back
24
+ #### to this original and start from there.
25
+ #
26
+ # Copyright (c) 2008-2009 Relevance, Inc.
27
+ #
28
+ # Permission is hereby granted, free of charge, to any person obtaining
29
+ # a copy of this software and associated documentation files (the
30
+ # "Software"), to deal in the Software without restriction, including
31
+ # without limitation the rights to use, copy, modify, merge, publish,
32
+ # distribute, sublicense, and/or sell copies of the Software, and to
33
+ # permit persons to whom the Software is furnished to do so, subject to
34
+ # the following conditions:
35
+ #
36
+ # The above copyright notice and this permission notice shall be
37
+ # included in all copies or substantial portions of the Software.
38
+ #
39
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
40
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
41
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
42
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
43
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
44
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
45
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46
+
47
+
48
+
49
+
50
+
51
+ begin # don't force Blue Ridge dependency on non-developers
52
+ # so we can make sure the 'test' db is seeded before tests run
53
+ require File.join( RAILS_ROOT, 'test', 'seed_helper' )
54
+
55
+ plugin_prefix = "#{RAILS_ROOT}/vendor/plugins/blue-ridge"
56
+ require File.join(plugin_prefix, "lib", "blue_ridge")
57
+
58
+ rhino_command = "java -Dblue.ridge.prefix=\"#{plugin_prefix}\" " +
59
+ " -jar #{plugin_prefix}/lib/env-js.jar -w -debug"
60
+ test_runner_command = "#{rhino_command} #{plugin_prefix}/lib/test_runner.js"
61
+
62
+
63
+ @link_root = "js-test-files"
64
+ @test_path = "test/javascript/fixtures"
65
+
66
+
67
+ # Support Test::Unit & Test/Spec style
68
+ namespace :test do
69
+ desc "Runs all the JavaScript tests and outputs the results."
70
+ task :javascripts => [ :environment ] do
71
+ prepare_and_load_database
72
+
73
+ Dir.chdir("#{RAILS_ROOT}/test/javascript") do
74
+ all_fine = true
75
+
76
+ begin
77
+ load_wontomedia_app_seed_data
78
+ setup_server_and_environment_for_js_testing
79
+
80
+ if ENV["TEST"]
81
+ all_fine = false unless
82
+ system "#{test_runner_command} #{ENV["TEST"]}_spec.js"
83
+ else
84
+ files = Dir.glob("**/*_spec.js").join(" ")
85
+ all_fine = false unless
86
+ system "#{test_runner_command} #{files}"
87
+ end
88
+ ensure
89
+ cleanup_server_and_environment_after_js_testing
90
+ end
91
+
92
+ raise "JavaScript test failures" unless all_fine
93
+ end
94
+
95
+ cleanup_database
96
+ end
97
+ end
98
+
99
+
100
+ namespace :js do
101
+ task :fixtures => [ :environment, "db:test_fixtures" ] do
102
+ begin
103
+ load_wontomedia_app_seed_data
104
+ setup_server_and_environment_for_js_testing
105
+
106
+ ENV["BLUERIDGE_PREFIX"] = "http://localhost:3001/#{@link_root}"
107
+ js_spec_dir = BlueRidge.find_javascript_spec_dir
108
+ fixture_path = BlueRidge.generateSpecIndexFile(js_spec_dir)
109
+
110
+ if PLATFORM[/darwin/]
111
+ system "open #{fixture_path}"
112
+ elsif PLATFORM[/linux/]
113
+ system "firefox #{fixture_path}"
114
+ end
115
+ ensure
116
+ cleanup_server_and_environment_after_js_testing
117
+ end
118
+ end
119
+
120
+ task :shell do
121
+ rlwrap = `which rlwrap`.chomp
122
+ system "#{rlwrap} #{rhino_command} -f #{plugin_prefix}/lib/shell.js -f -"
123
+ end
124
+ end
125
+
126
+
127
+ private
128
+
129
+
130
+ # use webrat's machinery for starting up a test server running our app
131
+ require 'webrat'
132
+ require 'webrat/selenium/application_servers/rails'
133
+
134
+ def setup_server_and_environment_for_js_testing
135
+ # Link the JavaScript test folder under /public to avoid "same
136
+ # origin policy" (DEVELOPTMENT ONLY!).
137
+ system "ln -s #{RAILS_ROOT} #{RAILS_ROOT}/public/#{@link_root}"
138
+
139
+ # Start a test web server. (Note, originally tried the Webrat::Selenium
140
+ # classes to do this, but found that their automatically calling
141
+ # server stop() at_exit caused Rake to fail when multiple attempts
142
+ # to stop the same server occurred. Making ApplicationServer.start()
143
+ # and .stop() internally veryify the absence/presence of the Mongrel
144
+ # pid also solved the problem, but I didn't want to have to patch Webrat.
145
+
146
+ system "mongrel_rails start -d --chdir='#{RAILS_ROOT}' " +
147
+ "--port=#{Webrat.configuration.application_port} " +
148
+ "--environment=#{Webrat.configuration.application_environment} " +
149
+ "--pid #{Webrat::Selenium::ApplicationServers::Rails.new.pid_file} &"
150
+ end
151
+
152
+ def cleanup_server_and_environment_after_js_testing
153
+ STDOUT.puts # Blue Ridge doesn't put a \n after last "."
154
+ system "rm #{RAILS_ROOT}/public/#{@link_root}"
155
+ silence_stream(STDOUT) do
156
+ system "mongrel_rails stop -c #{RAILS_ROOT} " +
157
+ "--pid #{Webrat::Selenium::ApplicationServers::Rails.new.pid_file}"
158
+ end
159
+ end
160
+
161
+ def prepare_and_load_database
162
+ # ensure that we start with a clean database
163
+ Rake::Task["db:test:prepare"].invoke
164
+ # plus our test "fixture" data
165
+ Rake::Task["db:test_fixtures"].invoke
166
+ end
167
+
168
+ def cleanup_database
169
+ # ensure that we *leave* a clean database, too
170
+ Rake::Task["db:test:prepare"].invoke
171
+ end
172
+
173
+ rescue LoadError
174
+ puts "WARNING: Missing development dependency. 'Blue Ridge', 'Webrat', or a dependency not available. To install, see 'http://wiki.wontology.org/SettingUpYourDevelopmentEnvironment'"
175
+ end
176
+
@@ -0,0 +1,50 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <!--
5
+ WontoMedia - a wontology web application
6
+ Copyright (C) 2010 - Glen E. Ivey
7
+ www.wontology.com
8
+
9
+ This program is free software: you can redistribute it and/or modify
10
+ it under the terms of the GNU Affero General Public License version
11
+ 3 as published by the Free Software Foundation.
12
+
13
+ This program is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU Affero General Public License for more details.
17
+
18
+ You should have received a copy of the GNU Affero General Public License
19
+ along with this program in the file COPYING and/or LICENSE. If not,
20
+ see "http://www.gnu.org/licenses/".
21
+ -->
22
+
23
+
24
+
25
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
26
+ <head>
27
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
28
+ <title>The page you were looking for doesn't exist (404)</title>
29
+ <style type="text/css">
30
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
31
+ div.dialog {
32
+ width: 25em;
33
+ padding: 0 4em;
34
+ margin: 4em auto 0 auto;
35
+ border: 1px solid #ccc;
36
+ border-right-color: #999;
37
+ border-bottom-color: #999;
38
+ }
39
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
40
+ </style>
41
+ </head>
42
+
43
+ <body>
44
+ <!-- This file lives in public/404.html -->
45
+ <div class="dialog">
46
+ <h1>The page you were looking for doesn't exist.</h1>
47
+ <p>You may have mistyped the address or the page may have moved.</p>
48
+ </div>
49
+ </body>
50
+ </html>
@@ -0,0 +1,50 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <!--
5
+ WontoMedia - a wontology web application
6
+ Copyright (C) 2010 - Glen E. Ivey
7
+ www.wontology.com
8
+
9
+ This program is free software: you can redistribute it and/or modify
10
+ it under the terms of the GNU Affero General Public License version
11
+ 3 as published by the Free Software Foundation.
12
+
13
+ This program is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU Affero General Public License for more details.
17
+
18
+ You should have received a copy of the GNU Affero General Public License
19
+ along with this program in the file COPYING and/or LICENSE. If not,
20
+ see "http://www.gnu.org/licenses/".
21
+ -->
22
+
23
+
24
+
25
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
26
+ <head>
27
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
28
+ <title>The change you wanted was rejected (422)</title>
29
+ <style type="text/css">
30
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
31
+ div.dialog {
32
+ width: 25em;
33
+ padding: 0 4em;
34
+ margin: 4em auto 0 auto;
35
+ border: 1px solid #ccc;
36
+ border-right-color: #999;
37
+ border-bottom-color: #999;
38
+ }
39
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
40
+ </style>
41
+ </head>
42
+
43
+ <body>
44
+ <!-- This file lives in public/422.html -->
45
+ <div class="dialog">
46
+ <h1>The change you wanted was rejected.</h1>
47
+ <p>Maybe you tried to change something you didn't have access to.</p>
48
+ </div>
49
+ </body>
50
+ </html>