extjs-mvc 0.4.0.b → 0.4.0.d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. data/Rakefile +6 -9
  2. data/VERSION +1 -1
  3. data/bin/extjs-mvc +19 -0
  4. data/lib/extjs-mvc.rb +13 -67
  5. data/lib/{js → vendor}/App.js +0 -0
  6. data/lib/{js → vendor}/MVC.js +0 -0
  7. data/lib/{js → vendor}/Presenter.js +0 -0
  8. data/lib/{js → vendor}/README.rdoc +0 -0
  9. data/lib/{js → vendor}/controller/Controller.js +0 -0
  10. data/lib/{js → vendor}/controller/CrudController.js +0 -0
  11. data/lib/{js → vendor}/lib/Array.js +0 -0
  12. data/lib/{js → vendor}/lib/Booter.js +4 -3
  13. data/lib/{js → vendor}/lib/ClassManager.js +0 -0
  14. data/lib/{js → vendor}/lib/ControllerClassManager.js +0 -0
  15. data/lib/{js → vendor}/lib/Dependencies.js +0 -0
  16. data/lib/{js → vendor}/lib/DispatchMatcher.js +0 -0
  17. data/lib/{js → vendor}/lib/Dispatcher.js +0 -0
  18. data/lib/{js → vendor}/lib/Environment.js +0 -0
  19. data/lib/{js → vendor}/lib/Inflector.js +17 -0
  20. data/lib/{js → vendor}/lib/ModelClassManager.js +0 -0
  21. data/lib/{js → vendor}/lib/Route.js +0 -0
  22. data/lib/{js → vendor}/lib/Router.js +0 -0
  23. data/lib/{js → vendor}/lib/String.js +0 -0
  24. data/lib/{js → vendor}/lib/ViewClassManager.js +0 -0
  25. data/lib/{js → vendor}/lib/notes.txt +0 -0
  26. data/lib/{js → vendor}/model/AdapterManager.js +0 -0
  27. data/lib/{js → vendor}/model/Association.js +0 -0
  28. data/lib/{js → vendor}/model/Base.js +0 -0
  29. data/lib/{js → vendor}/model/BelongsToAssociation.js +0 -0
  30. data/lib/{js → vendor}/model/Cache.js +0 -0
  31. data/lib/{js → vendor}/model/HasManyAssociation.js +0 -0
  32. data/lib/{js → vendor}/model/Model.js +0 -0
  33. data/lib/{js → vendor}/model/UrlBuilder.js +0 -0
  34. data/lib/{js → vendor}/model/adapters/AbstractAdapter.js +0 -0
  35. data/lib/{js → vendor}/model/adapters/MemoryAdapter.js +0 -0
  36. data/lib/{js → vendor}/model/adapters/RESTAdapter.js +0 -0
  37. data/lib/{js → vendor}/model/adapters/RESTJSONAdapter.js +0 -0
  38. data/lib/{js → vendor}/model/adapters/notes.txt +0 -0
  39. data/lib/{js → vendor}/model/associations/Association.js +0 -0
  40. data/lib/{js → vendor}/model/associations/notes.txt +0 -0
  41. data/lib/{js → vendor}/model/validations/Errors.js +0 -0
  42. data/lib/{js → vendor}/model/validations/Plugin.js +0 -0
  43. data/lib/{js → vendor}/model/validations/Validations.js +0 -0
  44. data/lib/{js → vendor}/notes/Charts.graffle +0 -0
  45. data/lib/{js → vendor}/overrides/Ext.Component.js +0 -0
  46. data/lib/{js → vendor}/overrides/Ext.extend.js +0 -0
  47. data/lib/{js → vendor}/spec/Array.spec.js +0 -0
  48. data/lib/{js → vendor}/spec/ExtMVC.spec.js +0 -0
  49. data/lib/{js → vendor}/spec/Model.spec.js +0 -0
  50. data/lib/{js → vendor}/spec/OS.spec.js +0 -0
  51. data/lib/{js → vendor}/spec/Router.spec.js +0 -0
  52. data/lib/{js → vendor}/spec/SpecHelper.js +0 -0
  53. data/lib/{js → vendor}/spec/String.spec.js +0 -0
  54. data/lib/{js → vendor}/spec/model/AbstractAdapter.spec.js +0 -0
  55. data/lib/{js → vendor}/spec/model/Associations.spec.js +0 -0
  56. data/lib/{js → vendor}/spec/model/Cache.spec.js +0 -0
  57. data/lib/{js → vendor}/spec/model/RESTAdapter.spec.js +0 -0
  58. data/lib/{js → vendor}/spec/model/ValidationErrors.spec.js +0 -0
  59. data/lib/{js → vendor}/spec/model/Validations.spec.js +0 -0
  60. data/lib/{js → vendor}/spec/model/ValidationsPlugin.spec.js +0 -0
  61. data/lib/{js → vendor}/spec/suite.html +0 -0
  62. data/lib/{js → vendor}/specs-old/JSSpec.css +0 -0
  63. data/lib/{js → vendor}/specs-old/JSSpec.js +0 -0
  64. data/lib/{js → vendor}/specs-old/all.html +0 -0
  65. data/lib/{js → vendor}/specs-old/base.js +0 -0
  66. data/lib/{js → vendor}/specs-old/controller.js +0 -0
  67. data/lib/{js → vendor}/specs-old/diff_match_patch.js +0 -0
  68. data/lib/{js → vendor}/specs-old/model.js +0 -0
  69. data/lib/{js → vendor}/specs-old/route.js +0 -0
  70. data/lib/{js → vendor}/specs-old/router.js +0 -0
  71. data/lib/{js → vendor}/specs-old/string.js +0 -0
  72. data/lib/{js → vendor}/testrunner/JSpecFormatter.js +0 -0
  73. data/lib/{js → vendor}/testrunner/TestClient.js +0 -0
  74. data/lib/{js → vendor}/testrunner/TestGrid.js +0 -0
  75. data/lib/{js → vendor}/testrunner/TestRunner.js +0 -0
  76. data/lib/{js → vendor}/testrunner/TestViewport.js +0 -0
  77. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/EXAMPLE.html +0 -0
  78. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/LICENSE +0 -0
  79. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/README.markdown +0 -0
  80. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/jquery-1.2.3.js +0 -0
  81. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/jquery.fn.js +0 -0
  82. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/jquery.print.js +0 -0
  83. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/screw.assets.js +0 -0
  84. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/screw.behaviors.js +0 -0
  85. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/screw.builder.js +0 -0
  86. data/lib/{js → vendor}/vendor/screw-unit/lib/screw.css +0 -0
  87. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/screw.events.js +0 -0
  88. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/screw.matchers.js +0 -0
  89. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/screw.server.js +0 -0
  90. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/spec/behaviors_spec.js +0 -0
  91. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/spec/matchers_spec.js +0 -0
  92. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/spec/print_spec.js +0 -0
  93. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/spec/spec_helper.js +0 -0
  94. data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/spec/suite.html +0 -0
  95. data/lib/{js → vendor}/view/FormWindow.js +0 -0
  96. data/lib/{js → vendor}/view/HasManyEditorGridPanel.js +0 -0
  97. data/lib/{js → vendor}/view/scaffold/Edit.js +0 -0
  98. data/lib/{js → vendor}/view/scaffold/Index.js +0 -0
  99. data/lib/{js → vendor}/view/scaffold/New.js +0 -0
  100. data/lib/{js → vendor}/view/scaffold/ScaffoldFormPanel.js +0 -0
  101. data/lib/{js/build → vendor.yml} +7 -1
  102. metadata +110 -203
  103. data/bin/xmvc +0 -13
  104. data/lib/extjs-mvc/README +0 -20
  105. data/lib/extjs-mvc/builder.rb +0 -83
  106. data/lib/extjs-mvc/builders/all_builder.rb +0 -15
  107. data/lib/extjs-mvc/builders/app_builder.rb +0 -36
  108. data/lib/extjs-mvc/builders/base.rb +0 -138
  109. data/lib/extjs-mvc/builders/css_builder.rb +0 -36
  110. data/lib/extjs-mvc/builders/docs_builder.rb +0 -20
  111. data/lib/extjs-mvc/builders/mvc_builder.rb +0 -33
  112. data/lib/extjs-mvc/builders/plugin_builder.rb +0 -53
  113. data/lib/extjs-mvc/cli.rb +0 -52
  114. data/lib/extjs-mvc/generator.rb +0 -79
  115. data/lib/extjs-mvc/generators/app.rb +0 -57
  116. data/lib/extjs-mvc/generators/base.rb +0 -53
  117. data/lib/extjs-mvc/generators/controller.rb +0 -41
  118. data/lib/extjs-mvc/generators/model.rb +0 -41
  119. data/lib/extjs-mvc/generators/scaffold.rb +0 -17
  120. data/lib/extjs-mvc/generators/templates/Controller.js +0 -17
  121. data/lib/extjs-mvc/generators/templates/Model.js +0 -9
  122. data/lib/extjs-mvc/generators/templates/ModelSpec.js +0 -12
  123. data/lib/extjs-mvc/generators/templates/View.js +0 -16
  124. data/lib/extjs-mvc/generators/templates/_Action.js +0 -7
  125. data/lib/extjs-mvc/generators/templates/app/README.rdoc +0 -152
  126. data/lib/extjs-mvc/generators/templates/app/app/App.js +0 -64
  127. data/lib/extjs-mvc/generators/templates/app/app/controllers/ApplicationController.js +0 -10
  128. data/lib/extjs-mvc/generators/templates/app/app/controllers/HomeController.js +0 -10
  129. data/lib/extjs-mvc/generators/templates/app/app/views/home/Index.js +0 -17
  130. data/lib/extjs-mvc/generators/templates/app/app/views/layout/Menu.js +0 -23
  131. data/lib/extjs-mvc/generators/templates/app/config/application.js +0 -1
  132. data/lib/extjs-mvc/generators/templates/app/config/boot.js +0 -67
  133. data/lib/extjs-mvc/generators/templates/app/config/build.xml +0 -77
  134. data/lib/extjs-mvc/generators/templates/app/config/database.js +0 -4
  135. data/lib/extjs-mvc/generators/templates/app/config/environment.json +0 -58
  136. data/lib/extjs-mvc/generators/templates/app/config/environments/development.json +0 -1
  137. data/lib/extjs-mvc/generators/templates/app/config/environments/production.json +0 -4
  138. data/lib/extjs-mvc/generators/templates/app/config/routes.js +0 -27
  139. data/lib/extjs-mvc/generators/templates/app/config/settings.yml +0 -3
  140. data/lib/extjs-mvc/generators/templates/app/public/index.html +0 -19
  141. data/lib/extjs-mvc/generators/templates/app/public/stylesheets/ext-mvc-all.css +0 -49
  142. data/lib/extjs-mvc/generators/templates/app/spec/SpecHelper.js +0 -0
  143. data/lib/extjs-mvc/generators/templates/app/spec/index.html +0 -66
  144. data/lib/extjs-mvc/generators/templates/app/vendor/screw-unit/lib/screw.css +0 -90
  145. data/lib/extjs-mvc/generators/templates/scaffold/ScaffoldController.js +0 -18
  146. data/lib/extjs-mvc/generators/view.rb +0 -29
  147. data/lib/extjs-mvc/plugin.rb +0 -105
  148. data/lib/extjs-mvc/scripts.rb +0 -15
  149. data/lib/extjs-mvc/settings.rb +0 -75
  150. data/lib/extjs-mvc/setup.rb +0 -5
  151. data/lib/extjs-mvc/stats.rb +0 -241
  152. data/lib/extjs-mvc/test.rb +0 -11
  153. data/lib/extjs-mvc/testserver.ru +0 -95
  154. data/lib/extjs-mvc/ui.rb +0 -58
  155. data/lib/extjs-mvc/update.rb +0 -73
  156. data/lib/js/vendor/screw-unit/EXAMPLE.html +0 -68
  157. data/lib/js/vendor/screw-unit/LICENSE +0 -22
  158. data/lib/js/vendor/screw-unit/README.markdown +0 -307
  159. data/lib/js/vendor/screw-unit/lib/jquery-1.2.3.js +0 -3408
  160. data/lib/js/vendor/screw-unit/lib/jquery.fn.js +0 -29
  161. data/lib/js/vendor/screw-unit/lib/jquery.print.js +0 -108
  162. data/lib/js/vendor/screw-unit/lib/screw.assets.js +0 -36
  163. data/lib/js/vendor/screw-unit/lib/screw.behaviors.js +0 -91
  164. data/lib/js/vendor/screw-unit/lib/screw.builder.js +0 -80
  165. data/lib/js/vendor/screw-unit/lib/screw.events.js +0 -42
  166. data/lib/js/vendor/screw-unit/lib/screw.matchers.js +0 -145
  167. data/lib/js/vendor/screw-unit/lib/screw.server.js +0 -21
  168. data/lib/js/vendor/screw-unit/spec/behaviors_spec.js +0 -178
  169. data/lib/js/vendor/screw-unit/spec/matchers_spec.js +0 -237
  170. data/lib/js/vendor/screw-unit/spec/print_spec.js +0 -119
  171. data/lib/js/vendor/screw-unit/spec/spec_helper.js +0 -0
  172. data/lib/js/vendor/screw-unit/spec/suite.html +0 -18
