volt 0.2.7 → 0.2.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb91ea42e6c276676ed2e332f3fa6852a1934c14
4
- data.tar.gz: f9cdcfc29256f2b153546f6036639391d8bb3a81
3
+ metadata.gz: 7be61678b8ab551460135dfeeaaab5060ed02f47
4
+ data.tar.gz: cc56d76316db3a18138fcce5f9bae3b7e4d301d7
5
5
  SHA512:
6
- metadata.gz: 3aa3f0d5362a4dd8877d82434de5c9ef40b0bdae7ab2cea519ee706f1955e6bb4403bb8421744b5f609240f7075a7319c17b4d93c80f5e103a9800f4f463772f
7
- data.tar.gz: 46a84efeaf3d6c254a9753d4e1b5fb97595276b6fa674a965f8809e89ef0872243ff20e66ad6c55555e4802a97d5a0b9209484339b58eef24075ab706192d0da
6
+ metadata.gz: 2cbbe9373a883d689ac88dfbc2d710a8c8e621de33e9baf90b1513b62c85021c7eda0ea21a8ed037d1d85a58149a64c71e742c681cd4ee5b5f591479ecf6df67
7
+ data.tar.gz: 9052a27af07b504f5f765d5c9ad2c833efea2acecb60e820518cf9a5532198435be84b3c84cfdf64a750e35077f1ba4b1e026801d51108c58f2937fa70582bbd
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.7
1
+ 0.2.9
@@ -10,4 +10,8 @@ class Volt
10
10
  def self.client?
11
11
  !!ENV['CLIENT']
12
12
  end
13
+
14
+ def self.source_maps?
15
+ !!ENV['MAPS']
16
+ end
13
17
  end
@@ -1,15 +1,20 @@
1
1
  require 'volt/server/rack/component_paths'
2
-
3
- SOURCE_MAPS = !!ENV['MAPS'] unless defined?(SOURCE_MAPS)
2
+ require 'volt'
4
3
 
5
4
  # Takes in the path to a component and gets all other components
6
5
  # required from this one
7
6
  class ComponentFiles
8
- def initialize(component_name, component_paths)
7
+ def initialize(component_name, component_paths, main_component=false)
9
8
  @component_name = component_name
10
9
  @component_paths = component_paths
11
10
  @asset_folders = []
12
11
  @components = [component_name]
12
+ @main_component = main_component
13
+
14
+ if @main_component
15
+ # Add in volt's JS files first
16
+ component('volt')
17
+ end
13
18
 
14
19
  load_child_components
15
20
  add_asset_folder(component_name)
@@ -57,7 +62,6 @@ class ComponentFiles
57
62
  if File.exists?(dependencies_file)
58
63
  # Run the dependencies file in this ComponentFiles context
59
64
  code = File.read(dependencies_file)
60
- puts "CODE: #{code.inspect}"
61
65
  instance_eval(code)
62
66
  end
63
67
  end
@@ -75,16 +79,19 @@ class ComponentFiles
75
79
 
76
80
 
77
81
  def javascript_files
78
- if SOURCE_MAPS
79
- javascript_files = environment['volt/templates/page'].to_a.map {|v| '/assets/' + v.logical_path + '?body=1' }
80
- else
81
- javascript_files = ['/assets/volt/templates/page.js']
82
+ javascript_files = asset_folders do |asset_folder|
83
+ Dir["#{asset_folder}/**/*.js"].map {|path| '/assets' + path[asset_folder.size..-1] }
82
84
  end
83
85
 
84
- javascript_files << '/components/home.js'
85
- javascript_files += asset_folders do |asset_folder|
86
- Dir["#{asset_folder}/**/*.js"].map {|path| '/assets' + path[asset_folder.size..-1] }
86
+ opal_js_files = []
87
+ if Volt.source_maps?
88
+ opal_js_files << environment['volt/templates/page'].to_a.map {|v| '/assets/' + v.logical_path + '?body=1' }
89
+ else
90
+ opal_js_files << '/assets/volt/templates/page.js'
87
91
  end
92
+ opal_js_files << '/components/home.js'
93
+
94
+ javascript_files.insert(2, *opal_js_files)
88
95
 
89
96
  return javascript_files
90
97
  end
@@ -12,7 +12,7 @@ class ComponentPaths
12
12
  # Gem folders with volt in them
13
13
  # TODO: we should probably qualify this a bit more
14
14
  app_folders += Gem.loaded_specs.values.map { |g| g.full_gem_path }.reject {|g| g !~ /volt/ }.map {|f| f + '/app' }
15
-
15
+
16
16
  app_folders
17
17
  end
18
18
 
@@ -23,8 +23,8 @@ class IndexFiles
23
23
  end
24
24
 
25
25
  def javascript_files
26
- # TODO: OPTimize
27
- ComponentFiles.new('home', @component_paths).javascript_files
26
+ # TODO: Cache somehow, this is being loaded every time
27
+ ComponentFiles.new('home', @component_paths, true).javascript_files
28
28
  end
29
29
 
30
30
  def css_files
@@ -1,14 +1,12 @@
1
1
  require 'volt/server/rack/source_map_server'
