zassets 0.2.7 → 0.2.8
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 +7 -0
- data/README.md +390 -39
- data/lib/zassets/config.rb +18 -5
- data/lib/zassets/version.rb +1 -1
- metadata +62 -136
- data/.gitignore +0 -3
- data/Gemfile +0 -5
- data/Guardfile +0 -12
- data/LICENSE +0 -23
- data/Rakefile +0 -7
- data/features/builder/build.feature +0 -14
- data/features/builder/manifest.feature +0 -13
- data/features/cli/default_action.feature +0 -5
- data/features/cli/usage.feature +0 -8
- data/features/cli/version.feature +0 -5
- data/features/config/file.feature +0 -10
- data/features/config/paths.feature +0 -11
- data/features/engines/coffee.feature +0 -16
- data/features/engines/sass.feature +0 -28
- data/features/server/handler.feature +0 -13
- data/features/server/interrupt.feature +0 -6
- data/features/server/logging.feature +0 -7
- data/features/server/public_file.feature +0 -18
- data/features/server/static_files.feature +0 -15
- data/features/step_definitions/builder_steps.rb +0 -41
- data/features/step_definitions/config_steps.rb +0 -8
- data/features/step_definitions/manifest_steps.rb +0 -7
- data/features/step_definitions/server_steps.rb +0 -49
- data/features/support/env.rb +0 -3
- data/features/support/env_aruba.rb +0 -16
- data/features/support/env_cucumber-doc_string.rb +0 -23
- data/features/support/env_server.rb +0 -91
- data/spec/fixtures/assets/app.js +0 -1
- data/spec/fixtures/config/zassets.yaml +0 -1
- data/spec/fixtures/public/hello.txt +0 -1
- data/spec/fixtures/public/index.html +0 -1
- data/spec/spec_helper.rb +0 -3
- data/spec/support/fixtures_helpers.rb +0 -13
- data/spec/zassets-plugins-dummy.rb +0 -17
- data/spec/zassets/builder_spec.rb +0 -52
- data/spec/zassets/cli_spec.rb +0 -158
- data/spec/zassets/config_spec.rb +0 -139
- data/spec/zassets/memory_file_spec.rb +0 -46
- data/spec/zassets/server_spec.rb +0 -116
- data/spec/zassets/sprockets_env_spec.rb +0 -44
- data/zassets.gemspec +0 -30
data/features/cli/usage.feature
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
Feature: Config file loading
|
2
|
-
|
3
|
-
Scenario: loads options from `config/zassets.yaml' when this file exists
|
4
|
-
Given a file named "config/zassets.yaml" with:
|
5
|
-
"""
|
6
|
-
&* invalid yaml
|
7
|
-
"""
|
8
|
-
When I run `zassets build`
|
9
|
-
Then it must fail to parse the config
|
10
|
-
And the output must contain "config/zassets.yaml"
|
@@ -1,16 +0,0 @@
|
|
1
|
-
Feature: CoffeeScript transpiler
|
2
|
-
|
3
|
-
Scenario: transpiles *.coffee files
|
4
|
-
Given this config file:
|
5
|
-
"""
|
6
|
-
paths:
|
7
|
-
- app
|
8
|
-
build:
|
9
|
-
- app.js
|
10
|
-
"""
|
11
|
-
And a file named "app/app.coffee" with:
|
12
|
-
"""
|
13
|
-
my_var = value
|
14
|
-
"""
|
15
|
-
When I build
|
16
|
-
Then the built file "public/assets/app-*.js" must match /var\s+my_var/
|
@@ -1,28 +0,0 @@
|
|
1
|
-
Feature: SASS transpiler
|
2
|
-
|
3
|
-
Scenario: transpiles *.sass files
|
4
|
-
Given this config file:
|
5
|
-
"""
|
6
|
-
paths:
|
7
|
-
- app
|
8
|
-
build:
|
9
|
-
- styles/main.css
|
10
|
-
"""
|
11
|
-
And a file named "app/styles/main.sass" with:
|
12
|
-
"""
|
13
|
-
$gray_dark: #121212
|
14
|
-
$white: #d0d0d0
|
15
|
-
|
16
|
-
html
|
17
|
-
background-color: $gray_dark
|
18
|
-
color: $white
|
19
|
-
"""
|
20
|
-
When I build
|
21
|
-
Then the built file "public/assets/styles/main-*.css" must match:
|
22
|
-
"""
|
23
|
-
.*
|
24
|
-
html\s*\{
|
25
|
-
\s*
|
26
|
-
background-color:\s*#121212\s*;
|
27
|
-
.*
|
28
|
-
"""
|
@@ -1,13 +0,0 @@
|
|
1
|
-
@server
|
2
|
-
Feature: Configurable rack handler
|
3
|
-
|
4
|
-
Scenario: uses puma as the default rack handler
|
5
|
-
Given the server is running
|
6
|
-
Then the rack handler must be "puma"
|
7
|
-
|
8
|
-
Scenario: uses the configured rack handler
|
9
|
-
Given the server is running with this config:
|
10
|
-
"""
|
11
|
-
server: webrick
|
12
|
-
"""
|
13
|
-
Then the rack handler must be "webrick"
|
@@ -1,18 +0,0 @@
|
|
1
|
-
@server
|
2
|
-
Feature: `public_file' option feature
|
3
|
-
|
4
|
-
Background:
|
5
|
-
Given a directory named "public"
|
6
|
-
And a file named "public/index.html" with:
|
7
|
-
"""
|
8
|
-
some_index
|
9
|
-
"""
|
10
|
-
|
11
|
-
Scenario: serves file path set for `public_file' when resource not found
|
12
|
-
Given the server is running with this config:
|
13
|
-
"""
|
14
|
-
public_file: index.html
|
15
|
-
"""
|
16
|
-
When I request "/inexistent_path"
|
17
|
-
Then the response status must be 200
|
18
|
-
And the body must be "some_index\n"
|
@@ -1,15 +0,0 @@
|
|
1
|
-
@server
|
2
|
-
Feature: Static files server
|
3
|
-
|
4
|
-
Background:
|
5
|
-
Given a directory named "public"
|
6
|
-
And a file named "public/some_file" with:
|
7
|
-
"""
|
8
|
-
some_content
|
9
|
-
"""
|
10
|
-
|
11
|
-
Scenario: serves files in `public' directory
|
12
|
-
Given the server is running
|
13
|
-
When I request "/some_file"
|
14
|
-
Then the response status must be 200
|
15
|
-
And the body must be "some_content\n"
|
@@ -1,41 +0,0 @@
|
|
1
|
-
Given /^a file named "([^"]*)" with "([^"]*)"$/ do |path, content|
|
2
|
-
write_file path, content
|
3
|
-
end
|
4
|
-
|
5
|
-
|
6
|
-
When /^I build$/ do
|
7
|
-
run_simple 'zassets build'
|
8
|
-
end
|
9
|
-
|
10
|
-
|
11
|
-
Then /^the built file "([^"]*)" should exist$/ do |path|
|
12
|
-
prep_for_fs_check do
|
13
|
-
Dir[path].any?.should == true
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
Then /^the built file "([^"]*)" should contain "([^"]*)"$/ do |path, content|
|
18
|
-
prep_for_fs_check do
|
19
|
-
IO.read(Dir[path].first).should include(content)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
Then /^the built file "([^"]*)" should match:/ do |path, content|
|
24
|
-
regexp = Regexp.compile(content, Regexp::EXTENDED)
|
25
|
-
prep_for_fs_check do
|
26
|
-
IO.read(Dir[path].first).should =~ regexp
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
Then /^the built file "([^"]*)" should match \/([^\/]*)\/$/ do |path, content|
|
31
|
-
regexp = Regexp.compile(content)
|
32
|
-
prep_for_fs_check do
|
33
|
-
IO.read(Dir[path].first).should =~ regexp
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
Then /^it should build$/ do
|
38
|
-
prep_for_fs_check do
|
39
|
-
File.exist?('public/assets/manifest.json').should be_truthy
|
40
|
-
end
|
41
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
Then /^the manifest should include build path for "([^"]*)"$/ do |path|
|
2
|
-
prep_for_fs_check do
|
3
|
-
manifest = JSON.parse(IO.read('public/assets/manifest.json'))
|
4
|
-
built_path_pattern = path.gsub '.', '-[0-9a-f]+\.'
|
5
|
-
manifest['assets'][path].should =~ Regexp.compile(built_path_pattern)
|
6
|
-
end
|
7
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
Given /^the server is running$/ do
|
2
|
-
@_server ||= Server.new
|
3
|
-
in_current_dir { @_server.start }
|
4
|
-
end
|
5
|
-
|
6
|
-
Given /^the server is running with this config:$/ do |config|
|
7
|
-
write_file DEFAULT_CONFIG_PATH, config
|
8
|
-
@_server = Server.new
|
9
|
-
in_current_dir { @_server.start }
|
10
|
-
end
|
11
|
-
|
12
|
-
|
13
|
-
When /^I stop the server$/ do
|
14
|
-
@_server.stop
|
15
|
-
end
|
16
|
-
|
17
|
-
When /^I request "([^"]*)"$/ do |path|
|
18
|
-
@response = HTTParty.get(@_server.uri_for_path path)
|
19
|
-
end
|
20
|
-
|
21
|
-
When /^I send the SIGINT signal$/ do
|
22
|
-
@_server.sig_int
|
23
|
-
end
|
24
|
-
|
25
|
-
|
26
|
-
Then /^the server should stop successfully$/ do
|
27
|
-
@_server.wait_stop.should == true
|
28
|
-
@_server.exit_status.should == 0
|
29
|
-
end
|
30
|
-
|
31
|
-
Then /^the rack handler should be "([^"]*)"$/ do |handler|
|
32
|
-
@_server.stop
|
33
|
-
output = @_server.stdout + @_server.stderr
|
34
|
-
output.should match /#{handler}/i
|
35
|
-
end
|
36
|
-
|
37
|
-
Then /^the response status should be (\d+)$/ do |status|
|
38
|
-
@response.code.should == status.to_i
|
39
|
-
end
|
40
|
-
|
41
|
-
Then /^the body should be "([^"]*)"$/ do |body|
|
42
|
-
@response.body.should == body.gsub('\n', "\n")
|
43
|
-
end
|
44
|
-
|
45
|
-
Then /^the server output should match \/(.*)\/$/ do |pattern|
|
46
|
-
@_server.stop
|
47
|
-
output = @_server.stdout + @_server.stderr
|
48
|
-
output.should =~ Regexp.compile(pattern)
|
49
|
-
end
|
data/features/support/env.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
module Cucumber
|
2
|
-
class Runtime
|
3
|
-
alias :old_step_match :step_match
|
4
|
-
|
5
|
-
def step_match(step_name, name_to_report = nil)
|
6
|
-
if step_name.include? ' must '
|
7
|
-
name_to_report = step_name.dup
|
8
|
-
step_name.gsub! ' must ', ' should '
|
9
|
-
end
|
10
|
-
|
11
|
-
old_step_match(step_name, name_to_report)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
require 'aruba/cucumber'
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'cucumber/formatter/pretty'
|
2
|
-
|
3
|
-
module Cucumber
|
4
|
-
module Ast
|
5
|
-
class DocString
|
6
|
-
alias :old_initialize :initialize
|
7
|
-
|
8
|
-
def initialize(string, content_type)
|
9
|
-
old_initialize(string + "\n", content_type)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
module Formatter
|
15
|
-
class Pretty
|
16
|
-
alias :old_doc_string :doc_string
|
17
|
-
|
18
|
-
def doc_string(string)
|
19
|
-
old_doc_string(string.chomp)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
class Server
|
2
|
-
DEFAULT_COMMAND = 'zassets serve'
|
3
|
-
DEFAULT_HOST = 'localhost'
|
4
|
-
DEFAULT_PORT = 9292
|
5
|
-
|
6
|
-
attr_reader :exit_status
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
@pid = nil
|
10
|
-
@exit_status = nil
|
11
|
-
@r_out, @w_out = IO.pipe
|
12
|
-
@r_err, @w_err = IO.pipe
|
13
|
-
end
|
14
|
-
|
15
|
-
def uri_base
|
16
|
-
'http://%s:%d' % [DEFAULT_HOST, DEFAULT_PORT]
|
17
|
-
end
|
18
|
-
|
19
|
-
def uri_for_path(path)
|
20
|
-
[uri_base, path].join
|
21
|
-
end
|
22
|
-
|
23
|
-
def stdout
|
24
|
-
@stdout ||= begin
|
25
|
-
@w_out.close
|
26
|
-
out = @r_out.read
|
27
|
-
@r_out.close
|
28
|
-
out
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def stderr
|
33
|
-
@stderr ||= begin
|
34
|
-
@w_err.close
|
35
|
-
err = @r_err.read
|
36
|
-
@r_err.close
|
37
|
-
err
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def running?
|
42
|
-
!!@pid
|
43
|
-
end
|
44
|
-
|
45
|
-
def start
|
46
|
-
@pid = fork do
|
47
|
-
$stdout.reopen @w_out
|
48
|
-
$stderr.reopen @w_err
|
49
|
-
|
50
|
-
exec DEFAULT_COMMAND
|
51
|
-
end
|
52
|
-
|
53
|
-
wait_ready
|
54
|
-
end
|
55
|
-
|
56
|
-
def wait_ready
|
57
|
-
TCPSocket.new DEFAULT_HOST, DEFAULT_PORT
|
58
|
-
rescue Errno::ECONNREFUSED
|
59
|
-
sleep 0.05
|
60
|
-
retry
|
61
|
-
end
|
62
|
-
|
63
|
-
def wait_stop
|
64
|
-
pid, status = Process.waitpid2(@pid)
|
65
|
-
|
66
|
-
if pid
|
67
|
-
@exit_status = status.exitstatus || status.termsig
|
68
|
-
end
|
69
|
-
|
70
|
-
!!pid
|
71
|
-
end
|
72
|
-
|
73
|
-
def stop
|
74
|
-
sig_int
|
75
|
-
Process.wait(@pid)
|
76
|
-
@pid = nil
|
77
|
-
end
|
78
|
-
|
79
|
-
def sig_int
|
80
|
-
Process.kill('INT', @pid)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
|
85
|
-
Before('@server') do
|
86
|
-
@_server = Server.new
|
87
|
-
end
|
88
|
-
|
89
|
-
After('@server') do
|
90
|
-
@_server.stop if @_server.running?
|
91
|
-
end
|
data/spec/fixtures/assets/app.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
console.log('hello!');
|
@@ -1 +0,0 @@
|
|
1
|
-
file_option: :file_value
|
@@ -1 +0,0 @@
|
|
1
|
-
hello!
|
@@ -1 +0,0 @@
|
|
1
|
-
hello HTML!
|
data/spec/spec_helper.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# Dummy zassets plugin for testing purpose.
|
2
|
-
|
3
|
-
module ZAssets
|
4
|
-
module Plugins
|
5
|
-
module Dummy
|
6
|
-
class Registrant
|
7
|
-
def initialize(config)
|
8
|
-
@config = config
|
9
|
-
end
|
10
|
-
|
11
|
-
def register
|
12
|
-
@config[:dummy_plugin] = :registered
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|