Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Made the solution F5-able. Reset references to GAC and removed unused…

… projects
  • Loading branch information...
commit 1197047a1c49fb080aa056082afa31e20704f11a 1 parent cf9417c
@casualjim casualjim authored
Showing with 444 additions and 41,746 deletions.
  1. +4 −2 IronRubyMvc.Tests/Controllers/RubyActionDescriptorFixture.cs
  2. +3 −2 IronRubyMvc.Tests/Controllers/RubyControllerActionInvokerSpec.cs
  3. +6 −4 IronRubyMvc.Tests/Controllers/RubyControllerDescriptorSpec.cs
  4. +60 −58 IronRubyMvc.Tests/Controllers/RubyControllerFactorySpec.cs
  5. +3 −1 IronRubyMvc.Tests/Controllers/RubyControllerSpec.cs
  6. +361 −377 IronRubyMvc.Tests/Core/RubyEngineSpec.cs
  7. +1 −4 IronRubyMvc.Tests/IronRubyMvcLibrary.Tests.csproj
  8. +3 −10 IronRubyMvc/System.Web.Mvc.IronRuby.csproj
  9. +0 −96 IronRubyMvcLibrarySpecs/IronRubyMvcLibrarySpecs.stproj
  10. +0 −17 IronRubyMvcLibrarySpecs/Rakefile.rb
  11. +0 −5 IronRubyMvcLibrarySpecs/bacon_helper.rb
  12. BIN  IronRubyMvcLibrarySpecs/bin/IronRuby.Libraries.dll
  13. BIN  IronRubyMvcLibrarySpecs/bin/IronRuby.Libraries.pdb
  14. BIN  IronRubyMvcLibrarySpecs/bin/IronRuby.dll
  15. BIN  IronRubyMvcLibrarySpecs/bin/IronRuby.pdb
  16. BIN  IronRubyMvcLibrarySpecs/bin/IronRubyMvcLibrary.dll
  17. BIN  IronRubyMvcLibrarySpecs/bin/IronRubyMvcLibrary.pdb
  18. BIN  IronRubyMvcLibrarySpecs/bin/Microsoft.Scripting.Core.dll
  19. BIN  IronRubyMvcLibrarySpecs/bin/Microsoft.Scripting.Core.pdb
  20. BIN  IronRubyMvcLibrarySpecs/bin/Microsoft.Scripting.ExtensionAttribute.dll
  21. BIN  IronRubyMvcLibrarySpecs/bin/Microsoft.Scripting.ExtensionAttribute.pdb
  22. BIN  IronRubyMvcLibrarySpecs/bin/Microsoft.Scripting.dll
  23. BIN  IronRubyMvcLibrarySpecs/bin/Microsoft.Scripting.pdb
  24. BIN  IronRubyMvcLibrarySpecs/bin/System.Web.Mvc.dll
  25. BIN  IronRubyMvcLibrarySpecs/bin/System.Web.Mvc.pdb
  26. +0 −3  IronRubyMvcLibrarySpecs/extensions/extensions.rb
  27. +0 −27 IronRubyMvcLibrarySpecs/extensions/ienumerable_extensions_spec.rb
  28. +0 −26 IronRubyMvcLibrarySpecs/extensions/object_extensions_spec.rb
  29. +0 −55 IronRubyMvcLibrarySpecs/extensions/string_extensions_spec.rb
  30. +0 −152 IronRubyMvcLibrarySpecs/lib/amok.rb
  31. 0  IronRubyMvcLibrarySpecs/ruby_controller_spec.rb
  32. +3 −10 IronRubyMvcWeb/IronRubyMvcWeb.csproj
  33. +0 −38 Pictures/Controllers/AlbumsController.rb
  34. +0 −57 Pictures/Controllers/ApplicationController.rb
  35. +0 −24 Pictures/Controllers/CommentsController.rb
  36. +0 −2  Pictures/Controllers/FollowsController.rb
  37. +0 −16 Pictures/Controllers/HomeController.rb
  38. +0 −37 Pictures/Controllers/PeopleController.rb
  39. +0 −69 Pictures/Controllers/PicturesController.rb
  40. +0 −71 Pictures/Controllers/ProductsController.rb
  41. +0 −19 Pictures/Controllers/SessionsController.rb
  42. +0 −12 Pictures/Controllers/TaggingsController.rb
  43. +0 −2  Pictures/Controllers/TagsController.rb
  44. +0 −3  Pictures/Default.aspx
  45. +0 −2  Pictures/Global.asax
  46. +0 −12 Pictures/Global.asax.cs
  47. +0 −21 Pictures/Models/album.rb
  48. +0 −21 Pictures/Models/base_model.rb
  49. +0 −6 Pictures/Models/comment.rb
  50. +0 −4 Pictures/Models/follow.rb
  51. +0 −5 Pictures/Models/home_model.rb
  52. +0 −237 Pictures/Models/in_memory_model.rb
  53. +0 −52 Pictures/Models/person.rb
  54. +0 −38 Pictures/Models/picture.rb
  55. +0 −7 Pictures/Models/tag.rb
  56. +0 −7 Pictures/Models/tagging.rb
  57. +0 −393 Pictures/Pictures.csproj
  58. +0 −42 Pictures/Properties/AssemblyInfo.cs
  59. +0 −10 Pictures/Rakefile
  60. +0 −15 Pictures/Routes.rb
  61. +0 −39 Pictures/Views/Helpers.rb
  62. +0 −5 Pictures/Views/Home/index.html.erb
  63. +0 −5 Pictures/Views/Login/login.html.erb
  64. +0 −82 Pictures/Views/Shared/layout.html.erb
  65. +0 −2  Pictures/Views/Shared/layout1.html.erb
  66. +0 −20 Pictures/Views/Web.config
  67. +0 −8 Pictures/Views/albums/_thumbnail_picture.html.erb
  68. +0 −7 Pictures/Views/albums/index.html.erb
  69. +0 −5 Pictures/Views/albums/new.html.erb
  70. +0 −16 Pictures/Views/albums/show.html.erb
  71. +0 −6 Pictures/Views/comments/_comment.html.erb
  72. +0 −5 Pictures/Views/comments/new.html.erb
  73. +0 −3  Pictures/Views/events/index.html.erb
  74. +0 −1  Pictures/Views/follows/index.html.erb
  75. +0 −7 Pictures/Views/people/_form.html.erb
  76. +0 −3  Pictures/Views/people/_person.html.erb
  77. +0 −5 Pictures/Views/people/edit.html.erb
  78. +0 −6 Pictures/Views/people/index.html.erb
  79. +0 −5 Pictures/Views/people/new.html.erb
  80. +0 −1  Pictures/Views/people/show.html.erb
  81. +0 −9 Pictures/Views/pictures/_cloud.html.erb
  82. +0 −38 Pictures/Views/pictures/_picture.html.erb
  83. +0 −5 Pictures/Views/pictures/_thumbnail_album.html.erb
  84. +0 −8 Pictures/Views/pictures/_thumbnail_picture.html.erb
  85. +0 −60 Pictures/Views/pictures/index.html.erb
  86. +0 −15 Pictures/Views/pictures/new.html.erb
  87. +0 −1  Pictures/Views/pictures/show.html.erb
  88. +0 −11 Pictures/Views/pictures/tagged.html.erb
  89. +0 −4 Pictures/Views/pictures/test.html.erb
  90. +0 −127 Pictures/Web.config
  91. 0  Pictures/favicon.ico
  92. BIN  Pictures/images/album.png
  93. BIN  Pictures/images/album_frame.jpg
  94. BIN  Pictures/images/banner.jpg
  95. BIN  Pictures/images/gradient.png
  96. BIN  Pictures/images/logo.png
  97. BIN  Pictures/images/rails.png
  98. BIN  Pictures/images/tab_button_bg.png
  99. BIN  Pictures/images/thumbnail_frame.jpg
  100. +0 −54 Pictures/javascripts/application.js
  101. +0 −963 Pictures/javascripts/controls.js
  102. +0 −972 Pictures/javascripts/dragdrop.js
  103. +0 −1,120 Pictures/javascripts/effects.js
  104. +0 −4,225 Pictures/javascripts/prototype.js
  105. +0 −12 Pictures/lib/activemodel/CHANGES
  106. +0 −21 Pictures/lib/activemodel/README
  107. +0 −24 Pictures/lib/activemodel/Rakefile
  108. +0 −20 Pictures/lib/activemodel/lib/active_model.rb
  109. +0 −474 Pictures/lib/activemodel/lib/active_model/associations.rb
  110. +0 −115 Pictures/lib/activemodel/lib/active_model/associations/association_collection.rb
  111. +0 −237 Pictures/lib/activemodel/lib/active_model/associations/association_proxy.rb
  112. +0 −58 Pictures/lib/activemodel/lib/active_model/associations/belongs_to_association.rb
  113. +0 −49 Pictures/lib/activemodel/lib/active_model/associations/belongs_to_polymorphic_association.rb
  114. +0 −19 Pictures/lib/activemodel/lib/active_model/associations/has_many_association.rb
  115. +0 −246 Pictures/lib/activemodel/lib/active_model/associations/has_many_through_association.rb
  116. +0 −32 Pictures/lib/activemodel/lib/active_model/associations/has_one_through_association.rb
  117. +0 −379 Pictures/lib/activemodel/lib/active_model/attribute_methods.rb
  118. +0 −553 Pictures/lib/activemodel/lib/active_model/base.rb
  119. +0 −150 Pictures/lib/activemodel/lib/active_model/callbacks.rb
  120. +0 −7 Pictures/lib/activemodel/lib/active_model/core.rb
  121. +0 −38 Pictures/lib/activemodel/lib/active_model/deprecated_error_methods.rb
  122. +0 −79 Pictures/lib/activemodel/lib/active_model/errors.rb
  123. +0 −182 Pictures/lib/activemodel/lib/active_model/named_scope.rb
  124. +0 −98 Pictures/lib/activemodel/lib/active_model/observing.rb
  125. +0 −36 Pictures/lib/activemodel/lib/active_model/persistence.rb
  126. +0 −268 Pictures/lib/activemodel/lib/active_model/reflection.rb
  127. +0 −258 Pictures/lib/activemodel/lib/active_model/schema_definitions.rb
  128. +0 −66 Pictures/lib/activemodel/lib/active_model/state_machine.rb
  129. +0 −62 Pictures/lib/activemodel/lib/active_model/state_machine/event.rb
  130. +0 −74 Pictures/lib/activemodel/lib/active_model/state_machine/machine.rb
  131. +0 −50 Pictures/lib/activemodel/lib/active_model/state_machine/state.rb
  132. +0 −40 Pictures/lib/activemodel/lib/active_model/state_machine/state_transition.rb
  133. +0 −126 Pictures/lib/activemodel/lib/active_model/validations.rb
  134. +0 −45 Pictures/lib/activemodel/lib/active_model/validations/acceptance.rb
  135. +0 −46 Pictures/lib/activemodel/lib/active_model/validations/associated.rb
  136. +0 −44 Pictures/lib/activemodel/lib/active_model/validations/confirmation.rb
  137. +0 −37 Pictures/lib/activemodel/lib/active_model/validations/exclusion.rb
  138. +0 −39 Pictures/lib/activemodel/lib/active_model/validations/format.rb
  139. +0 −37 Pictures/lib/activemodel/lib/active_model/validations/inclusion.rb
  140. +0 −95 Pictures/lib/activemodel/lib/active_model/validations/length.rb
  141. +0 −80 Pictures/lib/activemodel/lib/active_model/validations/numericality.rb
  142. +0 −42 Pictures/lib/activemodel/lib/active_model/validations/presence.rb
  143. +0 −104 Pictures/lib/activemodel/lib/active_model/validations/uniqueness.rb
  144. +0 −91 Pictures/lib/activemodel/test/associations_test.rb
  145. +0 −22 Pictures/lib/activemodel/test/attribute_methods_test.rb
  146. +0 −103 Pictures/lib/activemodel/test/callbacks_test.rb
  147. +0 −123 Pictures/lib/activemodel/test/observing_test.rb
  148. +0 −51 Pictures/lib/activemodel/test/state_machine/event_test.rb
  149. +0 −43 Pictures/lib/activemodel/test/state_machine/machine_test.rb
  150. +0 −74 Pictures/lib/activemodel/test/state_machine/state_test.rb
  151. +0 −88 Pictures/lib/activemodel/test/state_machine/state_transition_test.rb
  152. +0 −324 Pictures/lib/activemodel/test/state_machine_test.rb
  153. +0 −56 Pictures/lib/activemodel/test/test_helper.rb
  154. +0 −6 Pictures/lib/activemodel/test/validations_test.rb
  155. +0 −5,753 Pictures/lib/activerecord/CHANGELOG
  156. +0 −351 Pictures/lib/activerecord/README
  157. +0 −36 Pictures/lib/activerecord/RUNNING_UNIT_TESTS
  158. +0 −248 Pictures/lib/activerecord/Rakefile
  159. BIN  Pictures/lib/activerecord/examples/associations.png
  160. +0 −30 Pictures/lib/activerecord/install.rb
  161. +0 −80 Pictures/lib/activerecord/lib/active_record.rb
  162. +0 −189 Pictures/lib/activerecord/lib/active_record/aggregations.rb
  163. +0 −282 Pictures/lib/activerecord/lib/active_record/association_preload.rb
  164. +0 −2,012 Pictures/lib/activerecord/lib/active_record/associations.rb
  165. +0 −368 Pictures/lib/activerecord/lib/active_record/associations/association_collection.rb
  166. +0 −220 Pictures/lib/activerecord/lib/active_record/associations/association_proxy.rb
  167. +0 −58 Pictures/lib/activerecord/lib/active_record/associations/belongs_to_association.rb
  168. +0 −49 Pictures/lib/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb
  169. +0 −111 Pictures/lib/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
  170. +0 −121 Pictures/lib/activerecord/lib/active_record/associations/has_many_association.rb
  171. +0 −254 Pictures/lib/activerecord/lib/active_record/associations/has_many_through_association.rb
  172. +0 −98 Pictures/lib/activerecord/lib/active_record/associations/has_one_association.rb
  173. +0 −32 Pictures/lib/activerecord/lib/active_record/associations/has_one_through_association.rb
  174. +0 −379 Pictures/lib/activerecord/lib/active_record/attribute_methods.rb
  175. +0 −2,744 Pictures/lib/activerecord/lib/active_record/base.rb
  176. +0 −288 Pictures/lib/activerecord/lib/active_record/calculations.rb
  177. +0 −312 Pictures/lib/activerecord/lib/active_record/callbacks.rb
  178. +0 −309 Pictures/lib/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
  179. +0 −176 Pictures/lib/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
  180. +0 −93 Pictures/lib/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
  181. +0 −69 Pictures/lib/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
  182. +0 −664 Pictures/lib/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
  183. +0 −428 Pictures/lib/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
  184. +0 −169 Pictures/lib/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
  185. +0 −559 Pictures/lib/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
  186. +0 −994 Pictures/lib/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
  187. +0 −34 Pictures/lib/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
  188. +0 −418 Pictures/lib/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
  189. +0 −165 Pictures/lib/activerecord/lib/active_record/dirty.rb
  190. +0 −997 Pictures/lib/activerecord/lib/active_record/fixtures.rb
  191. +0 −148 Pictures/lib/activerecord/lib/active_record/locking/optimistic.rb
  192. +0 −77 Pictures/lib/activerecord/lib/active_record/locking/pessimistic.rb
  193. +0 −523 Pictures/lib/activerecord/lib/active_record/migration.rb
  194. +0 −168 Pictures/lib/activerecord/lib/active_record/named_scope.rb
  195. +0 −197 Pictures/lib/activerecord/lib/active_record/observer.rb
  196. +0 −21 Pictures/lib/activerecord/lib/active_record/query_cache.rb
  197. +0 −239 Pictures/lib/activerecord/lib/active_record/reflection.rb
  198. +0 −51 Pictures/lib/activerecord/lib/active_record/schema.rb
  199. +0 −171 Pictures/lib/activerecord/lib/active_record/schema_dumper.rb
  200. +0 −98 Pictures/lib/activerecord/lib/active_record/serialization.rb
  201. +0 −80 Pictures/lib/activerecord/lib/active_record/serializers/json_serializer.rb
  202. +0 −338 Pictures/lib/activerecord/lib/active_record/serializers/xml_serializer.rb
  203. +0 −47 Pictures/lib/activerecord/lib/active_record/test_case.rb
  204. +0 −41 Pictures/lib/activerecord/lib/active_record/timestamp.rb
  205. +0 −130 Pictures/lib/activerecord/lib/active_record/transactions.rb
  206. +0 −971 Pictures/lib/activerecord/lib/active_record/validations.rb
  207. +0 −1,214 Pictures/lib/activerecord/lib/active_record/vendor/mysql.rb
  208. +0 −9 Pictures/lib/activerecord/lib/active_record/version.rb
  209. +0 −1  Pictures/lib/activerecord/lib/activerecord.rb
  210. +0 −1  Pictures/lib/activerecord/test/assets/example.log
  211. BIN  Pictures/lib/activerecord/test/assets/flowers.jpg
  212. +0 −24 Pictures/lib/activerecord/test/cases/aaa_create_tables_test.rb
  213. +0 −95 Pictures/lib/activerecord/test/cases/active_schema_test_mysql.rb
  214. +0 −24 Pictures/lib/activerecord/test/cases/active_schema_test_postgresql.rb
  215. +0 −127 Pictures/lib/activerecord/test/cases/adapter_test.rb
  216. +0 −95 Pictures/lib/activerecord/test/cases/adapter_test_sqlserver.rb
  217. +0 −128 Pictures/lib/activerecord/test/cases/aggregations_test.rb
  218. +0 −33 Pictures/lib/activerecord/test/cases/ar_schema_test.rb
  219. +0 −431 Pictures/lib/activerecord/test/cases/associations/belongs_to_associations_test.rb
  220. +0 −161 Pictures/lib/activerecord/test/cases/associations/callbacks_test.rb
  221. +0 −123 Pictures/lib/activerecord/test/cases/associations/cascaded_eager_loading_test.rb
  222. +0 −36 Pictures/lib/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb
  223. +0 −83 Pictures/lib/activerecord/test/cases/associations/eager_load_nested_include_test.rb
  224. +0 −145 Pictures/lib/activerecord/test/cases/associations/eager_singularization_test.rb
  225. +0 −636 Pictures/lib/activerecord/test/cases/associations/eager_test.rb
  226. +0 −47 Pictures/lib/activerecord/test/cases/associations/extension_test.rb
  227. +0 −706 Pictures/lib/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
