volt 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1ca7d169258c7293b67dc1c7d3153187e4780f2
4
- data.tar.gz: 7444ff10d20abbe48e0f327de849f1e13943d36e
3
+ metadata.gz: 1f150816f7a0d0a04624791bb0126192bd457baa
4
+ data.tar.gz: 76bbeb5ff7e2e92919fd2a42479fdbfd12eb7667
5
5
  SHA512:
6
- metadata.gz: 3f4ca97cfcdbc2be6f8b158230d3158d4774de0e793a461d00fad4d5b912b1e549c57aa33b8e958a190a7812c8e2d56d55cf45badfa3602e77aa7796a4a0a963
7
- data.tar.gz: 03a292434478f1ea50be6c5c5f1faa64a62575c14360e9a466d93e55d7fdfddd893051663358465a6b41d7f1c4680083c1daeed3da05b2fd835221a8688a0995
6
+ metadata.gz: 8809bf5a5ba5c9678db7a79b7ea9a00fa73f99366486f45745af56a7c524e34167c4061bb545219a68abde62ce2a93efedb793a3de2b673731ff4eb4fbb2d22d
7
+ data.tar.gz: c327c96bd63e7f315b094072eab88e575d65a7985c15bf3cc6f6bf0446859aea859dac9edf4ca481ff2b14735d06e48e80773262a8b84dcae337e98e9bf13b8c
data/Readme.md CHANGED
@@ -27,6 +27,17 @@ Volt has the following goals:
27
27
  9. Understandable code base
28
28
  10. Control Upgradeability
29
29
 