2
2
 
3
- SOURCE_MAPS = !!ENV['MAPS'] unless defined?(SOURCE_MAPS)
4
-
5
- Opal::Processor.source_map_enabled = SOURCE_MAPS
6
- # Opal::Processor.arity_check_enabled = true
7
- # Opal::Processor.dynamic_require_severity = :raise
8
-
9
3
  # Sets up the maps for the opal assets, and source maps if enabled.
10
4
  class OpalFiles
11
5
  def initialize(builder, app_path, component_paths)
6
+ Opal::Processor.source_map_enabled = Volt.source_maps?
7
+ # Opal::Processor.arity_check_enabled = true
8
+ # Opal::Processor.dynamic_require_severity = :raise
9
+
12
10
  @component_paths = component_paths
13
11
  environment = Opal::Environment.new
14
12
  environment.cache = Sprockets::Cache::FileStore.new("./tmp")
@@ -33,7 +31,7 @@ class OpalFiles
33
31
  run environment
34
32
  end
35
33
 
36
- if SOURCE_MAPS
34
+ if Volt.source_maps?
37
35
  source_maps = SourceMapServer.new(environment)
38
36
 
39
37
  builder.map(source_maps.prefix) do
@@ -1 +1,2 @@
1
1
  component 'shared'
2
+ component 'slideshow'
File without changes
@@ -12,12 +12,12 @@ describe ComponentFiles do
12
12
  main = ComponentFiles.new("main", @component_paths)
13
13
 
14
14
  components = main.components
15
- expect(components).to eq(['main', 'shared', 'bootstrap'])
15
+ expect(components).to eq(['main', 'shared', 'bootstrap', "slideshow"])
16
16
  end
17
17
 
18
18
  it "should list all JS files" do
19
19
  main = ComponentFiles.new("main", @component_paths)
20
20
 
21
- expect(main.javascript_files).to eq(["/assets/volt/templates/page.js", "/components/home.js", "/assets/js/test2.js", "/assets/js/test1.js"])
21
+ expect(main.javascript_files).to eq(["/assets/js/test2.js", "/assets/js/bootstrap.js", "/assets/volt/templates/page.js", "/components/home.js", "/assets/js/test3.js", "/assets/js/test1.js"])
22
22
  end
23
23
  end
@@ -1,4 +1,5 @@
1
1
  # Specify which components you wish to include when
2
2
  # the "home" component loads.
3
3
 
4
+ # the bootstrap theme
4
5
  component 'bootstrap'
@@ -2,8 +2,6 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <script src="/js/jquery-2.0.3.js"></script>
6
- <script src="/js/sockjs-0.2.1.min.js"></script>
7
5
  <% javascript_files.each do |javascript_file| %>
8
6
  <script src="<%= javascript_file %>"></script>
9
7
  <% end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: volt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Stout
@@ -265,6 +265,8 @@ files:
265
265
  - Rakefile
266
266
  - Readme.md
267
267
  - VERSION
268
+ - app/volt/assets/js/jquery-2.0.3.js
269
+ - app/volt/assets/js/sockjs-0.2.1.min.js
268
270
  - bin/volt
269
271
  - docs/GETTING_STARTED.md
270
272
  - docs/GUIDE.md
@@ -336,10 +338,12 @@ files:
336
338
  - lib/volt/templates/targets/dom_target.rb
337
339
  - lib/volt/templates/template_binding.rb
338
340
  - lib/volt/templates/template_renderer.rb
341
+ - spec/app/bootstrap/assets/js/bootstrap.js
339
342
  - spec/app/main/assets/js/test1.js
340
343
  - spec/app/main/config/dependencies.rb
341
344
  - spec/app/shared/assets/js/test2.js
342
345
  - spec/app/shared/config/dependencies.rb
346
+ - spec/app/slideshow/assets/js/test3.js
343
347
  - spec/models/event_chain_spec.rb
344
348
  - spec/models/model_spec.rb
345
349
  - spec/models/old_model_spec.rb
@@ -385,8 +389,6 @@ files:
385
389
  - templates/project/app/home/views/index/index.html
386
390
  - templates/project/config.ru
387
391
  - templates/project/public/index.html
388
- - templates/project/public/js/jquery-2.0.3.js
389
- - templates/project/public/js/sockjs-0.2.1.min.js
390
392
  - templates/project/spec/spec_helper.rb
391
393
  - volt.gemspec
392
394
  homepage: http://voltframework.com
@@ -415,10 +417,12 @@ specification_version: 4
415
417
  summary: A ruby web framework where your ruby runs on both server and client (via
416
418
  Opal)
417
419
  test_files:
420
+ - spec/app/bootstrap/assets/js/bootstrap.js
418
421
  - spec/app/main/assets/js/test1.js
419
422
  - spec/app/main/config/dependencies.rb
420
423
  - spec/app/shared/assets/js/test2.js
421
424
  - spec/app/shared/config/dependencies.rb
425
+ - spec/app/slideshow/assets/js/test3.js
422
426
  - spec/models/event_chain_spec.rb
423
427
  - spec/models/model_spec.rb
424
428
  - spec/models/old_model_spec.rb