Class: Jasmine::Config
- Inherits:
-
Object
- Object
- Jasmine::Config
- Defined in:
- lib/jax/monkeypatch/jasmine/config.rb,
lib/jax/generators/app/templates/spec/javascripts/support/jasmine_config.rb
Instance Method Summary collapse
- #helpers ⇒ Object
- #plugin_and_app_files(src_files) ⇒ Object
-
#root_dir ⇒ Object
new, used by overridden 'server.rb' so that we can map /public to root.
- #spec_files ⇒ Object
-
#src_files ⇒ Object
overridden so that we can map source files separately from /public.
Instance Method Details
#helpers ⇒ Object
22 23 24 25 26 27 |
# File 'lib/jax/monkeypatch/jasmine/config.rb', line 22 def helpers helpers = simple_config['helpers'] || ['helpers/**/*.js'] helpers.collect! { |s| File.(s, spec_dir).gsub(/^#{Regexp::escape Jax.root.to_s}\/?/, '') } match_files(project_root, plugin_and_app_files(helpers)).uniq end |
#plugin_and_app_files(src_files) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/jax/monkeypatch/jasmine/config.rb', line 3 def plugin_and_app_files(src_files) src_files.collect do |src_file| Jax.application.plugins.inject([]) { |ary, plugin| ary + [File.join(plugin.relative_path, src_file)] } + [src_file] end.flatten end |
#root_dir ⇒ Object
new, used by overridden 'server.rb' so that we can map /public to root
37 38 39 40 41 42 43 |
# File 'lib/jax/monkeypatch/jasmine/config.rb', line 37 def root_dir if simple_config['root_dir'] File.join project_root, simple_config['root_dir'] else project_root end end |
#spec_files ⇒ Object
29 30 31 32 33 34 |
# File 'lib/jax/monkeypatch/jasmine/config.rb', line 29 def spec_files spec_files = simple_config['spec_files'] || ['**/*[sS]pec.js'] spec_files.collect! { |s| File.(s, spec_dir).gsub(/^#{Regexp::escape Jax.root.to_s}\/?/, '') } match_files(project_root, plugin_and_app_files(spec_files)).uniq end |
#src_files ⇒ Object
overridden so that we can map source files separately from /public
12 13 14 15 16 17 18 19 20 |
# File 'lib/jax/monkeypatch/jasmine/config.rb', line 12 def src_files if simple_config['src_files'] match_files(src_dir, plugin_and_app_files(simple_config['src_files'])).collect do |f| File.join("__src__", f) end.uniq else [] end end |