roger 1.6.4 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/CHANGELOG.md +12 -0
- data/Gemfile +4 -3
- data/Rakefile +1 -0
- data/doc/cli.md +12 -1
- data/doc/templating.md +9 -0
- data/lib/roger/cli/serve.rb +12 -8
- data/lib/roger/cli.rb +78 -5
- data/lib/roger/helpers/registration.rb +33 -0
- data/lib/roger/project.rb +14 -8
- data/lib/roger/rack/roger.rb +1 -1
- data/lib/roger/release/finalizers/dir.rb +10 -7
- data/lib/roger/release/finalizers/git_branch.rb +18 -32
- data/lib/roger/release/finalizers/rsync.rb +24 -23
- data/lib/roger/release/finalizers/zip.rb +16 -16
- data/lib/roger/release/finalizers.rb +3 -19
- data/lib/roger/release/processors/mockup.rb +17 -28
- data/lib/roger/release/processors/url_relativizer.rb +11 -13
- data/lib/roger/release/processors.rb +50 -22
- data/lib/roger/release/scm/git.rb +15 -15
- data/lib/roger/release.rb +12 -37
- data/lib/roger/renderer.rb +16 -8
- data/lib/roger/server.rb +59 -3
- data/lib/roger/template/helpers/partial.rb +6 -1
- data/lib/roger/version.rb +1 -1
- data/roger.gemspec +1 -1
- data/test/helpers/generators.rb +25 -0
- data/test/project/layouts/bracket.html.erb +1 -0
- data/test/project/partials/test/locals.html.erb +1 -0
- data/test/project/partials/test/max_depth.html.erb +1 -1
- data/test/project/partials/test/parent_template.html.erb +1 -0
- data/test/unit/cli/cli_base_test.rb +67 -0
- data/test/unit/cli/cli_generate_test.rb +0 -20
- data/test/unit/cli/cli_serve_test.rb +19 -4
- data/test/unit/generators_test.rb +5 -28
- data/test/unit/rack/roger_test.rb +19 -3
- data/test/unit/release/finalizers/rsync_test.rb +11 -9
- data/test/unit/release/processors/mockup_test.rb +12 -0
- data/test/unit/release_test.rb +27 -4
- data/test/unit/renderer/renderer_base_test.rb +24 -0
- data/test/unit/renderer/renderer_layout_test.rb +26 -2
- data/test/unit/renderer/renderer_partial_test.rb +12 -2
- data/test/unit/server_test.rb +32 -0
- data/test/unit/test_helper.rb +2 -7
- metadata +13 -4
@@ -1,9 +1,32 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
require "./lib/roger/cli"
|
3
3
|
|
4
|
+
module Roger
|
5
|
+
# Just a noop command class for testing
|
6
|
+
class CliNoop < Cli::Command
|
7
|
+
end
|
8
|
+
|
9
|
+
# Open existing Cli::Base to add Noop method.
|
10
|
+
class Cli::Base < Thor
|
11
|
+
register(
|
12
|
+
CliNoop,
|
13
|
+
"noop",
|
14
|
+
"noop",
|
15
|
+
"noop"
|
16
|
+
)
|
17
|
+
tasks["noop"].options = Cli::Serve.class_options
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
4
21
|
module Roger
|
5
22
|
# Test for roger base commands
|
6
23
|
class CliBaseTest < ::Test::Unit::TestCase
|
24
|
+
include TestCli
|
25
|
+
|
26
|
+
def teardown
|
27
|
+
Cli::Base.project = nil
|
28
|
+
end
|
29
|
+
|
7
30
|
def test_has_test_command
|
8
31
|
assert_includes Cli::Base.tasks.keys, "test"
|
9
32
|
end
|
@@ -23,5 +46,49 @@ module Roger
|
|
23
46
|
def test_has_version_command
|
24
47
|
assert_includes Cli::Base.tasks.keys, "version"
|
25
48
|
end
|
49
|
+
|
50
|
+
# Option passing
|
51
|
+
|
52
|
+
def test_pass_options_to_project
|
53
|
+
run_command(%w(noop --path=henk))
|
54
|
+
assert_equal "henk", Cli::Base.project.options[:path]
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_pass_roger_options_to_project
|
58
|
+
run_command(%w(noop --some_option=henk))
|
59
|
+
assert_equal "henk", Cli::Base.project.options[:some_option]
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_pass_multiple_roger_options_to_project
|
63
|
+
run_command(%w(noop --option1=henk --option2=henk))
|
64
|
+
assert_equal "henk", Cli::Base.project.options[:option1]
|
65
|
+
assert_equal "henk", Cli::Base.project.options[:option2]
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_pass_roger_options_without_equal_to_project
|
69
|
+
run_command(%w(noop --option1 henk --option2 pino))
|
70
|
+
assert_equal "henk", Cli::Base.project.options[:option1]
|
71
|
+
assert_equal "pino", Cli::Base.project.options[:option2]
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_pass_roger_nested_options_to_project
|
75
|
+
run_command(%w(noop --level0:level1=henk))
|
76
|
+
assert_equal "henk", Cli::Base.project.options[:level0][:level1]
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_pass_boolean_roger_options_to_project
|
80
|
+
run_command(%w(noop --istrue))
|
81
|
+
assert_equal true, Cli::Base.project.options[:istrue]
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_pass_boolean_literal_true_roger_options_to_project
|
85
|
+
run_command(%w(noop --istrue=true))
|
86
|
+
assert_equal true, Cli::Base.project.options[:istrue]
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_pass_boolean_literal_false_roger_options_to_project
|
90
|
+
run_command(%w(noop --isfalse=false))
|
91
|
+
assert_equal false, Cli::Base.project.options[:isfalse]
|
92
|
+
end
|
26
93
|
end
|
27
94
|
end
|
@@ -3,26 +3,6 @@ require "./lib/roger/cli"
|
|
3
3
|
|
4
4
|
require File.dirname(__FILE__) + "/../../helpers/cli"
|
5
5
|
|
6
|
-
# CustomGenerators namespace
|
7
|
-
module CustomGens
|
8
|
-
# The Generators namespace
|
9
|
-
module Generators
|
10
|
-
# Mock generator
|
11
|
-
class MockedGenerator < Roger::Generators::Base
|
12
|
-
desc "@mocked description"
|
13
|
-
argument :path, type: :string, required: false, desc: "Path to generate mockup into"
|
14
|
-
argument :another_arg, type: :string, required: false, desc: "Mocked or what?!"
|
15
|
-
|
16
|
-
def test
|
17
|
-
# Somewhat ugly way of checking
|
18
|
-
fail NotImplementedError
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
Roger::Generators.register :mocked, MockedGenerator
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
6
|
module Roger
|
27
7
|
# These tests ar for the roger generate command
|
28
8
|
class CliGenerateTest < ::Test::Unit::TestCase
|
@@ -5,11 +5,26 @@ require File.dirname(__FILE__) + "/../../helpers/cli"
|
|
5
5
|
|
6
6
|
module Roger
|
7
7
|
module Cli
|
8
|
-
#
|
9
|
-
# to actually start the server
|
8
|
+
# Monkeypatching the server command for testing
|
10
9
|
class Serve
|
11
|
-
|
12
|
-
|
10
|
+
# Stop start from being called
|
11
|
+
remove_invocation :start
|
12
|
+
|
13
|
+
# Wrap start so we can immediately stop it
|
14
|
+
def real_start
|
15
|
+
# Let's stop immediately so we can inspect output.
|
16
|
+
start do |server|
|
17
|
+
case server
|
18
|
+
when Puma::Launcher
|
19
|
+
# Most unfortunately we have to do it using an exception because
|
20
|
+
# Puma will yield before actually starting the server resulting in failures
|
21
|
+
fail "Stop"
|
22
|
+
else
|
23
|
+
server.stop
|
24
|
+
end
|
25
|
+
end
|
26
|
+
rescue # rubocop:disable all
|
27
|
+
# Nothing to do.
|
13
28
|
end
|
14
29
|
end
|
15
30
|
end
|
@@ -2,30 +2,7 @@
|
|
2
2
|
require "test_helper"
|
3
3
|
require "./lib/roger/generators.rb"
|
4
4
|
|
5
|
-
|
6
|
-
module Generators
|
7
|
-
# Simple Mock generator
|
8
|
-
class MockedGenerator < Roger::Generators::Base
|
9
|
-
desc "@mocked description"
|
10
|
-
argument :path, type: :string, required: false, desc: "Path to generate project into"
|
11
|
-
argument :another_arg, type: :string, required: false, desc: "Mocked or what?!"
|
12
|
-
|
13
|
-
def test
|
14
|
-
# Somewhat ugly way of checking
|
15
|
-
fail NotImplementedError
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
# Simple Mocku generator that has a project
|
20
|
-
class MockedWithProjectGenerator < Roger::Generators::Base
|
21
|
-
desc "Returns a project"
|
22
|
-
def test
|
23
|
-
# Somewhat ugly way of checking
|
24
|
-
fail StandardError if @project
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
5
|
+
require File.dirname(__FILE__) + "/../helpers/generators"
|
29
6
|
|
30
7
|
module Roger
|
31
8
|
# Test Roger Generators
|
@@ -39,7 +16,7 @@ module Roger
|
|
39
16
|
end
|
40
17
|
|
41
18
|
def test_working_project
|
42
|
-
Roger::Generators.register
|
19
|
+
Roger::Generators.register ::Generators::MockedWithProjectGenerator
|
43
20
|
generators = Cli::Generate.new
|
44
21
|
|
45
22
|
assert_raise StandardError do
|
@@ -48,14 +25,14 @@ module Roger
|
|
48
25
|
end
|
49
26
|
|
50
27
|
def test_register_generator
|
51
|
-
Roger::Generators.register
|
28
|
+
Roger::Generators.register ::Generators::MockedGenerator
|
52
29
|
assert_includes Cli::Generate.tasks, "mocked"
|
53
30
|
assert_equal Cli::Generate.tasks["mocked"].description, "@mocked description"
|
54
31
|
assert_equal Cli::Generate.tasks["mocked"].usage, "mocked PATH ANOTHER_ARG"
|
55
32
|
end
|
56
33
|
|
57
34
|
def test_register_generator_with_custom_name
|
58
|
-
Roger::Generators.register :mockery,
|
35
|
+
Roger::Generators.register :mockery, ::Generators::MockedGenerator
|
59
36
|
assert_includes Cli::Generate.tasks, "mockery"
|
60
37
|
end
|
61
38
|
|
@@ -78,7 +55,7 @@ module Roger
|
|
78
55
|
end
|
79
56
|
|
80
57
|
def test_invoke_mocked_generator
|
81
|
-
Roger::Generators.register
|
58
|
+
Roger::Generators.register ::Generators::MockedGenerator
|
82
59
|
|
83
60
|
generators = Cli::Generate.new
|
84
61
|
assert_raise NotImplementedError do
|
@@ -1,21 +1,37 @@
|
|
1
1
|
require "test_helper"
|
2
|
-
require File.dirname(__FILE__) + "../../../../lib/roger/rack/roger"
|
3
2
|
|
4
3
|
module Roger
|
5
4
|
module Rack
|
6
5
|
# Test Roger Rack
|
7
6
|
class ServerTest < ::Test::Unit::TestCase
|
8
7
|
def setup
|
9
|
-
@project =
|
8
|
+
@project = Testing::MockProject.new
|
10
9
|
@app = ::Roger::Rack::Roger.new(@project)
|
11
10
|
end
|
12
11
|
|
12
|
+
def teardown
|
13
|
+
@project.destroy
|
14
|
+
end
|
15
|
+
|
13
16
|
def test_middleware_renders_template
|
17
|
+
@project.construct.file "html/erb.html.erb", "ERB format"
|
14
18
|
request = ::Rack::MockRequest.new(@app)
|
15
|
-
response = request.get("/
|
19
|
+
response = request.get("/erb")
|
16
20
|
|
17
21
|
assert response.body.include?("ERB format")
|
18
22
|
end
|
23
|
+
|
24
|
+
def test_renderer_options_are_passed
|
25
|
+
@project.options[:renderer][:layout] = "bracket"
|
26
|
+
|
27
|
+
@project.construct.file "layouts/bracket.html.erb", "[<%= yield %>]"
|
28
|
+
@project.construct.file "html/test.html.erb", "<%= 'test' %>"
|
29
|
+
|
30
|
+
request = ::Rack::MockRequest.new(@app)
|
31
|
+
response = request.get("/test")
|
32
|
+
|
33
|
+
assert_equal "[test]", response.body
|
34
|
+
end
|
19
35
|
end
|
20
36
|
end
|
21
37
|
end
|
@@ -27,25 +27,27 @@ module Roger
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_basic_functionality
|
30
|
-
finalizer = Roger::Release::Finalizers::Rsync.new
|
30
|
+
finalizer = Roger::Release::Finalizers::Rsync.new
|
31
|
+
|
32
|
+
finalizer.call(
|
33
|
+
@release,
|
31
34
|
remote_path: @target_path.to_s,
|
32
35
|
ask: false
|
33
36
|
)
|
34
37
|
|
35
|
-
finalizer.call(@release)
|
36
|
-
|
37
38
|
assert File.exist?(@target_path + "index.html"), @release.target_path.inspect
|
38
39
|
end
|
39
40
|
|
40
41
|
def test_rsync_command_works
|
41
|
-
finalizer = Roger::Release::Finalizers::Rsync.new
|
42
|
-
rsync: "rsync-0123456789", # Let's hope nobody actually has this command
|
43
|
-
remote_path: @target_path.to_s,
|
44
|
-
ask: false
|
45
|
-
)
|
42
|
+
finalizer = Roger::Release::Finalizers::Rsync.new
|
46
43
|
|
47
44
|
assert_raise(RuntimeError) do
|
48
|
-
finalizer.call(
|
45
|
+
finalizer.call(
|
46
|
+
@release,
|
47
|
+
rsync: "rsync-0123456789", # Let's hope nobody actually has this command
|
48
|
+
remote_path: @target_path.to_s,
|
49
|
+
ask: false
|
50
|
+
)
|
49
51
|
end
|
50
52
|
end
|
51
53
|
end
|
@@ -43,6 +43,18 @@ module Roger
|
|
43
43
|
@mockup.call(@release)
|
44
44
|
end
|
45
45
|
end
|
46
|
+
|
47
|
+
def test_renderer_options_are_passed
|
48
|
+
@release.project.options[:renderer][:layout] = "bracket"
|
49
|
+
@release.project.construct.file "layouts/bracket.html.erb", "[<%= yield %>]"
|
50
|
+
@release.project.construct.directory "build" do |dir|
|
51
|
+
dir.file "test.html.erb", "<%= 'test' %>"
|
52
|
+
end
|
53
|
+
|
54
|
+
@mockup.call(@release)
|
55
|
+
|
56
|
+
assert_equal "[test]", File.read(@release.build_path + "test.html")
|
57
|
+
end
|
46
58
|
end
|
47
59
|
|
48
60
|
# Test the target_path function of Mockup
|
data/test/unit/release_test.rb
CHANGED
@@ -33,14 +33,13 @@ module Roger
|
|
33
33
|
@project.release.run!
|
34
34
|
|
35
35
|
assert @project.release.stack.empty?
|
36
|
-
assert @project.release.finalizers.empty?
|
37
36
|
end
|
38
37
|
|
39
38
|
def test_release_should_add_mockup_processor_as_first_by_default
|
40
39
|
release = @rogerfile.release
|
41
40
|
release.run!
|
42
41
|
|
43
|
-
assert release.stack.
|
42
|
+
assert !release.stack.empty?
|
44
43
|
assert_equal Roger::Release::Processors::Mockup, release.stack.first.first.class
|
45
44
|
end
|
46
45
|
|
@@ -48,8 +47,16 @@ module Roger
|
|
48
47
|
release = @rogerfile.release
|
49
48
|
release.run!
|
50
49
|
|
51
|
-
assert release.stack.
|
52
|
-
assert_equal Roger::Release::Processors::UrlRelativizer, release.stack.
|
50
|
+
assert !release.stack.empty?
|
51
|
+
assert_equal Roger::Release::Processors::UrlRelativizer, release.stack[-2].first.class
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_release_should_add_dir_finalizer_by_default
|
55
|
+
release = @rogerfile.release
|
56
|
+
release.run!
|
57
|
+
|
58
|
+
assert !release.stack.empty?
|
59
|
+
assert_equal Roger::Release::Finalizers::Dir, release.stack.last.first.class
|
53
60
|
end
|
54
61
|
|
55
62
|
# =============================
|
@@ -80,6 +87,22 @@ module Roger
|
|
80
87
|
assert_equal build_path + "test.txt", build_path.children.first
|
81
88
|
end
|
82
89
|
|
90
|
+
def test_release_should_use_html_path_as_default_source
|
91
|
+
# Create a file in the web dir
|
92
|
+
@project.construct.file "web/index.html"
|
93
|
+
@project.html_path = @project.path + "web"
|
94
|
+
|
95
|
+
# Blank release, just the copying
|
96
|
+
@rogerfile.release(blank: true, cleanup_build: false)
|
97
|
+
|
98
|
+
@project.release.run!
|
99
|
+
|
100
|
+
build_path = @project.release.build_path
|
101
|
+
assert build_path.exist?
|
102
|
+
assert_equal 1, build_path.children.size
|
103
|
+
assert_equal build_path + "index.html", build_path.children.first
|
104
|
+
end
|
105
|
+
|
83
106
|
# ============================
|
84
107
|
# = Banner and comment tests =
|
85
108
|
# ============================
|
@@ -36,6 +36,12 @@ module Roger
|
|
36
36
|
assert_equal "file", result
|
37
37
|
end
|
38
38
|
|
39
|
+
def test_render_file_relative_fails_from_top_level
|
40
|
+
assert_raise ArgumentError do
|
41
|
+
@renderer.render_file("file.html.erb")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
39
45
|
def test_render_file_prevent_recursive
|
40
46
|
assert_raise(ArgumentError) do
|
41
47
|
@renderer.render(@base + "html/renderer/recursive.html.erb")
|
@@ -55,6 +61,24 @@ module Roger
|
|
55
61
|
assert_equal "<h1>h1</h1>\n", result
|
56
62
|
end
|
57
63
|
|
64
|
+
def test_current_remplate
|
65
|
+
path = @base + "html/dir1/test.html.erb"
|
66
|
+
result = @renderer.render(
|
67
|
+
path,
|
68
|
+
source: "<%= renderer.current_template.source_path %>"
|
69
|
+
)
|
70
|
+
assert_equal((@base + "html/dir1/test.html.erb").to_s, result)
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_parent_template
|
74
|
+
path = @base + "html/dir1/test.html.erb"
|
75
|
+
result = @renderer.render(
|
76
|
+
path,
|
77
|
+
source: "<%= partial 'test/parent_template' %>"
|
78
|
+
)
|
79
|
+
assert_equal((@base + "html/dir1/test.html.erb").to_s, result)
|
80
|
+
end
|
81
|
+
|
58
82
|
def test_render_md_erb
|
59
83
|
result = @renderer.render("test.md.erb", source: "<%= '# h1' %>")
|
60
84
|
assert_equal "<h1>h1</h1>\n", result
|
@@ -33,8 +33,32 @@ module Roger
|
|
33
33
|
assert_equal "TEMPLATEB-PARTIAL-A", render_erb_template(template)
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
37
|
-
|
36
|
+
def test_missing_layout
|
37
|
+
template = "---\nlayout: \"not-there\"\n---\nTEMPLATE"
|
38
|
+
|
39
|
+
assert_raise ArgumentError do
|
40
|
+
render_erb_template(template)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_default_layout
|
45
|
+
template = "TEMPLATE"
|
46
|
+
assert_equal "[TEMPLATE]", render_erb_template(template, layout: "bracket")
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_default_layout_is_overriden_by_frontmatter
|
50
|
+
template = "---\nlayout: \"yield\"\n---\nTEMPLATE"
|
51
|
+
assert_equal "TEMPLATE", render_erb_template(template, layout: "bracket")
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_default_layout_can_by_disabled_in_frontmatter
|
55
|
+
template = "---\nlayout: \n---\nTEMPLATE"
|
56
|
+
assert_equal "TEMPLATE", render_erb_template(template, layout: "bracket")
|
57
|
+
end
|
58
|
+
|
59
|
+
def render_erb_template(template, options = {})
|
60
|
+
options = {}.update(options).update(source: template)
|
61
|
+
@renderer.render(@base + "html/layouts/test.html.erb", options)
|
38
62
|
end
|
39
63
|
end
|
40
64
|
end
|
@@ -51,6 +51,16 @@ module Roger
|
|
51
51
|
assert_equal result, "{ key: value }"
|
52
52
|
end
|
53
53
|
|
54
|
+
def test_partial_pass_locals
|
55
|
+
result = render_erb_template "<%= partial 'test/locals', variable: 'variable' %>"
|
56
|
+
assert_equal result, "variable"
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_partial_pass_options
|
60
|
+
result = render_erb_template "<%= partial 'test/locals', locals: {variable: 'variable'} %>"
|
61
|
+
assert_equal result, "variable"
|
62
|
+
end
|
63
|
+
|
54
64
|
def test_partial_with_block
|
55
65
|
result = render_erb_template "<% partial 'test/yield' do %>CONTENT<% end %>"
|
56
66
|
assert_equal result, "B-CONTENT-A"
|
@@ -82,12 +92,12 @@ module Roger
|
|
82
92
|
end
|
83
93
|
|
84
94
|
def test_partial_ten_max_depth_recursion
|
85
|
-
r = render_erb_template "<%= partial 'test/max_depth',
|
95
|
+
r = render_erb_template "<%= partial 'test/max_depth', {depth: 0, max_depth: 10} %>"
|
86
96
|
|
87
97
|
assert_match(/Hammertime/, r)
|
88
98
|
|
89
99
|
assert_raise(ArgumentError) do
|
90
|
-
render_erb_template "<%= partial 'test/max_depth',
|
100
|
+
render_erb_template "<%= partial 'test/max_depth', {depth: 0, max_depth: 11} %>"
|
91
101
|
end
|
92
102
|
end
|
93
103
|
|
data/test/unit/server_test.rb
CHANGED
@@ -7,6 +7,38 @@ module Roger
|
|
7
7
|
def setup
|
8
8
|
@project = Project.new(File.dirname(__FILE__) + "/../../project", rogerfile_path: false)
|
9
9
|
@server = Server.new(@project)
|
10
|
+
@host = "127.0.0.1"
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_port_free
|
14
|
+
port = 5192
|
15
|
+
|
16
|
+
# Port is free
|
17
|
+
assert @server.send(:port_free?, @host, port)
|
18
|
+
|
19
|
+
s = TCPServer.new(@host, port)
|
20
|
+
|
21
|
+
# Port is not free
|
22
|
+
assert !@server.send(:port_free?, @host, port)
|
23
|
+
ensure
|
24
|
+
s.close
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_free_port_for_host_above
|
28
|
+
port = 9000
|
29
|
+
|
30
|
+
# Make sure something is running on port
|
31
|
+
begin
|
32
|
+
s = TCPServer.new(@host, port)
|
33
|
+
rescue SocketError, Errno::EADDRINUSE # rubocop:disable all
|
34
|
+
# Something already must be running on port
|
35
|
+
end
|
36
|
+
|
37
|
+
next_port = @server.send(:free_port_for_host_above, @host, port)
|
38
|
+
assert next_port > port
|
39
|
+
|
40
|
+
ensure
|
41
|
+
s.close
|
10
42
|
end
|
11
43
|
|
12
44
|
# Test to see if env["roger.project"] is set
|
data/test/unit/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flurin Egger
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-11-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thor
|
@@ -158,14 +158,14 @@ dependencies:
|
|
158
158
|
requirements:
|
159
159
|
- - "~>"
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
161
|
+
version: 3.6.0
|
162
162
|
type: :development
|
163
163
|
prerelease: false
|
164
164
|
version_requirements: !ruby/object:Gem::Requirement
|
165
165
|
requirements:
|
166
166
|
- - "~>"
|
167
167
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
168
|
+
version: 3.6.0
|
169
169
|
- !ruby/object:Gem::Dependency
|
170
170
|
name: rubocop
|
171
171
|
requirement: !ruby/object:Gem::Requirement
|
@@ -227,6 +227,7 @@ files:
|
|
227
227
|
- lib/roger/helpers/get_callable.rb
|
228
228
|
- lib/roger/helpers/get_files.rb
|
229
229
|
- lib/roger/helpers/logging.rb
|
230
|
+
- lib/roger/helpers/registration.rb
|
230
231
|
- lib/roger/project.rb
|
231
232
|
- lib/roger/rack/roger.rb
|
232
233
|
- lib/roger/rack/sleep.rb
|
@@ -260,6 +261,7 @@ files:
|
|
260
261
|
- lib/roger/version.rb
|
261
262
|
- roger.gemspec
|
262
263
|
- test/helpers/cli.rb
|
264
|
+
- test/helpers/generators.rb
|
263
265
|
- test/project/.rvmrc
|
264
266
|
- test/project/Gemfile
|
265
267
|
- test/project/Gemfile.lock
|
@@ -286,6 +288,7 @@ files:
|
|
286
288
|
- test/project/html/renderer/recursive.html.erb
|
287
289
|
- test/project/html/static/non-relative.html.erb
|
288
290
|
- test/project/html/static/relative.html.erb
|
291
|
+
- test/project/layouts/bracket.html.erb
|
289
292
|
- test/project/layouts/partial.html.erb
|
290
293
|
- test/project/layouts/partial_with_block.html.erb
|
291
294
|
- test/project/layouts/test.html.erb
|
@@ -303,8 +306,10 @@ files:
|
|
303
306
|
- test/project/partials/test/erb.html.erb
|
304
307
|
- test/project/partials/test/front_matter.html.erb
|
305
308
|
- test/project/partials/test/json.json.erb
|
309
|
+
- test/project/partials/test/locals.html.erb
|
306
310
|
- test/project/partials/test/markdown.md
|
307
311
|
- test/project/partials/test/max_depth.html.erb
|
312
|
+
- test/project/partials/test/parent_template.html.erb
|
308
313
|
- test/project/partials/test/recursive.html.erb
|
309
314
|
- test/project/partials/test/simple.html.erb
|
310
315
|
- test/project/partials/test/yield.html.erb
|
@@ -369,6 +374,7 @@ specification_version: 4
|
|
369
374
|
summary: Roger is a set of tools to create self-containing HTML mockups.
|
370
375
|
test_files:
|
371
376
|
- test/helpers/cli.rb
|
377
|
+
- test/helpers/generators.rb
|
372
378
|
- test/project/.rvmrc
|
373
379
|
- test/project/Gemfile
|
374
380
|
- test/project/Gemfile.lock
|
@@ -395,6 +401,7 @@ test_files:
|
|
395
401
|
- test/project/html/renderer/recursive.html.erb
|
396
402
|
- test/project/html/static/non-relative.html.erb
|
397
403
|
- test/project/html/static/relative.html.erb
|
404
|
+
- test/project/layouts/bracket.html.erb
|
398
405
|
- test/project/layouts/partial.html.erb
|
399
406
|
- test/project/layouts/partial_with_block.html.erb
|
400
407
|
- test/project/layouts/test.html.erb
|
@@ -412,8 +419,10 @@ test_files:
|
|
412
419
|
- test/project/partials/test/erb.html.erb
|
413
420
|
- test/project/partials/test/front_matter.html.erb
|
414
421
|
- test/project/partials/test/json.json.erb
|
422
|
+
- test/project/partials/test/locals.html.erb
|
415
423
|
- test/project/partials/test/markdown.md
|
416
424
|
- test/project/partials/test/max_depth.html.erb
|
425
|
+
- test/project/partials/test/parent_template.html.erb
|
417
426
|
- test/project/partials/test/recursive.html.erb
|
418
427
|
- test/project/partials/test/simple.html.erb
|
419
428
|
- test/project/partials/test/yield.html.erb
|