bemer 0.0.0 → 0.1.0

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.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +12 -0
  3. data/.overcommit.yml +59 -0
  4. data/.rspec +4 -0
  5. data/.rubocop.yml +12 -1
  6. data/.rubocop_todo.yml +3 -6
  7. data/Gemfile +6 -0
  8. data/LICENSE +21 -0
  9. data/LICENSE-RU +23 -0
  10. data/README.md +2 -10
  11. data/Rakefile +8 -1
  12. data/bemer.gemspec +19 -6
  13. data/lib/bemer.rb +93 -2
  14. data/lib/bemer/asset_matcher.rb +21 -0
  15. data/lib/bemer/builders.rb +23 -0
  16. data/lib/bemer/builders/tag/element.rb +22 -0
  17. data/lib/bemer/builders/template.rb +57 -0
  18. data/lib/bemer/builders/template_list.rb +56 -0
  19. data/lib/bemer/builders/tree.rb +35 -0
  20. data/lib/bemer/builders/tree/element.rb +22 -0
  21. data/lib/bemer/common_template.rb +29 -0
  22. data/lib/bemer/component.rb +19 -0
  23. data/lib/bemer/component_pack.rb +39 -0
  24. data/lib/bemer/configuration.rb +36 -0
  25. data/lib/bemer/context.rb +44 -0
  26. data/lib/bemer/context_extentions.rb +12 -0
  27. data/lib/bemer/context_extentions/structure.rb +32 -0
  28. data/lib/bemer/context_extentions/template.rb +15 -0
  29. data/lib/bemer/default_template_list.rb +35 -0
  30. data/lib/bemer/entity.rb +94 -0
  31. data/lib/bemer/entity_builder.rb +126 -0
  32. data/lib/bemer/helpers.rb +41 -0
  33. data/lib/bemer/mixin_list.rb +74 -0
  34. data/lib/bemer/modifier_list.rb +68 -0
  35. data/lib/bemer/pipeline.rb +85 -0
  36. data/lib/bemer/pipeline/handler.rb +132 -0
  37. data/lib/bemer/predicate.rb +63 -0
  38. data/lib/bemer/railtie.rb +36 -0
  39. data/lib/bemer/renderer.rb +15 -0
  40. data/lib/bemer/tag.rb +35 -0
  41. data/lib/bemer/tag_builder.rb +11 -0
  42. data/lib/bemer/template.rb +90 -0
  43. data/lib/bemer/template_catalog.rb +42 -0
  44. data/lib/bemer/template_catalog/drawer.rb +31 -0
  45. data/lib/bemer/template_list.rb +62 -0
  46. data/lib/bemer/tree.rb +143 -0
  47. data/lib/bemer/tree/base_node.rb +49 -0
  48. data/lib/bemer/tree/node.rb +129 -0
  49. data/lib/bemer/tree/text_node.rb +11 -0
  50. data/lib/bemer/version.rb +1 -1
  51. data/spec/bemer/entity_spec.rb +37 -0
  52. data/spec/bemer/mixin_list_spec.rb +99 -0
  53. data/spec/bemer/modifier_list_spec.rb +83 -0
  54. data/spec/bemer_spec.rb +36 -0
  55. data/spec/dummy/Rakefile +8 -0
  56. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  57. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  58. data/spec/dummy/app/helpers/application_helper.rb +4 -0
  59. data/spec/dummy/app/jobs/application_job.rb +4 -0
  60. data/spec/dummy/app/mailers/application_mailer.rb +6 -0
  61. data/spec/dummy/app/models/application_record.rb +5 -0
  62. data/spec/dummy/app/models/concerns/.keep +0 -0
  63. data/spec/dummy/app/views/layouts/application.html.erb +13 -0
  64. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  65. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  66. data/spec/dummy/bin/bundle +5 -0
  67. data/spec/dummy/bin/rails +6 -0
  68. data/spec/dummy/bin/rake +6 -0
  69. data/spec/dummy/bin/setup +39 -0
  70. data/spec/dummy/bin/update +31 -0
  71. data/spec/dummy/bin/yarn +13 -0
  72. data/spec/dummy/config.ru +7 -0
  73. data/spec/dummy/config/application.rb +27 -0
  74. data/spec/dummy/config/boot.rb +7 -0
  75. data/spec/dummy/config/cable.yml +10 -0
  76. data/spec/dummy/config/database.yml +25 -0
  77. data/spec/dummy/config/environment.rb +7 -0
  78. data/spec/dummy/config/environments/development.rb +51 -0
  79. data/spec/dummy/config/environments/production.rb +84 -0
  80. data/spec/dummy/config/environments/test.rb +44 -0
  81. data/spec/dummy/config/initializers/application_controller_renderer.rb +7 -0
  82. data/spec/dummy/config/initializers/backtrace_silencers.rb +8 -0
  83. data/spec/dummy/config/initializers/bemer.rb +7 -0
  84. data/spec/dummy/config/initializers/cookies_serializer.rb +7 -0
  85. data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  86. data/spec/dummy/config/initializers/inflections.rb +17 -0
  87. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  88. data/spec/dummy/config/initializers/wrap_parameters.rb +16 -0
  89. data/spec/dummy/config/locales/en.yml +33 -0
  90. data/spec/dummy/config/puma.rb +58 -0
  91. data/spec/dummy/config/routes.rb +5 -0
  92. data/spec/dummy/config/secrets.yml +32 -0
  93. data/spec/dummy/config/spring.rb +8 -0
  94. data/spec/dummy/lib/assets/.keep +0 -0
  95. data/spec/dummy/log/.keep +0 -0
  96. data/spec/dummy/package.json +5 -0
  97. data/spec/dummy/public/404.html +67 -0
  98. data/spec/dummy/public/422.html +67 -0
  99. data/spec/dummy/public/500.html +66 -0
  100. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  101. data/spec/dummy/public/apple-touch-icon.png +0 -0
  102. data/spec/dummy/public/favicon.ico +0 -0
  103. data/spec/rails_helper.rb +37 -0
  104. data/spec/spec_helper.rb +41 -0
  105. metadata +301 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea8eab1d06518bfae9c195fb8c0ce91760bcb17b
