torba 1.1.0 → 1.2.0
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 +13 -0
- data/README.md +1 -1
- data/lib/torba/remote_sources/npm.rb +7 -1
- data/torba.gemspec +2 -3
- metadata +4 -72
- data/test/acceptance-cli/open_test.rb +0 -101
- data/test/acceptance-cli/pack_test.rb +0 -49
- data/test/acceptance-cli/show_test.rb +0 -61
- data/test/acceptance-cli/verify_test.rb +0 -25
- data/test/css_url_to_erb_asset_path_test.rb +0 -139
- data/test/fixtures/home_path/01/trumbowyg/icons-2x.png +0 -0
- data/test/fixtures/home_path/01/trumbowyg/icons.png +0 -0
- data/test/fixtures/home_path/01/trumbowyg/trumbowyg.css.erb +0 -471
- data/test/fixtures/home_path/01/trumbowyg/trumbowyg.js +0 -1124
- data/test/fixtures/home_path/02/lo_dash/lodash.js +0 -2793
- data/test/fixtures/home_path/03/bourbon/_border-image.scss +0 -59
- data/test/fixtures/home_path/03/bourbon/_font-source-declaration.scss +0 -43
- data/test/fixtures/home_path/03/bourbon/_retina-image.scss +0 -25
- data/test/fixtures/torbafiles/01_gh_release.rb +0 -8
- data/test/fixtures/torbafiles/01_image_asset_not_specified.rb +0 -7
- data/test/fixtures/torbafiles/01_targz.rb +0 -7
- data/test/fixtures/torbafiles/01_zip.rb +0 -7
- data/test/fixtures/torbafiles/02_npm.rb +0 -1
- data/test/fixtures/torbafiles/03_not_existed_assets.rb +0 -5
- data/test/fixtures/torbafiles/04_similar_names.rb +0 -2
- data/test/import_list_test.rb +0 -53
- data/test/manifest_test.rb +0 -142
- data/test/package/import_list_test.rb +0 -123
- data/test/package/logical_paths_test.rb +0 -28
- data/test/package_test.rb +0 -52
- data/test/rake_task_test.rb +0 -69
- data/test/remote_sources/common_test.rb +0 -62
- data/test/remote_sources/get_file_test.rb +0 -12
- data/test/remote_sources/github_release_test.rb +0 -42
- data/test/remote_sources/npm_test.rb +0 -34
- data/test/remote_sources/targz_test.rb +0 -29
- data/test/remote_sources/zip_test.rb +0 -26
- data/test/test_helper.rb +0 -109
- data/test/torba_test.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9849d15bd1d02ad1f5c11d40d2d29cfdc48a52a1cd2232e9bd4f42d3e3ff5c5a
|
4
|
+
data.tar.gz: 0dbedc6624a2bcd9d65b94832d59ccf94cbe0cdf632ba48b4510df6317ccb498
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6841aac3d6f672029f69397dccf0ea0ccb8681cc19d4a3cada4fc2925c80de4b6af15aa78c695acebb27e10310d4ad32918af80d88e9c4912eadf1fd76be0d5f
|
7
|
+
data.tar.gz: cff51fe06431dc8a36efa3bdfc539cbd687297f4bd33b89a8aa1484cf634f2cf3500e29a4053777d595bea50ff1bae12b4935f53e92e9726e9ed5511e8a03ac3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
## Unreleased
|
2
2
|
|
3
|
+
## Version 1.2.0
|
4
|
+
|
5
|
+
### Enhancements
|
6
|
+
|
7
|
+
* Support scoped names for NPM packages (e.g. "@lottiefiles/lottie-player")
|
8
|
+
|
9
|
+
## Version 1.1.1
|
10
|
+
|
11
|
+
### Enhancements
|
12
|
+
|
13
|
+
* Test files have been removed from the package to reduce
|
14
|
+
file size (and to spend less internet traffic too).
|
15
|
+
|
3
16
|
## Version 1.1.0
|
4
17
|
|
5
18
|
### Enhancements
|
data/README.md
CHANGED
@@ -8,6 +8,7 @@ module Torba
|
|
8
8
|
# @return [String] package name.
|
9
9
|
# @example
|
10
10
|
# "coffee-script"
|
11
|
+
# "@lottiefiles/lottie-player"
|
11
12
|
attr_reader :package
|
12
13
|
|
13
14
|
# @return [String] package version.
|
@@ -20,7 +21,12 @@ module Torba
|
|
20
21
|
def initialize(package, version)
|
21
22
|
@package = package
|
22
23
|
@version = version
|
23
|
-
|
24
|
+
|
25
|
+
# https://docs.npmjs.com/about-scopes
|
26
|
+
# "@lottiefiles/lottie-player" => "lottie-player"
|
27
|
+
unscoped_package = package.sub(%r{@[^/]+/}, "")
|
28
|
+
|
29
|
+
super("https://registry.npmjs.org/#{package}/-/#{unscoped_package}-#{version}.tgz")
|
24
30
|
@digest = "#{package}-#{Torba.digest(url)}"
|
25
31
|
end
|
26
32
|
end
|
data/torba.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "torba"
|
3
|
-
spec.version = "1.
|
3
|
+
spec.version = "1.2.0"
|
4
4
|
spec.authors = ["Andrii Malyshko"]
|
5
5
|
spec.email = ["mail@nashbridges.me"]
|
6
6
|
spec.description = "Bundler for Sprockets"
|
@@ -8,9 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.homepage = "https://github.com/torba-rb/torba"
|
9
9
|
spec.license = "MIT"
|
10
10
|
|
11
|
-
spec.files = `git ls-files`.split($/)
|
11
|
+
spec.files = `git ls-files`.split($/).grep_v(%r{^test/})
|
12
12
|
spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
14
13
|
spec.bindir = "bin"
|
15
14
|
spec.require_paths = ["lib"]
|
16
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrii Malyshko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -133,40 +133,6 @@ files:
|
|
133
133
|
- lib/torba/remote_sources/zip.rb
|
134
134
|
- lib/torba/ui.rb
|
135
135
|
- lib/torba/verify.rb
|
136
|
-
- test/acceptance-cli/open_test.rb
|
137
|
-
- test/acceptance-cli/pack_test.rb
|
138
|
-
- test/acceptance-cli/show_test.rb
|
139
|
-
- test/acceptance-cli/verify_test.rb
|
140
|
-
- test/css_url_to_erb_asset_path_test.rb
|
141
|
-
- test/fixtures/home_path/01/trumbowyg/icons-2x.png
|
142
|
-
- test/fixtures/home_path/01/trumbowyg/icons.png
|
143
|
-
- test/fixtures/home_path/01/trumbowyg/trumbowyg.css.erb
|
144
|
-
- test/fixtures/home_path/01/trumbowyg/trumbowyg.js
|
145
|
-
- test/fixtures/home_path/02/lo_dash/lodash.js
|
146
|
-
- test/fixtures/home_path/03/bourbon/_border-image.scss
|
147
|
-
- test/fixtures/home_path/03/bourbon/_font-source-declaration.scss
|
148
|
-
- test/fixtures/home_path/03/bourbon/_retina-image.scss
|
149
|
-
- test/fixtures/torbafiles/01_gh_release.rb
|
150
|
-
- test/fixtures/torbafiles/01_image_asset_not_specified.rb
|
151
|
-
- test/fixtures/torbafiles/01_targz.rb
|
152
|
-
- test/fixtures/torbafiles/01_zip.rb
|
153
|
-
- test/fixtures/torbafiles/02_npm.rb
|
154
|
-
- test/fixtures/torbafiles/03_not_existed_assets.rb
|
155
|
-
- test/fixtures/torbafiles/04_similar_names.rb
|
156
|
-
- test/import_list_test.rb
|
157
|
-
- test/manifest_test.rb
|
158
|
-
- test/package/import_list_test.rb
|
159
|
-
- test/package/logical_paths_test.rb
|
160
|
-
- test/package_test.rb
|
161
|
-
- test/rake_task_test.rb
|
162
|
-
- test/remote_sources/common_test.rb
|
163
|
-
- test/remote_sources/get_file_test.rb
|
164
|
-
- test/remote_sources/github_release_test.rb
|
165
|
-
- test/remote_sources/npm_test.rb
|
166
|
-
- test/remote_sources/targz_test.rb
|
167
|
-
- test/remote_sources/zip_test.rb
|
168
|
-
- test/test_helper.rb
|
169
|
-
- test/torba_test.rb
|
170
136
|
- torba.gemspec
|
171
137
|
homepage: https://github.com/torba-rb/torba
|
172
138
|
licenses:
|
@@ -187,42 +153,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
153
|
- !ruby/object:Gem::Version
|
188
154
|
version: '0'
|
189
155
|
requirements: []
|
190
|
-
rubygems_version: 3.
|
156
|
+
rubygems_version: 3.1.6
|
191
157
|
signing_key:
|
192
158
|
specification_version: 4
|
193
159
|
summary: Bundler for Sprockets
|
194
|
-
test_files:
|
195
|
-
- test/acceptance-cli/open_test.rb
|
196
|
-
- test/acceptance-cli/pack_test.rb
|
197
|
-
- test/acceptance-cli/show_test.rb
|
198
|
-
- test/acceptance-cli/verify_test.rb
|
199
|
-
- test/css_url_to_erb_asset_path_test.rb
|
200
|
-
- test/fixtures/home_path/01/trumbowyg/icons-2x.png
|
201
|
-
- test/fixtures/home_path/01/trumbowyg/icons.png
|
202
|
-
- test/fixtures/home_path/01/trumbowyg/trumbowyg.css.erb
|
203
|
-
- test/fixtures/home_path/01/trumbowyg/trumbowyg.js
|
204
|
-
- test/fixtures/home_path/02/lo_dash/lodash.js
|
205
|
-
- test/fixtures/home_path/03/bourbon/_border-image.scss
|
206
|
-
- test/fixtures/home_path/03/bourbon/_font-source-declaration.scss
|
207
|
-
- test/fixtures/home_path/03/bourbon/_retina-image.scss
|
208
|
-
- test/fixtures/torbafiles/01_gh_release.rb
|
209
|
-
- test/fixtures/torbafiles/01_image_asset_not_specified.rb
|
210
|
-
- test/fixtures/torbafiles/01_targz.rb
|
211
|
-
- test/fixtures/torbafiles/01_zip.rb
|
212
|
-
- test/fixtures/torbafiles/02_npm.rb
|
213
|
-
- test/fixtures/torbafiles/03_not_existed_assets.rb
|
214
|
-
- test/fixtures/torbafiles/04_similar_names.rb
|
215
|
-
- test/import_list_test.rb
|
216
|
-
- test/manifest_test.rb
|
217
|
-
- test/package/import_list_test.rb
|
218
|
-
- test/package/logical_paths_test.rb
|
219
|
-
- test/package_test.rb
|
220
|
-
- test/rake_task_test.rb
|
221
|
-
- test/remote_sources/common_test.rb
|
222
|
-
- test/remote_sources/get_file_test.rb
|
223
|
-
- test/remote_sources/github_release_test.rb
|
224
|
-
- test/remote_sources/npm_test.rb
|
225
|
-
- test/remote_sources/targz_test.rb
|
226
|
-
- test/remote_sources/zip_test.rb
|
227
|
-
- test/test_helper.rb
|
228
|
-
- test/torba_test.rb
|
160
|
+
test_files: []
|
@@ -1,101 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module Torba
|
4
|
-
class OpenTest < Minitest::Test
|
5
|
-
def test_complains_no_editor_set
|
6
|
-
out, err, status = torba("open trumbowyg", torbafile: "01_zip.rb", env: {
|
7
|
-
"TORBA_EDITOR" => nil, "VISUAL" => nil, "EDITOR" => nil
|
8
|
-
})
|
9
|
-
refute status.success?, err
|
10
|
-
assert_includes out, "To open a package, set $EDITOR or $TORBA_EDITOR"
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_runs_pack
|
14
|
-
out, err, status = torba("open trumbowyg", torbafile: "01_zip.rb", env: {
|
15
|
-
"TORBA_EDITOR" => "echo torba_editor", "VISUAL" => "echo visual", "EDITOR" => "echo editor"
|
16
|
-
})
|
17
|
-
assert status.success?, err
|
18
|
-
assert_dirs_equal "test/fixtures/home_path/01", path_to_packaged("trumbowyg")
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_uses_torba_editor_first
|
22
|
-
out, err, status = torba("open trumbowyg", torbafile: "01_zip.rb", env: {
|
23
|
-
"TORBA_EDITOR" => "echo torba_editor", "VISUAL" => "echo visual", "EDITOR" => "echo editor"
|
24
|
-
})
|
25
|
-
assert status.success?, err
|
26
|
-
assert_includes out, "torba_editor #{path_to_packaged "trumbowyg"}"
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_uses_visual_editor_second
|
30
|
-
out, err, status = torba("open trumbowyg", torbafile: "01_zip.rb", env: {
|
31
|
-
"TORBA_EDITOR" => nil, "VISUAL" => "echo visual", "EDITOR" => "echo editor"
|
32
|
-
})
|
33
|
-
assert status.success?, err
|
34
|
-
assert_includes out, "visual #{path_to_packaged "trumbowyg"}"
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_uses_editor_third
|
38
|
-
out, err, status = torba("open trumbowyg", torbafile: "01_zip.rb", env: {
|
39
|
-
"TORBA_EDITOR" => nil, "VISUAL" => nil, "EDITOR" => "echo editor"
|
40
|
-
})
|
41
|
-
assert status.success?, err
|
42
|
-
assert_includes out, "editor #{path_to_packaged "trumbowyg"}"
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_finds_by_partial_package_name
|
46
|
-
out, err, status = torba("open trumbo", torbafile: "01_zip.rb", env: {
|
47
|
-
"TORBA_EDITOR" => nil, "VISUAL" => nil, "EDITOR" => "echo editor"
|
48
|
-
})
|
49
|
-
assert status.success?, err
|
50
|
-
assert_includes out, "editor #{path_to_packaged "trumbowyg"}"
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_could_not_find_package
|
54
|
-
out, err, status = torba("open dumbo", torbafile: "01_zip.rb", env: {
|
55
|
-
"TORBA_EDITOR" => nil, "VISUAL" => nil, "EDITOR" => "echo editor"
|
56
|
-
})
|
57
|
-
refute status.success?, err
|
58
|
-
assert_includes out, "Could not find package 'dumbo'."
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_similar_names_show_options
|
62
|
-
out, err, status = torba("open bourbon", torbafile: "04_similar_names.rb", env: {
|
63
|
-
"TORBA_EDITOR" => nil, "VISUAL" => nil, "EDITOR" => "echo editor"
|
64
|
-
})
|
65
|
-
refute status.success?, err
|
66
|
-
assert_includes out, <<OUT
|
67
|
-
1 : bourbon
|
68
|
-
2 : bourbon-neat
|
69
|
-
0 : - exit -
|
70
|
-
OUT
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_similar_names_chosen_option
|
74
|
-
skip_java_capture3_bug
|
75
|
-
out, err, status = torba("open bourbon", torbafile: "04_similar_names.rb", stdin_data: "2", env: {
|
76
|
-
"TORBA_EDITOR" => nil, "VISUAL" => nil, "EDITOR" => "echo editor"
|
77
|
-
})
|
78
|
-
assert status.success?, err
|
79
|
-
refute_includes out, "editor #{path_to_packaged "bourbon"}"
|
80
|
-
assert_includes out, "editor #{path_to_packaged "bourbon-neat"}"
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_similar_names_chosen_exit
|
84
|
-
out, err, status = torba("open bourbon", torbafile: "04_similar_names.rb", stdin_data: "0", env: {
|
85
|
-
"TORBA_EDITOR" => nil, "VISUAL" => nil, "EDITOR" => "echo editor"
|
86
|
-
})
|
87
|
-
refute status.success?, err
|
88
|
-
refute_includes out, "editor #{path_to_packaged "bourbon"}"
|
89
|
-
refute_includes out, "editor #{path_to_packaged "bourbon-neat"}"
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_similar_names_chosen_unexisted_option
|
93
|
-
out, err, status = torba("open bourbon", torbafile: "04_similar_names.rb", stdin_data: "7", env: {
|
94
|
-
"TORBA_EDITOR" => nil, "VISUAL" => nil, "EDITOR" => "echo editor"
|
95
|
-
})
|
96
|
-
refute status.success?, err
|
97
|
-
refute_includes out, "editor #{path_to_packaged "bourbon"}"
|
98
|
-
refute_includes out, "editor #{path_to_packaged "bourbon-neat"}"
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module Torba
|
4
|
-
class PackTest < Minitest::Test
|
5
|
-
def test_zip
|
6
|
-
out, err, status = torba("pack", torbafile: "01_zip.rb")
|
7
|
-
assert status.success?, err
|
8
|
-
assert_includes out, "Torba has been packed!"
|
9
|
-
assert_dirs_equal "test/fixtures/home_path/01", path_to_packaged("trumbowyg")
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_targz
|
13
|
-
out, err, status = torba("pack", torbafile: "01_targz.rb")
|
14
|
-
assert status.success?, err
|
15
|
-
assert_includes out, "Torba has been packed!"
|
16
|
-
assert_dirs_equal "test/fixtures/home_path/01", path_to_packaged("trumbowyg")
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_gh_release
|
20
|
-
out, err, status = torba("pack", torbafile: "01_gh_release.rb")
|
21
|
-
assert status.success?, err
|
22
|
-
assert_includes out, "Torba has been packed!"
|
23
|
-
assert_dirs_equal "test/fixtures/home_path/01", path_to_packaged("trumbowyg")
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_npm
|
27
|
-
out, err, status = torba("pack", torbafile: "02_npm.rb")
|
28
|
-
assert status.success?, err
|
29
|
-
assert_includes out, "Torba has been packed!"
|
30
|
-
assert_dirs_equal "test/fixtures/home_path/02", path_to_packaged("lo_dash")
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_without_image_asset_specified_in_import
|
34
|
-
out, err, status = torba("pack", torbafile: "01_image_asset_not_specified.rb")
|
35
|
-
refute status.success?, err
|
36
|
-
assert_includes out, <<OUT
|
37
|
-
Unknown asset to process with path '#{path_to_packaged "Trumbowyg", Test::TempHome.persistent_tmp_dir}/dist/ui/images/icons-2x.png'.
|
38
|
-
Make sure that you've imported all image/font assets mentioned in a stylesheet(-s).
|
39
|
-
OUT
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_with_not_existed_assets_mentioned_in_stylesheets
|
43
|
-
out, err, status = torba("pack", torbafile: "03_not_existed_assets.rb")
|
44
|
-
assert status.success?, err
|
45
|
-
assert_includes out, "Torba has been packed!"
|
46
|
-
assert_dirs_equal "test/fixtures/home_path/03", path_to_packaged("bourbon")
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module Torba
|
4
|
-
class ShowTest < Minitest::Test
|
5
|
-
def test_runs_pack
|
6
|
-
out, err, status = torba("show trumbowyg", torbafile: "01_zip.rb")
|
7
|
-
assert status.success?, err
|
8
|
-
assert_dirs_equal "test/fixtures/home_path/01", path_to_packaged("trumbowyg")
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_outputs_package_directory
|
12
|
-
out, err, status = torba("show trumbowyg", torbafile: "01_zip.rb")
|
13
|
-
assert status.success?, err
|
14
|
-
assert_includes out, path_to_packaged("trumbowyg")
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_finds_by_partial_package_name
|
18
|
-
out, err, status = torba("show trumbo", torbafile: "01_zip.rb")
|
19
|
-
assert status.success?, err
|
20
|
-
assert_includes out, path_to_packaged("trumbowyg")
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_could_not_find_package
|
24
|
-
out, err, status = torba("show dumbo", torbafile: "01_zip.rb")
|
25
|
-
refute status.success?, err
|
26
|
-
assert_includes out, "Could not find package 'dumbo'."
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_similar_names_show_options
|
30
|
-
out, err, status = torba("show bourbon", torbafile: "04_similar_names.rb")
|
31
|
-
refute status.success?, err
|
32
|
-
assert_includes out, <<OUT
|
33
|
-
1 : bourbon
|
34
|
-
2 : bourbon-neat
|
35
|
-
0 : - exit -
|
36
|
-
OUT
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_similar_names_chosen_option
|
40
|
-
skip_java_capture3_bug
|
41
|
-
out, err, status = torba("show bourbon", torbafile: "04_similar_names.rb", stdin_data: "2")
|
42
|
-
assert status.success?, err
|
43
|
-
refute_includes out, path_to_packaged("bourbon")
|
44
|
-
assert_includes out, path_to_packaged("bourbon-neat")
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_similar_names_chosen_exit
|
48
|
-
out, err, status = torba("show bourbon", torbafile: "04_similar_names.rb", stdin_data: "0")
|
49
|
-
refute status.success?, err
|
50
|
-
refute_includes out, path_to_packaged("bourbon")
|
51
|
-
refute_includes out, path_to_packaged("bourbon-neat")
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_similar_names_chosen_unexisted_option
|
55
|
-
out, err, status = torba("show bourbon", torbafile: "04_similar_names.rb", stdin_data: "7")
|
56
|
-
refute status.success?, err
|
57
|
-
refute_includes out, path_to_packaged("bourbon")
|
58
|
-
refute_includes out, path_to_packaged("bourbon-neat")
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module Torba
|
4
|
-
class VerifyTest < Minitest::Test
|
5
|
-
def test_unpacked
|
6
|
-
out, err, status = torba("verify", torbafile: "01_zip.rb")
|
7
|
-
refute status.success?, err
|
8
|
-
assert_equal <<OUT, out
|
9
|
-
Your Torba is not packed yet.
|
10
|
-
Missing packages:
|
11
|
-
* trumbowyg
|
12
|
-
Run `bundle exec torba pack` to install missing packages.
|
13
|
-
OUT
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_packed
|
17
|
-
_, err, status = torba("pack", torbafile: "01_zip.rb")
|
18
|
-
assert status.success?, err
|
19
|
-
|
20
|
-
out, err, status = torba("verify", torbafile: "01_zip.rb")
|
21
|
-
assert status.success?, err
|
22
|
-
assert_includes out, "Torba is prepared!"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,139 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module Torba
|
4
|
-
class CssUrlToErbAssetPathTest < Minitest::Test
|
5
|
-
def filter
|
6
|
-
CssUrlToErbAssetPath
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_no_url
|
10
|
-
css = "p { margin: 0; }"
|
11
|
-
assert_equal css, filter.call(css, "/current/file")
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_url_with_data
|
15
|
-
css = "background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaskip);"
|
16
|
-
assert_equal css, filter.call(css, "/current/file")
|
17
|
-
css = "background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaskip');"
|
18
|
-
assert_equal css, filter.call(css, "/current/file")
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_http_url
|
22
|
-
url = 'http://example.com/example.png'
|
23
|
-
url_https = url.gsub('http', 'https')
|
24
|
-
css = "background-image: url('#{url}');"
|
25
|
-
css_https = "background-image: url('#{url_https}');"
|
26
|
-
assert_equal css, filter.call(css, url)
|
27
|
-
assert_equal css_https, filter.call(css_https, url_https)
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_absolute_url
|
31
|
-
css = "background-image: url('/icons.png');"
|
32
|
-
assert_equal "background-image: url('/icons.png');", filter.call(css, "/current_file")
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_block_returns_nil
|
36
|
-
css = "background-image: url('icons.png');"
|
37
|
-
assert_equal css, filter.call(css, "/current_file") { nil }
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_stylesheet_and_image_in_same_directory
|
41
|
-
current_file = "/home/package/dist/ui/stylesheet.css"
|
42
|
-
css = "background-image: url('icons.png');"
|
43
|
-
|
44
|
-
new_content = filter.call(css, current_file) do |image_full_url|
|
45
|
-
assert_equal "/home/package/dist/ui/icons.png", image_full_url
|
46
|
-
"ui/icons.png"
|
47
|
-
end
|
48
|
-
assert_equal "background-image: url('<%= asset_path('ui/icons.png') %>');", new_content
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_url_double_quotes
|
52
|
-
current_file = "/home/package/dist/ui/stylesheet.css"
|
53
|
-
css = 'background-image: url("icons.png");'
|
54
|
-
|
55
|
-
filter.call(css, current_file) do |image_full_url|
|
56
|
-
assert_equal "/home/package/dist/ui/icons.png", image_full_url
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_minified
|
61
|
-
current_file = "/home/package/dist/ui/stylesheet.css"
|
62
|
-
css = ".image{background-image:url(icons.png)}.border{border(1px solid)};"
|
63
|
-
|
64
|
-
filter.call(css, current_file) do |image_full_url|
|
65
|
-
assert_equal "/home/package/dist/ui/icons.png", image_full_url
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_stylesheet_and_image_in_sibling_directories
|
70
|
-
current_file = "/home/package/dist/ui/stylesheet.css"
|
71
|
-
css = "background-image: url('../images/icons.png');"
|
72
|
-
|
73
|
-
new_content = filter.call(css, current_file) do |image_full_url|
|
74
|
-
assert_equal "/home/package/dist/images/icons.png", image_full_url
|
75
|
-
"images/icons.png"
|
76
|
-
end
|
77
|
-
assert_equal "background-image: url('<%= asset_path('images/icons.png') %>');", new_content
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_image_in_child_directory_of_stylesheet
|
81
|
-
current_file = "/home/package/dist/ui/stylesheet.css"
|
82
|
-
css = "background-image: url('./images/icons.png');"
|
83
|
-
|
84
|
-
new_content = filter.call(css, current_file) do |image_full_url|
|
85
|
-
assert_equal "/home/package/dist/ui/images/icons.png", image_full_url
|
86
|
-
"ui/images/icons.png"
|
87
|
-
end
|
88
|
-
assert_equal "background-image: url('<%= asset_path('ui/images/icons.png') %>');", new_content
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_url_with_iefix_query
|
92
|
-
current_file = "/home/dist/ui/stylesheet.css"
|
93
|
-
css = <<-CSS
|
94
|
-
@font-face {
|
95
|
-
font-family: "Material-Design-Icons";
|
96
|
-
src: url("../font/material-design-icons/Material-Design-Icons.eot?#iefix") format("embedded-opentype");
|
97
|
-
font-weight: normal;
|
98
|
-
font-style: normal; }
|
99
|
-
CSS
|
100
|
-
|
101
|
-
new_content = filter.call(css, current_file) do |image_full_url|
|
102
|
-
assert_equal "/home/dist/font/material-design-icons/Material-Design-Icons.eot", image_full_url
|
103
|
-
"material-design-icons/Material-Design-Icons.eot"
|
104
|
-
end
|
105
|
-
|
106
|
-
assert_equal <<-CSS, new_content
|
107
|
-
@font-face {
|
108
|
-
font-family: "Material-Design-Icons";
|
109
|
-
src: url("<%= asset_path('material-design-icons/Material-Design-Icons.eot') %>?#iefix") format("embedded-opentype");
|
110
|
-
font-weight: normal;
|
111
|
-
font-style: normal; }
|
112
|
-
CSS
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_url_with_svg_fragment
|
116
|
-
current_file = "/home/dist/ui/stylesheet.css"
|
117
|
-
css = <<-CSS
|
118
|
-
@font-face {
|
119
|
-
font-family: "Material-Design-Icons";
|
120
|
-
src: url("../font/material-design-icons/Material-Design-Icons.svg#Material-Design-Icons") format("svg");
|
121
|
-
font-weight: normal;
|
122
|
-
font-style: normal; }
|
123
|
-
CSS
|
124
|
-
|
125
|
-
new_content = filter.call(css, current_file) do |image_full_url|
|
126
|
-
assert_equal "/home/dist/font/material-design-icons/Material-Design-Icons.svg", image_full_url
|
127
|
-
"material-design-icons/Material-Design-Icons.svg"
|
128
|
-
end
|
129
|
-
|
130
|
-
assert_equal <<-CSS, new_content
|
131
|
-
@font-face {
|
132
|
-
font-family: "Material-Design-Icons";
|
133
|
-
src: url("<%= asset_path('material-design-icons/Material-Design-Icons.svg') %>#Material-Design-Icons") format("svg");
|
134
|
-
font-weight: normal;
|
135
|
-
font-style: normal; }
|
136
|
-
CSS
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
Binary file
|
Binary file
|