lanes 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +7 -0
  3. data/Gemfile +2 -2
  4. data/client/lanes/components/Base.coffee +12 -11
  5. data/client/lanes/components/enabled.js.erb +1 -1
  6. data/client/lanes/components/grid/Editor.coffee +2 -2
  7. data/client/lanes/components/grid/Grid.coffee +60 -58
  8. data/client/lanes/components/grid/PopOverEditor.coffee +3 -3
  9. data/client/lanes/components/grid/RowEditor.coffee +1 -1
  10. data/client/lanes/components/grid/{grid.scss → _index.scss} +0 -0
  11. data/client/lanes/components/grid/template.html +1 -1
  12. data/client/lanes/components/modal/ModalDialog.coffee +1 -1
  13. data/client/lanes/components/modal/{modal.scss → _index.scss} +1 -1
  14. data/client/lanes/components/modal/index.js +1 -1
  15. data/client/lanes/components/popover/PopOver.coffee +1 -1
  16. data/client/lanes/components/popover/_index.scss +1 -0
  17. data/client/lanes/components/popover/index.js +1 -1
  18. data/client/lanes/components/select_field/{select_field.scss → _index.scss} +0 -0
  19. data/client/lanes/extension/Extensions.coffee +3 -2
  20. data/client/lanes/lib/Templates.coffee +7 -0
  21. data/client/lanes/minimal.js +1 -1
  22. data/client/lanes/minimal.scss.erb +1 -1
  23. data/client/lanes/models/Base.coffee +16 -19
  24. data/client/lanes/models/Bootstrap.coffee +1 -2
  25. data/client/lanes/models/Collection.coffee +37 -25
  26. data/client/lanes/models/Screens.coffee +6 -18
  27. data/client/lanes/models/Sync.coffee +12 -5
  28. data/client/lanes/screens/Base.coffee +1 -2
  29. data/client/lanes/screens/Instance.coffee +2 -5
  30. data/client/lanes/screens/screen-definitions.js.erb +10 -2
  31. data/client/{styles → lanes/styles}/components/all.scss +0 -0
  32. data/client/{styles → lanes/styles}/components/changes-notification.scss +0 -0
  33. data/client/{styles → lanes/styles}/components/record-finder.scss +0 -0
  34. data/client/{styles → lanes/styles}/components/suggest.scss +0 -0
  35. data/client/{styles → lanes/styles}/fonts/icomoon.eot +0 -0
  36. data/client/{styles → lanes/styles}/fonts/icomoon.svg +0 -0
  37. data/client/{styles → lanes/styles}/fonts/icomoon.ttf +0 -0
  38. data/client/{styles → lanes/styles}/fonts/icomoon.woff +0 -0
  39. data/client/{styles → lanes/styles}/fonts/selection.json +0 -0
  40. data/client/{styles → lanes/styles}/fonts/style.scss +0 -0
  41. data/client/{styles → lanes/styles}/fonts.scss +5 -5
  42. data/client/{styles → lanes/styles}/forms.scss +0 -0
  43. data/client/{styles → lanes/styles}/index.css +0 -0
  44. data/client/{styles → lanes/styles}/keybindings.scss +0 -0
  45. data/client/{styles → lanes/styles}/layout.scss +0 -0
  46. data/client/{styles → lanes/styles}/plugins/all.scss +0 -0
  47. data/client/{styles → lanes/styles}/plugins/overlay.scss +0 -0
  48. data/client/{styles → lanes/styles}/plugins/resize-sensor.scss +0 -0
  49. data/client/{styles → lanes/styles}/screens.scss +0 -0
  50. data/client/{styles → lanes/styles}/tabs.scss +0 -0
  51. data/client/{styles → lanes/styles}/vendor/bootstrap/_alerts.scss +0 -0
  52. data/client/{styles → lanes/styles}/vendor/bootstrap/_badges.scss +0 -0
  53. data/client/{styles → lanes/styles}/vendor/bootstrap/_breadcrumbs.scss +0 -0
  54. data/client/{styles → lanes/styles}/vendor/bootstrap/_button-groups.scss +0 -0
  55. data/client/{styles → lanes/styles}/vendor/bootstrap/_buttons.scss +0 -0
  56. data/client/{styles → lanes/styles}/vendor/bootstrap/_carousel.scss +0 -0
  57. data/client/{styles → lanes/styles}/vendor/bootstrap/_close.scss +0 -0
  58. data/client/{styles → lanes/styles}/vendor/bootstrap/_code.scss +0 -0
  59. data/client/{styles → lanes/styles}/vendor/bootstrap/_component-animations.scss +0 -0
  60. data/client/{styles → lanes/styles}/vendor/bootstrap/_dropdowns.scss +0 -0
  61. data/client/{styles → lanes/styles}/vendor/bootstrap/_forms.scss +0 -0
  62. data/client/{styles → lanes/styles}/vendor/bootstrap/_glyphicons.scss +0 -0
  63. data/client/{styles → lanes/styles}/vendor/bootstrap/_grid.scss +0 -0
  64. data/client/{styles → lanes/styles}/vendor/bootstrap/_input-groups.scss +0 -0
  65. data/client/{styles → lanes/styles}/vendor/bootstrap/_jumbotron.scss +0 -0
  66. data/client/{styles → lanes/styles}/vendor/bootstrap/_labels.scss +0 -0
  67. data/client/{styles → lanes/styles}/vendor/bootstrap/_list-group.scss +0 -0
  68. data/client/{styles → lanes/styles}/vendor/bootstrap/_media.scss +0 -0
  69. data/client/{styles → lanes/styles}/vendor/bootstrap/_mixins.scss +0 -0
  70. data/client/{styles → lanes/styles}/vendor/bootstrap/_modals.scss +0 -0
  71. data/client/{styles → lanes/styles}/vendor/bootstrap/_navbar.scss +0 -0
  72. data/client/{styles → lanes/styles}/vendor/bootstrap/_navs.scss +0 -0
  73. data/client/{styles → lanes/styles}/vendor/bootstrap/_normalize.scss +0 -0
  74. data/client/{styles → lanes/styles}/vendor/bootstrap/_pager.scss +0 -0
  75. data/client/{styles → lanes/styles}/vendor/bootstrap/_pagination.scss +0 -0
  76. data/client/{styles → lanes/styles}/vendor/bootstrap/_panels.scss +0 -0
  77. data/client/{styles → lanes/styles}/vendor/bootstrap/_popovers.scss +0 -0
  78. data/client/{styles → lanes/styles}/vendor/bootstrap/_print.scss +0 -0
  79. data/client/{styles → lanes/styles}/vendor/bootstrap/_progress-bars.scss +0 -0
  80. data/client/{styles → lanes/styles}/vendor/bootstrap/_responsive-embed.scss +0 -0
  81. data/client/{styles → lanes/styles}/vendor/bootstrap/_responsive-utilities.scss +0 -0
  82. data/client/{styles → lanes/styles}/vendor/bootstrap/_scaffolding.scss +0 -0
  83. data/client/{styles → lanes/styles}/vendor/bootstrap/_tables.scss +0 -0
  84. data/client/{styles → lanes/styles}/vendor/bootstrap/_theme.scss +0 -0
  85. data/client/{styles → lanes/styles}/vendor/bootstrap/_thumbnails.scss +0 -0
  86. data/client/{styles → lanes/styles}/vendor/bootstrap/_tooltip.scss +0 -0
  87. data/client/{styles → lanes/styles}/vendor/bootstrap/_type.scss +0 -0
  88. data/client/{styles → lanes/styles}/vendor/bootstrap/_utilities.scss +0 -0
  89. data/client/{styles → lanes/styles}/vendor/bootstrap/_variables.scss +0 -0
  90. data/client/{styles → lanes/styles}/vendor/bootstrap/_wells.scss +0 -0
  91. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_alerts.scss +0 -0
  92. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_background-variant.scss +0 -0
  93. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_border-radius.scss +0 -0
  94. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_buttons.scss +0 -0
  95. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_center-block.scss +0 -0
  96. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_clearfix.scss +0 -0
  97. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_forms.scss +0 -0
  98. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_gradients.scss +0 -0
  99. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_grid-framework.scss +0 -0
  100. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_grid.scss +0 -0
  101. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_hide-text.scss +0 -0
  102. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_image.scss +0 -0
  103. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_labels.scss +0 -0
  104. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_list-group.scss +0 -0
  105. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_nav-divider.scss +0 -0
  106. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_nav-vertical-align.scss +0 -0
  107. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_opacity.scss +0 -0
  108. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_pagination.scss +0 -0
  109. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_panels.scss +0 -0
  110. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_progress-bar.scss +0 -0
  111. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_reset-filter.scss +0 -0
  112. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_resize.scss +0 -0
  113. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_responsive-visibility.scss +0 -0
  114. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_size.scss +0 -0
  115. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_tab-focus.scss +0 -0
  116. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_table-row.scss +0 -0
  117. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_text-emphasis.scss +0 -0
  118. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_text-overflow.scss +0 -0
  119. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_vendor-prefixes.scss +0 -0
  120. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_alerts.scss +0 -0
  121. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_badges.scss +0 -0
  122. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_breadcrumbs.scss +0 -0
  123. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_button-groups.scss +0 -0
  124. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_buttons.scss +0 -0
  125. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_carousel.scss +0 -0
  126. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_close.scss +0 -0
  127. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_code.scss +0 -0
  128. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_component-animations.scss +0 -0
  129. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_dropdowns.scss +0 -0
  130. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_forms.scss +0 -0
  131. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_glyphicons.scss +0 -0
  132. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_grid.scss +0 -0
  133. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_input-groups.scss +0 -0
  134. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_jumbotron.scss +0 -0
  135. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_labels.scss +0 -0
  136. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_list-group.scss +0 -0
  137. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_media.scss +0 -0
  138. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_mixins.scss +0 -0
  139. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_modals.scss +0 -0
  140. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_navbar.scss +0 -0
  141. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_navs.scss +0 -0
  142. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_normalize.scss +0 -0
  143. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_pager.scss +0 -0
  144. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_pagination.scss +0 -0
  145. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_panels.scss +0 -0
  146. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_popovers.scss +0 -0
  147. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_print.scss +0 -0
  148. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_progress-bars.scss +0 -0
  149. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_responsive-embed.scss +0 -0
  150. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_responsive-utilities.scss +0 -0
  151. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_scaffolding.scss +0 -0
  152. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_tables.scss +0 -0
  153. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_theme.scss +0 -0
  154. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_thumbnails.scss +0 -0
  155. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_tooltip.scss +0 -0
  156. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_type.scss +0 -0
  157. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_utilities.scss +0 -0
  158. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_variables.scss +0 -0
  159. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_wells.scss +0 -0
  160. data/client/{styles → lanes/styles}/vendor/bootstrap/old/bootstrap.scss +0 -0
  161. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_alerts.scss +0 -0
  162. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_background-variant.scss +0 -0
  163. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_border-radius.scss +0 -0
  164. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_buttons.scss +0 -0
  165. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_center-block.scss +0 -0
  166. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_clearfix.scss +0 -0
  167. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_forms.scss +0 -0
  168. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_gradients.scss +0 -0
  169. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_grid-framework.scss +0 -0
  170. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_grid.scss +0 -0
  171. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_hide-text.scss +0 -0
  172. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_image.scss +0 -0
  173. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_labels.scss +0 -0
  174. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_list-group.scss +0 -0
  175. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_nav-divider.scss +0 -0
  176. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_nav-vertical-align.scss +0 -0
  177. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_opacity.scss +0 -0
  178. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_pagination.scss +0 -0
  179. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_panels.scss +0 -0
  180. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_progress-bar.scss +0 -0
  181. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_reset-filter.scss +0 -0
  182. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_resize.scss +0 -0
  183. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_responsive-visibility.scss +0 -0
  184. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_size.scss +0 -0
  185. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_tab-focus.scss +0 -0
  186. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_table-row.scss +0 -0
  187. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_text-emphasis.scss +0 -0
  188. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_text-overflow.scss +0 -0
  189. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_vendor-prefixes.scss +0 -0
  190. data/client/{styles → lanes/styles}/vendor/bootstrap-custom-grid.scss +0 -0
  191. data/client/{styles → lanes/styles}/vendor/bootstrap-custom-modals.scss +0 -0
  192. data/client/{styles → lanes/styles}/vendor/bootstrap.scss +2 -2
  193. data/client/{styles → lanes/styles}/vendor/dataTables.scss +0 -0
  194. data/client/lanes/views/Base.coffee +34 -49
  195. data/client/lanes/views/FormBindings.coffee +22 -20
  196. data/client/lanes/views/Helpers.coffee +1 -1
  197. data/client/lanes/views/empty-span.html +1 -0
  198. data/client/lanes/workspace/ActiveScreensSwitcher.coffee +8 -1
  199. data/client/lanes/workspace/Layout.coffee +7 -4
  200. data/client/lanes/workspace/Navbar.coffee +6 -2
  201. data/client/lanes/workspace/Pages.coffee +5 -1
  202. data/client/lanes/workspace/ScreensMenu.coffee +14 -2
  203. data/client/lanes/workspace/WorkspaceView.coffee +5 -0
  204. data/client/lanes/workspace/index.js +1 -0
  205. data/client/lanes/workspace.scss.erb +6 -1
  206. data/lanes.gemspec +1 -1
  207. data/lib/lanes/api/controller.rb +5 -7
  208. data/lib/lanes/api/helper_methods.rb +1 -1
  209. data/lib/lanes/api/javascript_processor.rb +3 -2
  210. data/lib/lanes/command/app.rb +8 -4
  211. data/lib/lanes/command/generate_model.rb +13 -11
  212. data/lib/lanes/command/generate_screen.rb +9 -2
  213. data/lib/lanes/command/generate_view.rb +15 -3
  214. data/lib/lanes/command/generate_view.usage +7 -7
  215. data/lib/lanes/command/named_command.rb +2 -2
  216. data/lib/lanes/command/templates/client/index.js +3 -0
  217. data/lib/lanes/command/templates/client/models/BaseModel.coffee +5 -0
  218. data/lib/lanes/command/templates/client/models/Model.coffee +1 -1
  219. data/lib/lanes/command/templates/client/views/BaseView.coffee +5 -0
  220. data/lib/lanes/command/templates/client/views/View.coffee +1 -1
  221. data/lib/lanes/command/templates/config/screen.rb +8 -0
  222. data/lib/lanes/command/templates/lib/namespace/base_model.rb +9 -0
  223. data/lib/lanes/command/templates/lib/namespace/model.rb +1 -1
  224. data/lib/lanes/command/templates/spec/client/models/ModelSpec.coffee +1 -1
  225. data/lib/lanes/command/templates/spec/client/views/ViewSpec.coffee +1 -1
  226. data/lib/lanes/command.rb +1 -2
  227. data/lib/lanes/components.rb +5 -4
  228. data/lib/lanes/concerns/all.rb +0 -5
  229. data/lib/lanes/concerns/attr_accessor_with_default.rb +5 -3
  230. data/lib/lanes/concerns/set_attribute_data.rb +6 -23
  231. data/lib/lanes/configuration.rb +1 -0
  232. data/lib/lanes/extension.rb +19 -10
  233. data/lib/lanes/guard_tasks.rb +1 -1
  234. data/lib/lanes/model.rb +1 -6
  235. data/lib/lanes/{screens.rb → screen.rb} +40 -23
  236. data/lib/lanes/spec_helper.rb +4 -2
  237. data/lib/lanes/version.rb +1 -1
  238. data/lib/lanes.rb +1 -1
  239. data/spec/api/javascript_processor_spec.rb +3 -3
  240. data/spec/command_spec.rb +49 -0
  241. data/spec/concerns/attr_accessor_with_default_spec.rb +7 -0
  242. data/spec/helpers/lanes-helpers.coffee +46 -22
  243. data/spec/helpers/minitest_assertions.rb +23 -0
  244. data/spec/lanes/models/BaseSpec.coffee +57 -56
  245. data/spec/lanes/models/CollectionSpec.coffee +14 -0
  246. data/spec/lanes/models/PubSubSpec.coffee +5 -5
  247. data/spec/lanes/views/BaseSpec.coffee +32 -31
  248. data/spec/lanes/views/FormBindingsSpec.coffee +32 -0
  249. metadata +183 -179
  250. data/client/lanes/components/popover/popover.scss +0 -1
  251. data/lib/lanes/command/templates/lib/namespace/screen.rb +0 -17
  252. data/lib/lanes/concerns/code_identifier.rb +0 -43
  253. data/lib/lanes/concerns/immutable_model.rb +0 -32
  254. data/lib/lanes/concerns/locked_fields.rb +0 -84
  255. data/lib/lanes/concerns/random_hash_code.rb +0 -40
  256. data/lib/lanes/concerns/visible_id_identifier.rb +0 -53
  257. data/spec/concerns/code_identifier_spec.rb +0 -45
