cells 4.0.0.beta4 → 4.0.0.beta5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +19 -0
  3. data/Rakefile +11 -0
  4. data/cells.gemspec +3 -4
  5. data/gemfiles/rails4.2.gemfile +0 -7
  6. data/lib/cell.rb +19 -19
  7. data/lib/cell/abstract.rb +9 -0
  8. data/lib/cell/caching.rb +16 -17
  9. data/lib/cell/concept.rb +2 -4
  10. data/lib/cell/prefixes.rb +3 -2
  11. data/lib/cell/rails.rb +27 -4
  12. data/lib/cell/railtie.rb +47 -42
  13. data/lib/cell/testing.rb +12 -9
  14. data/lib/cell/twin.rb +2 -2
  15. data/lib/cell/util.rb +16 -0
  16. data/lib/cell/version.rb +1 -8
  17. data/lib/cell/view_model.rb +63 -90
  18. data/test/builder_test.rb +5 -5
  19. data/test/caching_test.rb +2 -2
  20. data/test/cell_test.rb +1 -1
  21. data/test/concept_test.rb +24 -10
  22. data/test/dummy/config/application.rb +1 -1
  23. data/test/public_test.rb +8 -9
  24. data/test/rails4.2/.gitignore +13 -0
  25. data/test/rails4.2/Gemfile +16 -0
  26. data/test/rails4.2/README.rdoc +3 -0
  27. data/test/rails4.2/Rakefile +6 -0
  28. data/test/rails4.2/app/assets/images/.keep +0 -0
  29. data/test/rails4.2/app/assets/stylesheets/application.css +17 -0
  30. data/test/rails4.2/app/cells/song/song.css +1 -0
  31. data/test/rails4.2/app/cells/song_cell.rb +2 -0
  32. data/test/rails4.2/app/controllers/application_controller.rb +5 -0
  33. data/test/rails4.2/app/controllers/concerns/.keep +0 -0
  34. data/test/rails4.2/app/controllers/index_controller.rb +7 -0
  35. data/test/rails4.2/app/helpers/application_helper.rb +2 -0
  36. data/test/rails4.2/app/mailers/.keep +0 -0
  37. data/test/rails4.2/app/models/.keep +0 -0
  38. data/test/rails4.2/app/models/concerns/.keep +0 -0
  39. data/test/rails4.2/app/views/index/index.html.erb +6 -0
  40. data/test/rails4.2/app/views/layouts/application.html.erb +13 -0
  41. data/test/rails4.2/bin/bundle +3 -0
  42. data/test/rails4.2/bin/rails +4 -0
  43. data/test/rails4.2/bin/rake +4 -0
  44. data/test/rails4.2/bin/setup +29 -0
  45. data/test/rails4.2/config.ru +4 -0
  46. data/test/rails4.2/config/application.rb +38 -0
  47. data/test/rails4.2/config/boot.rb +3 -0
  48. data/test/rails4.2/config/environment.rb +5 -0
  49. data/test/rails4.2/config/environments/development.rb +25 -0
  50. data/test/rails4.2/config/environments/production.rb +64 -0
  51. data/test/rails4.2/config/environments/test.rb +42 -0
  52. data/test/rails4.2/config/initializers/backtrace_silencers.rb +7 -0
  53. data/test/rails4.2/config/initializers/cookies_serializer.rb +3 -0
  54. data/test/rails4.2/config/initializers/filter_parameter_logging.rb +4 -0
  55. data/test/rails4.2/config/initializers/inflections.rb +16 -0
  56. data/test/rails4.2/config/initializers/mime_types.rb +4 -0
  57. data/test/rails4.2/config/initializers/session_store.rb +3 -0
  58. data/test/rails4.2/config/initializers/wrap_parameters.rb +9 -0
  59. data/test/rails4.2/config/locales/en.yml +23 -0
  60. data/test/rails4.2/config/routes.rb +4 -0
  61. data/test/rails4.2/config/secrets.yml +22 -0
  62. data/test/rails4.2/db/seeds.rb +7 -0
  63. data/test/rails4.2/engines/my_engine/.gitignore +3 -0
  64. data/test/rails4.2/engines/my_engine/Gemfile +15 -0
  65. data/test/rails4.2/engines/my_engine/MIT-LICENSE +20 -0
  66. data/test/rails4.2/engines/my_engine/README.rdoc +3 -0
  67. data/test/rails4.2/engines/my_engine/Rakefile +24 -0
  68. data/test/rails4.2/engines/my_engine/app/assets/images/my_engine/.keep +0 -0
  69. data/test/rails4.2/engines/my_engine/app/assets/stylesheets/my_engine/application.css +15 -0
  70. data/test/rails4.2/engines/my_engine/app/concepts/user/cell.rb +8 -0
  71. data/test/rails4.2/engines/my_engine/app/concepts/user/views/show.erb +1 -0
  72. data/test/rails4.2/engines/my_engine/app/concepts/user/views/user.scss +3 -0
  73. data/test/rails4.2/engines/my_engine/app/controllers/my_engine/application_controller.rb +4 -0
  74. data/test/rails4.2/engines/my_engine/app/controllers/my_engine/user_controller.rb +7 -0
  75. data/test/rails4.2/engines/my_engine/app/helpers/my_engine/application_helper.rb +4 -0
  76. data/test/rails4.2/engines/my_engine/app/models/my_engine/user.rb +4 -0
  77. data/test/rails4.2/engines/my_engine/app/views/layouts/my_engine/application.html.erb +14 -0
  78. data/test/rails4.2/engines/my_engine/app/views/my_engine/user/show.html.erb +3 -0
  79. data/test/rails4.2/engines/my_engine/bin/rails +12 -0
  80. data/test/rails4.2/engines/my_engine/config/routes.rb +3 -0
  81. data/test/rails4.2/engines/my_engine/db/migrate/20150530135920_create_my_engine_users.rb +8 -0
  82. data/test/rails4.2/engines/my_engine/lib/my_engine.rb +6 -0
  83. data/test/rails4.2/engines/my_engine/lib/my_engine/engine.rb +9 -0
  84. data/test/rails4.2/engines/my_engine/lib/my_engine/version.rb +3 -0
  85. data/test/rails4.2/engines/my_engine/lib/tasks/my_engine_tasks.rake +4 -0
  86. data/test/rails4.2/engines/my_engine/my_engine.gemspec +24 -0
  87. data/test/rails4.2/engines/my_engine/test/fixtures/my_engine/users.yml +11 -0
  88. data/test/rails4.2/engines/my_engine/test/models/my_engine/user_test.rb +9 -0
  89. data/test/rails4.2/lib/assets/.keep +0 -0
  90. data/test/rails4.2/lib/tasks/.keep +0 -0
  91. data/test/rails4.2/log/.keep +0 -0
  92. data/test/rails4.2/public/404.html +67 -0
  93. data/test/rails4.2/public/422.html +67 -0
  94. data/test/rails4.2/public/500.html +66 -0
  95. data/test/rails4.2/public/favicon.ico +0 -0
  96. data/test/rails4.2/public/robots.txt +5 -0
  97. data/test/rails4.2/test/integration/asset_pipeline_test.rb +17 -0
  98. data/test/rails4.2/test/test_helper.rb +14 -0
  99. data/test/rails4.2/vendor/assets/stylesheets/.keep +0 -0
  100. data/test/twin_test.rb +1 -1
  101. data/test/url_helper_test.rb +1 -1
  102. metadata +83 -19
