middleman-cells 0.0.1 → 0.0.2

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: 78e0de27631ecda408448270d603dcbdf978c6ba
4
- data.tar.gz: 3b487f2183c522e01e639e9edba5eefaa4cfcef8
3
+ metadata.gz: d51fb07d45d15db2b79f75900a857ddd7e724e01
4
+ data.tar.gz: 4764a1450a1a749ed23e8b176a03a176f1622384
5
5
  SHA512:
6
- metadata.gz: 924d0d83a3fba72932d7ec2e34a713354b1bbf9f58f2231e1fc57d1f18e7f98975d40d974cf43a9a1bfa6201e09bdaaa48a30ba4af5742864ed76fd1f7464fc7
7
- data.tar.gz: 8a17f15450d9349a592fa57f31155ccc40b6facd5e0a81209de1b388ac1db112e3b8ccbbaed10b3ddab5b4e3c20bb53357cf4559d72b245a01476aaf076c9818
6
+ metadata.gz: 4dae900683f8c35408070b2bfed4ef96147b608ae9097e026c18b4595619b5c6aae14c8bfcd082cee6ec8a946e8e972b48eeda64b74b69664fe91cbbb357eb60
7
+ data.tar.gz: 0a0ddcb4323ca1c0c408f357e74b66aaa96c938470a8eab20af044ab3369c6c88f4eb513bf536d2e1cd78538ec2f6868c4aaaee65b93b1cfea63002253df3216
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 notozeki
3
+ Copyright (c) 2016 tnzk.org, LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Middleman::Cells
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/middleman-cells.svg)](https://badge.fury.io/rb/middleman-cells)
4
+
3
5
  [Cells](https://github.com/apotonick/cells) support for [Middleman](https://github.com/middleman/middleman).
4
6
 
5
7
  ## Usage
@@ -32,6 +32,20 @@ Feature: Cells support for Middleman
32
32
  When I go to "/index.html"
33
33
  Then I should see "After"
34
34
 
35
+ Scenario: View helpers
36
+ Given the Server is running at "view-helpers-app"
37
+ When I go to "/index.html"
38
+ Then I should see:
39
+ """
40
+ <a href="https://twitter.com/notozeki">Follow me</a>
41
+ """
42
+ When I go to "/render_nested_cells.html"
43
+ Then I should see:
44
+ """
45
+ <p>This is a parent.</p>
46
+ <p>This is a child.</p>
47
+ """
48
+
35
49
  Scenario: Hamlit support
36
50
  Given the Server is running at "hamlit-app"
37
51
  When I go to "/index.html"
@@ -0,0 +1,3 @@
1
+ activate :cells do
2
+ require 'cells-erb'
3
+ end
@@ -0,0 +1 @@
1
+ <p>This is a child.</p>
@@ -0,0 +1,5 @@
1
+ class ChildCell < Cell::ViewModel
2
+ def show
3
+ render
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ <p>This is a parent.</p>
2
+ <%= cell(:child).() %>
@@ -0,0 +1,5 @@
1
+ class ParentCell < Cell::ViewModel
2
+ def show
3
+ render
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ <%= link_to 'Follow me', 'https://twitter.com/notozeki' %>
@@ -0,0 +1,5 @@
1
+ class ViewHelpersCell < Cell::ViewModel
2
+ def show
3
+ render
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ <%= ViewHelpersCell.().() %>
@@ -0,0 +1 @@
1
+ <%= ParentCell.().() %>
@@ -34,8 +34,19 @@ module Middleman
34
34
 
35
35
  def after_configuration
36
36
  cells_dir = File.join(app.root, app.config[:source], options.cells_dir)
37
+ helper_modules = app.template_context_class.included_modules
37
38
 
38
- ::Cell::ViewModel.view_paths << cells_dir
39
+ # Extending Cell::ViewModel to adapt Middleman
40
+ ::Cell::ViewModel.class_eval do
41
+ self.view_paths << cells_dir
42
+
43
+ # Required for Padrino's helpers
44
+ def current_engine
45
+ end
46
+
47
+ # Include view helpers
48
+ helper_modules.each {|helper| include helper }
49
+ end
39
50
 
40
51
  if options.autoload
41
52
  require 'active_support/dependencies'
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Cells
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
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.1
4
+ version: 0.0.2
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-02 00:00:00.000000000 Z
11
+ date: 2016-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core
@@ -100,6 +100,15 @@ files:
100
100
  - fixtures/slim-app/source/cells/slim/show.slim
101
101
  - fixtures/slim-app/source/cells/slim_cell.rb
102
102
  - fixtures/slim-app/source/index.html.erb
103
+ - fixtures/view-helpers-app/config.rb
104
+ - fixtures/view-helpers-app/source/cells/child/show.erb
105
+ - fixtures/view-helpers-app/source/cells/child_cell.rb
106
+ - fixtures/view-helpers-app/source/cells/parent/show.erb
107
+ - fixtures/view-helpers-app/source/cells/parent_cell.rb
108
+ - fixtures/view-helpers-app/source/cells/view_helpers/show.erb
109
+ - fixtures/view-helpers-app/source/cells/view_helpers_cell.rb
110
+ - fixtures/view-helpers-app/source/index.html.erb
111
+ - fixtures/view-helpers-app/source/render_nested_cells.html.erb
103
112
  - lib/middleman-cells.rb
104
113
  - lib/middleman-cells/extension.rb
105
114
  - lib/middleman-cells/version.rb