@@ -19,14 +19,21 @@ module Lanes
19
19
  end
20
20
 
21
21
  def create_screen
22
- template "lib/namespace/screen.rb", "lib/#{namespace}/#{name}_screen.rb"
23
22
  template "client/screens/index.js", "#{client_dir}/screens/#{name}/index.js"
24
23
  template "client/screens/styles.scss", "#{client_dir}/screens/#{name}/index.scss"
25
- template "client/screens/Screen.coffee", "#{client_dir}/screens/#{name}/#{class_name}.coffee"
24
+ template "client/screens/Screen.coffee",
25
+ "#{client_dir}/screens/#{name}/#{class_name}.coffee"
26
26
  template "client/screens/layout.html", "#{client_dir}/screens/#{name}/layout.html"
27
27
  template "spec/client/Screen.coffee", "#{spec_dir}/screens/#{class_name}.coffee"
28
28
  end
29
29
 
30
+ def add_definition
31
+ insert_into_file "config/screens.rb", after: "" do
32
+ source = File.expand_path(find_in_source_paths("config/screen.rb"))
33
+ ERB.new(::File.binread(source), nil, "-","@output_buffer").result(binding)
34
+ end
35
+
36
+ end
30
37
  end
31
38
  end
32
39
  end
@@ -5,17 +5,29 @@ module Lanes
5
5
 