@@ -0,0 +1,4 @@
1
+ Rails.application.routes.draw do
2
+ mount MyEngine::Engine => "/"
3
+ root to: "index#index"
4
+ end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: 0ff2fd9cbf01493f9bc5368f102cfd66e9a69b5fbbdd3c308afccef6de2f7c834cc19618d305f223a1e01a5fbf98d4d41c9017214efe9fa3832282eaca032c7f
15
+
16
+ test:
17
+ secret_key_base: 8c3a9dbc139ed27c32022254d832f53a3d4d3e545003be31cd5bbc3b81b5ff0a8a6d9b9f6aab6ca206aff92a7ccc6f32354d3c9cf77b4708e1c4778a6d5920a4
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+ # Mayor.create(name: 'Emanuel', city: cities.first)
@@ -0,0 +1,3 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Declare your gem's dependencies in my_engine.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use a debugger
14
+ # gem 'byebug', group: [:development, :test]
15
+
@@ -0,0 +1,20 @@
1
+ Copyright 2015 Alexander Huber
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ = MyEngine
2
+
3
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,24 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'MyEngine'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+ load 'rails/tasks/statistics.rake'
20
+
21
+
22
+
23
+ Bundler::GemHelper.install_tasks
24
+
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,8 @@
1
+ class User::Cell < Cell::Concept
2
+ view_paths << "#{MyEngine::Engine.root}/app/concepts"
3
+
4
+ def show
5
+ # return _prefixes.inspect
6
+ render#(view: :show)
7
+ end
8
+ end
@@ -0,0 +1 @@
1
+ <%= "Just an empty view, rendered by a cell..." %>
@@ -0,0 +1,3 @@
1
+ user {
2
+ background: green;
3
+ }
@@ -0,0 +1,4 @@
1
+ module MyEngine
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ module MyEngine
2
+ class UserController < MyEngine::ApplicationController
3
+
4
+ def show
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ module MyEngine
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module MyEngine
2
+ class User
3
+ end
4
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>MyEngine</title>
5
+ <%= stylesheet_link_tag "my_engine/application", media: "all" %>
6
+ <%= javascript_include_tag "my_engine/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ <%- @user = MyEngine::User.new %>
2
+
3
+ <%= concept("user/cell", @user) %>
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
3
+
4
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
+ ENGINE_PATH = File.expand_path('../../lib/my_engine/engine', __FILE__)
6
+
7
+ # Set up gems listed in the Gemfile.
8
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
9
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
10
+
11
+ require 'rails/all'
12
+ require 'rails/engine/commands'
@@ -0,0 +1,3 @@
1
+ MyEngine::Engine.routes.draw do
2
+ get "user" => "user#show"
3
+ end
@@ -0,0 +1,8 @@
1
+ class CreateMyEngineUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_engine_users do |t|
4
+
5
+ t.timestamps null: false
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ require "my_engine/engine"
2
+
3
+ module MyEngine
4
+ # This also works
5
+ # Cell::Concept.view_paths << File.expand_path("#{MyEngine::Engine.root}/app/concepts", __FILE__)
6
+ end
@@ -0,0 +1,9 @@
1
+ require "cells"
2
+ puts "eingiiiiiiine loaded"
3
+ module MyEngine
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace MyEngine
6
+ # This also works
7
+ # Cell::Concept.view_paths << File.expand_path("#{MyEngine::Engine.root}/app/concepts", __FILE__)
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module MyEngine
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :my_engine do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,24 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require "my_engine/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |s|
8
+ s.name = "my_engine"
9
+ s.version = MyEngine::VERSION
10
+ s.authors = ["Alexander Huber"]
11
+ s.email = ["alih83@gmx.de"]
12
+ s.homepage = "TODO"
13
+ s.summary = "TODO: Summary of MyEngine."
14
+ s.description = "TODO: Description of MyEngine."
15
+ s.license = "MIT"
16
+
17
+ s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
18
+
19
+ s.add_dependency "rails", "~> 4.2.1"
20
+ s.add_dependency "cells", "4.0.0.beta4"
21
+ s.add_dependency "cells-erb"
22
+
23
+ s.add_development_dependency "sqlite3"
24
+ end
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the '{}' from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ module MyEngine
4
+ class UserTest < ActiveSupport::TestCase
5
+ # test "the truth" do
6
+ # assert true
7
+ # end
8
+ end
9
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>