4
- data.tar.gz: 143034a0fb23dcccac4149a1a1dd5a2dda4ae26b
3
+ metadata.gz: 16debb87f2467a03c58ce016590f7a8782f8058b
4
+ data.tar.gz: 106a22bbfb569721d22b9cde7d9f4518ede99ec2
5
5
  SHA512:
6
- metadata.gz: fb2c6a1ec8eba0687dadf80221ab19bf402a92c8b0efe3ec7040e5cb9cd1f79502fa78fd572d72d7736d7385d9baa95a8ea70996af8048b3619fd4ad835e6528
7
- data.tar.gz: 8b0728d0ac0975403fc13ecfe1610bd766e27077aed9db917bea6d5b1f8da3774d6932b6ba4451c819f640864580635f1da3f45f4a50ae3e80dc9bfea78ca713
6
+ metadata.gz: e01fb9646706fa961e6183bd8ab7bf13a558b9712c6cf2a1bc71fe02869b8f2aaffefff031573c17dcdb4f614afd78b2071d1705cc9039ce63f208f7efa8704f
7
+ data.tar.gz: 0e0e17a046595b5b0531e8f1f106bdf4f8895dcef75f3c68e49f6773ef100db3a10bcad819424b3f1665e92882447b15d65074496e1df4bc2bf1643741873095
data/.gitignore CHANGED
@@ -1,5 +1,17 @@
1
1
  pkg/*
2
2
  *.gem
3
3
  .bundle
4
+ log/*.log
5
+
6
+ spec/dummy/db/*.sqlite3
7
+ spec/dummy/db/*.sqlite3-journal
8
+ spec/dummy/log/*.log
9
+ spec/dummy/tmp/
10
+
4
11
  .ruby-version
5
12
  .ruby-gemset
13
+
14
+ .DS_Store
15
+ *.swp
16
+ *.swo
17
+ *~
data/.overcommit.yml ADDED
@@ -0,0 +1,59 @@
1
+ # Use this file to configure the Overcommit hooks you wish to use. This will
2
+ # extend the default configuration defined in:
3
+ # https://github.com/brigade/overcommit/blob/master/config/default.yml
4
+ #
5
+ # At the topmost level of this YAML file is a key representing type of hook
6
+ # being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
7
+ # customize each hook, such as whether to only run it on certain files (via
8
+ # `include`), whether to only display output if it fails (via `quiet`), etc.
9
+ #
10
+ # For a complete list of hooks, see:
11
+ # https://github.com/brigade/overcommit/tree/master/lib/overcommit/hook
12
+ #
13
+ # For a complete list of options that you can use to customize hooks, see:
14
+ # https://github.com/brigade/overcommit#configuration
15
+
16
+ gemfile: Gemfile
17
+
18
+ CommitMsg:
19
+ HardTabs:
20
+ enabled: true
21
+
22
+ RussianNovel:
23
+ enabled: true
24
+
25
+ PreCommit:
26
+ BundleAudit:
27
+ enabled: true
28
+ flags:
29
+ # Update the ruby-advisory-db and check Gemfile.lock
30
+ - '--update'
31
+
32
+ BundleCheck:
33
+ enabled: true
34
+
35
+ ExecutePermissions:
36
+ enabled: true
37
+ exclude:
38
+ - 'spec/dummy/bin/*'
39
+
40
+ Fasterer:
41
+ enabled: true
42
+
43
+ ForbiddenBranches:
44
+ enabled: true
45
+ branch_patterns:
46
+ - 'master'
47
+
48
+ HardTabs:
49
+ enabled: true
50
+
51
+ RuboCop:
52
+ enabled: true
53
+
54
+ TrailingWhitespace:
55
+ enabled: true
56
+
57
+ PrePush:
58
+ RSpec:
59
+ enabled: true
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --require spec_helper
3
+ --format documentation
4
+ --warnings
data/.rubocop.yml CHANGED
@@ -1,10 +1,21 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
+ require: rubocop-rspec
4
+
3
5
  AllCops:
4
- TargetRubyVersion: 2.4
6
+ TargetRubyVersion: 2.2
5
7
  DisplayCopNames: true
6
8
 
7
9
  Metrics/LineLength:
8
10
  Max: 100
9
11
  IgnoredPatterns:
10
12
  - '^\s*#'
13
+ Exclude:
14
+ - 'spec/**/*'
15
+
16
+ Metrics/BlockLength:
17
+ Exclude:
18
+ - 'spec/**/*'
19
+
20
+ Style/FrozenStringLiteralComment:
21
+ EnforcedStyle: always
data/.rubocop_todo.yml CHANGED
@@ -1,14 +1,11 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-12-10 12:36:03 +0700 using RuboCop version 0.51.0.
3
+ # on 2018-03-01 16:43:54 +0700 using RuboCop version 0.52.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
9
+ # Offense count: 31
10
10
  Style/Documentation:
