middleman-cells 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d51fb07d45d15db2b79f75900a857ddd7e724e01
4
- data.tar.gz: 4764a1450a1a749ed23e8b176a03a176f1622384
3
+ metadata.gz: 95d219efbd995f336e3c65d89265f8003f16c718
4
+ data.tar.gz: f6711fe44a1edf5a6e8bc073d825da218681ab1a
5
5
  SHA512:
6
- metadata.gz: 4dae900683f8c35408070b2bfed4ef96147b608ae9097e026c18b4595619b5c6aae14c8bfcd082cee6ec8a946e8e972b48eeda64b74b69664fe91cbbb357eb60
7
- data.tar.gz: 0a0ddcb4323ca1c0c408f357e74b66aaa96c938470a8eab20af044ab3369c6c88f4eb513bf536d2e1cd78538ec2f6868c4aaaee65b93b1cfea63002253df3216
6
+ metadata.gz: 3d22340e5c8d18246918714a214b02c29d526bc2cbe747f70b20c00367c28b9975166e9045aed1506e9ea5434d2454d3fdf7eec3547f0db8a52e4d347c3017ea
7
+ data.tar.gz: 65ed57d90ee65d93a0a9e2428a56474f108d497ebc32f57966883428dcc460d1d587f8b283de467b97cd604794351b7f284aa6c71c6be0fdc27407c3cef4543c
@@ -45,6 +45,9 @@ Feature: Cells support for Middleman
45
45
  <p>This is a parent.</p>
46
46
  <p>This is a child.</p>
47
47
  """
48
+ When I go to "/app_shortcuts.html"
49
+ Then I should see "Awesome Site"
50
+ Then I should see "Middleman::Cells::Extension"
48
51
 
49
52
  Scenario: Hamlit support
50
53
  Given the Server is running at "hamlit-app"
@@ -0,0 +1 @@
1
+ site_name: Awesome Site
@@ -0,0 +1 @@
1
+ <%= ShortcutCell.().() %>
@@ -0,0 +1,2 @@
1
+ <p><%= data.metadata.site_name %></p>
2
+ <pre><%= extensions[:cells] %></pre>
@@ -0,0 +1,5 @@
1
+ class ShortcutCell < Cell::ViewModel
2
+ def show
3
+ render
4
+ end
5
+ end
@@ -35,6 +35,7 @@ module Middleman
35
35
  def after_configuration
36
36
  cells_dir = File.join(app.root, app.config[:source], options.cells_dir)
37
37
  helper_modules = app.template_context_class.included_modules
38
+ app_proxy = app
38
39
 
39
40
  # Extending Cell::ViewModel to adapt Middleman
40
41
  ::Cell::ViewModel.class_eval do
@@ -46,6 +47,12 @@ module Middleman
46
47
 
47
48
  # Include view helpers
48
49
  helper_modules.each {|helper| include helper }
50
+
51
+ # Shortcut to global values on the app instance
52
+ globals = %i[config logger sitemap server? build? environment? data extensions root]
53
+ globals.each do |name|
54
+ define_method(name) { app_proxy.send(name) }
55
+ end
49
56
  end
50
57
 
51
58
  if options.autoload
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Cells
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-cells
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - notozeki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-08 00:00:00.000000000 Z
11
+ date: 2016-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core
@@ -101,10 +101,14 @@ files:
101
101
  - fixtures/slim-app/source/cells/slim_cell.rb
102
102
  - fixtures/slim-app/source/index.html.erb
103
103
  - fixtures/view-helpers-app/config.rb
104
+ - fixtures/view-helpers-app/data/metadata.yml
105
+ - fixtures/view-helpers-app/source/app_shortcuts.html.erb
104
106
  - fixtures/view-helpers-app/source/cells/child/show.erb
105
107
  - fixtures/view-helpers-app/source/cells/child_cell.rb
106
108
  - fixtures/view-helpers-app/source/cells/parent/show.erb
107
109
  - fixtures/view-helpers-app/source/cells/parent_cell.rb
110
+ - fixtures/view-helpers-app/source/cells/shortcut/show.erb
111
+ - fixtures/view-helpers-app/source/cells/shortcut_cell.rb
108
112
  - fixtures/view-helpers-app/source/cells/view_helpers/show.erb
109
113
  - fixtures/view-helpers-app/source/cells/view_helpers_cell.rb
110
114
  - fixtures/view-helpers-app/source/index.html.erb