lanes 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -0
- data/Gemfile +2 -2
- data/client/lanes/components/Base.coffee +12 -11
- data/client/lanes/components/enabled.js.erb +1 -1
- data/client/lanes/components/grid/Editor.coffee +2 -2
- data/client/lanes/components/grid/Grid.coffee +60 -58
- data/client/lanes/components/grid/PopOverEditor.coffee +3 -3
- data/client/lanes/components/grid/RowEditor.coffee +1 -1
- data/client/lanes/components/grid/{grid.scss → _index.scss} +0 -0
- data/client/lanes/components/grid/template.html +1 -1
- data/client/lanes/components/modal/ModalDialog.coffee +1 -1
- data/client/lanes/components/modal/{modal.scss → _index.scss} +1 -1
- data/client/lanes/components/modal/index.js +1 -1
- data/client/lanes/components/popover/PopOver.coffee +1 -1
- data/client/lanes/components/popover/_index.scss +1 -0
- data/client/lanes/components/popover/index.js +1 -1
- data/client/lanes/components/select_field/{select_field.scss → _index.scss} +0 -0
- data/client/lanes/extension/Extensions.coffee +3 -2
- data/client/lanes/lib/Templates.coffee +7 -0
- data/client/lanes/minimal.js +1 -1
- data/client/lanes/minimal.scss.erb +1 -1
- data/client/lanes/models/Base.coffee +16 -19
- data/client/lanes/models/Bootstrap.coffee +1 -2
- data/client/lanes/models/Collection.coffee +37 -25
- data/client/lanes/models/Screens.coffee +6 -18
- data/client/lanes/models/Sync.coffee +12 -5
- data/client/lanes/screens/Base.coffee +1 -2
- data/client/lanes/screens/Instance.coffee +2 -5
- data/client/lanes/screens/screen-definitions.js.erb +10 -2
- data/client/{styles → lanes/styles}/components/all.scss +0 -0
- data/client/{styles → lanes/styles}/components/changes-notification.scss +0 -0
- data/client/{styles → lanes/styles}/components/record-finder.scss +0 -0
- data/client/{styles → lanes/styles}/components/suggest.scss +0 -0
- data/client/{styles → lanes/styles}/fonts/icomoon.eot +0 -0
- data/client/{styles → lanes/styles}/fonts/icomoon.svg +0 -0
- data/client/{styles → lanes/styles}/fonts/icomoon.ttf +0 -0
- data/client/{styles → lanes/styles}/fonts/icomoon.woff +0 -0
- data/client/{styles → lanes/styles}/fonts/selection.json +0 -0
- data/client/{styles → lanes/styles}/fonts/style.scss +0 -0
- data/client/{styles → lanes/styles}/fonts.scss +5 -5
- data/client/{styles → lanes/styles}/forms.scss +0 -0
- data/client/{styles → lanes/styles}/index.css +0 -0
- data/client/{styles → lanes/styles}/keybindings.scss +0 -0
- data/client/{styles → lanes/styles}/layout.scss +0 -0
- data/client/{styles → lanes/styles}/plugins/all.scss +0 -0
- data/client/{styles → lanes/styles}/plugins/overlay.scss +0 -0
- data/client/{styles → lanes/styles}/plugins/resize-sensor.scss +0 -0
- data/client/{styles → lanes/styles}/screens.scss +0 -0
- data/client/{styles → lanes/styles}/tabs.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_alerts.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_badges.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_breadcrumbs.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_button-groups.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_buttons.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_carousel.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_close.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_code.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_component-animations.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_dropdowns.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_forms.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_glyphicons.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_grid.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_input-groups.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_jumbotron.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_labels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_list-group.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_media.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_mixins.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_modals.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_navbar.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_navs.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_normalize.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_pager.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_pagination.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_panels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_popovers.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_print.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_progress-bars.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_responsive-embed.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_responsive-utilities.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_scaffolding.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_tables.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_theme.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_thumbnails.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_tooltip.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_type.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_utilities.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_variables.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_wells.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_alerts.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_background-variant.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_border-radius.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_buttons.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_center-block.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_clearfix.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_forms.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_gradients.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_grid-framework.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_grid.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_hide-text.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_image.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_labels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_list-group.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_nav-divider.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_nav-vertical-align.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_opacity.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_pagination.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_panels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_progress-bar.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_reset-filter.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_resize.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_responsive-visibility.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_size.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_tab-focus.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_table-row.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_text-emphasis.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_text-overflow.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_vendor-prefixes.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_alerts.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_badges.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_breadcrumbs.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_button-groups.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_buttons.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_carousel.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_close.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_code.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_component-animations.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_dropdowns.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_forms.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_glyphicons.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_grid.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_input-groups.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_jumbotron.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_labels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_list-group.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_media.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_mixins.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_modals.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_navbar.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_navs.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_normalize.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_pager.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_pagination.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_panels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_popovers.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_print.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_progress-bars.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_responsive-embed.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_responsive-utilities.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_scaffolding.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_tables.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_theme.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_thumbnails.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_tooltip.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_type.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_utilities.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_variables.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_wells.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/bootstrap.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_alerts.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_background-variant.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_border-radius.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_buttons.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_center-block.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_clearfix.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_forms.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_gradients.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_grid-framework.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_grid.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_hide-text.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_image.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_labels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_list-group.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_nav-divider.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_nav-vertical-align.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_opacity.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_pagination.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_panels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_progress-bar.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_reset-filter.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_resize.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_responsive-visibility.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_size.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_tab-focus.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_table-row.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_text-emphasis.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_text-overflow.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_vendor-prefixes.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap-custom-grid.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap-custom-modals.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap.scss +2 -2
- data/client/{styles → lanes/styles}/vendor/dataTables.scss +0 -0
- data/client/lanes/views/Base.coffee +34 -49
- data/client/lanes/views/FormBindings.coffee +22 -20
- data/client/lanes/views/Helpers.coffee +1 -1
- data/client/lanes/views/empty-span.html +1 -0
- data/client/lanes/workspace/ActiveScreensSwitcher.coffee +8 -1
- data/client/lanes/workspace/Layout.coffee +7 -4
- data/client/lanes/workspace/Navbar.coffee +6 -2
- data/client/lanes/workspace/Pages.coffee +5 -1
- data/client/lanes/workspace/ScreensMenu.coffee +14 -2
- data/client/lanes/workspace/WorkspaceView.coffee +5 -0
- data/client/lanes/workspace/index.js +1 -0
- data/client/lanes/workspace.scss.erb +6 -1
- data/lanes.gemspec +1 -1
- data/lib/lanes/api/controller.rb +5 -7
- data/lib/lanes/api/helper_methods.rb +1 -1
- data/lib/lanes/api/javascript_processor.rb +3 -2
- data/lib/lanes/command/app.rb +8 -4
- data/lib/lanes/command/generate_model.rb +13 -11
- data/lib/lanes/command/generate_screen.rb +9 -2
- data/lib/lanes/command/generate_view.rb +15 -3
- data/lib/lanes/command/generate_view.usage +7 -7
- data/lib/lanes/command/named_command.rb +2 -2
- data/lib/lanes/command/templates/client/index.js +3 -0
- data/lib/lanes/command/templates/client/models/BaseModel.coffee +5 -0
- data/lib/lanes/command/templates/client/models/Model.coffee +1 -1
- data/lib/lanes/command/templates/client/views/BaseView.coffee +5 -0
- data/lib/lanes/command/templates/client/views/View.coffee +1 -1
- data/lib/lanes/command/templates/config/screen.rb +8 -0
- data/lib/lanes/command/templates/lib/namespace/base_model.rb +9 -0
- data/lib/lanes/command/templates/lib/namespace/model.rb +1 -1
- data/lib/lanes/command/templates/spec/client/models/ModelSpec.coffee +1 -1
- data/lib/lanes/command/templates/spec/client/views/ViewSpec.coffee +1 -1
- data/lib/lanes/command.rb +1 -2
- data/lib/lanes/components.rb +5 -4
- data/lib/lanes/concerns/all.rb +0 -5
- data/lib/lanes/concerns/attr_accessor_with_default.rb +5 -3
- data/lib/lanes/concerns/set_attribute_data.rb +6 -23
- data/lib/lanes/configuration.rb +1 -0
- data/lib/lanes/extension.rb +19 -10
- data/lib/lanes/guard_tasks.rb +1 -1
- data/lib/lanes/model.rb +1 -6
- data/lib/lanes/{screens.rb → screen.rb} +40 -23
- data/lib/lanes/spec_helper.rb +4 -2
- data/lib/lanes/version.rb +1 -1
- data/lib/lanes.rb +1 -1
- data/spec/api/javascript_processor_spec.rb +3 -3
- data/spec/command_spec.rb +49 -0
- data/spec/concerns/attr_accessor_with_default_spec.rb +7 -0
- data/spec/helpers/lanes-helpers.coffee +46 -22
- data/spec/helpers/minitest_assertions.rb +23 -0
- data/spec/lanes/models/BaseSpec.coffee +57 -56
- data/spec/lanes/models/CollectionSpec.coffee +14 -0
- data/spec/lanes/models/PubSubSpec.coffee +5 -5
- data/spec/lanes/views/BaseSpec.coffee +32 -31
- data/spec/lanes/views/FormBindingsSpec.coffee +32 -0
- metadata +183 -179
- data/client/lanes/components/popover/popover.scss +0 -1
- data/lib/lanes/command/templates/lib/namespace/screen.rb +0 -17
- data/lib/lanes/concerns/code_identifier.rb +0 -43
- data/lib/lanes/concerns/immutable_model.rb +0 -32
- data/lib/lanes/concerns/locked_fields.rb +0 -84
- data/lib/lanes/concerns/random_hash_code.rb +0 -40
- data/lib/lanes/concerns/visible_id_identifier.rb +0 -53
- 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",
|
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
|
-
|
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}
|
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
|
-
|
4
|
+
When executed inside a project called "Blog":
|
5
5
|
|
6
|
-
|
6
|
+
`lanes generate view comment`
|
7
7
|
|
8
|
-
|
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
|
@@ -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
|
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
|
data/lib/lanes/components.rb
CHANGED
@@ -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
|
-
|
24
|
-
|
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)
|
data/lib/lanes/concerns/all.rb
CHANGED
@@ -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
|
-
|
51
|
-
|
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(
|
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
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
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
|
data/lib/lanes/configuration.rb
CHANGED
data/lib/lanes/extension.rb
CHANGED
@@ -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
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
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
|
data/lib/lanes/guard_tasks.rb
CHANGED
@@ -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:
|
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
|
7
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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 :
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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
|
-
|
86
|
+
js: js,
|
87
|
+
css: css,
|
88
|
+
assets: assets,
|
72
89
|
group_id: group_id,
|
73
90
|
description: description
|
74
91
|
}, mode: :compat)
|
data/lib/lanes/spec_helper.rb
CHANGED
@@ -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
data/lib/lanes.rb
CHANGED
@@ -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),
|
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
|