roger 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +10 -0
- data/.travis.yml +3 -2
- data/CHANGELOG.md +6 -0
- data/lib/roger/generators.rb +6 -4
- data/lib/roger/rack/roger.rb +1 -1
- data/lib/roger/release.rb +28 -18
- data/lib/roger/release/finalizers/git_branch.rb +1 -1
- data/lib/roger/release/finalizers/rsync.rb +1 -0
- data/lib/roger/release/injector.rb +4 -5
- data/lib/roger/release/processors.rb +0 -1
- data/lib/roger/rogerfile.rb +1 -1
- data/lib/roger/template.rb +1 -1
- data/lib/roger/version.rb +1 -1
- data/roger.gemspec +4 -5
- data/test/project/Gemfile +2 -2
- data/test/project/Rogerfile +1 -2
- data/test/project/lib/tests/noop/lib/cli.rb +1 -2
- data/test/unit/generators/generator_test.rb +1 -0
- data/test/unit/generators/new_test.rb +1 -0
- data/test/unit/generators_test.rb +1 -2
- data/test/unit/release_test.rb +2 -10
- data/test/unit/renderer/renderer_base_test.rb +2 -1
- data/test/unit/renderer/renderer_content_for_test.rb +1 -0
- data/test/unit/renderer/renderer_helper_test.rb +1 -0
- data/test/unit/renderer/renderer_layout_test.rb +1 -0
- data/test/unit/renderer/renderer_partial_test.rb +1 -0
- data/test/unit/server_test.rb +1 -3
- data/test/unit/template/template_base_test.rb +2 -1
- data/test/unit/test_test.rb +3 -2
- metadata +11 -28
- data/lib/roger/release/processors/url_relativizer.rb +0 -74
- data/test/unit/release/processors/url_relativizer_test.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 69986cc9095a927deaa4d0c24ded5939d2ed1ea5373a2e3646af631bf0601c50
|
4
|
+
data.tar.gz: e2fa26c7a1aed9f93fa55b236acbbd7ecece390c615978c3bf3cc5867621743a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43991d9924c031c0ffae6f413d4a32186c09ad5e4fd64187ca528b97f227b3fa7db5f47476d4b2667900a83516bb20cbcd973165b3cf98b814f06afeb582753d
|
7
|
+
data.tar.gz: 87cb05672e3960e1c8ca8622af06bcf360e0ddebe73d56ce81a6b3122bacf8d7eff4ec9972bec9fdfe35f2e5e1c4cfbbbaf53f902ac20c3fa508d181b404a9e3
|
data/.rubocop.yml
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
Style/PercentLiteralDelimiters:
|
2
|
+
PreferredDelimiters:
|
3
|
+
"%w": "()"
|
4
|
+
|
1
5
|
LineLength:
|
2
6
|
Description: 'Limit lines to 100 characters.'
|
3
7
|
Max: 100
|
@@ -18,10 +22,16 @@ Metrics/MethodLength:
|
|
18
22
|
Metrics/AbcSize:
|
19
23
|
Max: 20
|
20
24
|
|
25
|
+
Metrics/BlockLength:
|
26
|
+
Max: 35
|
27
|
+
|
21
28
|
Style/ClassAndModuleChildren:
|
22
29
|
EnforcedStyle: compact
|
23
30
|
Enabled: false
|
24
31
|
|
32
|
+
Style/SymbolArray:
|
33
|
+
Enabled: false
|
34
|
+
|
25
35
|
# By default, the rails cops are not run. Override in project or home
|
26
36
|
# directory .rubocop.yml files, or by giving the -R/--rails option.
|
27
37
|
Rails:
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## Version 1.9.0
|
4
|
+
* Render all *.erb files by default
|
5
|
+
* Update dependencies
|
6
|
+
* Rsync finalizer now uses `--delete`
|
7
|
+
* Removed hpricot dependency and URL relativizer (now lives in roger_url)relativizer gem)
|
8
|
+
|
3
9
|
## Version 1.8.0
|
4
10
|
* Roger Rack application now adheres to match/skip options. Pass them in the rogerfile as follows:
|
5
11
|
```
|
data/lib/roger/generators.rb
CHANGED
@@ -12,10 +12,12 @@ module Roger
|
|
12
12
|
def self.register(name, klass = nil)
|
13
13
|
name, klass = generator_name(name, klass)
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
if Cli::Generate.tasks.key?(name)
|
16
|
+
raise(
|
17
|
+
ArgumentError,
|
18
|
+
"Generator name '#{name.inspect}' already in use"
|
19
|
+
)
|
20
|
+
end
|
19
21
|
|
20
22
|
usage = "#{name} #{klass.arguments.map(&:banner).join(' ')}"
|
21
23
|
long_desc = klass.desc || "Run #{name} generator"
|
data/lib/roger/rack/roger.rb
CHANGED
data/lib/roger/release.rb
CHANGED
@@ -235,33 +235,43 @@ module Roger
|
|
235
235
|
# Checks if build path exists (and cleans it up)
|
236
236
|
# Checks if target path exists (if not, creates it)
|
237
237
|
def validate_paths!
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
end
|
238
|
+
ensure_clean_build_path!
|
239
|
+
ensure_existing_target_path!
|
240
|
+
end
|
242
241
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
242
|
+
def ensure_clean_build_path!
|
243
|
+
return unless build_path.exist?
|
244
|
+
|
245
|
+
log self, "Cleaning up previous build \"#{build_path}\""
|
246
|
+
rm_rf(build_path)
|
247
|
+
end
|
248
|
+
|
249
|
+
def ensure_existing_target_path!
|
250
|
+
return if target_path.exist?
|
251
|
+
|
252
|
+
log self, "Creating target path \"#{target_path}\""
|
253
|
+
mkdir target_path
|
247
254
|
end
|
248
255
|
|
249
256
|
# Checks if the project will be runned
|
250
|
-
# If config[:blank] is true it will automatically add
|
257
|
+
# If config[:blank] is true it will automatically add Mockup processor
|
251
258
|
def validate_stack!
|
252
259
|
return if config[:blank]
|
253
260
|
|
254
|
-
|
255
|
-
|
256
|
-
|
261
|
+
ensure_mockup_processor_in_stack!
|
262
|
+
ensure_dir_finalizer_in_stack!
|
263
|
+
end
|
257
264
|
|
258
|
-
|
259
|
-
|
260
|
-
end
|
265
|
+
def ensure_mockup_processor_in_stack!
|
266
|
+
return if find_in_stack(Roger::Release::Processors::Mockup)
|
261
267
|
|
262
|
-
|
263
|
-
|
264
|
-
|
268
|
+
@stack.unshift([Roger::Release::Processors::Mockup.new, {}])
|
269
|
+
end
|
270
|
+
|
271
|
+
def ensure_dir_finalizer_in_stack!
|
272
|
+
return if find_in_stack(Roger::Release::Finalizers::Dir)
|
273
|
+
|
274
|
+
@stack.push([Roger::Release::Finalizers::Dir.new, {}])
|
265
275
|
end
|
266
276
|
|
267
277
|
# Find a processor in the stack
|
@@ -58,7 +58,7 @@ module Roger::Release::Finalizers
|
|
58
58
|
FileUtils.cp_r @release.build_path.to_s + "/.", clone_dir.to_s
|
59
59
|
|
60
60
|
commands = [
|
61
|
-
%w(git add .
|
61
|
+
%w(git add .), # 4. Add all files
|
62
62
|
%w(git commit -q -a -m) << "Release #{@release.scm.version}" # 5. Commit
|
63
63
|
]
|
64
64
|
|
@@ -80,11 +80,10 @@ module Roger
|
|
80
80
|
raise ArgumentError, "No :content or :file specified" unless content
|
81
81
|
|
82
82
|
if injection[:processor]
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
end
|
83
|
+
tmpl = Tilt[injection[:processor]]
|
84
|
+
raise(ArgumentError, "Unknown processor #{injection[:processor]}") unless tmpl
|
85
|
+
|
86
|
+
(tmpl.new { content }).render
|
88
87
|
else
|
89
88
|
content
|
90
89
|
end
|
data/lib/roger/rogerfile.rb
CHANGED
data/lib/roger/template.rb
CHANGED
data/lib/roger/version.rb
CHANGED
data/roger.gemspec
CHANGED
@@ -31,16 +31,15 @@ Gem::Specification.new do |s|
|
|
31
31
|
end
|
32
32
|
|
33
33
|
s.add_dependency("thor", ["~> 0.19.0"])
|
34
|
-
s.add_dependency("rack", [">=
|
34
|
+
s.add_dependency("rack", [">= 2.0.0"])
|
35
35
|
s.add_dependency("tilt", ["~> 2.0.1"])
|
36
|
-
s.add_dependency("mime-types", ["~>
|
37
|
-
s.add_dependency("hpricot", ["= 0.8.4"])
|
36
|
+
s.add_dependency("mime-types", ["~> 3.1"])
|
38
37
|
s.add_dependency("redcarpet", [">= 3.1.1"])
|
39
38
|
s.add_dependency("test_construct", "~> 2.0")
|
40
39
|
|
41
40
|
s.add_development_dependency("test-unit", "~> 3.0.0")
|
42
41
|
s.add_development_dependency("mocha", "~> 1.1.0")
|
43
42
|
s.add_development_dependency("simplecov", "~> 0.10.0")
|
44
|
-
s.add_development_dependency("puma", "~> 3.
|
45
|
-
s.add_development_dependency("rubocop", "~> 0.
|
43
|
+
s.add_development_dependency("puma", "~> 3.12.0")
|
44
|
+
s.add_development_dependency("rubocop", "~> 0.49.0")
|
46
45
|
end
|
data/test/project/Gemfile
CHANGED
data/test/project/Rogerfile
CHANGED
@@ -41,8 +41,7 @@ module Roger
|
|
41
41
|
assert_includes Cli::Generate.tasks, "mockery"
|
42
42
|
end
|
43
43
|
|
44
|
-
def test_cli_help_shows_all_available_generators
|
45
|
-
end
|
44
|
+
def test_cli_help_shows_all_available_generators; end
|
46
45
|
|
47
46
|
def test_invoke_mocked_generator
|
48
47
|
Roger::Generators.register ::Generators::MockedGenerator
|
data/test/unit/release_test.rb
CHANGED
@@ -19,9 +19,9 @@ module Roger
|
|
19
19
|
|
20
20
|
# Running a blank release
|
21
21
|
@rogerfile.release(blank: true) do |r|
|
22
|
-
r.use
|
22
|
+
r.use(proc { |release|
|
23
23
|
assert_equal release.project.mode, :release
|
24
|
-
}
|
24
|
+
})
|
25
25
|
end
|
26
26
|
|
27
27
|
@project.release.run!
|
@@ -43,14 +43,6 @@ module Roger
|
|
43
43
|
assert_equal Roger::Release::Processors::Mockup, release.stack.first.first.class
|
44
44
|
end
|
45
45
|
|
46
|
-
def test_release_should_add_url_relativizer_by_default
|
47
|
-
release = @rogerfile.release
|
48
|
-
release.run!
|
49
|
-
|
50
|
-
assert !release.stack.empty?
|
51
|
-
assert_equal Roger::Release::Processors::UrlRelativizer, release.stack[-2].first.class
|
52
|
-
end
|
53
|
-
|
54
46
|
def test_release_should_add_dir_finalizer_by_default
|
55
47
|
release = @rogerfile.release
|
56
48
|
release.run!
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
|
2
3
|
# Generators register themself on the CLI module
|
3
4
|
require "test_helper"
|
4
5
|
require "./lib/roger/renderer.rb"
|
@@ -120,7 +121,7 @@ module Roger
|
|
120
121
|
# "md.erb" => "html",
|
121
122
|
"css.erb" => "css",
|
122
123
|
"json.erb" => "json",
|
123
|
-
"js.erb" => "
|
124
|
+
"js.erb" => "ecma"
|
124
125
|
}
|
125
126
|
|
126
127
|
mime_types.each do |ext, ext_out|
|
data/test/unit/server_test.rb
CHANGED
@@ -36,7 +36,6 @@ module Roger
|
|
36
36
|
|
37
37
|
next_port = @server.send(:free_port_for_host_above, @host, port)
|
38
38
|
assert next_port > port
|
39
|
-
|
40
39
|
ensure
|
41
40
|
s.close
|
42
41
|
end
|
@@ -44,8 +43,7 @@ module Roger
|
|
44
43
|
# Test to see if env["roger.project"] is set
|
45
44
|
def test_env_roger_project_is_set
|
46
45
|
test = Class.new do
|
47
|
-
def initialize(_app)
|
48
|
-
end
|
46
|
+
def initialize(_app); end
|
49
47
|
|
50
48
|
def call(env)
|
51
49
|
[200, {}, [env["roger.project"].object_id.to_s]]
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
|
2
3
|
# Generators register themself on the CLI module
|
3
4
|
require "test_helper"
|
4
5
|
require "./lib/roger/template.rb"
|
@@ -23,7 +24,7 @@ module Roger
|
|
23
24
|
|
24
25
|
def test_render_with_block
|
25
26
|
template = Template.new("<%= yield %>", {}, source_path: "test.erb")
|
26
|
-
assert_equal "inner", template.render { "inner" }
|
27
|
+
assert_equal "inner", (template.render { "inner" })
|
27
28
|
end
|
28
29
|
|
29
30
|
def test_data
|
data/test/unit/test_test.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
|
2
3
|
require "test_helper"
|
3
4
|
require "./lib/roger/test.rb"
|
4
5
|
require "roger/testing/mock_project"
|
@@ -27,9 +28,9 @@ module Roger
|
|
27
28
|
assert_equal @project.mode, nil
|
28
29
|
|
29
30
|
@rogerfile.test do |t|
|
30
|
-
t.use
|
31
|
+
t.use(proc { |test|
|
31
32
|
assert_equal test.project.mode, :test
|
32
|
-
}
|
33
|
+
})
|
33
34
|
end
|
34
35
|
|
35
36
|
@project.test.run!
|
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.9.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:
|
13
|
+
date: 2018-09-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thor
|
@@ -32,14 +32,14 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
35
|
+
version: 2.0.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
42
|
+
version: 2.0.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: tilt
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,28 +60,14 @@ dependencies:
|
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: '
|
63
|
+
version: '3.1'
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: '
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: hpricot
|
73
|
-
requirement: !ruby/object:Gem::Requirement
|
74
|
-
requirements:
|
75
|
-
- - '='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 0.8.4
|
78
|
-
type: :runtime
|
79
|
-
prerelease: false
|
80
|
-
version_requirements: !ruby/object:Gem::Requirement
|
81
|
-
requirements:
|
82
|
-
- - '='
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version: 0.8.4
|
70
|
+
version: '3.1'
|
85
71
|
- !ruby/object:Gem::Dependency
|
86
72
|
name: redcarpet
|
87
73
|
requirement: !ruby/object:Gem::Requirement
|
@@ -158,28 +144,28 @@ dependencies:
|
|
158
144
|
requirements:
|
159
145
|
- - "~>"
|
160
146
|
- !ruby/object:Gem::Version
|
161
|
-
version: 3.
|
147
|
+
version: 3.12.0
|
162
148
|
type: :development
|
163
149
|
prerelease: false
|
164
150
|
version_requirements: !ruby/object:Gem::Requirement
|
165
151
|
requirements:
|
166
152
|
- - "~>"
|
167
153
|
- !ruby/object:Gem::Version
|
168
|
-
version: 3.
|
154
|
+
version: 3.12.0
|
169
155
|
- !ruby/object:Gem::Dependency
|
170
156
|
name: rubocop
|
171
157
|
requirement: !ruby/object:Gem::Requirement
|
172
158
|
requirements:
|
173
159
|
- - "~>"
|
174
160
|
- !ruby/object:Gem::Version
|
175
|
-
version: 0.
|
161
|
+
version: 0.49.0
|
176
162
|
type: :development
|
177
163
|
prerelease: false
|
178
164
|
version_requirements: !ruby/object:Gem::Requirement
|
179
165
|
requirements:
|
180
166
|
- - "~>"
|
181
167
|
- !ruby/object:Gem::Version
|
182
|
-
version: 0.
|
168
|
+
version: 0.49.0
|
183
169
|
description: See homepage for more information.
|
184
170
|
email:
|
185
171
|
- info@digitpaint.nl
|
@@ -241,7 +227,6 @@ files:
|
|
241
227
|
- lib/roger/release/injector.rb
|
242
228
|
- lib/roger/release/processors.rb
|
243
229
|
- lib/roger/release/processors/mockup.rb
|
244
|
-
- lib/roger/release/processors/url_relativizer.rb
|
245
230
|
- lib/roger/release/scm.rb
|
246
231
|
- lib/roger/release/scm/fixed.rb
|
247
232
|
- lib/roger/release/scm/git.rb
|
@@ -335,7 +320,6 @@ files:
|
|
335
320
|
- test/unit/release/finalizers/zip_test.rb
|
336
321
|
- test/unit/release/injector_test.rb
|
337
322
|
- test/unit/release/processors/mockup_test.rb
|
338
|
-
- test/unit/release/processors/url_relativizer_test.rb
|
339
323
|
- test/unit/release/processors_test.rb
|
340
324
|
- test/unit/release/scm/base_test.rb
|
341
325
|
- test/unit/release/scm/fixed_test.rb
|
@@ -372,7 +356,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
372
356
|
version: '0'
|
373
357
|
requirements: []
|
374
358
|
rubyforge_project:
|
375
|
-
rubygems_version: 2.
|
359
|
+
rubygems_version: 2.7.7
|
376
360
|
signing_key:
|
377
361
|
specification_version: 4
|
378
362
|
summary: Roger is a set of tools to create self-containing HTML mockups.
|
@@ -452,7 +436,6 @@ test_files:
|
|
452
436
|
- test/unit/release/finalizers/zip_test.rb
|
453
437
|
- test/unit/release/injector_test.rb
|
454
438
|
- test/unit/release/processors/mockup_test.rb
|
455
|
-
- test/unit/release/processors/url_relativizer_test.rb
|
456
439
|
- test/unit/release/processors_test.rb
|
457
440
|
- test/unit/release/scm/base_test.rb
|
458
441
|
- test/unit/release/scm/fixed_test.rb
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require "hpricot"
|
2
|
-
require File.dirname(__FILE__) + "../../../resolver"
|
3
|
-
|
4
|
-
module Roger::Release::Processors
|
5
|
-
# URL relativizer processor
|
6
|
-
# The relativizer can be used to rewrite absolute paths in attributes to relative paths
|
7
|
-
# during release.
|
8
|
-
class UrlRelativizer < Base
|
9
|
-
self.name = :url_relativizer
|
10
|
-
|
11
|
-
def default_options
|
12
|
-
{
|
13
|
-
url_attributes: %w(src href action),
|
14
|
-
match: ["**/*.html"],
|
15
|
-
skip: []
|
16
|
-
}
|
17
|
-
end
|
18
|
-
|
19
|
-
def perform
|
20
|
-
log_call
|
21
|
-
|
22
|
-
@resolver = Roger::Resolver.new(release.build_path)
|
23
|
-
|
24
|
-
relativize_attributes_in_files(
|
25
|
-
release,
|
26
|
-
options[:url_attributes],
|
27
|
-
release.get_files(options[:match], options[:skip])
|
28
|
-
)
|
29
|
-
end
|
30
|
-
|
31
|
-
protected
|
32
|
-
|
33
|
-
def log_call
|
34
|
-
log_message = "Relativizing all URLS in #{@options[:match].inspect}"
|
35
|
-
log_message << "files in attributes #{@options[:url_attributes].inspect},"
|
36
|
-
log_message << "skipping #{@options[:skip].any? ? @options[:skip].inspect : 'none'}"
|
37
|
-
release.log(self, log_message)
|
38
|
-
end
|
39
|
-
|
40
|
-
def relativize_attributes_in_files(release, attributes, files)
|
41
|
-
files.each do |file_path|
|
42
|
-
release.debug(self, "Relativizing URLS in #{file_path}") do
|
43
|
-
relativize_attributes_in_file(release, attributes, file_path)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def relativize_attributes_in_file(release, attributes, file_path)
|
49
|
-
orig_source = File.read(file_path)
|
50
|
-
File.open(file_path, "w") do |f|
|
51
|
-
f.write(relativize_attributes_in_source(release, attributes, orig_source, file_path))
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def relativize_attributes_in_source(release, attributes, source, file_path)
|
56
|
-
doc = Hpricot(source)
|
57
|
-
attributes.each do |attribute|
|
58
|
-
(doc / "*[@#{attribute}]").each do |tag|
|
59
|
-
converted_url = @resolver.url_to_relative_url(tag[attribute], file_path)
|
60
|
-
release.debug(self, "Converting '#{tag[attribute]}' to '#{converted_url}'")
|
61
|
-
case converted_url
|
62
|
-
when String
|
63
|
-
tag[attribute] = converted_url
|
64
|
-
when nil
|
65
|
-
release.log(self, "Could not resolve link #{tag[attribute]} in #{file_path}")
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
doc.to_original_html
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
Roger::Release::Processors.register(Roger::Release::Processors::UrlRelativizer)
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
require "roger/testing/mock_release"
|
3
|
-
|
4
|
-
module Roger
|
5
|
-
# Test UrlRelativizer
|
6
|
-
class UrlRelativizerTest < ::Test::Unit::TestCase
|
7
|
-
def setup
|
8
|
-
@release = Testing::MockRelease.new
|
9
|
-
@processor = Roger::Release::Processors::UrlRelativizer.new
|
10
|
-
end
|
11
|
-
|
12
|
-
def teardown
|
13
|
-
@release.destroy
|
14
|
-
@release = nil
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_empty_release_runs
|
18
|
-
files = @processor.call(@release)
|
19
|
-
assert_equal 0, files.length
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_basic_relativization
|
23
|
-
@release.project.construct.directory "build/sub" do |dir|
|
24
|
-
dir.file "test.html", "<a href='/test.html'>link</a>"
|
25
|
-
end
|
26
|
-
@release.project.construct.file "build/test.html"
|
27
|
-
|
28
|
-
files = @processor.call(@release)
|
29
|
-
assert_equal 2, files.length
|
30
|
-
|
31
|
-
contents = File.read((@release.build_path + "sub/test.html").to_s)
|
32
|
-
assert contents.include?("../test.html")
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|