volt 0.9.5.pre7 → 0.9.5.pre8
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/volt/cli.rb +21 -12
- data/lib/volt/cli/asset_compile.rb +13 -8
- data/lib/volt/cli/base_index_renderer.rb +4 -3
- data/lib/volt/cli/new_gem.rb +22 -4
- data/lib/volt/models/model.rb +3 -0
- data/lib/volt/models/validators/length_validator.rb +2 -2
- data/lib/volt/page/bindings/event_binding.rb +4 -4
- data/lib/volt/server/middleware/default_middleware_stack.rb +2 -2
- data/lib/volt/server/rack/asset_files.rb +12 -7
- data/lib/volt/server/rack/component_code.rb +3 -2
- data/lib/volt/server/rack/component_paths.rb +1 -1
- data/lib/volt/server/rack/index_files.rb +5 -5
- data/lib/volt/server/rack/opal_files.rb +7 -6
- data/lib/volt/server/rack/sprockets_helpers_setup.rb +41 -7
- data/lib/volt/server/template_handlers/sprockets_component_handler.rb +1 -1
- data/lib/volt/utils/recursive_exists.rb +19 -0
- data/lib/volt/version.rb +1 -1
- data/lib/volt/volt/app.rb +3 -1
- data/lib/volt/volt/server_setup/app.rb +8 -0
- data/spec/apps/file_loading/app/disable_auto/config/dependencies.rb +1 -1
- data/spec/apps/kitchen_sink/Gemfile +1 -1
- data/spec/apps/kitchen_sink/app/main/views/main/store_demo.html +1 -5
- data/spec/integration/todos_spec.rb +26 -2
- data/spec/models/validators/length_validator_spec.rb +2 -10
- data/spec/server/rack/asset_files_spec.rb +35 -35
- data/spec/server/rack/rack_requests_spec.rb +2 -1
- data/spec/server/rack/sprockets_helpers_setup.rb +15 -0
- data/templates/newgem/Gemfile.tt +11 -0
- data/templates/newgem/app/newgem/tasks/.empty_directory +0 -0
- data/templates/newgem/newgem.gemspec.tt +16 -1
- data/templates/newgem/spec/integration/sample_integration_spec.rb +11 -0
- data/templates/newgem/spec/newgem_spec.rb.tt +0 -4
- data/templates/newgem/spec/spec_helper.rb.tt +5 -1
- data/templates/project/Gemfile.tt +5 -5
- data/volt.gemspec +1 -1
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c66c8281cc4ad10eadde2b575b4ca2606cf270e8
|
4
|
+
data.tar.gz: f76598259c1dcd62376c61efb2f208295bc221cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5f7e6b83f481e1c81222c93df07f77a2fc3dc8715de60712950701cda264c6192fa9ce294d680f4ce77fba651948562386d774e312893862a374e0b7253218a
|
7
|
+
data.tar.gz: 89030a005ae230751ed6f45f0afaa1ac190fbe0c0abe3fb63f9e7643ffda2675904748251f86dd4bbab53a84fb70af0bb208f5e42ef95bb7a6591d6d25668dde
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
3
|
## 0.9.5
|
4
|
+
### Breaking Changes
|
5
|
+
- previously, we mounted the asset folders in components at /assets, and we also mounted the /app folder (and any gem's app folders') at /assets. This allowed you to usually access what you wanted at /assets, but resulted in conflicts. To ensure better component isolation, we now only mount the ```app``` folders. To make things clear, instead of sprockets being mounted at /assets, it is now mounted at /app. So the url for something in /app/main/assets/css/something.css can be accessed at (you guessed it) /app/main/assets/css/something.css
|
6
|
+
|
4
7
|
### Added
|
5
8
|
- You can now disable auto-import of JS/CSS with ```disable_auto_import``` in a dependencies.rb file
|
6
9
|
- Opal was upgraded to 0.8, which brings sourcemaps back (yah!)
|
@@ -12,6 +15,8 @@
|
|
12
15
|
- Rewrote the precompile pipeline.
|
13
16
|
- Added image compression by default. (using image_optim)
|
14
17
|
- All volt CLI tasks now can run from inside of any directory in the volt app (or the root)
|
18
|
+
- Asset precompilation has been reworked to use Sprockets::Manifest. The results are written to /public, and an index.html file is created. The entire app loading up until the websocket connect can be served statically (via nginx for example) All js and css is written to a single file.
|
19
|
+
- The ```generate gem``` generator has been improved to setup a dummy app and integration specs out of the box.
|
15
20
|
|
16
21
|
### Changed
|
17
22
|
- fix issue with ```raw``` and promises (#275)
|
data/lib/volt/cli.rb
CHANGED
@@ -17,16 +17,7 @@ module Volt
|
|
17
17
|
desc 'new PROJECT_NAME', 'generates a new project.'
|
18
18
|
|
19
19
|
def new(name)
|
20
|
-
|
21
|
-
|
22
|
-
# Grab the current volt version
|
23
|
-
directory('project', name, version: Volt::Version::STRING, name: name, domain: name.dasherize.downcase, app_name: name.capitalize)
|
24
|
-
|
25
|
-
# Move into the directory
|
26
|
-
Dir.chdir(name) do
|
27
|
-
# bundle
|
28
|
-
bundle_command('install')
|
29
|
-
end
|
20
|
+
new_project(name)
|
30
21
|
|
31
22
|
say ""
|
32
23
|
say "Your app is now ready in the #{name} directory.", :green
|
@@ -63,11 +54,12 @@ module Volt
|
|
63
54
|
|
64
55
|
require 'fileutils'
|
65
56
|
require 'volt/server'
|
57
|
+
require 'volt/utils/recursive_exists'
|
66
58
|
|
67
59
|
# If we're in a Volt project, clear the temp directory
|
68
60
|
# TODO: this is a work around for a bug when switching between
|
69
61
|
# source maps and non-source maps.
|
70
|
-
if
|
62
|
+
if RecursiveExists.exists_here_or_up?('config.ru') && RecursiveExists.exists_here_or_up?('Gemfile')
|
71
63
|
# FileUtils.rm_rf('tmp/sass')
|
72
64
|
# FileUtils.rm_rf('tmp/sprockets')
|
73
65
|
else
|
@@ -126,13 +118,30 @@ module Volt
|
|
126
118
|
end
|
127
119
|
|
128
120
|
no_tasks do
|
121
|
+
# The logic for creating a new project. We want to be able to invoke this
|
122
|
+
# inside of a method so we can run it with Dir.chdir
|
123
|
+
def new_project(name, skip_gemfile = false)
|
124
|
+
require 'securerandom'
|
125
|
+
|
126
|
+
# Grab the current volt version
|
127
|
+
directory('project', name, version: Volt::Version::STRING, name: name, domain: name.dasherize.downcase, app_name: name.capitalize)
|
128
|
+
|
129
|
+
unless skip_gemfile
|
130
|
+
# Move into the directory
|
131
|
+
Dir.chdir(name) do
|
132
|
+
# bundle
|
133
|
+
bundle_command('install')
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
129
138
|
def move_to_root
|
130
139
|
unless Gem.win_platform?
|
131
140
|
# Change CWD to the root of the volt project
|
132
141
|
pwd = Dir.pwd
|
133
142
|
changed = false
|
134
143
|
loop do
|
135
|
-
if File.exists?(pwd + '/Gemfile')
|
144
|
+
if File.exists?(pwd + '/config.ru') || File.exists?(pwd + '/Gemfile')
|
136
145
|
Dir.chdir(pwd) if changed
|
137
146
|
break
|
138
147
|
else
|
@@ -16,6 +16,11 @@ module Volt
|
|
16
16
|
ENV['MAPS'] = 'false'
|
17
17
|
ENV['NO_FORKING'] = 'true'
|
18
18
|
|
19
|
+
if !ENV['VOLT_ENV'] && !ENV['RACK_ENV']
|
20
|
+
# Set the default env for compile
|
21
|
+
ENV['VOLT_ENV'] = 'production'
|
22
|
+
end
|
23
|
+
|
19
24
|
require 'opal'
|
20
25
|
require 'rack'
|
21
26
|
require 'volt'
|
@@ -41,7 +46,7 @@ module Volt
|
|
41
46
|
end
|
42
47
|
|
43
48
|
def write_files_and_manifest
|
44
|
-
asset_files = AssetFiles.from_cache('main', @volt_app.component_paths)
|
49
|
+
asset_files = AssetFiles.from_cache(@volt_app.app_url, 'main', @volt_app.component_paths)
|
45
50
|
# Write a temp css file
|
46
51
|
js = asset_files.javascript(@volt_app)
|
47
52
|
css = asset_files.css
|
@@ -51,7 +56,7 @@ module Volt
|
|
51
56
|
js.each do |type, src_or_body|
|
52
57
|
if type == :src
|
53
58
|
src = src_or_body
|
54
|
-
url = src.gsub(
|
59
|
+
url = src.gsub(/^#{@volt_app.app_url}\//, '')
|
55
60
|
file.write("//= require '#{url}'\n")
|
56
61
|
else
|
57
62
|
body = src_or_body
|
@@ -73,14 +78,14 @@ module Volt
|
|
73
78
|
|
74
79
|
File.open(Volt.root + '/app/main/app.scss', 'wb') do |file|
|
75
80
|
css.each do |link|
|
76
|
-
url = link.gsub(
|
81
|
+
url = link.gsub(/^#{@volt_app.app_url}\//, '')
|
77
82
|
file.write("//= require '#{url}'\n")
|
78
83
|
end
|
79
84
|
end
|
80
85
|
end
|
81
86
|
|
82
87
|
def compile_manifests
|
83
|
-
manifest = Sprockets::Manifest.new(@volt_app.sprockets,
|
88
|
+
manifest = Sprockets::Manifest.new(@volt_app.sprockets, "./public#{@volt_app.app_url}/manifest.json")
|
84
89
|
|
85
90
|
# Compile the files (and linked assets)
|
86
91
|
manifest.compile('main/app.js')
|
@@ -90,8 +95,8 @@ module Volt
|
|
90
95
|
@tmp_files.each {|path| FileUtils.rm(path) }
|
91
96
|
|
92
97
|
# Remove the temp files
|
93
|
-
FileUtils.rm(Volt.root +
|
94
|
-
FileUtils.rm(Volt.root +
|
98
|
+
FileUtils.rm(Volt.root + "#{@volt_app.app_url}/main/app.js")
|
99
|
+
FileUtils.rm(Volt.root + "#{@volt_app.app_url}/main/app.scss")
|
95
100
|
end
|
96
101
|
|
97
102
|
def write_index
|
@@ -100,8 +105,8 @@ module Volt
|
|
100
105
|
output_path = "#{@root_path}/public/index.html"
|
101
106
|
require 'json'
|
102
107
|
|
103
|
-
@manifest = JSON.parse(File.read(@root_path +
|
104
|
-
output_html = BaseIndexRenderer.new(@manifest).html
|
108
|
+
@manifest = JSON.parse(File.read(@root_path + "/public#{@volt_app.app_url}/manifest.json"))
|
109
|
+
output_html = BaseIndexRenderer.new(@volt_app, @manifest).html
|
105
110
|
|
106
111
|
write_file(output_path, output_html)
|
107
112
|
end
|
@@ -3,7 +3,8 @@
|
|
3
3
|
|
4
4
|
module Volt
|
5
5
|
class BaseIndexRenderer
|
6
|
-
def initialize(manifest)
|
6
|
+
def initialize(volt_app, manifest)
|
7
|
+
@volt_app = volt_app
|
7
8
|
@manifest = manifest
|
8
9
|
end
|
9
10
|
|
@@ -16,11 +17,11 @@ module Volt
|
|
16
17
|
|
17
18
|
# When writing the index, we render the
|
18
19
|
def javascript_tags
|
19
|
-
"<script src=\"
|
20
|
+
"<script async src=\"#{@volt_app.app_url}/#{@manifest['assets']['main/app.js']}\"></script>"
|
20
21
|
end
|
21
22
|
|
22
23
|
def css_tags
|
23
|
-
"<link href=\"
|
24
|
+
"<link href=\"#{@volt_app.app_url}/#{@manifest['assets']['main/app.css']}\" media=\"all\" rel=\"stylesheet\" type=\"text/css\" />"
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
data/lib/volt/cli/new_gem.rb
CHANGED
@@ -25,6 +25,25 @@ class NewGem
|
|
25
25
|
|
26
26
|
copy_files
|
27
27
|
copy_options
|
28
|
+
|
29
|
+
# Create a sample project inside of the specs folder
|
30
|
+
Dir.chdir(@target + '/spec') do
|
31
|
+
@thor.say 'Generating dummy project for integration specs', :green
|
32
|
+
cli = Volt::CLI.new
|
33
|
+
cli.shell.mute do
|
34
|
+
cli.new_project('dummy', true)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Remove gemfile
|
38
|
+
FileUtils.rm('dummy/Gemfile')
|
39
|
+
|
40
|
+
# Remove spec directory inside of dummy app
|
41
|
+
FileUtils.rm_rf('dummy/spec')
|
42
|
+
end
|
43
|
+
|
44
|
+
puts "Initializing git repo in #{@target}"
|
45
|
+
Dir.chdir(@target) { `git init`; `git add .` }
|
46
|
+
|
28
47
|
end
|
29
48
|
|
30
49
|
# Check with the rubygems api to see if this gem name is available.
|
@@ -78,9 +97,8 @@ at choosealicense.com/licenses/mit.\n\ny/(n):")
|
|
78
97
|
copy('newgem/bin/newgem.tt', "bin/#{@name}") if @options[:bin]
|
79
98
|
copy('newgem/rspec.tt', '.rspec')
|
80
99
|
copy('newgem/spec/spec_helper.rb.tt', 'spec/spec_helper.rb')
|
81
|
-
copy('newgem/spec/newgem_spec.rb.tt', "spec
|
82
|
-
|
83
|
-
Dir.chdir(@target) { `git init`; `git add .` }
|
100
|
+
copy('newgem/spec/newgem_spec.rb.tt', "spec/sample_spec.rb")
|
101
|
+
copy('newgem/spec/integration/sample_integration_spec.rb', "spec/integration/sample_integration_spec.rb")
|
84
102
|
|
85
103
|
if @options[:edit]
|
86
104
|
run("#{@options['edit']} \"#{gemspec_dest}\"") # Open gemspec in editor
|
@@ -115,7 +133,7 @@ at choosealicense.com/licenses/mit.\n\ny/(n):")
|
|
115
133
|
|
116
134
|
def volt_version_base
|
117
135
|
require 'volt/version'
|
118
|
-
Volt::Version::STRING
|
136
|
+
Volt::Version::STRING
|
119
137
|
end
|
120
138
|
|
121
139
|
def get_constant_name
|
data/lib/volt/models/model.rb
CHANGED
@@ -19,9 +19,9 @@ module Volt
|
|
19
19
|
end
|
20
20
|
|
21
21
|
if !value || value.size < min
|
22
|
-
errors[field_name] = [message || "must be at least #{
|
22
|
+
errors[field_name] = [message || "must be at least #{min} characters"]
|
23
23
|
elsif max && value.size > max
|
24
|
-
errors[field_name] = [message || "must be less than #{
|
24
|
+
errors[field_name] = [message || "must be less than #{max} characters"]
|
25
25
|
end
|
26
26
|
|
27
27
|
errors
|
@@ -13,19 +13,19 @@ module Volt
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def key_code
|
16
|
-
`
|
16
|
+
`self.js_event.keyCode`
|
17
17
|
end
|
18
18
|
|
19
19
|
def stop!
|
20
|
-
`
|
20
|
+
`self.js_event.stopPropagation();`
|
21
21
|
end
|
22
22
|
|
23
23
|
def prevent_default!
|
24
|
-
`
|
24
|
+
`self.js_event.preventDefault();`
|
25
25
|
end
|
26
26
|
|
27
27
|
def target
|
28
|
-
`
|
28
|
+
`self.js_event.toElement || self.js_event.target`
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -43,11 +43,11 @@ module Volt
|
|
43
43
|
# can set them up.
|
44
44
|
def self.postboot_setup(volt_app, rack_app)
|
45
45
|
# Serve the opal files
|
46
|
-
opal_files = OpalFiles.new(rack_app, volt_app.app_path, volt_app.component_paths)
|
46
|
+
opal_files = OpalFiles.new(rack_app, volt_app.app_url, volt_app.app_path, volt_app.component_paths)
|
47
47
|
volt_app.opal_files = opal_files
|
48
48
|
volt_app.sprockets = opal_files.environment
|
49
49
|
|
50
|
-
Volt::SprocketsHelpersSetup.new(volt_app
|
50
|
+
Volt::SprocketsHelpersSetup.new(volt_app)
|
51
51
|
|
52
52
|
# Serve the main html files from public, also figure out
|
53
53
|
# which JS/CSS files to serve.
|
@@ -4,17 +4,18 @@ require 'uri'
|
|
4
4
|
# from the dependencies.rb files.
|
5
5
|
module Volt
|
6
6
|
class AssetFiles
|
7
|
-
def self.from_cache(component_name, component_paths)
|
7
|
+
def self.from_cache(app_url, component_name, component_paths)
|
8
8
|
# @cache ||= {}
|
9
9
|
|
10
10
|
# @cache[component_name] ||= begin
|
11
11
|
# not cached, create
|
12
12
|
|
13
|
-
self.new(component_name, component_paths)
|
13
|
+
self.new(app_url, component_name, component_paths)
|
14
14
|
# end
|
15
15
|
end
|
16
16
|
|
17
|
-
def initialize(component_name, component_paths)
|
17
|
+
def initialize(app_url, component_name, component_paths)
|
18
|
+
@app_url = app_url
|
18
19
|
@component_paths = component_paths
|
19
20
|
@assets = []
|
20
21
|
@included_components = {}
|
@@ -93,7 +94,7 @@ module Volt
|
|
93
94
|
|
94
95
|
def prepare_locator(locator, valid_extensions)
|
95
96
|
unless url_or_path?(locator)
|
96
|
-
locator = File.join(
|
97
|
+
locator = File.join(@app_url, @current_component, '/assets', valid_extensions.first, "#{locator}")
|
97
98
|
locator += '.css' unless locator =~ /^.*\.(#{valid_extensions.join('|')})$/
|
98
99
|
end
|
99
100
|
locator
|
@@ -129,7 +130,10 @@ module Volt
|
|
129
130
|
case type
|
130
131
|
when :folder
|
131
132
|
# for a folder, we search for all .js files and return a tag for them
|
132
|
-
javascript_files += Dir["#{path}/**/*.js"].sort.map
|
133
|
+
javascript_files += Dir["#{path}/**/*.js"].sort.map do |folder|
|
134
|
+
# Grab the component folder/assets/js/file.js
|
135
|
+
@app_url + '/' + folder.split('/')[-4..-1].join('/')
|
136
|
+
end
|
133
137
|
when :javascript_file
|
134
138
|
# javascript_file is a cdn path to a JS file
|
135
139
|
javascript_files << path
|
@@ -146,7 +150,7 @@ module Volt
|
|
146
150
|
if ENV['MAPS'] == 'all'
|
147
151
|
scripts << @opal_tag_generator.javascript_include_tag(volt_path)
|
148
152
|
else
|
149
|
-
scripts << "<script src=\"
|
153
|
+
scripts << "<script src=\"#{volt_app.app_url}/#{volt_path}.js\"></script>"
|
150
154
|
scripts << "<script>#{Opal::Processor.load_asset_code(volt_app.sprockets, volt_path)}</script>"
|
151
155
|
end
|
152
156
|
|
@@ -172,7 +176,8 @@ module Volt
|
|
172
176
|
# aren't imported by default:
|
173
177
|
# http://sass-lang.com/guide
|
174
178
|
css_files += Dir["#{path}/**/[^_]*.{css,scss}"].sort.map do |folder|
|
175
|
-
|
179
|
+
last4 = folder.split('/')[-4..-1].join('/').gsub(/[.]scss$/, '')
|
180
|
+
css_path = @app_url + '/' + last4
|
176
181
|
css_path += '.css' unless css_path =~ /[.]css$/
|
177
182
|
css_path
|
178
183
|
end
|
@@ -6,7 +6,8 @@ require 'volt/server/rack/asset_files'
|
|
6
6
|
# method that returns all of the ruby setup code for the component.
|
7
7
|
module Volt
|
8
8
|
class ComponentCode
|
9
|
-
def initialize(component_name, component_paths, client = true)
|
9
|
+
def initialize(volt_app, component_name, component_paths, client = true)
|
10
|
+
@volt_app = volt_app
|
10
11
|
@component_name = component_name
|
11
12
|
@component_paths = component_paths
|
12
13
|
@client = client
|
@@ -17,7 +18,7 @@ module Volt
|
|
17
18
|
# Start with config code
|
18
19
|
code = @client ? generate_config_code : ''
|
19
20
|
|
20
|
-
asset_files = AssetFiles.from_cache(@component_name, @component_paths)
|
21
|
+
asset_files = AssetFiles.from_cache(@volt_app.app_url, @component_name, @component_paths)
|
21
22
|
asset_files.component_paths.each do |component_path, component_name|
|
22
23
|
code << ComponentTemplates.new(component_path, component_name, @client).code
|
23
24
|
code << "\n\n"
|
@@ -84,7 +84,7 @@ module Volt
|
|
84
84
|
# Load in all views and routes
|
85
85
|
# TODO: Nested components listed twice are are loaded multiple times
|
86
86
|
component_names.uniq.each do |component_name|
|
87
|
-
code = Volt::ComponentCode.new(component_name, self, false).code
|
87
|
+
code = Volt::ComponentCode.new(volt_app, component_name, self, false).code
|
88
88
|
# Evaluate returned code, the ```volt_app``` variable is set for access.
|
89
89
|
eval(code)
|
90
90
|
end
|
@@ -4,8 +4,8 @@ require 'volt/router/routes'
|
|
4
4
|
# Serves the main pages
|
5
5
|
module Volt
|
6
6
|
class IndexFiles
|
7
|
-
def initialize(
|
8
|
-
@
|
7
|
+
def initialize(rack_app, volt_app, component_paths, opal_files)
|
8
|
+
@rack_app = rack_app
|
9
9
|
@volt_app = volt_app
|
10
10
|
@component_paths = component_paths
|
11
11
|
@opal_files = opal_files
|
@@ -37,7 +37,7 @@ module Volt
|
|
37
37
|
if route_match?(env['PATH_INFO'])
|
38
38
|
[200, { 'Content-Type' => 'text/html; charset=utf-8' }, [html]]
|
39
39
|
else
|
40
|
-
@
|
40
|
+
@rack_app.call env
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -58,11 +58,11 @@ module Volt
|
|
58
58
|
|
59
59
|
def javascript_tags
|
60
60
|
# TODO: Cache somehow, this is being loaded every time
|
61
|
-
AssetFiles.from_cache('main', @component_paths).javascript_tags(@volt_app)
|
61
|
+
AssetFiles.from_cache(@volt_app.app_url, 'main', @component_paths).javascript_tags(@volt_app)
|
62
62
|
end
|
63
63
|
|
64
64
|
def css_tags
|
65
|
-
AssetFiles.from_cache('main', @component_paths).css_tags
|
65
|
+
AssetFiles.from_cache(@volt_app.app_url, 'main', @component_paths).css_tags
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -12,7 +12,7 @@ module Volt
|
|
12
12
|
class OpalFiles
|
13
13
|
attr_reader :environment, :server
|
14
14
|
|
15
|
-
def initialize(builder, app_path, component_paths)
|
15
|
+
def initialize(builder, app_url, app_path, component_paths)
|
16
16
|
Opal::Processor.source_map_enabled = Volt.source_maps?
|
17
17
|
Opal::Processor.const_missing_enabled = true
|
18
18
|
|
@@ -34,7 +34,7 @@ module Volt
|
|
34
34
|
# Opal::Processor.arity_check_enabled = !Volt.env.production?
|
35
35
|
# Opal::Processor.dynamic_require_severity = :raise
|
36
36
|
|
37
|
-
@server = Opal::Server.new(prefix:
|
37
|
+
@server = Opal::Server.new(prefix: app_url, debug: Volt.source_maps?)
|
38
38
|
@server.use_index = false
|
39
39
|
|
40
40
|
@component_paths = component_paths
|
@@ -78,7 +78,7 @@ module Volt
|
|
78
78
|
# environment in closure
|
79
79
|
environment = @environment
|
80
80
|
|
81
|
-
builder.map
|
81
|
+
builder.map(app_url) do
|
82
82
|
run environment
|
83
83
|
end
|
84
84
|
|
@@ -121,9 +121,10 @@ module Volt
|
|
121
121
|
end
|
122
122
|
|
123
123
|
def add_asset_folders(environment)
|
124
|
-
@component_paths.asset_folders do |asset_folder|
|
125
|
-
|
126
|
-
|
124
|
+
# @component_paths.asset_folders do |asset_folder|
|
125
|
+
# puts "ADD ASSET FOLDER: #{asset_folder.inspect}"
|
126
|
+
# environment.append_path(asset_folder)
|
127
|
+
# end
|
127
128
|
end
|
128
129
|
end
|
129
130
|
end
|
@@ -2,8 +2,9 @@ require 'sprockets-helpers'
|
|
2
2
|
|
3
3
|
module Volt
|
4
4
|
class SprocketsHelpersSetup
|
5
|
-
def initialize(
|
6
|
-
@
|
5
|
+
def initialize(volt_app)
|
6
|
+
@volt_app = volt_app
|
7
|
+
@env = volt_app.sprockets
|
7
8
|
|
8
9
|
setup_path_helpers
|
9
10
|
add_linking_in_asset_path
|
@@ -15,7 +16,7 @@ module Volt
|
|
15
16
|
# Configure Sprockets::Helpers (if necessary)
|
16
17
|
Sprockets::Helpers.configure do |config|
|
17
18
|
config.environment = @env
|
18
|
-
config.prefix =
|
19
|
+
config.prefix = @volt_app.app_url
|
19
20
|
config.public_path = 'public'
|
20
21
|
config.debug = false#!Volt.env.production?
|
21
22
|
|
@@ -36,9 +37,27 @@ module Volt
|
|
36
37
|
# We "freedom-patch" sprockets-helpers asset_path method to
|
37
38
|
# automatically link assets.
|
38
39
|
def asset_path(source, options = {})
|
40
|
+
relative_path = source =~ /^[.][.]\//
|
41
|
+
if relative_path
|
42
|
+
component_root = logical_path.gsub(/\/[^\/]+$/, '')
|
43
|
+
path = File.join(component_root, source)
|
44
|
+
source = Volt::SprocketsHelpersSetup.expand(path)
|
45
|
+
end
|
46
|
+
|
47
|
+
if relative_path
|
48
|
+
link_path = source
|
49
|
+
else
|
50
|
+
link_path = source.gsub(/^#{@volt_app.app_path}\//, '')
|
51
|
+
end
|
52
|
+
|
53
|
+
# Return for absolute urls (one's off site)
|
39
54
|
uri = URI.parse(source)
|
40
55
|
return source if uri.absolute?
|
41
56
|
|
57
|
+
# Link all assets out of the box
|
58
|
+
# Added by volt
|
59
|
+
link_asset(link_path)
|
60
|
+
|
42
61
|
options[:prefix] = Sprockets::Helpers.prefix unless options[:prefix]
|
43
62
|
|
44
63
|
if Sprockets::Helpers.debug || options[:debug]
|
@@ -53,11 +72,8 @@ module Volt
|
|
53
72
|
uri.path << ".#{options[:ext]}"
|
54
73
|
end
|
55
74
|
|
56
|
-
# Link all assets out of the box
|
57
|
-
# Added by volt
|
58
|
-
link_asset(uri)
|
59
|
-
|
60
75
|
path = find_asset_path(uri, source, options)
|
76
|
+
|
61
77
|
if options[:expand] && path.respond_to?(:to_a)
|
62
78
|
path.to_a
|
63
79
|
else
|
@@ -67,5 +83,23 @@ module Volt
|
|
67
83
|
end
|
68
84
|
|
69
85
|
end
|
86
|
+
|
87
|
+
private
|
88
|
+
|
89
|
+
def self.expand(path)
|
90
|
+
parts = path.split('/')
|
91
|
+
|
92
|
+
output = []
|
93
|
+
|
94
|
+
parts.each do |part|
|
95
|
+
if part == '..'
|
96
|
+
output.pop
|
97
|
+
else
|
98
|
+
output << part
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
output.join('/')
|
103
|
+
end
|
70
104
|
end
|
71
105
|
end
|
@@ -49,7 +49,7 @@ module Sprockets
|
|
49
49
|
|
50
50
|
# Working with a component path
|
51
51
|
volt_app = Thread.current['volt_app'] || $volt_app
|
52
|
-
data = Volt::ComponentCode.new(component_name, volt_app.component_paths, true).code
|
52
|
+
data = Volt::ComponentCode.new(volt_app, component_name, volt_app.component_paths, true).code
|
53
53
|
else
|
54
54
|
data = env.read_file(input[:filename], input[:content_type])
|
55
55
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Volt
|
2
|
+
module RecursiveExists
|
3
|
+
def self.exists_here_or_up?(file)
|
4
|
+
# Check for a gemfile here or up a directory
|
5
|
+
pwd = Dir.pwd
|
6
|
+
|
7
|
+
loop do
|
8
|
+
if File.exists?("#{pwd}/#{file}")
|
9
|
+
return true
|
10
|
+
else
|
11
|
+
pwd = pwd.gsub(/\/[^\/]+$/, '')
|
12
|
+
return false if pwd == ''
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/volt/version.rb
CHANGED
data/lib/volt/volt/app.rb
CHANGED
@@ -91,7 +91,9 @@ module Volt
|
|
91
91
|
# Load up the main component dependencies. This is needed to load in
|
92
92
|
# any opal_gem calls in dependencies.rb
|
93
93
|
# TODO: Needs to support all components
|
94
|
-
|
94
|
+
if Dir.exists?(Volt.root + '/app/main')
|
95
|
+
AssetFiles.from_cache(app_url, 'main', component_paths)
|
96
|
+
end
|
95
97
|
|
96
98
|
reset_query_pool!
|
97
99
|
|
@@ -10,6 +10,11 @@ end
|
|
10
10
|
module Volt
|
11
11
|
module ServerSetup
|
12
12
|
module App
|
13
|
+
# The root url is where the volt app is mounted
|
14
|
+
attr_reader :root_url
|
15
|
+
# The app url is where the app folder (and sprockets) is mounted
|
16
|
+
attr_reader :app_url
|
17
|
+
|
13
18
|
def setup_paths
|
14
19
|
# Load component paths
|
15
20
|
@component_paths = ComponentPaths.new(@app_path)
|
@@ -19,6 +24,9 @@ module Volt
|
|
19
24
|
def load_app_code
|
20
25
|
setup_router
|
21
26
|
require_http_controllers
|
27
|
+
|
28
|
+
@root_url = '/'
|
29
|
+
@app_url = '/app'
|
22
30
|
end
|
23
31
|
|
24
32
|
def setup_router
|
@@ -7,7 +7,7 @@ gem 'volt-mongo'
|
|
7
7
|
|
8
8
|
# The following gem's are optional for themeing
|
9
9
|
# Twitter bootstrap
|
10
|
-
gem 'volt-bootstrap', '~> 0.0
|
10
|
+
gem 'volt-bootstrap', '~> 0.1.0'
|
11
11
|
|
12
12
|
# Simple theme for bootstrap, remove to theme yourself.
|
13
13
|
gem 'volt-bootstrap_jumbotron_theme', '~> 0.1.0'
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'todos app', type: :feature, sauce: true do
|
4
|
+
ENTER_KEY = ENV["BROWSER"] == 'phantom' ? :Enter : :return
|
4
5
|
it 'should add a todo and remove it' do
|
5
6
|
visit '/todos'
|
6
7
|
|
7
8
|
fill_in 'newtodo', :with => 'Todo 1'
|
8
|
-
find('#newtodo').native.send_keys(
|
9
|
+
find('#newtodo').native.send_keys(ENTER_KEY)
|
9
10
|
|
10
11
|
expect(page).to have_content('Todo 1')
|
11
12
|
|
@@ -16,7 +17,30 @@ describe 'todos app', type: :feature, sauce: true do
|
|
16
17
|
expect(page).to_not have_content('Todo 1')
|
17
18
|
|
18
19
|
# Make sure it deleted
|
19
|
-
|
20
|
+
if ENV['BROWSER'] == 'phantom'
|
21
|
+
visit '/todos'
|
22
|
+
else
|
23
|
+
page.driver.browser.navigate.refresh
|
24
|
+
end
|
20
25
|
expect(page).to_not have_content('Todo 1')
|
21
26
|
end
|
27
|
+
|
28
|
+
it 'should update a todo check state and persist' do
|
29
|
+
visit '/todos'
|
30
|
+
|
31
|
+
fill_in 'newtodo', :with => 'Todo 1'
|
32
|
+
find('#newtodo').native.send_keys(ENTER_KEY)
|
33
|
+
|
34
|
+
expect(page).to have_content('Todo 1')
|
35
|
+
|
36
|
+
find("input[type='checkbox']").click
|
37
|
+
|
38
|
+
if ENV['BROWSER'] == 'phantom'
|
39
|
+
visit '/todos'
|
40
|
+
else
|
41
|
+
page.evaluate_script('document.location.reload()')
|
42
|
+
end
|
43
|
+
|
44
|
+
expect(find("input[type='checkbox']").checked?).to eq(true)
|
45
|
+
end
|
22
46
|
end
|
@@ -38,22 +38,14 @@ describe Volt::LengthValidator do
|
|
38
38
|
describe 'when name is "John"' do
|
39
39
|
let(:name) { 'John' }
|
40
40
|
it do
|
41
|
-
|
42
|
-
expect(subject).to eq(name: ["must be at least {\"length\"=>5, \"maximum\"=>10} characters"])
|
43
|
-
else
|
44
|
-
expect(subject).to eq(name: ['must be at least {:length=>5, :maximum=>10} characters'])
|
45
|
-
end
|
41
|
+
expect(subject).to eq(name: ["must be at least 5 characters"])
|
46
42
|
end
|
47
43
|
end
|
48
44
|
|
49
45
|
describe 'when name is "Zach Galifianakis"' do
|
50
46
|
let(:name) { 'Zach Galifianakis' }
|
51
47
|
it do
|
52
|
-
|
53
|
-
expect(subject).to eq(name: ["must be less than {\"length\"=>5, \"maximum\"=>10} characters"])
|
54
|
-
else
|
55
|
-
expect(subject).to eq(name: ['must be less than {:length=>5, :maximum=>10} characters'])
|
56
|
-
end
|
48
|
+
expect(subject).to eq(name: ['must be less than 10 characters'])
|
57
49
|
end
|
58
50
|
end
|
59
51
|
end
|
@@ -11,7 +11,7 @@ if RUBY_PLATFORM != 'opal'
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'should return the dependencies list' do
|
14
|
-
main = Volt::AssetFiles.new('main', @component_paths)
|
14
|
+
main = Volt::AssetFiles.new('/app', 'main', @component_paths)
|
15
15
|
|
16
16
|
components = main.components
|
17
17
|
expect(components).to eq(%w(volt mongo main shared bootstrap slideshow))
|
@@ -20,31 +20,31 @@ if RUBY_PLATFORM != 'opal'
|
|
20
20
|
describe 'js files' do
|
21
21
|
context "when the component's dependencies.rb does not contain .disable_auto_import" do
|
22
22
|
it 'should list all JS files' do
|
23
|
-
main = Volt::AssetFiles.new('main', @component_paths)
|
23
|
+
main = Volt::AssetFiles.new('/app', 'main', @component_paths)
|
24
24
|
expect(main.javascript(volt_app).reject{|v| v[0] != :src }).to eq([
|
25
|
-
[:src,
|
26
|
-
[:src,
|
27
|
-
[:src,
|
28
|
-
[:src,
|
29
|
-
[:src,
|
30
|
-
[:src,
|
31
|
-
[:src,
|
32
|
-
[:src,
|
33
|
-
[:src,
|
25
|
+
[:src, "/app/volt/assets/js/jquery-2.0.3.js"],
|
26
|
+
[:src, "/app/volt/assets/js/volt_js_polyfills.js"],
|
27
|
+
[:src, "/app/volt/assets/js/volt_watch.js"],
|
28
|
+
[:src, "/app/bootstrap/assets/js/bootstrap.js"],
|
29
|
+
[:src, "/app/shared/assets/js/test2.js"],
|
30
|
+
[:src, "/app/slideshow/assets/js/test3.js"],
|
31
|
+
[:src, "/app/main/assets/js/test1.js"],
|
32
|
+
[:src, "/app/volt/volt/app.js"],
|
33
|
+
[:src, "/app/components/main.js"]
|
34
34
|
])
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
context "when the component's dependencies.rb contains .disable_auto_import" do
|
39
39
|
it 'should list only the files included via the css_file helpers' do
|
40
|
-
disabled_auto = Volt::AssetFiles.new('disable_auto', @component_paths)
|
40
|
+
disabled_auto = Volt::AssetFiles.new('/app', 'disable_auto', @component_paths)
|
41
41
|
expect(disabled_auto.javascript(volt_app).reject{|v| v[0] != :src }).to eq([
|
42
|
-
[:src,
|
43
|
-
[:src,
|
44
|
-
[:src,
|
45
|
-
[:src,
|
46
|
-
[:src,
|
47
|
-
[:src,
|
42
|
+
[:src, "/app/volt/assets/js/jquery-2.0.3.js"],
|
43
|
+
[:src, "/app/volt/assets/js/volt_js_polyfills.js"],
|
44
|
+
[:src, "/app/volt/assets/js/volt_watch.js"],
|
45
|
+
[:src, "/app/disable_auto/assets/js/test1.js"],
|
46
|
+
[:src, "/app/volt/volt/app.js"],
|
47
|
+
[:src, "/app/components/main.js"]
|
48
48
|
])
|
49
49
|
end
|
50
50
|
end
|
@@ -54,23 +54,23 @@ if RUBY_PLATFORM != 'opal'
|
|
54
54
|
|
55
55
|
context "when the component's dependencies.rb does not contain .disable_auto_import" do
|
56
56
|
it 'should list all the asset files in that component' do
|
57
|
-
main = Volt::AssetFiles.new('main', @component_paths)
|
57
|
+
main = Volt::AssetFiles.new('/app', 'main', @component_paths)
|
58
58
|
|
59
59
|
expect(main.css).to eq([
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
"/app/volt/assets/css/notices.css",
|
61
|
+
"/app/bootstrap/assets/css/01-bootstrap.css",
|
62
|
+
"/app/main/assets/css/test3.css"
|
63
63
|
])
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
67
|
context "when the component's dependencies.rb contains .disable_auto_import" do
|
68
68
|
it 'should list only the files included via the css_file helpers' do
|
69
|
-
disabled_auto = Volt::AssetFiles.new('disable_auto', @component_paths)
|
69
|
+
disabled_auto = Volt::AssetFiles.new('/app', 'disable_auto', @component_paths)
|
70
70
|
|
71
71
|
expect(disabled_auto.css).to eq([
|
72
|
-
|
73
|
-
|
72
|
+
"/app/volt/assets/css/notices.css",
|
73
|
+
"/app/disable_auto/assets/css/test1.css"
|
74
74
|
])
|
75
75
|
end
|
76
76
|
end
|
@@ -78,33 +78,33 @@ if RUBY_PLATFORM != 'opal'
|
|
78
78
|
|
79
79
|
describe '.is_url?' do
|
80
80
|
it 'should return true for URIs like //something.com/something.js' do
|
81
|
-
main = Volt::AssetFiles.new('main', @component_paths)
|
81
|
+
main = Volt::AssetFiles.new('/app', 'main', @component_paths)
|
82
82
|
expect(main.url_or_path? '//something.com/a-folder/something.js').to eq(true)
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'should return true for HTTP and HTTPS urls' do
|
86
|
-
main = Volt::AssetFiles.new('main', @component_paths)
|
86
|
+
main = Volt::AssetFiles.new('/app', 'main', @component_paths)
|
87
87
|
expect(main.url_or_path? 'http://something.com/a-folder/something.js').to eq(true)
|
88
88
|
expect(main.url_or_path? 'https://something.com/a-folder/something.js').to eq(true)
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'should return true for paths' do
|
92
|
-
main = Volt::AssetFiles.new('main', @component_paths)
|
92
|
+
main = Volt::AssetFiles.new('/app', 'main', @component_paths)
|
93
93
|
expect(main.url_or_path? 'something.js').to eq(false)
|
94
|
-
expect(main.url_or_path? '/
|
95
|
-
expect(main.url_or_path? '/
|
94
|
+
expect(main.url_or_path? '/app/something.js').to eq(true)
|
95
|
+
expect(main.url_or_path? '/app/something/something.js').to eq(true)
|
96
96
|
end
|
97
97
|
|
98
98
|
it 'should return false for file names' do
|
99
|
-
main = Volt::AssetFiles.new('main', @component_paths)
|
99
|
+
main = Volt::AssetFiles.new('/app', 'main', @component_paths)
|
100
100
|
expect(main.url_or_path? 'something.js').to eq(false)
|
101
|
-
expect(main.url_or_path? '
|
101
|
+
expect(main.url_or_path? 'app/something/something.js').to eq(false)
|
102
102
|
end
|
103
103
|
|
104
104
|
end
|
105
105
|
|
106
106
|
it 'should raise an exception for a missing component gem' do
|
107
|
-
main = Volt::AssetFiles.new('main', @component_paths)
|
107
|
+
main = Volt::AssetFiles.new('/app', 'main', @component_paths)
|
108
108
|
|
109
109
|
relative_dep_path = '../../apps/file_loading/app/missing_deps'
|
110
110
|
path_to_missing_deps = File.join(File.dirname(__FILE__), relative_dep_path)
|
@@ -115,7 +115,7 @@ if RUBY_PLATFORM != 'opal'
|
|
115
115
|
end
|
116
116
|
|
117
117
|
it 'should not raise an exception for a dependency file with valid components' do
|
118
|
-
main = Volt::AssetFiles.new('main', @component_paths)
|
118
|
+
main = Volt::AssetFiles.new('/app', 'main', @component_paths)
|
119
119
|
|
120
120
|
path_to_main = File.join(File.dirname(__FILE__), '../../apps/file_loading/app/main')
|
121
121
|
path_to_missing_deps = File.join(File.dirname(__FILE__), path_to_main)
|
@@ -125,7 +125,7 @@ if RUBY_PLATFORM != 'opal'
|
|
125
125
|
end
|
126
126
|
|
127
127
|
it 'should parse javascript src/body from the javascript tags' do
|
128
|
-
main = Volt::AssetFiles.new('main', @component_paths)
|
128
|
+
main = Volt::AssetFiles.new('/app', 'main', @component_paths)
|
129
129
|
|
130
130
|
expect(main).to receive(:javascript_tags).and_return("<script src='/someurl.js'></script><script>var inlinejs = true;</script>")
|
131
131
|
|
@@ -1,8 +1,9 @@
|
|
1
|
+
require 'spec_helper'
|
1
2
|
|
2
3
|
if ENV['BROWSER'] && ENV['BROWSER'] == 'phantom'
|
3
4
|
describe 'Rack Requests', type: :feature do
|
4
5
|
it 'should send JS file with JS mimetype' do
|
5
|
-
visit '/components/main.js'
|
6
|
+
visit '/app/components/main.js'
|
6
7
|
|
7
8
|
expect(page.response_headers['Content-Type']).to include 'application/javascript'
|
8
9
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "sprockets helpers" do
|
4
|
+
it 'should expand paths' do
|
5
|
+
result = Volt::SprocketsHelpersSetup.expand('/something/cool/../awesome/beans/../../five/six/seven')
|
6
|
+
|
7
|
+
expect(result).to eq('/something/five/six/seven')
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should expand paths2' do
|
11
|
+
result = Volt::SprocketsHelpersSetup.expand('bootstrap/assets/css/../fonts/glyphicons-halflings-regular.svg')
|
12
|
+
|
13
|
+
expect(result).to eq('bootstrap/assets/fonts/glyphicons-halflings-regular.svg')
|
14
|
+
end
|
15
|
+
end
|
data/templates/newgem/Gemfile.tt
CHANGED
@@ -2,3 +2,14 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in <%=config[:name]%>.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
# Optional Gems for testing/dev
|
7
|
+
|
8
|
+
# The implementation of ReadWriteLock in Volt uses concurrent ruby and ext helps performance.
|
9
|
+
gem 'concurrent-ruby-ext', '~> 0.8.0'
|
10
|
+
|
11
|
+
# For mongo (optional)
|
12
|
+
gem 'bson_ext', '~> 1.9.0'
|
13
|
+
|
14
|
+
# Gems you use for development should be added to the gemspec file as
|
15
|
+
# development dependencies.
|
File without changes
|
@@ -19,8 +19,23 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_development_dependency "volt", "~> <%= config[:volt_version_base] %>"
|
22
|
-
spec.add_development_dependency 'rspec', '~> 3.2.0'
|
23
22
|
spec.add_development_dependency "rake"
|
23
|
+
|
24
|
+
# Testing gems
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.2.0'
|
26
|
+
spec.add_development_dependency 'opal-rspec', '~> 0.4.2'
|
27
|
+
spec.add_development_dependency 'capybara', '~> 2.4.2'
|
28
|
+
spec.add_development_dependency 'selenium-webdriver', '~> 2.43.0'
|
29
|
+
spec.add_development_dependency 'chromedriver2-helper', '~> 0.0.8'
|
30
|
+
spec.add_development_dependency 'poltergeist', '~> 1.5.0'
|
31
|
+
|
32
|
+
# Gems to run the dummy app
|
33
|
+
spec.add_development_dependency 'volt-mongo', '0.1.1'
|
34
|
+
spec.add_development_dependency 'volt-bootstrap', '~> 0.1.0'
|
35
|
+
spec.add_development_dependency 'volt-bootstrap_jumbotron_theme', '~> 0.1.0'
|
36
|
+
spec.add_development_dependency 'volt-user_templates', '~> 0.4.0'
|
37
|
+
spec.add_development_dependency 'thin', '~> 1.6.0'
|
38
|
+
|
24
39
|
<% if config[:test] -%>
|
25
40
|
spec.add_development_dependency "<%=config[:test]%>"
|
26
41
|
<% end -%>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'sample integration test', type: :feature do
|
4
|
+
# An example integration spec, this will only be run if ENV['BROWSER'] is
|
5
|
+
# specified. Current values for ENV['BROWSER'] are 'firefox' and 'phantom'
|
6
|
+
it 'should load the page' do
|
7
|
+
visit '/'
|
8
|
+
|
9
|
+
expect(page).to have_content('Home')
|
10
|
+
end
|
11
|
+
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
# Volt sets up rspec and capybara for testing.
|
2
2
|
require 'volt/spec/setup'
|
3
|
-
|
3
|
+
|
4
|
+
# When testing Volt component gems, we boot up a dummy app first to run the
|
5
|
+
# test in, so we have access to Volt itself.
|
6
|
+
dummy_app_path = File.join(File.dirname(__FILE__), 'dummy')
|
7
|
+
Volt.spec_setup(dummy_app_path)
|
4
8
|
|
5
9
|
RSpec.configure do |config|
|
6
10
|
config.run_all_when_everything_filtered = true
|
@@ -7,7 +7,7 @@ gem 'volt-mongo', '~> 0.1.0'
|
|
7
7
|
|
8
8
|
# The following gem's are optional for themeing
|
9
9
|
# Twitter bootstrap
|
10
|
-
gem 'volt-bootstrap', '~> 0.0
|
10
|
+
gem 'volt-bootstrap', '~> 0.1.0'
|
11
11
|
|
12
12
|
# Simple theme for bootstrap, remove to theme yourself.
|
13
13
|
gem 'volt-bootstrap_jumbotron_theme', '~> 0.1.0'
|
@@ -27,10 +27,6 @@ platform :ruby, :jruby do
|
|
27
27
|
gem 'rbnacl-libsodium', require: false
|
28
28
|
end
|
29
29
|
|
30
|
-
# Asset compilation gems, they will be required when needed.
|
31
|
-
gem 'csso-rails', '~> 0.3.4', require: false
|
32
|
-
gem 'uglifier', '>= 2.4.0', require: false
|
33
|
-
|
34
30
|
group :test do
|
35
31
|
# Testing dependencies
|
36
32
|
gem 'rspec', '~> 3.2.0'
|
@@ -52,6 +48,10 @@ platform :mri, :mingw do
|
|
52
48
|
end
|
53
49
|
|
54
50
|
group :production do
|
51
|
+
# Asset compilation gems, they will be required when needed.
|
52
|
+
gem 'csso-rails', '~> 0.3.4', require: false
|
53
|
+
gem 'uglifier', '>= 2.4.0', require: false
|
54
|
+
|
55
55
|
# Image compression gem for precompiling assets
|
56
56
|
gem 'image_optim'
|
57
57
|
|
data/volt.gemspec
CHANGED
@@ -45,7 +45,7 @@ Gem::Specification.new do |spec|
|
|
45
45
|
|
46
46
|
# There is a big performance issue with selenium-webdriver on v2.45.0
|
47
47
|
spec.add_development_dependency 'selenium-webdriver', '~> 2.46.2'
|
48
|
-
spec.add_development_dependency '
|
48
|
+
spec.add_development_dependency 'chromedriver-helper', '~> 1.0.0'
|
49
49
|
spec.add_development_dependency 'poltergeist', '~> 1.5.0'
|
50
50
|
spec.add_development_dependency 'thin', '~> 1.6.3'
|
51
51
|
spec.add_development_dependency 'coveralls', '~> 0.8.1'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: volt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.5.
|
4
|
+
version: 0.9.5.pre8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Stout
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -235,19 +235,19 @@ dependencies:
|
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: 2.46.2
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
|
-
name:
|
238
|
+
name: chromedriver-helper
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|
240
240
|
requirements:
|
241
241
|
- - "~>"
|
242
242
|
- !ruby/object:Gem::Version
|
243
|
-
version: 0.0
|
243
|
+
version: 1.0.0
|
244
244
|
type: :development
|
245
245
|
prerelease: false
|
246
246
|
version_requirements: !ruby/object:Gem::Requirement
|
247
247
|
requirements:
|
248
248
|
- - "~>"
|
249
249
|
- !ruby/object:Gem::Version
|
250
|
-
version: 0.0
|
250
|
+
version: 1.0.0
|
251
251
|
- !ruby/object:Gem::Dependency
|
252
252
|
name: poltergeist
|
253
253
|
requirement: !ruby/object:Gem::Requirement
|
@@ -591,6 +591,7 @@ files:
|
|
591
591
|
- lib/volt/utils/parsing.rb
|
592
592
|
- lib/volt/utils/promise_extensions.rb
|
593
593
|
- lib/volt/utils/read_write_lock.rb
|
594
|
+
- lib/volt/utils/recursive_exists.rb
|
594
595
|
- lib/volt/utils/set_patch.rb
|
595
596
|
- lib/volt/utils/tilt_patch.rb
|
596
597
|
- lib/volt/utils/time_patch.rb
|
@@ -739,6 +740,7 @@ files:
|
|
739
740
|
- spec/server/rack/http_response_renderer_spec.rb
|
740
741
|
- spec/server/rack/quite_common_logger_spec.rb
|
741
742
|
- spec/server/rack/rack_requests_spec.rb
|
743
|
+
- spec/server/rack/sprockets_helpers_setup.rb
|
742
744
|
- spec/spec_helper.rb
|
743
745
|
- spec/store/mongo_spec.rb
|
744
746
|
- spec/tasks/dispatcher_spec.rb
|
@@ -796,6 +798,7 @@ files:
|
|
796
798
|
- templates/newgem/app/newgem/controllers/server/.empty_directory
|
797
799
|
- templates/newgem/app/newgem/lib/.empty_directory
|
798
800
|
- templates/newgem/app/newgem/models/.empty_directory
|
801
|
+
- templates/newgem/app/newgem/tasks/.empty_directory
|
799
802
|
- templates/newgem/app/newgem/views/main/index.html
|
800
803
|
- templates/newgem/bin/newgem.tt
|
801
804
|
- templates/newgem/gitignore.tt
|
@@ -804,6 +807,7 @@ files:
|
|
804
807
|
- templates/newgem/lib/newgem/version.rb.tt
|
805
808
|
- templates/newgem/newgem.gemspec.tt
|
806
809
|
- templates/newgem/rspec.tt
|
810
|
+
- templates/newgem/spec/integration/sample_integration_spec.rb
|
807
811
|
- templates/newgem/spec/newgem_spec.rb.tt
|
808
812
|
- templates/newgem/spec/spec_helper.rb.tt
|
809
813
|
- templates/newgem/test/minitest_helper.rb.tt
|
@@ -1001,6 +1005,7 @@ test_files:
|
|
1001
1005
|
- spec/server/rack/http_response_renderer_spec.rb
|
1002
1006
|
- spec/server/rack/quite_common_logger_spec.rb
|
1003
1007
|
- spec/server/rack/rack_requests_spec.rb
|
1008
|
+
- spec/server/rack/sprockets_helpers_setup.rb
|
1004
1009
|
- spec/spec_helper.rb
|
1005
1010
|
- spec/store/mongo_spec.rb
|
1006
1011
|
- spec/tasks/dispatcher_spec.rb
|