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,13 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore all logfiles and tempfiles.
11
+ /log/*
12
+ !/log/.keep
13
+ /tmp
@@ -0,0 +1,16 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '4.2.1'
4
+
5
+ gem "my_engine", path: "engines/my_engine"
6
+
7
+ gem 'sass-rails', "~> 4.0.3"#, " ~> 3.1.0"
8
+ gem "sprockets", "~> 2.12.3"
9
+
10
+ group :development, :test do
11
+ gem "minitest-spec-rails"
12
+ gem "capybara_minitest_spec"
13
+ end
14
+
15
+ gem "cells", path: "../../"
16
+ gem "cells-erb"
@@ -0,0 +1,3 @@
1
+ == README
2
+
3
+ Demo app for Cells 4 and Rails engines
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
File without changes
@@ -0,0 +1,17 @@
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
+ *= require user
16
+ *= require song
17
+ */
@@ -0,0 +1 @@
1
+ .song { background: red; }
@@ -0,0 +1,2 @@
1
+ class SongCell < Cell::ViewModel
2
+ end
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,7 @@
1
+ class IndexController < ApplicationController
2
+
3
+ def index
4
+ end
5
+
6
+ end
7
+
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ <h1>Hello World</h1>
2
+ <%= link_to "render", my_engine.user_path %>
3
+
4
+
5
+ hello?
6
+ <%= concept( "user/cell") %>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>EngineCells</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all' %>
6
+ <%= csrf_meta_tags %>
7
+ </head>
8
+ <body>
9
+
10
+ <%= yield %>
11
+
12
+ </body>
13
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,38 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "rails"
4
+ # Pick the frameworks you want:
5
+ require "active_model/railtie"
6
+ require "active_job/railtie"
7
+ # require "active_record/railtie"
8
+ require "action_controller/railtie"
9
+ require "action_mailer/railtie"
10
+ require "action_view/railtie"
11
+ require "sprockets/railtie"
12
+ require "rails/test_unit/railtie"
13
+
14
+ # Require the gems listed in Gemfile, including any gems
15
+ # you've limited to :test, :development, or :production.
16
+ Bundler.require(*Rails.groups)
17
+
18
+ module EngineCells
19
+ class Application < Rails::Application
20
+ # Settings in config/environments/* take precedence over those specified here.
21
+ # Application configuration should go into files in config/initializers
22
+ # -- all .rb files in that directory are automatically loaded.
23
+
24
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26
+ # config.time_zone = 'Central Time (US & Canada)'
27
+
28
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
29
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
+ # config.i18n.default_locale = :de
31
+
32
+ # enable asset pipeline as in development/test.
33
+ config.assets.enabled = true
34
+ config.assets.compile = true
35
+
36
+ config.cells.with_assets = ["user/cell", "song_cell"]
37
+ end
38
+ end
@@ -0,0 +1,3 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2
+
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,25 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+
23
+ # Raises error for missing translations
24
+ # config.action_view.raise_on_missing_translations = true
25
+ end
@@ -0,0 +1,64 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # Code is not reloaded between requests.
5
+ config.cache_classes = true
6
+
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both threaded web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like
20
+ # NGINX, varnish or squid.
21
+ # config.action_dispatch.rack_cache = true
22
+
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
26
+
27
+
28
+ # Specifies the header that your server uses for sending files.
29
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
30
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
31
+
32
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
33
+ # config.force_ssl = true
34
+
35
+ # Use the lowest log level to ensure availability of diagnostic information
36
+ # when problems arise.
37
+ config.log_level = :debug
38
+
39
+ # Prepend all log lines with the following tags.
40
+ # config.log_tags = [ :subdomain, :uuid ]
41
+
42
+ # Use a different logger for distributed setups.
43
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
44
+
45
+ # Use a different cache store in production.
46
+ # config.cache_store = :mem_cache_store
47
+
48
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
49
+ # config.action_controller.asset_host = 'http://assets.example.com'
50
+
51
+ # Ignore bad email addresses and do not raise email delivery errors.
52
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
53
+ # config.action_mailer.raise_delivery_errors = false
54
+
55
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
56
+ # the I18n.default_locale when a translation cannot be found).
57
+ config.i18n.fallbacks = true
58
+
59
+ # Send deprecation notices to registered listeners.
60
+ config.active_support.deprecation = :notify
61
+
62
+ # Use default logging formatter so that PID and timestamp are not suppressed.
63
+ config.log_formatter = ::Logger::Formatter.new
64
+ end
@@ -0,0 +1,42 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure static file server for tests with Cache-Control for performance.
16
+ config.serve_static_files = true
17
+ config.static_cache_control = 'public, max-age=3600'
18
+
19
+ # Show full error reports and disable caching.
20
+ config.consider_all_requests_local = true
21
+ config.action_controller.perform_caching = false
22
+
23
+ # Raise exceptions instead of rendering exception templates.
24
+ config.action_dispatch.show_exceptions = false
25
+
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
28
+
29
+ # Tell Action Mailer not to deliver emails to the real world.
30
+ # The :test delivery method accumulates sent emails in the
31
+ # ActionMailer::Base.deliveries array.
32
+ config.action_mailer.delivery_method = :test
33
+
34
+ # Randomize the order test cases are executed.
35
+ config.active_support.test_order = :random
36
+
37
+ # Print deprecation notices to the stderr.
38
+ config.active_support.deprecation = :stderr
39
+
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
42
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_engine_cells_session'
@@ -0,0 +1,9 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"