6
6
  class GenerateView < NamedCommand
7
7
  OPTIONS ||= {
8
- namespace: nil
8
+ namespace: nil,
9
+ screen: 'global'
9
10
  }
10
11
  class_options( OPTIONS )
11
12
 
13
+ # desc "foo bar"
14
+ # option :from, :required => true
15
+
12
16
  def create_screen
13
- template "client/views/View.coffee", "#{client_dir}/views/#{name.classify}.coffee"
14
- template "client/views/template.html", "#{client_dir}/views/#{name.dasherize}.html"
17
+ template "client/views/View.coffee", "#{client_dir}/#{name.classify}.coffee"
15
18
  template "spec/client/views/ViewSpec.coffee", \
16
19
  "#{spec_dir}/views/#{class_name}Spec.coffee"
17
20
  end
18
21
 
22
+ private
23
+
24
+ def client_dir
25
+ if options[:screen] == 'global'
26
+ "client/#{namespace}/views"
27
+ else
28
+ "client/#{namespace}/screens/#{options[:screen].dasherize}"
29
+ end
30
+ end
19
31
  end
20
32
 
21
33
  end
@@ -1,13 +1,13 @@
1
1
  Stubs out a new View. Pass the view name, either CamelCased or
2
2
  under_scored
3
3
 