@@ -1,66 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
-
4
- <html>
5
- <head>
6
- <link type="text/css" rel="stylesheet" href="../vendor/screw-unit/lib/screw.css" />
7
- <title>Application Specs</title>
8
- </head>
9
- <body>
10
- <div id="dom_test" style="position: absolute; left: -9999"></div>
11
-
12
- <!-- Library code (not directly part of the app) -->
13
- <div id="libs">
14
- <!-- Screw Unit -->
15
- <script type="text/javascript" src="../vendor/screw-unit/lib/jquery-1.2.3.js"></script>
16
- <script type="text/javascript" src="../vendor/screw-unit/lib/jquery.fn.js"></script>
17
- <script type="text/javascript" src="../vendor/screw-unit/lib/jquery.print.js"></script>
18
- <script type="text/javascript" src="../vendor/screw-unit/lib/screw.builder.js"></script>
19
- <script type="text/javascript" src="../vendor/screw-unit/lib/screw.matchers.js"></script>
20
- <script type="text/javascript" src="../vendor/screw-unit/lib/screw.events.js"></script>
21
- <script type="text/javascript" src="../vendor/screw-unit/lib/screw.behaviors.js"></script>
22
-
23
- <!-- Ext JS - using debug while in test mode -->
24
- <script type="text/javascript" src="../vendor/ext/adapter/ext/ext-base.js"></script>
25
- <script type="text/javascript" src="../vendor/ext/ext-all-debug.js"></script>
26
-
27
- <!-- Ext MVC -->
28
- <script type="text/javascript" src="../vendor/mvc/ext-mvc-all.js"></script>
29
- </div>
30
-
31
- <!-- Application Files - include any model, controller and view files you need to test here -->
32
- <div id="app">
33
- <script type="text/javascript" src="../app/OS.js"></script>
34
-
35
- <div class="models">
36
-
37
- </div>
38
-
39
- <div class="controllers">
40
-
41
- </div>
42
-
43
- <div class="views">
44
-
45
- </div>
46
- </div>
47
-
48
- <!-- Specs -->
49
- <div id="specs">
50
- <script type="text/javascript" src="SpecHelper.js"></script>
51
-
52
- <div class="models">
53
-
54
- </div>
55
-
56
- <div class="controllers">
57
-
58
- </div>
59
-
60
- <div class="views">
61
-
62
- </div>
63
- </div>
64
-
65
- </body>
66
- </html>
@@ -1,90 +0,0 @@
1
- html {
2
- padding: 0.5em;
3
- font-family: Georgia, serif;
4
- background: #EDEBD5;
5
- }
6
-
7
- li {
8
- list-style-type: none;
9
- }
10
-
11
- .focused {
12
- background-color: #F4F2E4;
13
- }
14
-
15
- .focused * {
16
- opacity: 1.0;
17
- }
18
-
19
- h1, h2, p {
20
- opacity: 0.4;
21
- }
22
-
23
- .describes {
24
- padding-left: 0;
25
- }
26
-
27
- .describes h1 {
28
- font-size: 1.1em;
29
- color: #877C21;
30
- line-height: 1.8em;
31
- margin: 0pt 0pt 0.6em;
32
- border-bottom: 1px solid transparent;
33
- }
34
-
35
- .describes h1:hover {
36
- cursor: pointer;
37
- color: #000;
38
- background-color: #F4F2E4;
39
- border-bottom: 1px solid #9A8E51;
40
- }
41
-
42
- .describes .describe {
43
- margin-left: 0.6em;
44
- padding-left: 0.6em;
45
- border: 1px dashed grey;
46
- }
47
-
48
- .describes .describe .its {}
49
-
50
- .describes .describe .its .it {
51
- list-style-type: lower-roman;
52
- list-style-position: outside;
53
- }
54
-
55
- .describes .describe .its .it h2 {
56
- font-weight: normal;
57
- font-style: italic;
58
- padding-left: 0.5em;
59
- font-size: 1.0em;
60
- color: #877C21;
61
- line-height: 1.8em;
62
- margin: 0 0 0.5em;
63
- border-bottom: 1px solid transparent;
64
- }
65
-
66
- .describes .describe .its .it.enqueued h2 {
67
- background-color: #CC6600;
68
- color: white !important;
69
- }
70
-
71
- .describes .describe .its .it.passed h2 {
72
- background-color: #5A753D;
73
- color: white !important;
74
- }
75
-
76
- .describes .describe .its .it.failed h2 {
77
- background-color: #993300;
78
- color: white !important;
79
- }
80
-
81
- .describes .describe .its .it.failed p {
82
- margin-left: 1em;
83
- color: #993300;
84
- }
85
-
86
- .describes .describe .its .it h2:hover {
87
- cursor: pointer;
88
- color: #000 !important;
89
- border-bottom: 1px solid #9A8E51;
90
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * @class <%= @namespace %>.controllers.<%= @controller_name %>
3
- * @extends ExtMVC.Controller
4
- */
5
- <%= @namespace %>.controllers.<%= @controller_name %> = Ext.extend(ExtMVC.Controller, {
6
- constructor: function() {
7
- //super
8
- <%= @namespace %>.controllers.<%= @controller_name %>.superclass.constructor.call(this, {
9
- viewsPackage: <%= @namespace %>.views.<%= @short_name %>
10
- });
11
-
12
- this.actsAsCrudController(<%= @model_name %>);
13
- }
14
- });
15
-
16
- ExtMVC.OS.getOS().registerController('<%= @short_name %>', <%= @namespace %>.controllers.<%= @controller_name %>);
17
-
18
- Ext.ns('<%= @namespace %>.views.<%= @short_name %>');
@@ -1,29 +0,0 @@
1
- module ExtJS
2
- module MVC
3
- module Generator
4
- class View < Base
5
- def initialize(package, name)
6
- super
7
-
8
- @package = package
9
- @name = name.capitalize
10
-
11
- @view_filename = "app/views/#{package}/#{@name}.js"
12
-
13
- @gsubs.merge!({
14
- 'name' => @name,
15
- 'view_namespace' => @package,
16
- 'filename' => @view_filename
17
- })
18
- end
19
-
20
- def generate!
21
- ensure_no_overwrite! @view_filename
22
- ensure_directories_present! "app", "app/views", "app/views/#{@package}"
23
-
24
- template "View.js", @view_filename
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,105 +0,0 @@
1
- # Is this really required??
2
- #
3
- #require 'ftools'
4
-
5
- module ExtJS
6
- module MVC
7
- class Plugin
8
- def self.dispatch
9
- meth = ARGV.shift.downcase
10
- name = ARGV.shift
11
-
12
- if name == 'all'
13
- self.send("#{meth}_all")
14
- else
15
- ExtMVC::Plugin.new(name).send(meth)
16
- end
17
- end
18
-
19
- def self.install_all
20
- self.all_plugins.each {|pluginName| ExtMVC::Plugin.new(pluginName).install}
21
- end
22
-
23
- def self.uninstall_all
24
- self.all_plugins.each {|pluginName| ExtMVC::Plugin.new(pluginName).uninstall}
25
- end
26
-
27
- def self.all_plugins
28
- pluginsDir = 'vendor/plugins'
29
-
30
- #Gets the name of each plugin directory inside vendor/plugins and calls self.plugin with it
31
- Dir.entries(pluginsDir).select {|fileName|
32
- File.directory?("#{pluginsDir}/#{fileName}") && (fileName =~ /^\./) != 0
33
- }
34
- end
35
-
36
- attr_reader :name, :type, :directory
37
-
38
- def initialize name
39
- @name = @directory = name
40
- @type = @name =~ /git:\/\// ? 'git' : 'dir'
41
-
42
- @public_directory = "vendor/plugins/#{@name}/public"
43
- end
44
-
45
- def install
46
- install_assets
47
- end
48
-
49
- def install_assets
50
- install_assets_from_directory(@public_directory) if File.exists?(@public_directory)
51
- end
52
-
53
- def uninstall
54
- if File.exists?(@public_directory)
55
-
56
- end
57
- end
58
-
59
- private
60
- #installs all assets from the given directory and subdirs into the main /public folder
61
- def install_assets_from_directory(directory)
62
- directory ||= @public_directory
63
-
64
- find_assets_in_directory(directory).each do |f|
65
- new_asset = asset_new_location_name(f)
66
- if File.directory?(f)
67
- unless File.exists?(new_asset)
68
- Dir.mkdir(new_asset)
69
- puts "Created directory: " + new_asset
70
- end
71
- else
72
- action = File.exists?(new_asset) ? 'Updated' : 'Installed'
73
- File.copy(f, new_asset)
74
- puts action + " file: " + new_asset
75
- end
76
- end
77
- end
78
-
79
- #recursively finds assets in directories under /public inside the plugin
80
- def find_assets_in_directory(directory)
81
- files = []
82
-
83
- Dir.entries(directory).each do |e|
84
- filename = File.join(directory, e)
85
- next if ['.', '..'].include?(filename.split('/').last.to_s)
86
-
87
- files.push(filename)
88
- files.concat(find_assets_in_directory(filename)) if File.directory?(filename)
89
- end
90
-
91
- return files
92
- end
93
-
94
- #i.e. vendor/plugins/MyPlugin/public/images/image.gif becomes public/images/image.gif
95
- def asset_new_location_name(filename)
96
- pieces = filename.split("/")
97
- if index = pieces.index('public')
98
- File.join(pieces.slice(index, pieces.size))
99
- else
100
- filename
101
- end
102
- end
103
- end
104
- end
105
- end
@@ -1,15 +0,0 @@
1
- require 'vendor/mvc/scripts/builder'
2
- require 'vendor/mvc/scripts/builders/plugin_builder'
3
- require 'vendor/mvc/scripts/builders/mvc_builder'
4
- require 'vendor/mvc/scripts/builders/app_builder'
5
- require 'vendor/mvc/scripts/builders/css_builder'
6
- require 'vendor/mvc/scripts/builders/all_builder'
7
- require 'vendor/mvc/scripts/builders/docs_builder'
8
-
9
- require 'vendor/mvc/scripts/generator'
10
- require 'vendor/mvc/scripts/plugin'
11
- require 'vendor/mvc/scripts/settings'
12
- require 'vendor/mvc/scripts/setup'
13
- require 'vendor/mvc/scripts/stats'
14
- require 'vendor/mvc/scripts/test'
15
- require 'vendor/mvc/scripts/update'
@@ -1,75 +0,0 @@
1
- module ExtJS
2
- module MVC
3
-
4
- # extracts settings from the config/settings.yml file
5
- def self.settings
6
- @config ||= YAML.load_file('config/settings.yml')
7
- end
8
-
9
- # returns environment settings
10
- def self.environment
11
- settings['environment']
12
- end
13
-
14
- def self.namespace
15
- environment["namespace"]
16
- end
17
-
18
- def self.show_settings
19
- puts environment.inspect
20
- end
21
-
22
- def self.application_files_for(environment)
23
- files = []
24
-
25
- [
26
- environment["plugins"].collect {|o| "vendor/plugins/#{o}/#{o}-all.js"},
27
- environment["overrides"].collect {|o| "config/overrides/#{o}.js"},
28
- environment["config"].collect {|o| "#{o}.js"},
29
- environment["models"].collect {|o| "app/models/#{o}.js"},
30
- environment["controllers"].collect {|o| "app/controllers/#{o}Controller.js"},
31
- environment["views"].collect {|o| o.collect {|dir, fileList| fileList.collect {|fileName| "app/views/#{dir}/#{fileName}.js"}.flatten}}.flatten
32
- ].each {|f| files.concat(f)}
33
-
34
- files
35
- end
36
-
37
- def self.css_files_for(environment)
38
- environment['stylesheets'].collect {|s| "public/stylesheets/#{s}.css"}
39
- end
40
-
41
- def self.mvc_development_environment
42
- environment = {}
43
-
44
- default = JSON::Parser.new(File.read('public/config/environment.json')).parse()
45
- development = JSON::Parser.new(File.read('public/config/environments/development.json')).parse()
46
-
47
- environment.merge!(default)
48
- environment.merge!(development)
49
-
50
- environment
51
- end
52
-
53
- def self.mvc_production_environment
54
- environment = {
55
- 'pluginsDir' => '../vendor/plugins',
56
- 'libDir' => '../lib',
57
- 'configDir' => '../config',
58
- 'overridesDir' => '../config/overrides',
59
- 'appDir' => '../app',
60
- 'vendor' => ['mvc'],
61
- 'mvcFilename' => 'ext-mvc-all-min',
62
- 'config' => ['app/App', 'config/routes'],
63
- 'stylesheets' => ['ext-all']
64
- }
65
-
66
- default = JSON::Parser.new(File.read('public/config/environment.json')).parse()
67
- production = JSON::Parser.new(File.read('public/config/environments/production.json')).parse()
68
-
69
- environment.merge!(default)
70
- environment.merge!(production)
71
-
72
- environment
73
- end
74
- end
75
- end
@@ -1,5 +0,0 @@
1
- module ExtJS
2
- module MVC
3
-
4
- end
5
- end
@@ -1,241 +0,0 @@
1
- module Ext
2
- module MVC
3
- module Stats
4
- def self.dispatch
5
- Statistics.new.output
6
- end
7
-
8
- class Statistics
9
-
10
- # Gathers and aggregates all project statistics
11
- def statistics
12
- @statistics ||= begin
13
- stats = {}
14
-
15
- # Calculate requested stats
16
- line_order.each do |line|
17
- stats[line] = array_statistics(self.send(line))
18
- end
19
-
20
- # Calculate totals
21
- stats[:total_code_loc] = project_code_arrays.inject(0) {|sum, e| sum + stats[e][:loc_count]}
22
- stats[:total_spec_loc] = project_spec_arrays.inject(0) {|sum, e| sum + stats[e][:loc_count]}
23
-
24
- stats
25
- end
26
- end
27
-
28
- # Prints statistics to the console
29
- def output
30
- print_headings
31
-
32
- line_order.each do |line_name|
33
- stats = statistics[line_name]
34
-
35
- arr = [line_headings[line_name]] + column_order.collect {|col| stats[col]}
36
- print_line(arr)
37
- end
38
-
39
- print_separator
40
- print_summary
41
- end
42
-
43
- # Prints a headings line based on column_order
44
- def print_headings
45
- puts
46
- print_separator
47
-
48
- columns = ["Name"];
49
- column_order.each {|heading| columns.push(column_headings[heading])}
50
- print_line(columns)
51
-
52
- print_separator
53
- end
54
-
55
- def print_totals
56
- # columns = ["Totals"]
57
- # column_order.collect {|c| statistics}
58
-
59
- # print_line(columns)
60
- end
61
-
62
- # Prints a summary line with total LOC
63
- def print_summary
64
- stats = [statistics[:total_code_loc], statistics[:total_spec_loc]]
65
- stats.push(stats[1].to_f / stats[0].to_f)
66
-
67
- puts " Code LOC: %s Test LOC: %s Code to Test Ratio: 1:%1.1f" % stats
68
- puts
69
- end
70
-
71
- # Prints a separator line
72
- def print_separator
73
- str = "+" + "-" * (title_width + 2)
74
-
75
- column_order.length.times do
76
- str += "+" + "-" * (column_width + 2)
77
- end
78
-
79
- puts str + '+'
80
- end
81
-
82
- # Prints an array of string as a line
83
- def print_line(line_elements)
84
- str = "| "
85
-
86
- line_elements.each_with_index do |element, index|
87
- if index == 0
88
- str += element.to_s.ljust(title_width) + " | "
89
- else
90
- str += element.to_s.rjust(column_width) + " | "
91
- end
92
- end
93
-
94
- puts str
95
- end
96
-
97
- # Calculates the width of the first column. Elements will be padded to this width
98
- def title_width
99
- line_headings.values.collect {|l| l.to_s.length}.max + 8
100
- end
101
-
102
- # Calculates the width of all columns but the first. Elements will be padded to this width
103
- def column_width
104
- column_headings.values.collect {|l| l.to_s.length}.max + 2
105
- end
106
-
107
- # The statistics columns to show, in order
108
- def column_order
109
- [:line_count, :loc_count, :file_count, :class_length]
110
- end
111
-
112
- # The lines to show, in order
113
- def line_order
114
- [:controller_files, :model_files, :view_files, :lib_files, :controller_specs, :model_specs, :view_specs]
115
- end
116
-
117
- # The arrays to use when calculating totals for project LOC etc
118
- def project_code_arrays
119
- [:controller_files, :model_files, :view_files, :lib_files]
120
- end
121
-
122
- # The arrays to use when calculating totals for project spec LOC etc
123
- def project_spec_arrays
124
- [:controller_specs, :model_specs, :view_specs]
125
- end
126
-
127
- # Mappings between method and human names for line headings
128
- def line_headings
129
- {
130
- :controller_files => "Controllers",
131
- :model_files => "Models",
132
- :view_files => "Views",
133
- :lib_files => "Libraries",
134
- :plugin_files => "Plugins",
135
- :controller_specs => "Controller Specs",
136
- :model_specs => "Model Specs",
137
- :view_specs => "View Specs"
138
- }
139
- end
140
-
141
- # Mappings between method and human names for column headings
142
- def column_headings
143
- {
144
- :line_count => "Lines",
145
- :loc_count => "LOC",
146
- :file_count => "Classes",
147
- :method_count => "Methods",
148
- :average_methods => "M/C",
149
- :method_length => "LOC/M",
150
- :class_length => "LOC/C"
151
- }
152
- end
153
-
154
- def controller_files
155
- files_in('app/controllers') + ['app/App.js']
156
- end
157
-
158
- def model_files
159
- files_in('app/models')
160
- end
161
-
162
- def view_files
163
- files_in('app/views')
164
- end
165
-
166
- def lib_files
167
- files_in('lib')
168
- end
169
-
170
- def plugin_files
171
- files_in('vendor/plugins')
172
- end
173
-
174
- def controller_specs
175
- files_in('spec/controllers')
176
- end
177
-
178
- def model_specs
179
- files_in('spec/models')
180
- end
181
-
182
- def view_specs
183
- files_in('spec/views')
184
- end
185
-
186
- private
187
- def files_in(directory)
188
- Dir.glob("#{directory}/**/*.js")
189
- end
190
-
191
- #calculates aggregated statistics for an array of files
192
- def array_statistics(files_array)
193
- file_count = 0; line_count = 0; loc_count = 0;
194
-
195
- files_array.collect {|f| file_statistics(f)}.each do |stats|
196
- file_count += 1
197
- line_count += stats[:line_count]
198
- loc_count += stats[:loc_count]
199
- end
200
-
201
- {
202
- :file_count => file_count,
203
- :line_count => line_count,
204
- :loc_count => loc_count,
205
- :class_length => file_count == 0 ? 0 : loc_count / file_count
206
- }
207
- end
208
-
209
- #calculates statistics on a given file
210
- def file_statistics(filename)
211
- line_count = 0; loc_count = 0;
212
-
213
- File.new(filename, 'r').each_line do |line|
214
- line.strip!
215
- line_count += 1
216
-
217
- # don't count blank lines or comment lines in LOC
218
- loc_count += 1 if line.gsub(/[\/\*\s]/i, "").length > 1 && line.match(/^\/\//).nil?
219
- end
220
-
221
- {:line_count => line_count, :loc_count => loc_count}
222
- end
223
- end
224
- end
225
- end
226
-
227
- # +----------------------+-------+-------+---------+---------+-----+-------+
228
- # | Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
229
- # +----------------------+-------+-------+---------+---------+-----+-------+
230
- # | Controllers | 1479 | 1172 | 26 | 152 | 5 | 5 |
231
- # | Helpers | 113 | 47 | 0 | 6 | 0 | 5 |
232
- # | Models | 1239 | 869 | 32 | 93 | 2 | 7 |
233
- # | Libraries | 609 | 367 | 2 | 54 | 27 | 4 |
234
- # | Model specs | 1361 | 989 | 0 | 3 | 0 | 327 |
235
- # | Controller specs | 3372 | 2319 | 1 | 73 | 73 | 29 |
236
- # | Helper specs | 159 | 148 | 0 | 0 | 0 | 0 |
237
- # +----------------------+-------+-------+---------+---------+-----+-------+
238
- # | Total | 8332 | 5911 | 61 | 381 | 6 | 13 |
239
- # +----------------------+-------+-------+---------+---------+-----+-------+
240
- # Code LOC: 2455 Test LOC: 3456 Code to Test Ratio: 1:1.4
241
- end
@@ -1,11 +0,0 @@
1
- module ExtJS
2
- module MVC
3
- class Test
4
- def self.dispatch
5
- environment = ExtMVC.mvc_production_environment
6
-
7
- system("rackup vendor/mvc/scripts/testserver.ru -p 5000")
8
- end
9
- end
10
- end
11
- end