11
- Exclude:
12
- - 'spec/**/*'
13
- - 'test/**/*'
14
- - 'lib/bemer.rb'
11
+ Enabled: false
data/Gemfile CHANGED
@@ -4,3 +4,9 @@ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in bemer.gemspec
6
6
  gemspec
7
+
8
+ group :development do
9
+ # Auto-reload require files or local gems without restarting server during Rails development.
10
+ gem 'require_reloader', '~> 0.2.1', git: 'https://github.com/vill/require_reloader.git',
11
+ branch: 'bugfix/delete-watchable-gems'
12
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017-2018 Alexander Grigorev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/LICENSE-RU ADDED
@@ -0,0 +1,23 @@
1
+ Лицензия MIT
2
+
3
+ Copyright (c) 2017-2018 Александр Григорьев
4
+
5
+ Данная лицензия разрешает лицам, получившим копию данного программного
6
+ обеспечения и сопутствующей документации (в дальнейшем именуемыми
7
+ «Программное Обеспечение»), безвозмездно использовать Программное
8
+ Обеспечение без ограничений, включая неограниченное право на использование,
9
+ копирование, изменение, слияние, публикацию, распространение, сублицензирование
10
+ и/или продажу копий Программного Обеспечения, а также лицам, которым
11
+ предоставляется данное Программное Обеспечение, при соблюдении следующих условий:
12
+
13
+ Указанное выше уведомление об авторском праве и данные условия должны быть включены
14
+ во все копии или значимые части данного Программного Обеспечения.
15
+
16
+ ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ,
17
+ ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ, ВКЛЮЧАЯ ГАРАНТИИ ТОВАРНОЙ ПРИГОДНОСТИ,
18
+ СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И ОТСУТСТВИЯ НАРУШЕНИЙ,
19
+ НО НЕ ОГРАНИЧИВАЯСЬ ИМИ. НИ В КАКОМ СЛУЧАЕ АВТОРЫ ИЛИ ПРАВООБЛАДАТЕЛИ
20
+ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ПО КАКИМ-ЛИБО ИСКАМ, ЗА УЩЕРБ ИЛИ ПО ИНЫМ ТРЕБОВАНИЯМ,
21
+ В ТОМ ЧИСЛЕ, ПРИ ДЕЙСТВИИ КОНТРАКТА, ДЕЛИКТЕ ИЛИ ИНОЙ СИТУАЦИИ,
22
+ ВОЗНИКШИМ ИЗ-ЗА ИСПОЛЬЗОВАНИЯ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ ИЛИ ИНЫХ ДЕЙСТВИЙ
23
+ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ.
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Bemer
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bemer`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Build reusable UI components for Rails applications using the [BEM methodology](https://en.bem.info/methodology/).
6
4
 
7
5
  ## Installation
8
6
 
@@ -24,12 +22,6 @@ Or install it yourself as:
24
22
 
25
23
  TODO: Write usage instructions here
26
24
 
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
25
  ## Contributing
34
26
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bemer.
27
+ Bug reports and pull requests are welcome on GitHub at https://github.com/vill/bemer.
data/Rakefile CHANGED
@@ -2,4 +2,11 @@
2
2
 
3
3
  require 'bundler/gem_tasks'
4
4
 
5
- task default: :spec
5
+ begin
6
+ require 'rspec/core/rake_task'
7
+
8
+ RSpec::Core::RakeTask.new(:spec)
9
+
10
+ task default: :spec
11
+ rescue LoadError # rubocop:disable Lint/HandleExceptions
12
+ end
data/bemer.gemspec CHANGED
@@ -6,7 +6,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
6
 
7
7
  require 'bemer/version'
8
8
 
9
- Gem::Specification.new do |spec|
9
+ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
10
10
  spec.name = 'bemer'
11
11
  spec.version = Bemer::VERSION
12
12
  spec.author = 'Alexander Grigorev'
@@ -15,16 +15,29 @@ Gem::Specification.new do |spec|
15
15
  spec.summary = 'Build reusable UI components for Rails applications using the BEM methodology.'
16
16
  spec.description = 'Build reusable UI components for Rails applications using the BEM methodology.'
17
17
  # rubocop:enable Metrics/LineLength
18
+ spec.homepage = 'https://github.com/vill/bemer'
18
19
  spec.license = 'MIT'
19
20
  spec.require_paths = ['lib']
21
+ spec.test_files = `git ls-files -z -- spec/*`.split("\x0")
20
22
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
21
- f.match(%r{^(test|spec|features)/|^Gemfile.lock$})
23
+ f.match(%r{^spec/|^Gemfile.lock$})
22
24
  end
23
25
 
24
- spec.required_ruby_version = '>= 2.0.0'
26
+ spec.required_ruby_version = '>= 2.2.0'
25
27
  spec.required_rubygems_version = '>= 2.2.0'
26
28
 
27
- spec.add_development_dependency 'bundler', '~> 1.15'
28
- spec.add_development_dependency 'rake', '~> 12.3.0'
29
- spec.add_development_dependency 'rubocop', '~> 0.51.0'
29
+ spec.add_development_dependency 'bundler', '~> 1.15'
30
+ spec.add_development_dependency 'bundler-audit', '~> 0.6.0'
31
+ spec.add_development_dependency 'fasterer', '~> 0.3.2'
32
+ spec.add_development_dependency 'overcommit', '~> 0.41.0'
33
+ spec.add_development_dependency 'rails', '~> 5.1.4'
34
+ spec.add_development_dependency 'rake', '~> 12.3.0'
35
+ spec.add_development_dependency 'require_reloader', '~> 0.2.1'
36
+ spec.add_development_dependency 'rspec', '~> 3.7.0'
37
+ spec.add_development_dependency 'rspec-rails', '~> 3.7.2'
38
+ spec.add_development_dependency 'rubocop', '~> 0.52.1'
39
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.21'
40
+ spec.add_development_dependency 'sqlite3', '~> 1.3.13'
41
+
42
+ spec.add_runtime_dependency 'railties', '>= 3.2.22', '<= 5.2'
30
43
  end
data/lib/bemer.rb CHANGED
@@ -1,7 +1,98 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bemer/version'
3
+ require 'forwardable'
4
+ require 'active_support'
5
+ require 'active_support/dependencies/autoload'
6
+ require 'active_support/core_ext/object/blank'
7
+ require 'active_support/core_ext/string/inflections'
4
8
 
5
9
  module Bemer
6
- # Your code goes here...
10
+ extend ActiveSupport::Autoload
11
+
12
+ autoload :AssetMatcher
13
+ autoload :Builders
14
+ autoload :CommonTemplate
15
+ autoload :Component
16
+ autoload :ComponentPack
17
+ autoload :Configuration
18
+ autoload :Context
19
+ autoload :ContextExtentions
20
+ autoload :DefaultTemplateList
21
+ autoload :Entity
22
+ autoload :EntityBuilder
23
+ autoload :MixinList
24
+ autoload :ModifierList
25
+ autoload :Pipeline
26
+ autoload :Predicate
27
+ autoload :Renderer
28
+ autoload :Tag
29
+ autoload :TagBuilder
30
+ autoload :Template
31
+ autoload :TemplateList
32
+ autoload :Tree
33
+
34
+ eager_autoload do
35
+ autoload :Helpers
36
+ autoload :TemplateCatalog
37
+ end
38
+
39
+ class << self
40
+ extend Forwardable
41
+
42
+ # rubocop:disable Layout/AlignParameters
43
+ def_delegators :config, :asset_paths,
44
+ :bem,
45
+ :can_use_new_matcher?,
46
+ :default_block_tag,
47
+ :default_element_tag,
48
+ :default_path_prefix,
49
+ :element_name_separator,
50
+ :modifier_name_separator,
51
+ :modifier_value_separator,
52
+ :path,
53
+ :paths,
54
+ :prepend_asset_paths
55
+ # rubocop:enable Layout/AlignParameters
56
+
57
+ alias prepend_asset_paths? prepend_asset_paths
58
+
59
+ def config
60
+ Configuration.instance
61
+ end
62
+
63
+ def setup
64
+ yield config
65
+ end
66
+
67
+ def eager_load!
68
+ super
69
+
70
+ Bemer::Builders.eager_load!
71
+ end
72
+
73
+ def bem_class(block, element = nil)
74
+ return '' if block.blank? || (!element.nil? && element.blank?)
75
+
76
+ entity_name(block, element)
77
+ end
78
+
79
+ def entity_name(block, element = nil)
80
+ names = [block]
81
+
82
+ names << element unless element.nil?
83
+
84
+ names.map { |name| css_class(name) }.join(element_name_separator)
85
+ end
86
+
87
+ def css_class(name)
88
+ name_without_whitespace = name.to_s.delete(' ')
89
+
90
+ return name_without_whitespace if name.instance_of?(String)
91
+
92
+ name_without_whitespace.dasherize
93
+ end
94
+ end
7
95
  end
96
+
97
+ require 'bemer/version'
98
+ require 'bemer/railtie' if defined?(::Rails::Railtie)
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bemer
4
+ class AssetMatcher
5
+ def initialize(loose_app_assets)
6
+ @loose_app_assets = loose_app_assets
7
+ end
8
+
9
+ def call(logical_path, filename = nil)
10
+ filename = Rails.application.assets.resolve(logical_path).to_s if filename.nil?
11
+
12
+ return if [Bemer.path, *Bemer.asset_paths].detect { |path| filename.start_with?(path.to_s) }
13
+
14
+ loose_app_assets.call(logical_path, filename) if loose_app_assets.respond_to?(:call)
15
+ end
16
+
17
+ protected
18
+
19
+ attr_reader :loose_app_assets
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/dependencies/autoload'
4
+
5
+ module Bemer
6
+ module Builders
7
+ extend ActiveSupport::Autoload
8
+
9
+ eager_autoload do
10
+ autoload :Template
11
+ autoload :TemplateList
12
+ autoload :Tree
13
+ end
14
+
15
+ module Tag
16
+ extend ActiveSupport::Autoload
17
+
18
+ eager_autoload do
19
+ autoload :Element
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bemer
4
+ module Builders
5
+ module Tag
6
+ class Element
7
+ def initialize(block, bem_cascade)
8
+ @bem_cascade = bem_cascade
9
+ @block = block
10
+ end
11
+
12
+ def elem(name = '', **options, &content)
13
+ Bemer::Tag.new(block, name, bem_cascade: bem_cascade, **options, &content).render
14
+ end
15
+
16
+ protected
17
+
18
+ attr_reader :block, :bem_cascade
19
+ end
20
+ end
21
+ end
22
+ end