4
- When executed inside a project called "Blog":
4
+ When executed inside a project called "Blog":
5
5
 
6
- `lanes generate view comment`
6
+ `lanes generate view comment`
7
7
 
8
- Lanes will create:
9
-
10
- Client View: client/view/Comment.coffee
11
- Template: client/view/comment.html
12
- Spec: spec/client/view/CommentSpec.coffee
8
+ Lanes will create:
9
+ ····················
13
10
 
11
+ * View: client/views/Comment.coffee
12
+ * Template: client/views/comment.html
13
+ * Spec: spec/<app>/views/CommentSpec.coffee
@@ -18,8 +18,8 @@ module Lanes
18
18
  end
19
19
 
20
20
  def set_variables
21
- @class_name = name.classify
22
- @spec_dir = "spec/#{namespace}"
21
+ @class_name = name.underscore.classify
22
+ @spec_dir = "spec/#{namespace}"
23
23
  @client_dir = "client/#{namespace}"
24
24
  end
25
25
 
@@ -1,6 +1,9 @@
1
+ //=require ./models/Base
2
+ //=require ./views/Base
1
3
  //=require_tree ./models
2
4
  //=require_tree ./views
3
5
  //=require_tree ./components
6
+ //=require ./screens/Base
4
7
  //=require ./Extension
5
8
 
