torba 1.0.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +6 -2
  3. data/CHANGELOG.md +19 -0
  4. data/README.md +1 -1
  5. data/lib/torba/remote_sources/common.rb +1 -1
  6. data/lib/torba/remote_sources/targz.rb +1 -1
  7. data/torba.gemspec +5 -6
  8. metadata +20 -84
  9. data/test/acceptance-cli/open_test.rb +0 -101
  10. data/test/acceptance-cli/pack_test.rb +0 -49
  11. data/test/acceptance-cli/show_test.rb +0 -61
  12. data/test/acceptance-cli/verify_test.rb +0 -25
  13. data/test/css_url_to_erb_asset_path_test.rb +0 -139
  14. data/test/fixtures/home_path/01/trumbowyg/icons-2x.png +0 -0
  15. data/test/fixtures/home_path/01/trumbowyg/icons.png +0 -0
  16. data/test/fixtures/home_path/01/trumbowyg/trumbowyg.css.erb +0 -471
  17. data/test/fixtures/home_path/01/trumbowyg/trumbowyg.js +0 -1124
  18. data/test/fixtures/home_path/02/lo_dash/lodash.js +0 -2793
  19. data/test/fixtures/home_path/03/bourbon/_border-image.scss +0 -59
  20. data/test/fixtures/home_path/03/bourbon/_font-source-declaration.scss +0 -43
  21. data/test/fixtures/home_path/03/bourbon/_retina-image.scss +0 -25
  22. data/test/fixtures/torbafiles/01_gh_release.rb +0 -8
  23. data/test/fixtures/torbafiles/01_image_asset_not_specified.rb +0 -7
  24. data/test/fixtures/torbafiles/01_targz.rb +0 -7
  25. data/test/fixtures/torbafiles/01_zip.rb +0 -7
  26. data/test/fixtures/torbafiles/02_npm.rb +0 -1
  27. data/test/fixtures/torbafiles/03_not_existed_assets.rb +0 -5
  28. data/test/fixtures/torbafiles/04_similar_names.rb +0 -2
  29. data/test/import_list_test.rb +0 -53
  30. data/test/manifest_test.rb +0 -142
  31. data/test/package/import_list_test.rb +0 -123
  32. data/test/package/logical_paths_test.rb +0 -28
  33. data/test/package_test.rb +0 -52
  34. data/test/rake_task_test.rb +0 -69
  35. data/test/remote_sources/common_test.rb +0 -62
  36. data/test/remote_sources/get_file_test.rb +0 -12
  37. data/test/remote_sources/github_release_test.rb +0 -42
  38. data/test/remote_sources/npm_test.rb +0 -34
  39. data/test/remote_sources/targz_test.rb +0 -29
  40. data/test/remote_sources/zip_test.rb +0 -26
  41. data/test/test_helper.rb +0 -109
  42. data/test/torba_test.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: dffb3d16bfcf61e1a3140263cad47fc52626ef52
4
- data.tar.gz: 1b60520eed5966d1a4cf78461f3f5676ca65d36b
2
+ SHA256:
3
+ metadata.gz: 42060e7719aaf33ebf638eefb20bdb1c24b2c8935dec839299c9569dac13ecee
4
+ data.tar.gz: eb2fac5b9909e4fcadb2704ca04e57cdae0213a4fba0c7b1bd8042edb2ea55ee
5
5
  SHA512:
6
- metadata.gz: de9720c5da6dacb684e29e0f2a1d8d4d256e7dfbee348552d073074578bad552e19742ccc768ff1897cfd87c6aa3ff42a8f5025ecc58476f4b28de1820644787
7
- data.tar.gz: 90b3a95611f4839a78aebf35e5146f5b510d969cc2c0278a4787f4034f597f7d42767bef40f3b213ac5780fa2ca18d7978083f15a3cdca319375d3c683b25c78
6
+ metadata.gz: f4ac7cc0274933509ba47fa2ba4feb0ed12afc84aa6bcb0c3214df0df467ddc8a65656da395ff9df4111b56f630bc0c006bb22218524f1e51e17fedf302325d6
7
+ data.tar.gz: ba528f929e0919a727b61cb894a41f069d01cc0761beb8d5c4a3ebb5a584ec8c12b8f8107c86e1a0ce9be411ff7f40f992cb6be78540a7cc7c85f87040d68626
data/.travis.yml CHANGED
@@ -4,6 +4,10 @@ rvm:
4
4
  - 2.0.0
