Module: Volt
- Includes:
- Config
- Defined in:
- lib/volt/config.rb,
lib/volt.rb,
lib/volt/cli.rb,
lib/volt/boot.rb,
lib/volt/server.rb,
lib/volt/page/page.rb,
lib/volt/cli/runner.rb,
lib/volt/models/url.rb,
lib/volt/page/tasks.rb,
lib/volt/spec/setup.rb,
lib/volt/cli/console.rb,
lib/volt/utils/ejson.rb,
lib/volt/models/model.rb,
lib/volt/page/channel.rb,
lib/volt/models/cursor.rb,
lib/volt/page/document.rb,
lib/volt/router/routes.rb,
lib/volt/page/sub_context.rb,
lib/volt/page/url_tracker.rb,
lib/volt/tasks/dispatcher.rb,
lib/volt/volt/environment.rb,
lib/volt/cli/asset_compile.rb,
lib/volt/page/channel_stub.rb,
lib/volt/models/array_model.rb,
lib/volt/models/model_state.rb,
lib/volt/models/validations.rb,
lib/volt/reactive/eventable.rb,
lib/volt/tasks/task_handler.rb,
lib/volt/utils/generic_pool.rb,
lib/volt/reactive/dependency.rb,
lib/volt/utils/local_storage.rb,
lib/volt/utils/local_storage.rb,
lib/volt/models/model_helpers.rb,
lib/volt/models/model_wrapper.rb,
lib/volt/page/document_events.rb,
lib/volt/reactive/computation.rb,
lib/volt/data_stores/data_store.rb,
lib/volt/models/persistors/base.rb,
lib/volt/page/template_renderer.rb,
lib/volt/reactive/reactive_hash.rb,
lib/volt/server/rack/opal_files.rb,
lib/volt/models/persistors/flash.rb,
lib/volt/models/persistors/store.rb,
lib/volt/page/targets/dom_target.rb,
lib/volt/reactive/reactive_array.rb,
lib/volt/server/rack/asset_files.rb,
lib/volt/server/rack/index_files.rb,
lib/volt/data_stores/mongo_driver.rb,
lib/volt/models/persistors/params.rb,
lib/volt/page/bindings/if_binding.rb,
lib/volt/page/targets/dom_section.rb,
lib/volt/reactive/hash_dependency.rb,
lib/volt/server/component_handler.rb,
lib/volt/page/targets/base_section.rb,
lib/volt/page/targets/dom_template.rb,
lib/volt/page/bindings/base_binding.rb,
lib/volt/page/bindings/each_binding.rb,
lib/volt/server/component_templates.rb,
lib/volt/server/rack/component_code.rb,
lib/volt/models/model_hash_behaviour.rb,
lib/volt/page/bindings/event_binding.rb,
lib/volt/reactive/reactive_accessors.rb,
lib/volt/server/rack/component_paths.rb,
lib/volt/utils/generic_counting_pool.rb,
lib/volt/controllers/model_controller.rb,
lib/volt/extra_core/inflector/methods.rb,
lib/volt/models/persistors/array_store.rb,
lib/volt/models/persistors/local_store.rb,
lib/volt/models/persistors/model_store.rb,
lib/volt/models/persistors/store_state.rb,
lib/volt/page/bindings/content_binding.rb,
lib/volt/page/string_template_renderer.rb,
lib/volt/page/targets/attribute_target.rb,
lib/volt/server/html_parser/each_scope.rb,
lib/volt/server/html_parser/view_scope.rb,
lib/volt/server/rack/source_map_server.rb,
app/volt/controllers/notices_controller.rb,
lib/volt/page/bindings/template_binding.rb,
lib/volt/page/targets/attribute_section.rb,
lib/volt/server/html_parser/view_parser.rb,
lib/volt/models/persistors/store_factory.rb,
lib/volt/page/bindings/attribute_binding.rb,
lib/volt/page/bindings/component_binding.rb,
lib/volt/server/html_parser/view_handler.rb,
lib/volt/extra_core/inflector/inflections.rb,
lib/volt/server/html_parser/if_view_scope.rb,
lib/volt/server/socket_connection_handler.rb,
lib/volt/server/html_parser/textarea_scope.rb,
lib/volt/models/validators/length_validator.rb,
lib/volt/server/html_parser/attribute_scope.rb,
lib/volt/server/rack/component_html_renderer.rb,
lib/volt/models/persistors/model_identity_map.rb,
lib/volt/models/validators/presence_validator.rb,
lib/volt/server/html_parser/sandlebars_parser.rb,
lib/volt/server/socket_connection_handler_stub.rb,
lib/volt/models/persistors/query/query_listener.rb,
lib/volt/page/targets/helpers/comment_searchers.rb,
lib/volt/page/targets/binding_document/base_node.rb,
lib/volt/page/targets/binding_document/html_node.rb,
lib/volt/models/persistors/query/query_listener_pool.rb,
lib/volt/page/targets/binding_document/component_node.rb,
lib/volt/page/bindings/template_binding/grouped_controllers.rb
Overview
Some template bindings share the controller with other template bindings based on a name. This class keeps track of the number of templates using this controller and clears it once no one else is using it. Use #get or #inc to add to the count. #clear removes 1 from the count. When the count is 0, delete the controller.
Defined Under Namespace
Modules: AttributeScope, CommentSearchers, Config, Eventable, Inflector, LocalStorage, ModelHashBehaviour, ModelHelpers, ModelState, ModelWrapper, Persistors, ReactiveAccessors, Validations Classes: ArrayModel, AssetFiles, AttributeBinding, AttributeSection, AttributeTarget, BaseBinding, BaseNode, BaseSection, CLI, Channel, ChannelStub, ComponentBinding, ComponentCode, ComponentHandler, ComponentHtmlRenderer, ComponentNode, ComponentPaths, ComponentTemplates, Computation, Console, ContentBinding, Cursor, DataStore, Dependency, Dispatcher, Document, DocumentEvents, DomSection, DomTarget, DomTemplate, EJson, EachBinding, EachScope, Environment, EventBinding, GenericCountingPool, GenericPool, GroupedControllers, HTMLParseError, HashDependency, HtmlNode, IfBinding, IfViewScope, IndexFiles, JSEvent, LengthValidator, Listener, Model, ModelController, ModelIdentityMap, NilMethodCall, NoticesController, OpalFiles, Page, PresenceValidator, QueryListener, QueryListenerPool, ReactiveArray, ReactiveHash, Routes, SandlebarsParser, Server, SocketConnectionHandler, SocketConnectionHandlerStub, SourceMapServer, StringTemplateRender, SubContext, TaskHandler, Tasks, TemplateBinding, TemplateRenderer, TextareaScope, URL, UrlTracker, ViewHandler, ViewParser, ViewScope
Class Attribute Summary collapse
Class Method Summary collapse
- .boot(app_path) ⇒ Object
- .client? ⇒ Boolean
- .env ⇒ Object
- .in_browser? ⇒ Boolean
- .server? ⇒ Boolean
- .source_maps? ⇒ Boolean
- .spec_setup(app_path = '.') ⇒ Object
Methods included from Config
#config, #reset_config!, #run_files_in_config_folder, #setup
Class Attribute Details
Class Method Details
.boot(app_path) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/volt/boot.rb', line 10 def self.boot(app_path) # Run the app config to load all users config files Volt.run_files_in_config_folder if Volt.server? $page = Page.new end component_paths = ComponentPaths.new(app_path) component_paths.require_in_components component_paths end |
.env ⇒ Object
38 39 40 |
# File 'lib/volt.rb', line 38 def env @env ||= Volt::Environment.new end |
.spec_setup(app_path = '.') ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/volt/spec/setup.rb', line 2 def self.spec_setup(app_path = '.') if RUBY_PLATFORM == 'opal' require 'volt' else ENV['SERVER'] = 'true' if ENV['BROWSER'] require 'capybara' require 'capybara/dsl' require 'capybara/rspec' require 'capybara/poltergeist' end require 'volt' require 'volt/boot' # Require in app Volt.boot(Dir.pwd) if ENV['BROWSER'] require 'volt/server' Capybara.server do |app, port| require 'rack/handler/thin' Rack::Handler::Thin.run(app, Port: port) end Capybara.app = Server.new(app_path).app if ENV['BROWSER'] == 'phantom' Capybara.default_driver = :poltergeist elsif ENV['BROWSER'] == 'chrome' Capybara.register_driver :chrome do |app| Capybara::Selenium::Driver.new(app, browser: :chrome) end Capybara.default_driver = :chrome elsif ENV['BROWSER'] == 'firefox' # require 'selenium/webdriver' # # require 'selenium/client' # Capybara.default_driver = :selenium # Capybara.register_driver :selenium_firefox do |app| # Capybara::Selenium::Driver.new(app, :browser => :firefox) # end # Capybara.current_driver = :selenium_firefox elsif ENV['BROWSER'] == 'safari' # Needs extension Capybara.register_driver :safari do |app| Capybara::Selenium::Driver.new(app, browser: :safari) end Capybara.default_driver = :safari end end end end |