6
9
  /*
@@ -0,0 +1,5 @@
1
+ # All models in <%= namespace.camelize %> will inherit from
2
+ # this common base class.
3
+ class <%= namespace.camelize %>.Models.<%= class_name %> extends Lanes.Models.Base
4
+
5
+ constructor: -> super
@@ -1,4 +1,4 @@
1
- class <%= namespace.camelize %>.Models.<%= class_name %> extends <%= client_parent %>
1
+ class <%= namespace.camelize %>.Models.<%= class_name %> extends <%= namespace.camelize %>.Models.Base
2
2
 
3
3
  api_path: '<%= name.downcase.pluralize.underscore.dasherize %>'
4
4
  FILE: FILE
@@ -0,0 +1,5 @@
1
+ # All views in <%= namespace.camelize %> will inherit from
2
+ # this common base class.
3
+ class <%= namespace.classify %>.Views.Base extends Lanes.Views.Base
4
+
5
+ constructor: -> super
@@ -1,4 +1,4 @@
1
- class <%= namespace.classify %>.Views.<%= class_name %> extends Lanes.Views.Base
1
+ class <%= namespace.classify %>.Views.<%= class_name %> extends <%= namespace.classify %>.Views.Base
2
2
 
3
3
  FILE: FILE
4
4
 
@@ -0,0 +1,8 @@
1
+ Lanes::Screen.define "<%= name.dasherize %>" do | screen |
2
+ screen.description = "<%= options[:description] %>"
3
+ screen.icon = "<%= options[:icon] %>"
4
+ screen.group_id = "<%= options[:group] %>"
5
+ screen.model_class = "<%= options[:model_class] %>"
6
+ screen.view_class = "<%= namespace.camelize %>.Screens.<%= class_name %>"
7
+ screen.files = ["<%= namespace %>/screens/<%= name.dasherize %>.js","<%= namespace %>/screens/<%= name.dasherize %>.css"]
8
+ end
@@ -0,0 +1,9 @@
1
+ module <%= namespace.camelize %>
2
+
3
+ # All models in <%= namespace.camelize %> will inherit from
4
+ # this common base class.
5
+ class Model < Lanes::Model
6
+
7
+ end
8
+
9
+ end
@@ -1,6 +1,6 @@
1
1
  module <%= namespace.camelize %>
2
2
 
3
- class <%= class_name %> < <%= options[:parent] %>
3
+ class <%= class_name %> < Model
4
4
 
5
5
  end
6
6
 
@@ -1,4 +1,4 @@
1
- describe "<%= class_name %> Model Suite", ->
1
+ describe "<%= namespace.camelize %>.Models.<%= class_name %>", ->
2
2
 
3
3
  it "can be instantiated", ->
4
4
  model = new <%= namespace.camelize %>.Models.<%= class_name %>()
@@ -1,4 +1,4 @@
1
- describe "<%= class_name %> View Suite", ->
1
+ describe "<%= namespace.camelize %>.Views.<%= class_name %>", ->
2
2
 
3
3
  it "can be instantiated", ->
4
4
  view = new <%= namespace.camelize %>.Views.<%= class_name %>()
data/lib/lanes/command.rb CHANGED
@@ -8,7 +8,7 @@ module Lanes
8
8
  # internally by commands to populate their long_desc
9
9
  # @param [String] basename of file to read usage from
10
10
  def usage_from_file(file)
11
- Pathname.new(__FILE__).dirname.join("command","#{file}.usage").read
11
+ Pathname.new(__FILE__).dirname.join("command","#{file}.usage").read.gsub(/\n/,"\n\x5")
12
12
  end
13
13
 
14
14
  # Loads the code for the extension that the user is currently
@@ -19,7 +19,6 @@ module Lanes
19
19
  #
20
20
  # @return [Extension] extension that was loaded, nil if none was found
21
21
  def load_current_extension(raise_on_fail:false)
22
-
23
22
  previous = Extensions.all
24
23
  ext = Dir.glob("./lib/*/extension.rb").first
25
24
  if ext
@@ -1,4 +1,3 @@
1
- require 'pry'
2
1
  module Lanes
3
2
 
4
3
  module Components
@@ -20,8 +19,10 @@ module Lanes
20
19
  # Requires the enabled components and all of their dependencies
21
20
  def enabled_with_dependencies(env, &block)
22
21
  enabled do | component |
23
- depends = component_configuration(component, env.environment)['depends']
24
- depends.each{ |d| yield d } if depends
22
+ config = component_configuration(component, env.environment)
23
+ if config['depends']
24
+ config['depends'].each{ |d| yield d }
25
+ end
25
26
  yield component
26
27
  end
27
28
  end
@@ -30,7 +31,7 @@ module Lanes
30
31
  # @return Hash configuration for component, read from a config.json file in the components directory,
31
32
  # or an empty hash if no configuration is present
32
33
  def component_configuration(component, env)
33
- if asset = env.find_asset("components/#{component}")
34
+ if asset = env.find_asset("lanes/components/#{component}")
34
35
  config_file = asset.pathname.dirname.join("config.json")
35
36
  if config_file.exist?
36
37
  return Oj.load(config_file.read)
@@ -1,16 +1,11 @@
1
1
  require_relative "api_path"
2
2
  require_relative "association_extensions"
3
3
  require_relative "attr_accessor_with_default"
4
- require_relative "code_identifier"
5
4
  require_relative "export_associations"
6
5
  require_relative "export_join_tables"
7
6
  require_relative "export_methods"
8
7
  require_relative "export_scope"
9
- require_relative "immutable_model"
10
8
  require_relative "set_attribute_data"
11
- require_relative "locked_fields"
12
9
  require_relative "pub_sub"
13
10
  require_relative "queries"
