torba 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -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
@@ -1,62 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
require "fileutils"
|
3
|
-
|
4
|
-
module Torba
|
5
|
-
class CommonRemoteSourceTest < Minitest::Test
|
6
|
-
def cache_path
|
7
|
-
Torba.home_path
|
8
|
-
end
|
9
|
-
|
10
|
-
def remote
|
11
|
-
@remote ||= Test::RemoteSource.new(cache_path)
|
12
|
-
end
|
13
|
-
|
14
|
-
def touch(path)
|
15
|
-
super File.join(cache_path, path)
|
16
|
-
end
|
17
|
-
|
18
|
-
def assert_valid_tuple(path, tuple)
|
19
|
-
assert_equal File.join(cache_path, path), tuple[0]
|
20
|
-
assert_equal path, tuple[1]
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_glob
|
24
|
-
touch "one.jpg"
|
25
|
-
touch "two.jpg"
|
26
|
-
|
27
|
-
tuples = remote["*"]
|
28
|
-
assert_equal 2, tuples.size
|
29
|
-
|
30
|
-
tuple1, tuple2 = tuples
|
31
|
-
assert_valid_tuple "one.jpg", tuple1
|
32
|
-
assert_valid_tuple "two.jpg", tuple2
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_no_directories
|
36
|
-
touch "hello/one.jpg"
|
37
|
-
|
38
|
-
tuples = remote["*"]
|
39
|
-
assert_equal 0, remote["*"].size
|
40
|
-
|
41
|
-
tuples = remote["**/*"]
|
42
|
-
assert_equal 1, tuples.size
|
43
|
-
|
44
|
-
assert_valid_tuple "hello/one.jpg", tuples.first
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_always_absolute_path
|
48
|
-
touch "hello/one.jpg"
|
49
|
-
|
50
|
-
Dir.chdir(cache_path) do
|
51
|
-
remote = Test::RemoteSource.new("./hello")
|
52
|
-
|
53
|
-
tuples = remote["*"]
|
54
|
-
assert_equal 1, tuples.size
|
55
|
-
|
56
|
-
tuple = tuples.first
|
57
|
-
assert_equal File.join(cache_path, "hello/one.jpg"), tuple[0]
|
58
|
-
assert_equal "one.jpg", tuple[1]
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module Torba
|
4
|
-
class GetFileTest < Minitest::Test
|
5
|
-
def test_404
|
6
|
-
exception = assert_raises(Errors::ShellCommandFailed) do
|
7
|
-
RemoteSources::GetFile.process("http://jquery.com/jquery.zip")
|
8
|
-
end
|
9
|
-
assert_includes exception.message, "curl"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module Torba
|
4
|
-
class GithubReleaseTest < Minitest::Test
|
5
|
-
def remote
|
6
|
-
RemoteSources::GithubRelease.new("user/repo", "v.2.0.0")
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_source
|
10
|
-
assert_equal "user/repo", remote.source
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_repository_name
|
14
|
-
assert_equal "repo", remote.repository_name
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_repository_user
|
18
|
-
assert_equal "user", remote.repository_user
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_tag
|
22
|
-
assert_equal "v.2.0.0", remote.tag
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_url
|
26
|
-
assert_equal "https://github.com/user/repo/archive/v.2.0.0.zip", remote.url
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_unique_digest
|
30
|
-
remote = RemoteSources::GithubRelease.new("user/repo", "v.2.0.0")
|
31
|
-
same_remote = RemoteSources::GithubRelease.new("user/repo", "v.2.0.0")
|
32
|
-
assert_equal remote.digest, same_remote.digest
|
33
|
-
|
34
|
-
another_remote = RemoteSources::GithubRelease.new("another/repo", "v.2.0.0")
|
35
|
-
refute_equal remote.digest, another_remote.digest
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_digest_contains_repository_name
|
39
|
-
assert_match /^repo-/, remote.digest
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module Torba
|
4
|
-
class NpmTest < Minitest::Test
|
5
|
-
def remote
|
6
|
-
RemoteSources::Npm.new("coffee-script", "2.0.0")
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_package
|
10
|
-
assert_equal "coffee-script", remote.package
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_tag
|
14
|
-
assert_equal "2.0.0", remote.version
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_url
|
18
|
-
assert_equal "https://registry.npmjs.org/coffee-script/-/coffee-script-2.0.0.tgz", remote.url
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_unique_digest
|
22
|
-
remote = RemoteSources::Npm.new("coffee-script", "2.0.0")
|
23
|
-
same_remote = RemoteSources::Npm.new("coffee-script", "2.0.0")
|
24
|
-
assert_equal remote.digest, same_remote.digest
|
25
|
-
|
26
|
-
another_remote = RemoteSources::Npm.new("coffee-script", "2.0.1")
|
27
|
-
refute_equal remote.digest, another_remote.digest
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_digest_contains_repository_name
|
31
|
-
assert_match /^coffee-script-/, remote.digest
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module Torba
|
4
|
-
class TargzTest < Minitest::Test
|
5
|
-
def test_url
|
6
|
-
remote = RemoteSources::Targz.new("http://jquery.com/jquery.tar.gz")
|
7
|
-
assert_equal "http://jquery.com/jquery.tar.gz", remote.url
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_unique_digest
|
11
|
-
remote = RemoteSources::Targz.new("http://jquery.com/jquery.tar.gz")
|
12
|
-
same_remote = RemoteSources::Targz.new("http://jquery.com/jquery.tar.gz")
|
13
|
-
|
14
|
-
assert_equal remote.digest, same_remote.digest
|
15
|
-
|
16
|
-
another_remote = RemoteSources::Targz.new("http://zeptojs.com/jquery.tar.gz")
|
17
|
-
|
18
|
-
refute_equal remote.digest, another_remote.digest
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_digest_contains_filename
|
22
|
-
remote = RemoteSources::Targz.new("http://jquery.com/jquery.tar.gz")
|
23
|
-
assert_match /^jquery-/, remote.digest
|
24
|
-
|
25
|
-
remote = RemoteSources::Targz.new("http://jquery.com/jquery.tgz")
|
26
|
-
assert_match /^jquery-/, remote.digest
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module Torba
|
4
|
-
class ZipTest < Minitest::Test
|
5
|
-
def test_url
|
6
|
-
remote = RemoteSources::Zip.new("http://jquery.com/jquery.zip")
|
7
|
-
assert_equal "http://jquery.com/jquery.zip", remote.url
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_unique_digest
|
11
|
-
remote = RemoteSources::Zip.new("http://jquery.com/jquery.zip")
|
12
|
-
same_remote = RemoteSources::Zip.new("http://jquery.com/jquery.zip")
|
13
|
-
|
14
|
-
assert_equal remote.digest, same_remote.digest
|
15
|
-
|
16
|
-
another_remote = RemoteSources::Zip.new("http://angularjs.com/angular.zip")
|
17
|
-
|
18
|
-
refute_equal remote.digest, another_remote.digest
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_digest_contains_filename
|
22
|
-
remote = RemoteSources::Zip.new("http://jquery.com/jquery.zip")
|
23
|
-
assert_match /^jquery-/, remote.digest
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
require "bundler/setup"
|
2
|
-
require "torba"
|
3
|
-
require "torba/remote_sources/common"
|
4
|
-
|
5
|
-
require "minitest/autorun"
|
6
|
-
require "minitest/assert_dirs_equal"
|
7
|
-
require "mocha/minitest"
|
8
|
-
require "tmpdir"
|
9
|
-
require "fileutils"
|
10
|
-
require "open3"
|
11
|
-
|
12
|
-
module Torba
|
13
|
-
module Test
|
14
|
-
module TempHome
|
15
|
-
attr_reader :torba_tmp_dir
|
16
|
-
|
17
|
-
def self.persistent_tmp_dir
|
18
|
-
@persistent_tmp_dir ||= File.realpath(Dir.mktmpdir("torba"))
|
19
|
-
end
|
20
|
-
|
21
|
-
def before_setup
|
22
|
-
Torba.home_path = @torba_tmp_dir = File.realpath(Dir.mktmpdir("torba"))
|
23
|
-
super
|
24
|
-
end
|
25
|
-
|
26
|
-
def after_teardown
|
27
|
-
FileUtils.rm_rf(torba_tmp_dir)
|
28
|
-
Torba.home_path = nil
|
29
|
-
super
|
30
|
-
end
|
31
|
-
|
32
|
-
Minitest.after_run do
|
33
|
-
FileUtils.rm_rf(persistent_tmp_dir)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
module FileSystem
|
38
|
-
def assert_exists(file_path)
|
39
|
-
assert File.exists?(file_path)
|
40
|
-
end
|
41
|
-
|
42
|
-
def refute_exists(file_path)
|
43
|
-
refute File.exists?(file_path)
|
44
|
-
end
|
45
|
-
|
46
|
-
def touch(path)
|
47
|
-
FileUtils.mkdir_p(File.dirname(path))
|
48
|
-
FileUtils.touch(path)
|
49
|
-
end
|
50
|
-
|
51
|
-
def path_to_packaged(name, home = torba_tmp_dir)
|
52
|
-
path = Dir.glob("#{home}/*").sort.grep(Regexp.new(name)).first
|
53
|
-
assert path, "Couldn't find packaged #{name.inspect} in #{home.inspect}"
|
54
|
-
path
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
module Exec
|
59
|
-
def torba(torba_cmd, options = {})
|
60
|
-
env = {"TORBA_HOME_PATH" => torba_tmp_dir, "TORBA_CACHE_PATH" => TempHome.persistent_tmp_dir}
|
61
|
-
|
62
|
-
if (torbafile = options.delete(:torbafile))
|
63
|
-
env.merge!("TORBA_FILE" => "test/fixtures/torbafiles/#{torbafile}")
|
64
|
-
end
|
65
|
-
|
66
|
-
if (home_path = options.delete(:home_path))
|
67
|
-
env.merge!("TORBA_HOME_PATH" => home_path)
|
68
|
-
end
|
69
|
-
|
70
|
-
if (cache_path = options.delete(:cache_path))
|
71
|
-
env.merge!("TORBA_CACHE_PATH" => cache_path)
|
72
|
-
end
|
73
|
-
|
74
|
-
if (additional_env = options.delete(:env))
|
75
|
-
env.merge!(additional_env)
|
76
|
-
end
|
77
|
-
|
78
|
-
cmd = "ruby bin/torba #{torba_cmd}"
|
79
|
-
Open3.capture3(env, cmd, options)
|
80
|
-
end
|
81
|
-
|
82
|
-
def skip_java_capture3_bug
|
83
|
-
if RUBY_PLATFORM == "java"
|
84
|
-
skip "Skipping test due to Open3.capture3 bug in Jruby"
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
class RemoteSource
|
90
|
-
include RemoteSources::Common
|
91
|
-
|
92
|
-
attr_reader :cache_path
|
93
|
-
|
94
|
-
def initialize(cache_path)
|
95
|
-
@cache_path = cache_path
|
96
|
-
end
|
97
|
-
|
98
|
-
def ensure_cached; end
|
99
|
-
|
100
|
-
def digest; '' end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
class Minitest::Test
|
106
|
-
include Torba::Test::TempHome
|
107
|
-
include Torba::Test::FileSystem
|
108
|
-
include Torba::Test::Exec
|
109
|
-
end
|
data/test/torba_test.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class TorbaTest < Minitest::Test
|
4
|
-
def test_home_path
|
5
|
-
Torba.home_path = "/new/home/path"
|
6
|
-
assert_equal "/new/home/path", Torba.home_path
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_cache_path
|
10
|
-
Torba.cache_path = "/new/cache/path"
|
11
|
-
assert_equal "/new/cache/path", Torba.cache_path
|
12
|
-
end
|
13
|
-
end
|