Sorry, we could not display the entire diff because too many files (874) changed.
View
6 IronRubyMvc.Tests/Controllers/RubyActionDescriptorFixture.cs
@@ -87,8 +87,10 @@ protected override void EstablishContext()
var rubyClass = _rubyEngine.GetRubyClass("SamuraisController");
var httpContext = new HttpContextMock().Object;
var requestContext = new RequestContext(httpContext, new RouteData());
- var controller = _rubyEngine.ConfigureController(_rubyEngine.GetRubyClass("SamuraisController"),
- requestContext);
+
+ var controller = _rubyEngine.CreateInstance<RubyController>(rubyClass);
+ controller.InternalInitialize(new ControllerConfiguration { Context = requestContext, Engine = _rubyEngine, RubyClass = rubyClass });
+
_controllerContext = new ControllerContext(requestContext, controller);
_controllerDescriptor = new RubyControllerDescriptor(rubyClass, _rubyEngine);
View
5 IronRubyMvc.Tests/Controllers/RubyControllerActionInvokerSpec.cs
@@ -66,8 +66,9 @@ protected override void EstablishContext()
var httpContext = new HttpContextMock().Object;
var requestContext = new RequestContext(httpContext, new RouteData());
- var controller = _rubyEngine.ConfigureController(rubyClass,
- requestContext);
+ var controller = _rubyEngine.CreateInstance<RubyController>(rubyClass);
+ controller.InternalInitialize(new ControllerConfiguration { Context = requestContext, Engine = _rubyEngine, RubyClass = rubyClass });
+
_controllerContext = new ControllerContext(requestContext, controller);
}
View
10 IronRubyMvc.Tests/Controllers/RubyControllerDescriptorSpec.cs
@@ -35,8 +35,9 @@ protected override void EstablishContext()
var httpContext = new HttpContextMock().Object;
var requestContext = new RequestContext(httpContext, new RouteData());
- var controller = _rubyEngine.ConfigureController(_rubyEngine.GetRubyClass(_controllerName),
- requestContext);
+ var controller = _rubyEngine.CreateInstance<RubyController>(_rubyClass);
+ controller.InternalInitialize(new ControllerConfiguration {Context = requestContext, Engine = _rubyEngine, RubyClass = _rubyClass});
+
_controllerContext = new ControllerContext(requestContext, controller);
}
@@ -87,8 +88,9 @@ protected override void EstablishContext()
var httpContext = new HttpContextMock().Object;
var requestContext = new RequestContext(httpContext, new RouteData());
- var controller = _rubyEngine.ConfigureController(_rubyEngine.GetRubyClass(_controllerName),
- requestContext);
+ var controller = _rubyEngine.CreateInstance<RubyController>(_rubyClass);
+ controller.InternalInitialize(new ControllerConfiguration { Context = requestContext, Engine = _rubyEngine, RubyClass = _rubyClass });
+
_controllerContext = new ControllerContext(requestContext, controller);
}
View
118 IronRubyMvc.Tests/Controllers/RubyControllerFactorySpec.cs
@@ -11,63 +11,63 @@
namespace System.Web.Mvc.IronRuby.Tests.Controllers
{
- [Concern(typeof (RubyControllerFactory))]
- public class when_a_ruby_controller_needs_to_be_resolved : InstanceContextSpecification<RubyControllerFactory>
- {
- private IRubyEngine _rubyEngine;
- private IControllerFactory _controllerFactory;
- private RequestContext _requestContext;
- private const string _controllerName = "my_controller";
- private IController _controller;
-
- protected override void EstablishContext()
- {
- _rubyEngine = Dependency<IRubyEngine>();
- _controllerFactory = Dependency<IControllerFactory>();
- _requestContext = new RequestContext(new HttpContextMock().Object, new RouteData());
-
- _controllerFactory
- .WhenToldTo(factory => factory.CreateController(_requestContext, _controllerName))
- .Throw(new InvalidOperationException());
-
- _rubyEngine.WhenToldTo(eng => eng.LoadController(_requestContext, _controllerName)).Return(Dependency<RubyController>());
-
- }
-
- protected override RubyControllerFactory CreateSut()
- {
- return new RubyControllerFactory(_controllerFactory, _rubyEngine);
- }
-
- protected override void Because()
- {
- _controller = Sut.CreateController(_requestContext, _controllerName);
- }
-
- [Observation]
- public void should_have_returned_a_result()
- {
- _controller.ShouldNotBeNull();
- }
-
- [Observation]
- public void should_have_returned_a_controller()
- {
- _controller.ShouldBeAnInstanceOf<IController>();
- }
-
- [Observation]
- public void it_should_have_called_the_ruby_engine()
- {
- _rubyEngine.WasToldTo(eng => eng.LoadController(_requestContext, _controllerName)).OnlyOnce();
- }
-
- [Observation]
- public void should_have_called_the_inner_controller_factory()
- {
- _controllerFactory.WasToldTo(factory => factory.CreateController(_requestContext, _controllerName)).OnlyOnce();
- }
- }
+// [Concern(typeof (RubyControllerFactory))]
+// public class when_a_ruby_controller_needs_to_be_resolved : InstanceContextSpecification<RubyControllerFactory>
+// {
+// private IRubyEngine _rubyEngine;
+// private IControllerFactory _controllerFactory;
+// private RequestContext _requestContext;
+// private const string _controllerName = "my_controller";
+// private IController _controller;
+//
+// protected override void EstablishContext()
+// {
+// _rubyEngine = Dependency<IRubyEngine>();
+// _controllerFactory = Dependency<IControllerFactory>();
+// _requestContext = new RequestContext(new HttpContextMock().Object, new RouteData());
+//
+// _controllerFactory
+// .WhenToldTo(factory => factory.CreateController(_requestContext, _controllerName))
+// .Throw(new InvalidOperationException());
+//
+// _rubyEngine.WhenToldTo(eng => eng.LoadController(_requestContext, _controllerName)).Return(Dependency<RubyController>());
+//
+// }
+//
+// protected override RubyControllerFactory CreateSut()
+// {
+// return new RubyControllerFactory(_controllerFactory, _rubyEngine);
+// }
+//
+// protected override void Because()
+// {
+// _controller = Sut.CreateController(_requestContext, _controllerName);
+// }
+//
+// [Observation]
+// public void should_have_returned_a_result()
+// {
+// _controller.ShouldNotBeNull();
+// }
+//
+// [Observation]
+// public void should_have_returned_a_controller()
+// {
+// _controller.ShouldBeAnInstanceOf<IController>();
+// }
+//
+// [Observation]
+// public void it_should_have_called_the_ruby_engine()
+// {
+// _rubyEngine.WasToldTo(eng => eng.LoadController(_requestContext, _controllerName)).OnlyOnce();
+// }
+//
+// [Observation]
+// public void should_have_called_the_inner_controller_factory()
+// {
+// _controllerFactory.WasToldTo(factory => factory.CreateController(_requestContext, _controllerName)).OnlyOnce();
+// }
+// }
[Concern(typeof(RubyControllerFactory))]
public class when_a_ruby_controller_needs_to_be_disposed: InstanceContextSpecification<RubyControllerFactory>
@@ -75,18 +75,20 @@ public class when_a_ruby_controller_needs_to_be_disposed: InstanceContextSpecifi
private IRubyEngine _rubyEngine;
private IControllerFactory _controllerFactory;
private IController _controller;
+ private IPathProvider _pathProvider;
protected override void EstablishContext()
{
_rubyEngine = Dependency<IRubyEngine>();
_controllerFactory = Dependency<IControllerFactory>();
+ _pathProvider = Dependency<IPathProvider>();
_controller = Dependency<RubyController>();
}
protected override RubyControllerFactory CreateSut()
{
- return new RubyControllerFactory(_controllerFactory, _rubyEngine);
+ return new RubyControllerFactory(_pathProvider, _controllerFactory, _rubyEngine);
}
protected override void Because()
View
4 IronRubyMvc.Tests/Controllers/RubyControllerSpec.cs
@@ -55,7 +55,9 @@ protected override void EstablishContext()
protected override RubyController CreateSut()
{
- var controller = _rubyEngine.ConfigureController(_rubyClass, _requestContext);
+ var controller = _rubyEngine.CreateInstance<RubyController>(_rubyClass);
+ controller.InternalInitialize(new ControllerConfiguration { Context = _requestContext, Engine = _rubyEngine, RubyClass = _rubyClass });
+
controller.ViewData().Add("test","testing");
// .ViewData.Add("test", "my value");
return controller;
View
738 IronRubyMvc.Tests/Core/RubyEngineSpec.cs
@@ -22,23 +22,7 @@
namespace System.Web.Mvc.IronRuby.Tests.Core
{
- [Concern(typeof (RubyEngine))]
- public class when_asked_for_controller_class_name : StaticContextSpecification
- {
- private string _controllerName;
-
-
- protected override void Because()
- {
- _controllerName = RubyEngine.GetControllerClassName("Ninjas");
- }
-
- [Observation]
- public void it_should_be_the_correct_class_name()
- {
- _controllerName.ShouldBeEqualTo("NinjasController");
- }
- }
+
[Concern(typeof(RubyEngine))]
public class when_asked_to_initialize_ironruby_mvc_with_existing_routes_file : StaticContextSpecification
@@ -64,13 +48,13 @@ protected override void Because()
[Observation]
public void it_should_have_a_global_routes_variable()
{
- _engine.Context.GetGlobalVariable("routes").ShouldNotBeNull();
+ _engine.GetGlobalVariable<object>("routes").ShouldNotBeNull();
}
[Observation]
public void routes_should_be_a_ruby_route_collection()
{
- _engine.Context.GetGlobalVariable("routes").ShouldBeAnInstanceOf<RubyRoutes>();
+ _engine.GetGlobalVariable<object>("routes").ShouldBeAnInstanceOf<RubyRoutes>();
}
[Observation]
@@ -114,7 +98,7 @@ protected override void Because()
[Observation]
public void it_should_not_have_a_global_routes_variable()
{
- _engine.Context.GetGlobalVariable("routes").ShouldBeNull();
+ _engine.GetGlobalVariable<object>("routes").ShouldBeNull();
}
@@ -184,361 +168,361 @@ public void it_should_be_able_to_get_the_ruby_class()
}
}
- [Concern(typeof (RubyEngine))]
- public class when_asked_to_configure_a_controller : with_an_engine_initialized
- {
- private IController _controller;
- private RequestContext _requestContext;
-
- protected override void EstablishContext()
- {
- base.EstablishContext();
-
- _requestContext = new RequestContext(new Mock<HttpContextBase>().Object, new RouteData());
- }
-
- protected override void Because()
- {
- AddController("MyTest");
- _controller = Sut.ConfigureController(Sut.GetRubyClass("MyTestController"), _requestContext);
- }
-
- [Observation]
- public void it_should_have_a_controller_instance()
- {
- _controller.ShouldNotBeNull();
- }
-
- [Observation]
- public void it_should_be_a_ruby_controller()
- {
- _controller.ShouldBeAnInstanceOf<RubyController>();
- }
-
- [Observation]
- public void it_should_have_the_correct_name()
- {
- ((RubyController) _controller).ControllerName.ShouldBeEqualTo("MyTest");
- }
-
- [Observation]
- public void should_have_the_correct_class_name()
- {
- ((RubyController) _controller).ControllerClassName.ShouldBeEqualTo("MyTestController");
- }
-
- private void AddController(string controllerName)
- {
- var script =
- "class {0}Controller < Controller; def my_action; $counter = $counter + 1; end; end;".FormattedWith(
- controllerName);
- Sut.ExecuteScript(script);
- }
- }
-
- [Concern(typeof (RubyEngine))]
- public class when_asked_to_call_a_method : with_an_engine_initialized
- {
- private RubyController _controller;
- private RequestContext _requestContext;
- private string _result;
-
- protected override void EstablishContext()
- {
- base.EstablishContext();
- _requestContext = new RequestContext(new Mock<HttpContextBase>().Object, new RouteData());
- }
-
- protected override void Because()
- {
- AddController("MyTesting");
- _controller = Sut.ConfigureController(Sut.GetRubyClass("MyTestingController"), _requestContext);
- _result = Sut.CallMethod(_controller, "my_action").ToString();
- }
-
- [Observation]
- public void it_should_get_the_correct_result()
- {
- _result.ShouldBeEqualTo("Can't see ninjas");
- }
-
- [Observation]
- public void should_have_the_correct_count()
- {
- _context.GetGlobalVariable("counter").ShouldBeEqualTo(12);
- }
-
- private void AddController(string controllerName)
- {
- var script = new StringBuilder();
- script.AppendLine("class {0}Controller < Controller".FormattedWith(controllerName));
- script.AppendLine(" def my_action");
- script.AppendLine(" $counter = $counter + 5");
- script.AppendLine(" \"Can't see ninjas\".to_clr_string");
- script.AppendLine(" end");
- script.AppendLine("end");
-
- _context.DefineGlobalVariable("counter", 7);
-
- Sut.ExecuteScript(script.ToString());
- }
- }
-
- [Concern(typeof (RubyEngine))]
- public class when_asked_if_a_underscored_controller_action_exists : with_an_engine_initialized
- {
- private RubyController _controller;
- private RequestContext _requestContext;
-
- protected override void EstablishContext()
- {
- base.EstablishContext();
- _requestContext = new RequestContext(new Mock<HttpContextBase>().Object, new RouteData());
- }
-
- protected override void Because()
- {
- AddController("MyTesting");
- _controller = Sut.ConfigureController(Sut.GetRubyClass("MyTestingController"), _requestContext);
- }
-
- [Observation]
- public void it_should_return_true_for_existing_underscored_message()
- {
- Sut.HasControllerAction(_controller, "my_action").ShouldBeTrue();
- }
-
- [Observation]
- public void it_should_return_false_for_non_existing_underscored_message()
- {
- Sut.HasControllerAction(_controller, "some_action").ShouldBeFalse();
- }
-
- [Observation]
- public void it_should_return_true_for_existing_pascal_cased_message()
- {
- Sut.HasControllerAction(_controller, "MyAction").ShouldBeTrue();
- }
-
- [Observation]
- public void it_should_return_false_for_non_existing_pascal_cased_message()
- {
- Sut.HasControllerAction(_controller, "SomeAction").ShouldBeFalse();
- }
-
- private void AddController(string controllerName)
- {
- var script = new StringBuilder();
- script.AppendLine("class {0}Controller < Controller".FormattedWith(controllerName));
- script.AppendLine(" def my_action");
- script.AppendLine(" $counter = $counter + 5");
- script.AppendLine(" \"Can't see ninjas\".to_clr_string");
- script.AppendLine(" end");
- script.AppendLine("end");
-
- _context.DefineGlobalVariable("counter", 7);
-
- Sut.ExecuteScript(script.ToString());
- }
- }
-
- [Concern(typeof (RubyEngine))]
- public class when_asked_if_a_pascal_cased_controller_action_exists : with_an_engine_initialized
- {
- private RubyController _controller;
- private RequestContext _requestContext;
-
- protected override void EstablishContext()
- {
- base.EstablishContext();
- _requestContext = new RequestContext(new Mock<HttpContextBase>().Object, new RouteData());
- }
-
- protected override void Because()
- {
- AddController("MyTesting");
- _controller = Sut.ConfigureController(Sut.GetRubyClass("MyTestingController"), _requestContext);
- }
-
- [Observation]
- public void it_should_return_true_for_existing_underscored_message()
- {
- Sut.HasControllerAction(_controller, "internal_initialize").ShouldBeTrue();
- }
-
- [Observation]
- public void it_should_return_false_for_non_existing_underscored_message()
- {
- Sut.HasControllerAction(_controller, "internal_initialize2").ShouldBeFalse();
- }
-
- [Observation]
- public void it_should_return_true_for_existing_pascal_cased_message()
- {
- Sut.HasControllerAction(_controller, "InternalInitialize").ShouldBeTrue();
- }
-
- [Observation]
- public void it_should_return_false_for_non_existing_pascal_cased_message()
- {
- Sut.HasControllerAction(_controller, "InternalInitialize2").ShouldBeFalse();
- }
-
- private void AddController(string controllerName)
- {
- var script = new StringBuilder();
- script.AppendLine("class {0}Controller < Controller".FormattedWith(controllerName));
- script.AppendLine(" def my_action");
- script.AppendLine(" $counter = $counter + 5");
- script.AppendLine(" \"Can't see ninjas\".to_clr_string");
- script.AppendLine(" end");
- script.AppendLine("end");
-
- _context.DefineGlobalVariable("counter", 7);
-
- Sut.ExecuteScript(script.ToString());
- }
- }
-
- [Concern(typeof (RubyEngine))]
- public class when_asked_to_load_a_controller_with_pascal_cased_name : with_an_engine_initialized
- {
- private RubyController _controller;
- private RequestContext _requestContext;
-
- protected override void EstablishContext()
- {
- base.EstablishContext();
-
- var script = new StringBuilder();
- script.AppendLine("class ATestController < Controller");
- script.AppendLine(" def my_action");
- script.AppendLine(" $counter = $counter + 5");
- script.AppendLine(" \"Can't see ninjas\".to_clr_string");
- script.AppendLine(" end");
- script.AppendLine("end");
-
- var filePath = "~\\Controllers\\ATestController.rb";
-
- _pathProvider.WhenToldTo(pp => pp.FileExists(filePath)).Return(true);
- _pathProvider.WhenToldTo(pp => pp.Open(filePath)).Return(new MemoryStream(Encoding.UTF8.GetBytes(script.ToString())));
-
- _requestContext = new RequestContext(Dependency<HttpContextBase>(), new RouteData());
- }
-
- protected override void Because()
- {
- _controller = Sut.LoadController(_requestContext, "ATest");
- }
-
- [Observation]
- public void it_should_have_a_controller_instance()
- {
- _controller.ShouldNotBeNull();
- }
-
- [Observation]
- public void it_should_be_a_ruby_controller()
- {
- _controller.ShouldBeAnInstanceOf<RubyController>();
- }
-
- [Observation]
- public void it_should_have_the_correct_name()
- {
- _controller.ControllerName.ShouldBeEqualTo("ATest");
- }
-
- [Observation]
- public void should_have_the_correct_class_name()
- {
- _controller.ControllerClassName.ShouldBeEqualTo("ATestController");
- }
- }
-
- [Concern(typeof(RubyEngine))]
- public class when_asked_to_load_a_non_existing_controller : with_an_engine_initialized
- {
- private RubyController _controller;
- private RequestContext _requestContext;
-
- protected override void EstablishContext()
- {
- base.EstablishContext();
-
- _pathProvider.WhenToldTo(pp => pp.FileExists(null)).IgnoreArguments().Return(false);
-
- _requestContext = new RequestContext(Dependency<HttpContextBase>(), new RouteData());
- }
-
- protected override void Because()
- {
- _controller = Sut.LoadController(_requestContext, "ATestd");
- }
-
- [Observation]
- public void it_should_not_have_a_controller_instance()
- {
- _controller.ShouldBeNull();
- }
-
-
- }
-
-
- [Concern(typeof(RubyEngine))]
- public class when_asked_to_load_a_controller_with_underscored_name : with_an_engine_initialized
- {
- private RubyController _controller;
- private RequestContext _requestContext;
-
- protected override void EstablishContext()
- {
- base.EstablishContext();
-
- var script = new StringBuilder();
- script.AppendLine("class ATestController < Controller");
- script.AppendLine(" def my_action");
- script.AppendLine(" $counter = $counter + 5");
- script.AppendLine(" \"Can't see ninjas\".to_clr_string");
- script.AppendLine(" end");
- script.AppendLine("end");
-
- var filePath = "~\\Controllers\\a_test_controller.rb";
-
- _pathProvider.WhenToldTo(pp => pp.FileExists(filePath)).Return(true);
- _pathProvider.WhenToldTo(pp => pp.Open(filePath)).Return(new MemoryStream(Encoding.UTF8.GetBytes(script.ToString())));
-
- _requestContext = new RequestContext(Dependency<HttpContextBase>(), new RouteData());
- }
-
- protected override void Because()
- {
- _controller = Sut.LoadController(_requestContext, "ATest");
- }
-
- [Observation]
- public void it_should_have_a_controller_instance()
- {
- _controller.ShouldNotBeNull();
- }
-
- [Observation]
- public void it_should_be_a_ruby_controller()
- {
- _controller.ShouldBeAnInstanceOf<RubyController>();
- }
-
- [Observation]
- public void it_should_have_the_correct_name()
- {
- _controller.ControllerName.ShouldBeEqualTo("ATest");
- }
-
- [Observation]
- public void should_have_the_correct_class_name()
- {
- _controller.ControllerClassName.ShouldBeEqualTo("ATestController");
- }
- }
+// [Concern(typeof (RubyEngine))]
+// public class when_asked_to_configure_a_controller : with_an_engine_initialized
+// {
+// private IController _controller;
+// private RequestContext _requestContext;
+//
+// protected override void EstablishContext()
+// {
+// base.EstablishContext();
+//
+// _requestContext = new RequestContext(new Mock<HttpContextBase>().Object, new RouteData());
+// }
+//
+// protected override void Because()
+// {
+// AddController("MyTest");
+// _controller = Sut.ConfigureController(Sut.GetRubyClass("MyTestController"), _requestContext);
+// }
+//
+// [Observation]
+// public void it_should_have_a_controller_instance()
+// {
+// _controller.ShouldNotBeNull();
+// }
+//
+// [Observation]
+// public void it_should_be_a_ruby_controller()
+// {
+// _controller.ShouldBeAnInstanceOf<RubyController>();
+// }
+//
+// [Observation]
+// public void it_should_have_the_correct_name()
+// {
+// ((RubyController) _controller).ControllerName.ShouldBeEqualTo("MyTest");
+// }
+//
+// [Observation]
+// public void should_have_the_correct_class_name()
+// {
+// ((RubyController) _controller).ControllerClassName.ShouldBeEqualTo("MyTestController");
+// }
+//
+// private void AddController(string controllerName)
+// {
+// var script =
+// "class {0}Controller < Controller; def my_action; $counter = $counter + 1; end; end;".FormattedWith(
+// controllerName);
+// Sut.ExecuteScript(script);
+// }
+// }
+
+// [Concern(typeof (RubyEngine))]
+// public class when_asked_to_call_a_method : with_an_engine_initialized
+// {
+// private RubyController _controller;
+// private RequestContext _requestContext;
+// private string _result;
+//
+// protected override void EstablishContext()
+// {
+// base.EstablishContext();
+// _requestContext = new RequestContext(new Mock<HttpContextBase>().Object, new RouteData());
+// }
+//
+// protected override void Because()
+// {
+// AddController("MyTesting");
+// _controller = Sut.ConfigureController(Sut.GetRubyClass("MyTestingController"), _requestContext);
+// _result = Sut.CallMethod(_controller, "my_action").ToString();
+// }
+//
+// [Observation]
+// public void it_should_get_the_correct_result()
+// {
+// _result.ShouldBeEqualTo("Can't see ninjas");
+// }
+//
+// [Observation]
+// public void should_have_the_correct_count()
+// {
+// _context.GetGlobalVariable("counter").ShouldBeEqualTo(12);
+// }
+//
+// private void AddController(string controllerName)
+// {
+// var script = new StringBuilder();
+// script.AppendLine("class {0}Controller < Controller".FormattedWith(controllerName));
+// script.AppendLine(" def my_action");
+// script.AppendLine(" $counter = $counter + 5");
+// script.AppendLine(" \"Can't see ninjas\".to_clr_string");
+// script.AppendLine(" end");
+// script.AppendLine("end");
+//
+// _context.DefineGlobalVariable("counter", 7);
+//
+// Sut.ExecuteScript(script.ToString());
+// }
+// }
+
+// [Concern(typeof (RubyEngine))]
+// public class when_asked_if_a_underscored_controller_action_exists : with_an_engine_initialized
+// {
+// private RubyController _controller;
+// private RequestContext _requestContext;
+//
+// protected override void EstablishContext()
+// {
+// base.EstablishContext();
+// _requestContext = new RequestContext(new Mock<HttpContextBase>().Object, new RouteData());
+// }
+//
+// protected override void Because()
+// {
+// AddController("MyTesting");
+// _controller = Sut.ConfigureController(Sut.GetRubyClass("MyTestingController"), _requestContext);
+// }
+//
+// [Observation]
+// public void it_should_return_true_for_existing_underscored_message()
+// {
+// Sut.HasControllerAction(_controller, "my_action").ShouldBeTrue();
+// }
+//
+// [Observation]
+// public void it_should_return_false_for_non_existing_underscored_message()
+// {
+// Sut.HasControllerAction(_controller, "some_action").ShouldBeFalse();
+// }
+//
+// [Observation]
+// public void it_should_return_true_for_existing_pascal_cased_message()
+// {
+// Sut.HasControllerAction(_controller, "MyAction").ShouldBeTrue();
+// }
+//
+// [Observation]
+// public void it_should_return_false_for_non_existing_pascal_cased_message()
+// {
+// Sut.HasControllerAction(_controller, "SomeAction").ShouldBeFalse();
+// }
+//
+// private void AddController(string controllerName)
+// {
+// var script = new StringBuilder();
+// script.AppendLine("class {0}Controller < Controller".FormattedWith(controllerName));
+// script.AppendLine(" def my_action");
+// script.AppendLine(" $counter = $counter + 5");
+// script.AppendLine(" \"Can't see ninjas\".to_clr_string");
+// script.AppendLine(" end");
+// script.AppendLine("end");
+//
+// _context.DefineGlobalVariable("counter", 7);
+//
+// Sut.ExecuteScript(script.ToString());
+// }
+// }
+
+// [Concern(typeof (RubyEngine))]
+// public class when_asked_if_a_pascal_cased_controller_action_exists : with_an_engine_initialized
+// {
+// private RubyController _controller;
+// private RequestContext _requestContext;
+//
+// protected override void EstablishContext()
+// {
+// base.EstablishContext();
+// _requestContext = new RequestContext(new Mock<HttpContextBase>().Object, new RouteData());
+// }
+//
+// protected override void Because()
+// {
+// AddController("MyTesting");
+// _controller = Sut.ConfigureController(Sut.GetRubyClass("MyTestingController"), _requestContext);
+// }
+//
+// [Observation]
+// public void it_should_return_true_for_existing_underscored_message()
+// {
+// Sut.HasControllerAction(_controller, "internal_initialize").ShouldBeTrue();
+// }
+//
+// [Observation]
+// public void it_should_return_false_for_non_existing_underscored_message()
+// {
+// Sut.HasControllerAction(_controller, "internal_initialize2").ShouldBeFalse();
+// }
+//
+// [Observation]
+// public void it_should_return_true_for_existing_pascal_cased_message()
+// {
+// Sut.HasControllerAction(_controller, "InternalInitialize").ShouldBeTrue();
+// }
+//
+// [Observation]
+// public void it_should_return_false_for_non_existing_pascal_cased_message()
+// {
+// Sut.HasControllerAction(_controller, "InternalInitialize2").ShouldBeFalse();
+// }
+//
+// private void AddController(string controllerName)
+// {
+// var script = new StringBuilder();
+// script.AppendLine("class {0}Controller < Controller".FormattedWith(controllerName));
+// script.AppendLine(" def my_action");
+// script.AppendLine(" $counter = $counter + 5");
+// script.AppendLine(" \"Can't see ninjas\".to_clr_string");
+// script.AppendLine(" end");
+// script.AppendLine("end");
+//
+// _context.DefineGlobalVariable("counter", 7);
+//
+// Sut.ExecuteScript(script.ToString());
+// }
+// }
+//
+// [Concern(typeof (RubyEngine))]
+// public class when_asked_to_load_a_controller_with_pascal_cased_name : with_an_engine_initialized
+// {
+// private RubyController _controller;
+// private RequestContext _requestContext;
+//
+// protected override void EstablishContext()
+// {
+// base.EstablishContext();
+//
+// var script = new StringBuilder();
+// script.AppendLine("class ATestController < Controller");
+// script.AppendLine(" def my_action");
+// script.AppendLine(" $counter = $counter + 5");
+// script.AppendLine(" \"Can't see ninjas\".to_clr_string");
+// script.AppendLine(" end");
+// script.AppendLine("end");
+//
+// var filePath = "~\\Controllers\\ATestController.rb";
+//
+// _pathProvider.WhenToldTo(pp => pp.FileExists(filePath)).Return(true);
+// _pathProvider.WhenToldTo(pp => pp.Open(filePath)).Return(new MemoryStream(Encoding.UTF8.GetBytes(script.ToString())));
+//
+// _requestContext = new RequestContext(Dependency<HttpContextBase>(), new RouteData());
+// }
+//
+// protected override void Because()
+// {
+// _controller = Sut.LoadController(_requestContext, "ATest");
+// }
+//
+// [Observation]
+// public void it_should_have_a_controller_instance()
+// {
+// _controller.ShouldNotBeNull();
+// }
+//
+// [Observation]
+// public void it_should_be_a_ruby_controller()
+// {
+// _controller.ShouldBeAnInstanceOf<RubyController>();
+// }
+//
+// [Observation]
+// public void it_should_have_the_correct_name()
+// {
+// _controller.ControllerName.ShouldBeEqualTo("ATest");
+// }
+//
+// [Observation]
+// public void should_have_the_correct_class_name()
+// {
+// _controller.ControllerClassName.ShouldBeEqualTo("ATestController");
+// }
+// }
+//
+// [Concern(typeof(RubyEngine))]
+// public class when_asked_to_load_a_non_existing_controller : with_an_engine_initialized
+// {
+// private RubyController _controller;
+// private RequestContext _requestContext;
+//
+// protected override void EstablishContext()
+// {
+// base.EstablishContext();
+//
+// _pathProvider.WhenToldTo(pp => pp.FileExists(null)).IgnoreArguments().Return(false);
+//
+// _requestContext = new RequestContext(Dependency<HttpContextBase>(), new RouteData());
+// }
+//
+// protected override void Because()
+// {
+// _controller = Sut.LoadController(_requestContext, "ATestd");
+// }
+//
+// [Observation]
+// public void it_should_not_have_a_controller_instance()
+// {
+// _controller.ShouldBeNull();
+// }
+//
+//
+// }
+//
+//
+// [Concern(typeof(RubyEngine))]
+// public class when_asked_to_load_a_controller_with_underscored_name : with_an_engine_initialized
+// {
+// private RubyController _controller;
+// private RequestContext _requestContext;
+//
+// protected override void EstablishContext()
+// {
+// base.EstablishContext();
+//
+// var script = new StringBuilder();
+// script.AppendLine("class ATestController < Controller");
+// script.AppendLine(" def my_action");
+// script.AppendLine(" $counter = $counter + 5");
+// script.AppendLine(" \"Can't see ninjas\".to_clr_string");
+// script.AppendLine(" end");
+// script.AppendLine("end");
+//
+// var filePath = "~\\Controllers\\a_test_controller.rb";
+//
+// _pathProvider.WhenToldTo(pp => pp.FileExists(filePath)).Return(true);
+// _pathProvider.WhenToldTo(pp => pp.Open(filePath)).Return(new MemoryStream(Encoding.UTF8.GetBytes(script.ToString())));
+//
+// _requestContext = new RequestContext(Dependency<HttpContextBase>(), new RouteData());
+// }
+//
+// protected override void Because()
+// {
+// _controller = Sut.LoadController(_requestContext, "ATest");
+// }
+//
+// [Observation]
+// public void it_should_have_a_controller_instance()
+// {
+// _controller.ShouldNotBeNull();
+// }
+//
+// [Observation]
+// public void it_should_be_a_ruby_controller()
+// {
+// _controller.ShouldBeAnInstanceOf<RubyController>();
+// }
+//
+// [Observation]
+// public void it_should_have_the_correct_name()
+// {
+// _controller.ControllerName.ShouldBeEqualTo("ATest");
+// }
+//
+// [Observation]
+// public void should_have_the_correct_class_name()
+// {
+// _controller.ControllerClassName.ShouldBeEqualTo("ATestController");
+// }
+// }
}
View
5 IronRubyMvc.Tests/IronRubyMvcLibrary.Tests.csproj
@@ -60,7 +60,6 @@
<HintPath>..\dependencies\Microsoft.Scripting.Core.dll</HintPath>
<Aliases>dlr</Aliases>
</Reference>
- <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Moq, Version=2.6.1014.1, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dependencies\Moq.dll</HintPath>
@@ -79,9 +78,7 @@
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Web" />
- <Reference Include="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\dependencies\System.Web.Abstractions.dll</HintPath>
+ <Reference Include="System.Web.Abstractions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
View
13 IronRubyMvc/System.Web.Mvc.IronRuby.csproj
@@ -79,18 +79,11 @@
<Reference Include="System.configuration" />
<Reference Include="System.Web" />
<Reference Include="System.Data" />
- <Reference Include="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\dependencies\System.Web.Abstractions.dll</HintPath>
+ <Reference Include="System.Web.Abstractions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
- <Reference Include="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\dependencies\System.Web.Mvc.dll</HintPath>
- </Reference>
- <Reference Include="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\dependencies\System.Web.Routing.dll</HintPath>
+ <Reference Include="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
+ <Reference Include="System.Web.Routing">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml" />
View
96 IronRubyMvcLibrarySpecs/IronRubyMvcLibrarySpecs.stproj
@@ -1,96 +0,0 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
- <Name>Debug</Name>
- <OutputPath>Debug\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
- <Name>Release</Name>
- <OutputPath>Release\</OutputPath>
- </PropertyGroup>
- <UsingTask TaskName="Sapphire.Steel.SteelRubyBuild" AssemblyName="SteelBuild, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8a42f26dbbcba2be, processorArchitecture=x86" />
- <UsingTask TaskName="Sapphire.Steel.SteelRailsBuild" AssemblyName="SteelBuild, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8a42f26dbbcba2be, processorArchitecture=x86" />
- <Target Name="BuildRails" Inputs="@(EmbeddedRuby)" Outputs="$(MSBuildProjectDirectory)\SyntaxCheck\%(Identity)">
- <MakeDir Directories="SyntaxCheck" />
- <SteelRailsBuild ERBFile="@(EmbeddedRuby)" ProjectDirectory="$(MSBuildProjectDirectory)" ERBProcessor="$(ERBProcessor)" ERBFlags="$(ERBFlags)" ERBLibraryFiles="$(ERBLibraryFiles)" ERBTimeout="$(ERBTimeout)" />
- </Target>
- <Target Name="BuildRuby" Inputs="@(Ruby)" Outputs="$(MSBuildProjectDirectory)\SyntaxCheck\%(Identity)">
- <MakeDir Directories="SyntaxCheck" />
- <SteelRubyBuild RubyFile="@(Ruby)" ProjectDirectory="$(MSBuildProjectDirectory)" RubyInterpreter="$(RubyInterpreter)" RubyInterpreterFlags="$(RubyInterpreterFlags)" RubyLibraryFiles="$(RubyLibraryFiles)" RubyLibraryPaths="$(LibraryPath)" RubyTimeout="$(RubyTimeout)" />
- </Target>
- <Target Name="Clean">
- <RemoveDir Directories="$(MSBuildProjectDirectory)\SyntaxCheck" />
- </Target>
- <Target Name="Build" DependsOnTargets="$(BuildDependsOn)" Inputs="@(Ruby); @(EmbeddedRuby)" Outputs="$(MSBuildProjectDirectory)\SyntaxCheck\%(Identity)">
- </Target>
- <Target Name="Clean">
- <RemoveDir Directories="$(MSBuildProjectDirectory)\SyntaxCheck" />
- </Target>
- <PropertyGroup>
- <RebuildDependsOn>
- Clean;
- Build;
- </RebuildDependsOn>
- <BuildDependsOn>
- BeforeBuild;
- BuildRuby;
- BuildRails;
- AfterBuild;
- </BuildDependsOn>
- <SteelVersion>1.2</SteelVersion>
- <ProjectGuid>{70018a7b-9100-428a-aafb-06e6b2c23710}</ProjectGuid>
- <AssemblyName>IronRubyMvcLibrarySpecs</AssemblyName>
- <RootNamespace>IronRubyMvcLibrarySpecs</RootNamespace>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'Debug_Signed' ">
- <Name>Debug</Name>
- <OutputPath>bin\Debug_Signed\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'Release_Signed' ">
- <OutputPath>bin\Release_Signed\</OutputPath>
- </PropertyGroup>
- <ItemGroup>
- <Ruby Include="bacon_helper.rb" />
- <Ruby Include="extensions\extensions.rb" />
- <Ruby Include="extensions\ienumerable_extensions_spec.rb" />
- <Ruby Include="extensions\object_extensions_spec.rb" />
- <Ruby Include="extensions\string_extensions_spec.rb" />
- <Ruby Include="lib\amok.rb" />
- <Ruby Include="Rakefile.rb" />
- <Ruby Include="ruby_controller_spec.rb" />
- </ItemGroup>
- <ItemGroup>
- <Folder Include="bin" />
- <Folder Include="Debug" />
- <Folder Include="extensions" />
- <Folder Include="lib" />
- <Folder Include="rake" />
- </ItemGroup>
- <ItemGroup>
- <Content Include="bin\IronRuby.dll" />
- <Content Include="bin\IronRuby.Libraries.dll" />
- <Content Include="bin\IronRuby.Libraries.pdb" />
- <Content Include="bin\IronRuby.pdb" />
- <Content Include="bin\IronRubyMvcLibrary.dll" />
- <Content Include="bin\IronRubyMvcLibrary.dll.CodeAnalysisLog.xml" />
- <Content Include="bin\IronRubyMvcLibrary.dll.lastcodeanalysissucceeded" />
- <Content Include="bin\IronRubyMvcLibrary.pdb" />
- <Content Include="bin\Microsoft.Scripting.Core.dll" />
- <Content Include="bin\Microsoft.Scripting.Core.pdb" />
- <Content Include="bin\Microsoft.Scripting.dll" />
- <Content Include="bin\Microsoft.Scripting.ExtensionAttribute.dll" />
- <Content Include="bin\Microsoft.Scripting.ExtensionAttribute.pdb" />
- <Content Include="bin\Microsoft.Scripting.pdb" />
- <Content Include="bin\System.Web.Mvc.dll" />
- <Content Include="bin\System.Web.Mvc.pdb" />
- </ItemGroup>
- <Target Name="Rebuild" DependsOnTargets="$(RebuildDependsOn)" Inputs="@(Ruby)" Outputs="$(MSBuildProjectDirectory)\SyntaxCheck\%(Identity)">
- </Target>
- <Target Name="BeforeBuild" Condition="'$(PreBuildEvent)'!='' ">
- <Exec Command="$(PreBuildEvent)" />
- </Target>
- <Target Name="AfterBuild" Condition="'$(PostBuildEvent)'!='' ">
- <Exec Command="$(PostBuildEvent)" />
- </Target>
- <!--<Import Project="$(MSBuildBinPath)\Microsoft.Common.targets" />-->
- <Target Name="ResolveAssemblyReferences" />
-</Project>
View
17 IronRubyMvcLibrarySpecs/Rakefile.rb
@@ -1,17 +0,0 @@
-
-
-
-def mono?
- !ENV['mono'].nil? && ENV['mono'] > 0
-end
-
-desc "Runs all the specs"
-task :spec => ['spec:extensions']
-
-namespace :spec do
- desc "runs the specs for the extensions"
- task :extensions do
- system "ibacon #{Dir.glob('extensions/**/*_spec.rb').join(' ')}"
- end
-end
-
View
5 IronRubyMvcLibrarySpecs/bacon_helper.rb
@@ -1,5 +0,0 @@
-require 'bacon'
-require 'mscorlib'
-require File.dirname(__FILE__) + "/lib/amok.rb"
-require File.dirname(__FILE__) + "/bin/IronRubyMvcLibrary.dll"
-
View
BIN  IronRubyMvcLibrarySpecs/bin/IronRuby.Libraries.dll
Binary file not shown
View
BIN  IronRubyMvcLibrarySpecs/bin/IronRuby.Libraries.pdb
Binary file not shown
View
BIN  IronRubyMvcLibrarySpecs/bin/IronRuby.dll
Binary file not shown
View
BIN  IronRubyMvcLibrarySpecs/bin/IronRuby.pdb
Binary file not shown
View
BIN  IronRubyMvcLibrarySpecs/bin/IronRubyMvcLibrary.dll
Binary file not shown
View
BIN  IronRubyMvcLibrarySpecs/bin/IronRubyMvcLibrary.pdb
Binary file not shown
View
BIN  IronRubyMvcLibrarySpecs/bin/Microsoft.Scripting.Core.dll
Binary file not shown
View
BIN  IronRubyMvcLibrarySpecs/bin/Microsoft.Scripting.Core.pdb
Binary file not shown
View
BIN  IronRubyMvcLibrarySpecs/bin/Microsoft.Scripting.ExtensionAttribute.dll
Binary file not shown
View
BIN  IronRubyMvcLibrarySpecs/bin/Microsoft.Scripting.ExtensionAttribute.pdb
Binary file not shown
View
BIN  IronRubyMvcLibrarySpecs/bin/Microsoft.Scripting.dll
Binary file not shown
View
BIN  IronRubyMvcLibrarySpecs/bin/Microsoft.Scripting.pdb
Binary file not shown
View
BIN  IronRubyMvcLibrarySpecs/bin/System.Web.Mvc.dll
Binary file not shown
View
BIN  IronRubyMvcLibrarySpecs/bin/System.Web.Mvc.pdb
Binary file not shown
View
3  IronRubyMvcLibrarySpecs/extensions/extensions.rb
@@ -1,3 +0,0 @@
-require File.dirname(__FILE__) + "/../bacon_helper.rb"
-
-include IronRubyMvcLibrary::Extensions
View
27 IronRubyMvcLibrarySpecs/extensions/ienumerable_extensions_spec.rb
@@ -1,27 +0,0 @@
-require File.dirname(__FILE__) + "/extensions.rb"
-
-describe "IEnumerableExtensions" do
-
- before do
- @collection = [1, 2, 3, 4, 5, 6, 7, 8]
- @generic_collection = System::Collections::Generic::List.of(System::Int32).new
- @generic_collection.add 1
- @generic_collection.add 2
- @generic_collection.add 3
- @generic_collection.add 5
- @generic_collection.add 6
- @generic_collection.add 7
- @generic_collection.add 8
- @generic_collection.add 9
- end
-
- it "should iterate over an untyped collection" do
- counter, result = 0, 0
- proc = Proc.new {|item| counter += 1; result += item }
- iterator = Workarounds.wrap_proc(proc)
- IEnumerableExtensions.for_each(@collection, iterator)
- counter.should.be 8
- result.should.be 36
- end
-
-end
View
26 IronRubyMvcLibrarySpecs/extensions/object_extensions_spec.rb
@@ -1,26 +0,0 @@
-require File.dirname(__FILE__) + '/extensions.rb'
-
-describe "ObjectExtensions" do
-
- describe "when asking for null" do
- it "should return true for a null value" do
- ObjectExtensions.is_null(nil).should.be.true?
- end
-
- it "should return false for an object instance" do
- ObjectExtensions.is_null(System::Object.new).should.be.false?
- end
- end
-
- describe "when asking for not null" do
- it "should return false for a null value" do
- ObjectExtensions.is_not_null(nil).should.be.false?
- end
-
- it "should return true for an object instance" do
- ObjectExtensions.is_not_null(Object.new).should.be.true?
- end
- end
-
-
-end
View
55 IronRubyMvcLibrarySpecs/extensions/string_extensions_spec.rb
@@ -1,55 +0,0 @@
-require File.dirname(__FILE__) + '/extensions.rb'
-
-describe "StringExtensions" do
-
- describe "when asking for null or blank" do
- it "should return true for a null value" do
- StringExtensions.is_null_or_blank(nil).should.be.true?
- end
-
- it "should return true for an empty value" do
- StringExtensions.is_null_or_blank("").should.be.true?
- end
-
- it "should return true when the string contains only spaces" do
- StringExtensions.is_null_or_blank(" ").should.be.true?
- end
-
- it "should return false when the string contains a value" do
- StringExtensions.is_null_or_blank("a string value").should.be.false?
- end
-
- end
-
- describe "when asking for not null or blank" do
-
- it "should return false when value is null" do
- StringExtensions.is_not_null_or_blank(nil).should.be.false?
- end
-
- it "should return false for an empty value" do
- StringExtensions.is_not_null_or_blank("").should.be.false?
- end
-
- it "should return false when the string contains only spaces" do
- StringExtensions.is_not_null_or_blank(" ").should.be.false?
- end
-
- it "should return true when the string contains a value" do
- StringExtensions.is_not_null_or_blank("a string value").should.be.true?
- end
-
- end
-
- describe "when asking to format a string" do
-
- it "should return a properly formatted string" do
- expected = "This is the 1 and only Format test at #{System::DateTime.now.to_short_date_string}".to_clr_string
- actual = StringExtensions.formatted_with("This is the {0} and only {1} test at {2}".to_clr_string, 1, "Format", System::DateTime.now.to_short_date_string)
-
- expected.should == actual
- end
-
- end
-
-end
View
152 IronRubyMvcLibrarySpecs/lib/amok.rb
@@ -1,152 +0,0 @@
-# Amok -- a compact mock library
-
-# Copyright (C) 2008 Christian Neukirchen <purl.org/net/chneukirchen>
-#
-# Amok is freely distributable under the terms of an MIT-style license.
-# See COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-class Amok
- VERSION = '0.1'
-
- attr_reader :obj
-
- class Failed < RuntimeError
- attr_accessor :errors
- end
-
- def self.with(obj)
- mock = new(obj)
- yield obj, mock
- mock.validate
- end
-
- def self.make(hash, &block)
- a = new(Object.new, &block)
- hash.each { |key, value| a.on(key) { value } }
- a.obj
- end
-
- @@uuid = 0
- def uuid
- @@uuid += 1
- end
-
- def initialize(obj, &block)
- @obj = obj
- @called = {}
- @previous = {}
- instance_eval(&block) if block
- end
-
- def on(method=nil, args=nil, n=nil, &block)
- return NiceProxy.new(self, n) unless method || block
-
- called = @called
- id = [method, args]
- called[id] = n
- _previous = @previous
-
- mock = self
- (class << @obj; self; end).class_eval {
- if block
- current = "__current_#{method}_#{mock.uuid}__amok__"
- define_method(current, &block)
- end
- begin
- previous = "__previous_#{method}_#{mock.uuid}__amok__"
- alias_method previous, method
- rescue NameError
- previous = nil
- end
- _previous[method] ||= previous
- define_method(method) { |*actual_args|
- if args.nil? || args == actual_args
- case called[id]
- when Numeric; called[id] -= 1
- when false; called[id] = true
- end
- __send__(current || previous, *actual_args)
- else
- __send__(previous, *actual_args)
- end
- }
- }
- end
-
- def previous(method, *args, &block)
- @obj.__send__(@previous[method], *args, &block)
- end
-
- def need(method=nil, args=nil, n=false, &block)
- unless block
- case method
- when nil; NiceProxy.new(self, n) # mock.need.foo
- when Numeric; NiceProxy.new(self, method) # mock.need(3).foo
- end
- else
- on(method, args, n, &block)
- end
- end
-
- def never(method=nil, args=nil)
- return NiceProxy.new(self, 0) if !method
- on(method, args, 0) {
- # should we raise here?
- }
- end
-
- def errors
- @called.reject { |k, v|
- v == 0 || # run the right number of times
- v == true || # run at all
- v == nil # run? who cares?
- }.map { |(m, a), v|
- msg = m.to_s
- msg << "(#{a.map { |x| x.inspect }.join(", ")})" if a
- if v == false
- msg << " was not called."
- else
- msg << " was called #{v.abs} times #{v < 0 ? "too often" : "too few"}."
- end
- }
- end
-
- def successful?
- errors.empty?
- end
-
- def validate
- unless successful?
- ex = Failed.new(errors.join(" "))
- ex.errors = errors.dup
- raise ex
- end
- end
-
- def cleanup!
- _previous = @previous
- (class << @obj; self; end).class_eval {
- _previous.each { |old, new|
- new ? alias_method(old, new) : undef_method(old)
- }
- methods.each { |m| undef_method if m =~ /__amok__\Z/ }
- }
- @obj
- end
-
- class NiceProxy
- instance_methods.each { |name|
- undef_method name unless name =~ /^__|^instance_eval$/
- }
-
- def initialize(obj, n=nil)
- @obj, @n = obj, n
- end
-
- def method_missing(name, *args, &block)
- args = nil if args.empty? # allow any arguments when none are mentioned
- @obj.on(name, args, @n, &block)
- self
- end
- end
-end
View
0  IronRubyMvcLibrarySpecs/ruby_controller_spec.rb
No changes.
View
13 IronRubyMvcWeb/IronRubyMvcWeb.csproj
@@ -59,18 +59,11 @@
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Web" />
- <Reference Include="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\dependencies\System.Web.Abstractions.dll</HintPath>
+ <Reference Include="System.Web.Abstractions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
- <Reference Include="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\dependencies\System.Web.Mvc.dll</HintPath>
- </Reference>
- <Reference Include="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\dependencies\System.Web.Routing.dll</HintPath>
+ <Reference Include="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
+ <Reference Include="System.Web.Routing">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq">
View
38 Pictures/Controllers/AlbumsController.rb
@@ -1,38 +0,0 @@
-class AlbumsController < ApplicationController
-
- def index
- @person = person
- @albums = albums
- return_view "index", "layout"
- end
-
- def new
- @album = Album.new
- return_view "new", "layout"
- end
-
- def show
- @album = Album.find(params[:id])
- return_view "show", "layout"
- end
-
- def create
- @album = current_person.albums.build(params[:album])
- if @album.save
- flash[:notice] = "Your album has been created!"
- redirect_to @album
- else
- flash[:error] = "There was a problem adding your album."
- render :action => 'new'
- end
- end
-
- private
- def person
- @person ||= (Person.first(:conditions => {:id => params[:person_id]}) || current_person)
- end
-
- def albums
- person.blank? ? Album.all : person.albums
- end
-end
View
57 Pictures/Controllers/ApplicationController.rb
@@ -1,57 +0,0 @@
-require 'base_model'
-
-class ApplicationController < Controller
- def initialize(context = nil)
- if(context != nil)
- base.Initialize(context)
- end
- end
-
- def fill_view_data
- instance_variables.each { |varname| view_data.Add(varname[1..-1], instance_variable_get(varname.to_sym)) }
- end
-
- def to_decimal value
- System::Convert::ToDecimal value
- end
-
- def return_view *args
- fill_view_data
- view *args
- end
-
- def current_person
- @current_person ||= logged_in? ? Person.find(session[:person_id]) : nil
- end
-
- def logged_in?
- !session[:person_id].blank?
- end
-
- def authenticate
- if !logged_in?
- flash[:notice] = "Please log in to continue!"
- redirect_to new_session_url
- end
- end
-
- def set_tags!
- @tags = Tag.all
- end
-
- def person
- @person ||= Person.find(params[:person_id]) if params[:person_id]
- end
-
- def album_person
- @person ||= person || current_person
- end
-
- def albums
- album_person.blank? ? Album.all : album_person.albums
- end
-
- def session
- @session ||= {}
- end
-end
View
24 Pictures/Controllers/CommentsController.rb
@@ -1,24 +0,0 @@
-class CommentsController < ApplicationController
- before_filter :authenticate
-
- def new
- @picture = Picture.find(params[:picture_id])
- @comment = @picture.comments.build
- end
-
- def index
- @comments = Picture.find(params[:picture_id]).comments
- render :xml => @comments
- end
-
- def create
- @comment = current_person.comments.build(params[:comment])
- if @comment.save
- flash[:notice] = "Your voice has been heard!"
- redirect_to :back
- else
- flash[:error] = "There was a problem submitting your comment"
- render :action => 'new'
- end
- end
-end
View
2  Pictures/Controllers/FollowsController.rb
@@ -1,2 +0,0 @@
-class FollowsController < ApplicationController
-end
View
16 Pictures/Controllers/HomeController.rb
@@ -1,16 +0,0 @@
-require "home_model"
-require 'base_model'
-require 'picture'
-require 'album'
-class HomeController < Controller
- def initialize(context = nil)
- if(context != nil)
- base.Initialize(context)
- end
- end
-
- def index
- Picture.find(:first)
- view nil, 'layout1', HomeModel.new
- end
-end
View
37 Pictures/Controllers/PeopleController.rb
@@ -1,37 +0,0 @@
-require 'ApplicationController'
-
-class PeopleController < ApplicationController
-
- def show
- @person = Person.find(params[:id])
- return_view "show", "layout"
- end
-
- def index
- @people = Person.search(params[:term])
- respond_to do |format|
- format.html
- format.js { render :json => @people }
- format.xml { render :xml => @people }
- end
- end
-
- def new
- @person = Person.new
- end
-
- def edit
- @person = current_person
- end
-
- def create
- @person = Person.new(params[:person])
- if @person.save
- flash[:notice] = "Welcome, and thanks for registering!"
- redirect_to new_session_url
- else
- flash[:error] = "There was a problem registering. Please try again."
- render :action => 'new'
- end
- end
-end
View
69 Pictures/Controllers/PicturesController.rb
@@ -1,69 +0,0 @@
-require 'ApplicationController'
-
-class PicturesController < ApplicationController
-
- def index
- @tags = Tag.all
- filtered_pictures(:limit => 13)
- filtered_albums(:limit => 5)
- return_view 'index', 'layout'
- end
-
- def test
- view 'test', 'layout'
- end
-
- def mine
- params[:person_id] = current_person.id
- filtered_pictures(:limit => 13)
- filtered_albums(:limit => 5)
- return_view 'index', 'layout'
- end
-
- def new
- @picture = Picture.new(:album_id => params[:album_id])
- end
-
- def create
- @picture = current_person.pictures.build(params[:picture])
- if @picture.save
- flash[:notice] = "Thanks, we've got it!"
- redirect_to @picture
- else
-
- end
- end
-
- def show
- @picture = Picture.find(params[:id])
- return_view 'show', 'layout'
- end
-
- def tagged
- @pictures = Picture.tagged_with(params[:tag])
- return_view 'tagged', 'layout'
- end
-
- private
-
- def filtered_pictures(options)
- if person
- @pictures = Picture.find_for(person, options)
- else
- @pictures = Picture.search(params[:term], options)
- end
- end
-
- def filtered_albums(options)
- if person
- @albums = Album.find_for(person, options)
- else
- @albums = Album.search(params[:term], options)
- end
- end
-
- def person
- @person ||= Person.find(params[:person_id]) if params[:person_id]
- end
-
-end
View
71 Pictures/Controllers/ProductsController.rb
@@ -1,71 +0,0 @@
-#require 'helpers/BaseController'
-#require 'ProductsRepository'
-
-require 'IronRubyMvcWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
-include IronRubyMvcWeb::Models
-include IronRubyMvcWeb::Models::Northwind
-
-class ProductsRepository < IronRubyRepository
-end
-
-class BaseController < Controller
- def initialize(context = nil)
- if(context != nil)
- base.Initialize(context)
- end
- end
-
- def fill_view_data
- instance_variables.each { |varname| view_data.Add(varname[1..-1], instance_variable_get(varname.to_sym)) }
- end
-
- def to_decimal value
- System::Convert::ToDecimal value
- end
-
- def return_view *args
- fill_view_data
- view *args
- end
-end
-
-class ProductsController < BaseController
- def index
- repository = ProductsRepository.new
-
- @message = "Hi Mom"
- @categories = repository.get_categories
-
- return_view nil, 'layout'
- end
-
- def list
- @category = params[:id]
-
- repository = ProductsRepository.new
- @products = repository.get_products_for_category @category
-
- return_view nil, 'layout'
- end
-
- def edit
- @id = params[:id]
-
- repository = ProductsRepository.new
- @product = repository.get_product @id
- return_view nil, 'layout'
- end
-
- def update
- id = params[:id]
- category = params[:category_name]
-
- repository = ProductsRepository.new
- @product = repository.get_product id
- @product.product_name = request.form.get_Item('Product.productname')
- @product.unit_price = to_decimal request.form.get_Item('Product.unitprice')
- repository.submit_changes
-
- redirect_to_action 'list', {:id => category }
- end
-end
View
19 Pictures/Controllers/SessionsController.rb
@@ -1,19 +0,0 @@
-class SessionsController < ApplicationController
- def create
- person = Person.authenticate(params[:email], params[:password])
- if person
- session[:person_id] = person.id
- flash[:notice] = "Welcome back, #{person.name}!"
- redirect_to person_pictures_url(person.id)
- else
- flash[:error] = "There was a problem with your email, password, or both. Please double-check them and try again."
- render :action => 'new'
- end
- end
-
- def destroy
- reset_session
- flash[:notice] = "Come again soon!"
- redirect_to root_url
- end
-end
View
12 Pictures/Controllers/TaggingsController.rb
@@ -1,12 +0,0 @@
-class TaggingsController < ApplicationController
- def create
- person = Person.find(params[:person_id])
- # person.taggings.create(:tag => Tag.find_or_create_by_name(params[:name]), :taggable => Picture.find(params[:picture_id]))
- #FIXME: this is not the way you'd do this with ActiveRecord, but we need to do some work for setting values that are
- # AM models correctly
- person.taggings.create(:tag_id => Tag.find_or_create_by_name(params[:name]).id, :taggable_id => Picture.find(params[:picture_id]).id, :taggable_type => "Picture")
-
- flash[:notice] = "Tagged it!"
- redirect_to :back
- end
-end
View
2  Pictures/Controllers/TagsController.rb
@@ -1,2 +0,0 @@
-class TagsController < ApplicationController
-end
View
3  Pictures/Default.aspx
@@ -1,3 +0,0 @@
-<%@ Page Language="C#" %>
-<%
- Response.Redirect("~/pictures");%>
View
2  Pictures/Global.asax
@@ -1,2 +0,0 @@
-<%@ Import Namespace="Pictures"%>
-<%@ Application Codebehind="Global.asax.cs" Inherits="Pictures.GlobalApplication" Language="C#" %>
View
12 Pictures/Global.asax.cs
@@ -1,12 +0,0 @@
-#region Usings
-
-using System.Web.Mvc.IronRuby.Core;
-
-#endregion
-
-namespace Pictures
-{
- public class GlobalApplication : RubyMvcApplication
- {
- }
-}
View
21 Pictures/Models/album.rb
@@ -1,21 +0,0 @@
-require 'in_memory_model'
-require 'picture'
-require 'person'
-
-class Album < InMemoryModel
- belongs_to :person
- has_many :pictures
-
- def self.find_for(person, options)
- find_all_by_person_id(person.id)
- end
-
- def self.search(term, options={})
- options = {:limit => 20, :order => "created_at DESC"}.merge(options)
- unless term.blank?
- options.merge!(:conditions => ['name LIKE ?', "%#{term}%"])
- end
- all(options)
- end
-
-end