14
- require_relative "random_hash_code"
15
- require_relative "visible_id_identifier"
16
11
  require_relative "sanitize_fields"
@@ -41,16 +41,18 @@ module Lanes::Concerns
41
41
  end
42
42
  end
43
43
  end
44
+
44
45
  def attr_reader_with_default( name, default )
45
46
  module_eval do
46
47
  define_method( name ) do
47
48
  class << self; self; end.class_eval do
48
49
  attr_reader( name )
49
50
  end
50
- if instance_variables.include? "@#{name}"
51
- instance_variable_get( "@#{name}" )
51
+ instance_var = "@#{name.to_s}".to_sym
52
+ if instance_variable_defined?(instance_var)
53
+ instance_variable_get(instance_var)
52
54
  else
53
- instance_variable_set( "@#{name}", default.is_a?(Proc) ? default.call : default )
55
+ instance_variable_set(instance_var, default.is_a?(Proc) ? default.call : default )
54
56
  end
55
57
  end
56
58
  end
@@ -101,13 +101,12 @@ module Lanes::Concerns
101
101
  next unless self.class.has_exported_nested_attribute?(name, user)
102
102
 
103
103
  association = self.association(name)
104
-
105
- result[name] = if value.is_a?(Hash) && [:belongs_to,:has_one].include?(association.reflection.macro)
106
- target = association.target || association.build
107
- target.set_attribute_data(value, user)
108
- elsif value.is_a?(Array) && :has_many == association.reflection.macro
109
- _set_attribute_data_from_collection(association, value, user)
110
- end
104
+ if value.is_a?(Hash) && [:belongs_to,:has_one].include?(association.reflection.macro)
105
+ target = association.target || association.build
106
+ result[name] = target.set_attribute_data(value, user)
107
+ elsif value.is_a?(Array) && :has_many == association.reflection.macro
108
+ result[name] = _set_attribute_data_from_collection(association, value, user)
109
+ end
111
110
  end
112
111
  end
113
112
  end
@@ -133,22 +132,6 @@ module Lanes::Concerns
133
132
  end
134
133
  end
135
134
 
136
-
137
- # association = self.send(name)
138
-
139
- # klass_name = self.class.reflections[ name.to_sym ].class_name
140
- # klass = klass_name.safe_constantize || "Lanes::#{klass_name}".constantize
141
-
142
- # # only Hash, Array & nil is valid for nesting attributes
143
- # cleaned = case value
144
- # when Hash then klass.sanitize_api_data( value, user, klass )
145
- # when Array then value.map{ | nested |
146
- # klass.sanitize_api_data( nested, user, klass )
147
- # }
148
- # else
149
- # nil
150
- # end
151
- # result[ name.to_sym ] = cleaned unless cleaned.blank?
152
135
  end
153
136
 
154
137
  end
@@ -68,6 +68,7 @@ module Lanes
68
68
  config_option :assets_path_prefix, "/assets"
69
69
  config_option :mounted_at, ''
70
70
  config_option :root_view, 'Lanes.Workspace.Layout'
71
+ config_option :initial_workspace_screen_id, ''
71
72
  config_option :specs_root, Pathname.getwd
72
73
  end
73
74
 
@@ -45,7 +45,7 @@ module Lanes
45
45
  def client_paths
46
46
  [ root_path.join('client') ]
47
47
  end
48
-
48
+
49
49
  def client_images
50
50
  images = []
51
51
  root_path.join('client','images').find{|path| images << path if path.file? }
@@ -58,10 +58,20 @@ module Lanes
58
58
  require routes_config
59
59
  end
60
60
  end
61
+
61
62
  end
62
63
 
63
64
  class << self
64
65
 
66
+ def load_screens
67
+ each do | ext |
68
+ screens_config = ext.root_path.join('config','screens.rb')
69
+ if screens_config.exist?
70
+ require screens_config
71
+ end
72
+ end
73
+ end
74
+
65
75
  def load_after(extension)
66
76
  self.after = extension
67
77
  end
@@ -77,7 +87,7 @@ module Lanes
77
87
  def require_workspace?
78
88
  all.detect{|ext| ext.uses_workspace }
79
89
  end
80
-
90
+
81
91
  def require_pub_sub?
82
92
  all.detect{|ext| ext.uses_pub_sub }
83
93
  end
@@ -120,11 +130,12 @@ module Lanes
120
130
 
121
131
  def client_bootstrap_data(view)
122
132
  data = {
123
- csrf_token: Rack::Csrf.csrf_token(view.env),
124
- root_view: Lanes.config.root_view,
125
- api_path: Lanes.config.mounted_at,
126
- pub_sub: require_pub_sub?
127
- }
133
+ csrf_token: Rack::Csrf.csrf_token(view.env),
134
+ root_view: Lanes.config.root_view,
135
+ api_path: Lanes.config.mounted_at,
136
+ initial_workspace_screen_id: Lanes.config.initial_workspace_screen_id,
137
+ pub_sub: require_pub_sub?
138
+ }
128
139
  each do | ext |
129
140
  data[ext.identifier] = ext.client_bootstrap_data(view)
130
141
  end
@@ -134,7 +145,7 @@ module Lanes
134
145
  def client_images
135
146
  each{|ext| }
136
147
  end
137
-
148
+
138
149
  def load_current_config
139
150
  config_file = Pathname.getwd.join('config','lanes.rb')
140
151
  if config_file.exist?