30
+ # Road Map
31
+
32
+ Many of the core Volt features are implemented. We still have a bit to go before 1.0, most of it involving models.
33
+
34
+ 1. Database storing models
35
+ 2. Model validations (client and server side)
36
+ 3. Reactive model queries
37
+ 4. Reactive Enumerators with Blocks (.map .count, etc...)
38
+ 5. Full managed render loop (for fast rendering)
39
+ 6. Fix N+1 issue with some reactive values (I know how to fix, just haven't gotten around to doing it)
40
+
30
41
  # VOLT guide
31
42
 
32
43
  This guide will take you through creating a basic web application in Volt. This tutorial assumes a basic knowledge of ruby and web development.
@@ -342,7 +353,7 @@ Any JS/CSS from an included component or component gem will be included as well.
342
353
 
343
354
  ## Component Generator
344
355
 
345
- Components can easily be shared as a gem. Volt provides a scaffold for component gems. In a folder (not in a volt project), simply type: volt component {component_name} This will create the files needed for the gem. Note that all volt component gems will be prefixed with volt- so they can easily be found by others.
356
+ Components can easily be shared as a gem. Volt provides a scaffold for component gems. In a folder (not in a volt project), simply type: volt gem {component_name} This will create the files needed for the gem. Note that all volt component gems will be prefixed with volt- so they can easily be found by others.
346
357
 
347
358
  While developing, you can use the component by placing the following in your Gemfile:
348
359
 
@@ -443,4 +454,12 @@ In the case above, if any url matches /todos/*, (where * is anything but a slash
443
454
 
444
455
  If params._controller is 'todos' and params._index is not nil, the route would be matched.
445
456
 
446
- Routes are matched top to bottom in a routes file.
457
+ Routes are matched top to bottom in a routes file.
458
+
459
+ ## Debugging
460
+
461
+ An in browser irb is in the works. We also have source maps support, but they are currently disabled due by default. To enable them run:
462
+
463
+ MAPS=true volt s
464
+
465
+ They are disabled by default because they slow down page rendering because so many files are rendered. We're working with the opal and sprockets teams to make it so everything is still served in one big source maps file (which would show the files as they originated on disk)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.5
1
+ 0.3.6
data/lib/volt/cli.rb CHANGED
@@ -21,19 +21,27 @@ class CLI < Thor
21
21
  desc "server", "run the server on the project in the current directory"
22
22
  def server
23
23
  require 'thin'
24
+ require 'fileutils'
25
+
26
+ # If we're in a Volt project, clear the temp directory
27
+ # TODO: this is a work around for a bug when switching between
28
+ # source maps and non-source maps.
29
+ if File.exists?("config.ru") && File.exists?("Gemfile")
30
+ FileUtils.rm_rf("tmp/.")
31
+ end
24
32
 
25
33
  ENV['SERVER'] = 'true'
26
34
  Thin::Runner.new(['start']).run!
27
35
  end
28
36
 
29
- desc "component GEM", "Creates a gem where you can share a component"
37
+ desc "gem GEM", "Creates a component gem where you can share a component"
30
38
  method_option :bin, :type => :boolean, :default => false, :aliases => '-b', :banner => "Generate a binary for your library."
31
39
  method_option :test, :type => :string, :lazy_default => 'rspec', :aliases => '-t', :banner => "Generate a test directory for your library: 'rspec' is the default, but 'minitest' is also supported."
32
40
  method_option :edit, :type => :string, :aliases => "-e",
33
41
  :lazy_default => [ENV['BUNDLER_EDITOR'], ENV['VISUAL'], ENV['EDITOR']].find{|e| !e.nil? && !e.empty? },
34
42
  :required => false, :banner => "/path/to/your/editor",
35
43
  :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
36
- def component(name)
44
+ def gem(name)
37
45
  require 'volt/cli/new_gem'
38
46
 
39
47
  NewGem.new(self, name, options)
data/lib/volt/server.rb CHANGED
@@ -34,11 +34,11 @@ class Server
34
34
  end
35
35
 
36
36
  # Serve the opal files
37
- OpalFiles.new(@app, @app_path, @component_paths)
37
+ opal_files = OpalFiles.new(@app, @app_path, @component_paths)
38
38
 
39
39
  # Serve the main html files from public, also figure out
40
40
  # which JS/CSS files to serve.
41
- @app.use IndexFiles, @component_paths
41
+ @app.use IndexFiles, @component_paths, opal_files
42
42
 
43
43
  # Handle socks js connection
44
44
  if RUBY_PLATFORM != 'java'
@@ -82,14 +82,14 @@ class ComponentFiles
82
82
  end
83
83
 
84
84
 
85
- def javascript_files
85
+ def javascript_files(opal_files)
86
86
  javascript_files = asset_folders do |asset_folder|
87
87
  Dir["#{asset_folder}/**/*.js"].map {|path| '/assets' + path[asset_folder.size..-1] }
88
88
  end
89
89
 
90
90
  opal_js_files = []
91
91
  if Volt.source_maps?
92
- opal_js_files << environment['volt/templates/page'].to_a.map {|v| '/assets/' + v.logical_path + '?body=1' }
92
+ opal_js_files += opal_files.environment['volt/templates/page'].to_a.map {|v| '/assets/' + v.logical_path + '?body=1' }
93
93
  else
94
94
  opal_js_files << '/assets/volt/templates/page.js'
95
95
  end
@@ -3,9 +3,10 @@ require 'volt/router/routes'
3
3
 
4
4
  # Serves the main pages
5
5
  class IndexFiles
6
- def initialize(app, component_paths)
6
+ def initialize(app, component_paths, opal_files)
7
7
  @app = app
8
8
  @component_paths = component_paths
9
+ @opal_files = opal_files
9
10
 
10
11
  @@router ||= Routes.new.define do
11
12
  # Find the route file
@@ -39,7 +40,7 @@ class IndexFiles
39
40
 
40
41
  def javascript_files
41
42
  # TODO: Cache somehow, this is being loaded every time
42
- ComponentFiles.new('home', @component_paths, true).javascript_files
43
+ ComponentFiles.new('home', @component_paths, true).javascript_files(@opal_files)
43
44
  end
44
45
 
45
46
  def css_files
@@ -2,13 +2,20 @@ require 'volt/server/rack/source_map_server'
2
2
 
3
3
  # Sets up the maps for the opal assets, and source maps if enabled.
4
4
  class OpalFiles
5
+ attr_reader :environment
6
+
5
7
  def initialize(builder, app_path, component_paths)
6
- Opal::Processor.source_map_enabled = Volt.source_maps?
8
+ ::Opal::Processor.source_map_enabled = Volt.source_maps?
7
9
  # Opal::Processor.arity_check_enabled = true
8
10
  # Opal::Processor.dynamic_require_severity = :raise
9
11
 
10
12
  @component_paths = component_paths
11
- environment = Opal::Environment.new
13
+ @environment = Opal::Environment.new
14
+
15
+ # Since the scope changes in builder blocks, we need to capture
16
+ # environment in closure
17
+ environment = @environment
18
+
12
19
  environment.cache = Sprockets::Cache::FileStore.new("./tmp")
13
20
 
14
21
  environment.append_path(app_path)
@@ -37,7 +44,7 @@ class OpalFiles
37
44
  builder.map(source_maps.prefix) do
38
45
  run source_maps
39
46
  end
40
- end
47
+ end
41
48
  end
42
49
 
43
50
  def add_asset_folders(environment)
@@ -18,6 +18,6 @@ describe ComponentFiles do
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/js/test2.js", "/assets/js/bootstrap.js", "/assets/volt/templates/page.js", "/components/home.js", "/assets/js/test3.js", "/assets/js/test1.js"])
21
+ expect(main.javascript_files(nil)).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
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.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Stout