5
5
  - 2.1
6
6
  - 2.2
7
- - jruby-19mode
8
- - rbx-2
7
+ - 2.3
8
+ - 2.4
9
+ - 2.5
10
+ - 2.6
11
+ - 2.7
12
+ - jruby
9
13
  bundler_args: --without doc debug
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  ## Unreleased
2
2
 
3
+ ## Version 1.1.1
4
+
5
+ ### Enhancements
6
+
7
+ * Test files have been removed from the package to reduce
8
+ file size (and to spend less internet traffic too).
9
+
10
+ ## Version 1.1.0
11
+
12
+ ### Enhancements
13
+
14
+ * Thor dependency has been relaxed to support Rails 6.x.
15
+
16
+ ## Version 1.0.1
17
+
18
+ ### Bug fixes
19
+
20
+ * Fix unpacking tar.gz when running on unpriveleged containers
21
+
3
22
  ## Version 1.0.0
4
23
 
5
24
  ### Breaking changes
data/README.md CHANGED
@@ -17,7 +17,7 @@ Production ready.
17
17
 
18
18
  ## Documentation
19
19
 
20
- [Released version](http://rubydoc.info/gems/torba/1.0.0)
20
+ [Released version](http://rubydoc.info/gems/torba/1.1.1)
21
21
 
22
22
  ## Why
23
23
 
@@ -10,7 +10,7 @@ module Torba
10
10
  def [](pattern)
11
11
  ensure_cached
12
12
 
13
- Dir.glob(File.join(cache_path, pattern)).reject{ |path| File.directory?(path) }.map do |path|
13
+ Dir.glob(File.join(cache_path, pattern)).sort.reject{ |path| File.directory?(path) }.map do |path|
14
14
  [File.absolute_path(path), path.sub(/#{cache_path}\/?/, "")]
15
15
  end
16
16
  end
@@ -25,7 +25,7 @@ module Torba
25
25
 
26
26
  tempfile = GetFile.process(url)
27
27
 
28
- command = "gzip -qcd #{tempfile.path} | tar -mxpf - --strip-components=1 -C #{cache_path}"
28
+ command = "gzip -qcd #{tempfile.path} | tar --no-same-owner -mxpf - --strip-components=1 -C #{cache_path}"
29
29
  system(command) || raise(Errors::ShellCommandFailed.new(command))
30
30
  end
31
31
  rescue
data/torba.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "torba"
3
- spec.version = "1.0.0"
3
+ spec.version = "1.1.1"
4
4
  spec.authors = ["Andrii Malyshko"]
5
5
  spec.email = ["mail@nashbridges.me"]
6
6
  spec.description = "Bundler for Sprockets"
@@ -8,16 +8,15 @@ 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
 
17
- spec.add_dependency "thor", "~> 0.19.1"
16
+ spec.add_dependency "thor", ">= 0.19.1", "< 2"
18
17
 
19
- spec.add_development_dependency "bundler", "~> 1.6"
20
- spec.add_development_dependency "rake", "~> 10.0"
18
+ spec.add_development_dependency "bundler"
19
+ spec.add_development_dependency "rake"
21
20
  spec.add_development_dependency "minitest", "~> 5.4"
22
21
  spec.add_development_dependency "mocha"
23
22
  spec.add_development_dependency "assert_dirs_equal", "~> 0.1"
metadata CHANGED
@@ -1,57 +1,63 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torba
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrii Malyshko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-09 00:00:00.000000000 Z
11
+ date: 2022-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.19.1
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: 0.19.1
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - "~>"
37
+ - - ">="
32
38
  - !ruby/object:Gem::Version
33
- version: '1.6'
39
+ version: '0'
34
40
  type: :development
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - "~>"
44
+ - - ">="
39
45
  - !ruby/object:Gem::Version
40
- version: '1.6'
46
+ version: '0'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: rake
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - "~>"
51
+ - - ">="
46
52
  - !ruby/object:Gem::Version
47
- version: '10.0'
53
+ version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - "~>"
58
+ - - ">="
53
59
  - !ruby/object:Gem::Version
54
- version: '10.0'
60
+ version: '0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: minitest
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -127,40 +133,6 @@ files:
127
133
  - lib/torba/remote_sources/zip.rb
128
134
  - lib/torba/ui.rb
129
135
  - lib/torba/verify.rb
130
- - test/acceptance-cli/open_test.rb
131
- - test/acceptance-cli/pack_test.rb
132
- - test/acceptance-cli/show_test.rb
133
- - test/acceptance-cli/verify_test.rb
134
- - test/css_url_to_erb_asset_path_test.rb
135
- - test/fixtures/home_path/01/trumbowyg/icons-2x.png
136
- - test/fixtures/home_path/01/trumbowyg/icons.png
137
- - test/fixtures/home_path/01/trumbowyg/trumbowyg.css.erb
138
- - test/fixtures/home_path/01/trumbowyg/trumbowyg.js
139
- - test/fixtures/home_path/02/lo_dash/lodash.js
140
- - test/fixtures/home_path/03/bourbon/_border-image.scss
141
- - test/fixtures/home_path/03/bourbon/_font-source-declaration.scss
142
- - test/fixtures/home_path/03/bourbon/_retina-image.scss
143
- - test/fixtures/torbafiles/01_gh_release.rb
144
- - test/fixtures/torbafiles/01_image_asset_not_specified.rb
145
- - test/fixtures/torbafiles/01_targz.rb
146
- - test/fixtures/torbafiles/01_zip.rb
147
- - test/fixtures/torbafiles/02_npm.rb
148
- - test/fixtures/torbafiles/03_not_existed_assets.rb
149
- - test/fixtures/torbafiles/04_similar_names.rb
150
- - test/import_list_test.rb
151
- - test/manifest_test.rb
152
- - test/package/import_list_test.rb
153
- - test/package/logical_paths_test.rb
154
- - test/package_test.rb
155
- - test/rake_task_test.rb
156
- - test/remote_sources/common_test.rb
157
- - test/remote_sources/get_file_test.rb
158
- - test/remote_sources/github_release_test.rb
159
- - test/remote_sources/npm_test.rb
160
- - test/remote_sources/targz_test.rb
161
- - test/remote_sources/zip_test.rb
162
- - test/test_helper.rb
163
- - test/torba_test.rb
164
136
  - torba.gemspec
165
137
  homepage: https://github.com/torba-rb/torba
166
138
  licenses:
@@ -181,44 +153,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
153
  - !ruby/object:Gem::Version
182
154
  version: '0'
183
155
  requirements: []
184
- rubyforge_project:
185
- rubygems_version: 2.4.5.1
156
+ rubygems_version: 3.1.6
186
157
  signing_key:
187
158
  specification_version: 4
188
159
  summary: Bundler for Sprockets
189
- test_files:
190
- - test/acceptance-cli/open_test.rb
191
- - test/acceptance-cli/pack_test.rb
192
- - test/acceptance-cli/show_test.rb
193
- - test/acceptance-cli/verify_test.rb
194
- - test/css_url_to_erb_asset_path_test.rb
195
- - test/fixtures/home_path/01/trumbowyg/icons-2x.png
196
- - test/fixtures/home_path/01/trumbowyg/icons.png
197
- - test/fixtures/home_path/01/trumbowyg/trumbowyg.css.erb
198
- - test/fixtures/home_path/01/trumbowyg/trumbowyg.js
199
- - test/fixtures/home_path/02/lo_dash/lodash.js
200
- - test/fixtures/home_path/03/bourbon/_border-image.scss
201
- - test/fixtures/home_path/03/bourbon/_font-source-declaration.scss
202
- - test/fixtures/home_path/03/bourbon/_retina-image.scss
203
- - test/fixtures/torbafiles/01_gh_release.rb
204
- - test/fixtures/torbafiles/01_image_asset_not_specified.rb
205
- - test/fixtures/torbafiles/01_targz.rb
206
- - test/fixtures/torbafiles/01_zip.rb
207
- - test/fixtures/torbafiles/02_npm.rb
208
- - test/fixtures/torbafiles/03_not_existed_assets.rb
209
- - test/fixtures/torbafiles/04_similar_names.rb
210
- - test/import_list_test.rb
211
- - test/manifest_test.rb
212
- - test/package/import_list_test.rb
213
- - test/package/logical_paths_test.rb
214
- - test/package_test.rb
215
- - test/rake_task_test.rb
216
- - test/remote_sources/common_test.rb
217
- - test/remote_sources/get_file_test.rb
218
- - test/remote_sources/github_release_test.rb
219
- - test/remote_sources/npm_test.rb
220
- - test/remote_sources/targz_test.rb
221
- - test/remote_sources/zip_test.rb
222
- - test/test_helper.rb
223
- - test/torba_test.rb
224
- has_rdoc:
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