@@ -146,6 +157,4 @@ module Lanes
146
157
 
147
158
  end
148
159
 
149
-
150
-
151
160
  end
@@ -23,7 +23,7 @@ module Lanes
23
23
 
24
24
  jasmine_options = options.merge({
25
25
  port: 8888, server_mount: '/spec', server_env: 'test', server: :puma,
26
- spec_dir: 'spec/client', console: :always, debug: false
26
+ spec_dir: "spec/#{app_name}", console: :always, debug: false
27
27
  })
28
28
 
29
29
  dsl.guard :jasmine, jasmine_options do
data/lib/lanes/model.rb CHANGED
@@ -8,11 +8,6 @@ module Lanes
8
8
 
9
9
  include Concerns::PubSub
10
10
  include Concerns::ApiAttributeAccess
11
- include Concerns::LockedFields
12
- include Concerns::CodeIdentifier
13
- include Concerns::RandomHashCode
14
- include Concerns::VisibleIdIdentifier
15
- include Concerns::ImmutableModel
16
11
  include Concerns::ExportMethods
17
12
  include Concerns::ExportScope
18
13
  include Concerns::ExportAssociations
@@ -20,7 +15,7 @@ module Lanes
20
15
  include Concerns::AssociationExtensions
21
16
  include Concerns::ApiPath
22
17
  include Concerns::SanitizeFields
23
-
18
+
24
19
  end
25
20
 
26
21
  end
@@ -1,18 +1,41 @@
1
1
  require 'yaml'
2
2
  require 'oj'
3
+ require 'pry'
3
4
 
4
5
  module Lanes
5
6
 
6
- module Screens
7
- class << self
7
+ module Screen
8
+ GROUPS=Hash.new{|h,k| g=Group.new; g.identifier=k; h[k]=g }
9
+ DEFINITIONS=Hash.new{|h,k| d=Definition.new; d.identifier=k; h[k]=d }
8
10
 
9
- def each_directory
10
- root = Pathname.new(__FILE__).dirname.join('../../assets/screens')
11
- root.each_child do | path |
12
- yield path if path.directory?
11
+ class << self
12
+ def [](config)
13
+ if DEFINITIONS.has_key?(config)
14
+ DEFINITIONS[config]
15
+ else
16
+ nil
13
17
  end
14
18
  end
15
19
 
20
+ def define(id)
21
+ definition = DEFINITIONS[id]
22
+ yield definition
23
+ end
24
+
25
+ def define_group(id)
26
+ group = GROUPS[id]
27
+ yield group
28
+ end
29
+
30
+ def each
31
+ Extensions.load_screens
32
+ DEFINITIONS.values.each{ | definition | yield definition }
33
+ end
34
+
35
+ def each_group
36
+ Extensions.load_screens
37
+ GROUPS.values.each{ | group | yield group }
38
+ end
16
39
  end
17
40
 
18
41
  class Group
@@ -23,14 +46,6 @@ module Lanes
23
46
  attr_accessor_with_default :description
24
47
  attr_accessor_with_default :icon
25
48
 
26
- def self.each(config)
27
- self.descendants.each{ |klass| yield klass.new(config) }
28
- end
29
-
30
- def initialize(sprockets)
31
- @sprockets=sprockets
32
- end
33
-
34
49
  def to_json
35
50
  Oj.dump({
36
51
  id: identifier,
@@ -51,14 +66,14 @@ module Lanes
51
66
  attr_accessor_with_default :group_id
52
67
  attr_accessor_with_default :view_class
53
68
  attr_accessor_with_default :model_class
54
- attr_accessor_with_default :files
55
-
56
- def self.each(config)
57
- self.descendants.each{ |klass| yield klass.new(config) }
58
- end
59
-
60
- def initialize(sprockets)
61
- @sprockets=sprockets
69
+ attr_accessor_with_default :js
70
+ attr_accessor_with_default :css
71
+
72
+ def assets
73
+ paths=[]
74
+ paths << "#{Lanes.config.assets_path_prefix}/#{js}" unless js.blank?
75
+ paths << "#{Lanes.config.assets_path_prefix}/#{css}" unless css.blank?
76
+ paths
62
77
  end
63
78
 
64
79
  def to_json
@@ -68,7 +83,9 @@ module Lanes
68
83
  icon: icon,
69
84
  model: model_class,
70
85
  view: view_class,
71
- files: files.map{ |f| "#{Lanes.config.assets_path_prefix}/#{f}"},
86
+ js: js,
87
+ css: css,
88
+ assets: assets,
72
89
  group_id: group_id,
73
90
  description: description
74
91
  }, mode: :compat)
@@ -6,19 +6,21 @@ require 'hashie/mash'
6
6
  require 'active_record'
7
7
  require 'active_record/fixtures'
8
8
  require 'minitest/around/unit'
9
+ require 'minitest/around/spec'
9
10
  require 'minitest/spec'
10
11
  require 'minitest/autorun'
11
12
  require 'mocha/mini_test'
12
13
 
13
14
  require_relative 'testing_models'
14
15
 
16
+
15
17
  RAILS_ENV = "test"
16
18
  I18n.enforce_available_locales = true
17
19
  Lanes::DB.establish_connection('test')
18
20
  Lanes.logger=Logger.new( File.open('log/test.log', File::WRONLY | File::APPEND | File::CREAT ))
19
21
  ActiveRecord::Base.logger = Lanes.logger
20
22
  ActiveSupport::Dependencies.mechanism = :require
21
-
23
+ ActiveSupport.test_order = :random
22
24
  module Lanes
23
25
 
24
26
  class DummyUser
@@ -32,7 +34,7 @@ module Lanes
32
34
  true
33
35
  end
34
36
  end
35
-
37
+
36
38
  class TestCase < ActiveSupport::TestCase
37
39
  include Lanes
38
40
  include ActiveRecordMocks::IncludeMe
data/lib/lanes/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Lanes
2
2
 
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.2"
4
4
 
5
5
  end
data/lib/lanes.rb CHANGED
@@ -17,4 +17,4 @@ require_relative "lanes/model"
17
17
 
18
18
  require_relative "lanes/components"
19
19
  require_relative "lanes/extension"
20
- require_relative "lanes/screens"
20
+ require_relative "lanes/screen"
@@ -95,7 +95,7 @@ Foo = (function() {
95
95
 
96
96
  Bar.extend(Foo);
97
97
 
98
- })(window.Lanes,(window.Lanes ? window.Lanes['Foo'] : null),window._, window,{namespace:(window.Lanes ? window.Lanes['Foo'] : null),extension:'Foo',file:'baz'});
98
+ })(window.Lanes,(window.Lanes ? window.Lanes['Foo'] : null),window._, window,{namespace:(window.Lanes ? window.Lanes['Foo'] : null),extensionName:'Foo',path:'baz'});
99
99
  EOS
100
100
 
101
101
  Scope = Struct.new(:logical_path)
@@ -103,8 +103,8 @@ Scope = Struct.new(:logical_path)
103
103
  def test_coffeescript_generation
104
104
  template = API::CoffeeScriptWrapper.new{ |t| SCRIPT }
105
105
  assert_equal CLEANED, template.cleaned
106
-
107
-
106
+
107
+
108
108
  assert_equal JS.chomp, template.render(Scope.new("foo/bar/baz"))
109
109
  end
110
110
  end
@@ -0,0 +1,49 @@
1
+ require "lanes/spec_helper"
2
+ require "lanes/cli"
3
+ require "find"
4
+ require_relative "helpers/minitest_assertions"
5
+
6
+ describe Lanes::Command do
7
+ let(:lanes) { Pathname.new(__FILE__).dirname.join('..','bin','lanes') }
8
+
9
+ around do |test|
10
+ Dir.mktmpdir do |dir|
11
+ @dir = dir
12
+ Dir.chdir(dir) do
13
+ `#{lanes} new test`
14
+ Dir.chdir("test") do
15
+ test.call
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ FILES = [
22
+ ".", ".gitignore", "Gemfile", "Guardfile", "Rakefile", "client",
23
+ "client/test", "client/test/Extension.coffee", "client/test/components",
24
+ "client/test/components/.gitkeep", "client/test/controllers",
25
+ "client/test/controllers/.gitkeep", "client/test/index.js", "client/test/models",
26
+ "client/test/models/.gitkeep", "client/test/models/Base.coffee", "client/test/screens",
27
+ "client/test/screens/.gitkeep", "client/test/screens/Base.coffee", "client/test/styles.scss",
28
+ "client/test/views", "client/test/views/.gitkeep", "client/test/views/Base.coffee", "config",
29
+ "config/database.yml", "config/lanes.rb", "config/routes.rb", "config/screens.rb",
30
+ "config.ru", "db", "db/.gitkeep", "lib", "lib/test", "lib/test/extension.rb",
31
+ "lib/test/model.rb", "lib/test/version.rb", "lib/test.rb", "tmp", "tmp/.gitkeep"]
32
+
33
+ it "generates an application" do
34
+ files = Find.find(".").to_a.map{|f| f.gsub(/^\.\//,'') }.sort
35
+ files.sort.must_equal FILES.sort
36
+ end
37
+
38
+ it "creates a view" do
39
+ assert_executes "#{lanes} generate view Test"
40
+ assert_match( /client\/test\/views\/Test.coffee/, last_cmd_execution_output )
41
+ assert_executes "#{lanes} generate view Testing --screen Base"
42
+ assert_match( /client\/test\/screens\/Base\/Testing.coffee/, last_cmd_execution_output )
43
+ end
44
+
45
+ it "creates a model" do
46
+ assert_executes "#{lanes} generate model Test"
47
+ assert_match( /client\/test\/models\/Test.coffee/, last_cmd_execution_output )
48
+ end
49
+ end
@@ -10,6 +10,7 @@ class AttrAccessorWithDefaultTest < Lanes::TestCase
10
10
  attr_accessor_with_default :non_copying, ->{ "default string" }
11
11
  attr_accessor_with_default :shared, Shared.new('default')
12
12
  attr_accessor_with_default :non_shared, ->{ Shared.new('default') }
13
+ attr_accessor_with_default :startingnil
13
14
  end
14
15
 
15
16
  class Inherited<AttrTestClass
@@ -53,5 +54,11 @@ class AttrAccessorWithDefaultTest < Lanes::TestCase
53
54
  assert_equal "default", b.non_shared.value
54
55
  end
55
56
 
57
+ def test_nils
58
+ a = AttrTestClass.new
59
+ assert_nil a.startingnil
60
+ a.startingnil = 22
61
+ assert_equal 22, a.startingnil
62
+ end
56
63
 
57
64
  end