torba 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +1 -1
  4. data/lib/torba/remote_sources/npm.rb +7 -1
  5. data/torba.gemspec +2 -3
  6. metadata +4 -72
  7. data/test/acceptance-cli/open_test.rb +0 -101
  8. data/test/acceptance-cli/pack_test.rb +0 -49
  9. data/test/acceptance-cli/show_test.rb +0 -61
  10. data/test/acceptance-cli/verify_test.rb +0 -25
  11. data/test/css_url_to_erb_asset_path_test.rb +0 -139
  12. data/test/fixtures/home_path/01/trumbowyg/icons-2x.png +0 -0
  13. data/test/fixtures/home_path/01/trumbowyg/icons.png +0 -0
  14. data/test/fixtures/home_path/01/trumbowyg/trumbowyg.css.erb +0 -471
  15. data/test/fixtures/home_path/01/trumbowyg/trumbowyg.js +0 -1124
  16. data/test/fixtures/home_path/02/lo_dash/lodash.js +0 -2793
  17. data/test/fixtures/home_path/03/bourbon/_border-image.scss +0 -59
  18. data/test/fixtures/home_path/03/bourbon/_font-source-declaration.scss +0 -43
  19. data/test/fixtures/home_path/03/bourbon/_retina-image.scss +0 -25
  20. data/test/fixtures/torbafiles/01_gh_release.rb +0 -8
  21. data/test/fixtures/torbafiles/01_image_asset_not_specified.rb +0 -7
  22. data/test/fixtures/torbafiles/01_targz.rb +0 -7
  23. data/test/fixtures/torbafiles/01_zip.rb +0 -7
  24. data/test/fixtures/torbafiles/02_npm.rb +0 -1
  25. data/test/fixtures/torbafiles/03_not_existed_assets.rb +0 -5
  26. data/test/fixtures/torbafiles/04_similar_names.rb +0 -2
  27. data/test/import_list_test.rb +0 -53
  28. data/test/manifest_test.rb +0 -142
  29. data/test/package/import_list_test.rb +0 -123
  30. data/test/package/logical_paths_test.rb +0 -28
  31. data/test/package_test.rb +0 -52
  32. data/test/rake_task_test.rb +0 -69
  33. data/test/remote_sources/common_test.rb +0 -62
  34. data/test/remote_sources/get_file_test.rb +0 -12
  35. data/test/remote_sources/github_release_test.rb +0 -42
  36. data/test/remote_sources/npm_test.rb +0 -34
  37. data/test/remote_sources/targz_test.rb +0 -29
  38. data/test/remote_sources/zip_test.rb +0 -26
  39. data/test/test_helper.rb +0 -109
  40. data/test/torba_test.rb +0 -13
@@ -1,59 +0,0 @@
1
- @mixin border-image($borders...) {
2
- $webkit-borders: ();
3
- $spec-borders: ();
4
-
5
- @each $border in $borders {
6
- $webkit-border: ();
7
- $spec-border: ();
8
- $border-type: type-of($border);
9
-
10
- @if $border-type == string or list {
11
- $border-str: if($border-type == list, nth($border, 1), $border);
12
-
13
- $url-str: str-slice($border-str, 1, 3);
14
- $gradient-type: str-slice($border-str, 1, 6);
15
-
16
- @if $url-str == "url" {
17
- $webkit-border: $border;
18
- $spec-border: $border;
19
- }
20
-
21
- @else if $gradient-type == "linear" {
22
- $gradients: _linear-gradient-parser("#{$border}");
23
- $webkit-border: map-get($gradients, webkit-image);
24
- $spec-border: map-get($gradients, spec-image);
25
- }
26
-
27
- @else if $gradient-type == "radial" {
28
- $gradients: _radial-gradient-parser("#{$border}");
29
- $webkit-border: map-get($gradients, webkit-image);
30
- $spec-border: map-get($gradients, spec-image);
31
- }
32
-
33
- @else {
34
- $webkit-border: $border;
35
- $spec-border: $border;
36
- }
37
- }
38
-
39
- @else {
40
- $webkit-border: $border;
41
- $spec-border: $border;
42
- }
43
-
44
- $webkit-borders: append($webkit-borders, $webkit-border, comma);
45
- $spec-borders: append($spec-borders, $spec-border, comma);
46
- }
47
-
48
- -webkit-border-image: $webkit-borders;
49
- border-image: $spec-borders;
50
- border-style: solid;
51
- }
52
-
53
- //Examples:
54
- // @include border-image(url("image.png"));
55
- // @include border-image(url("image.png") 20 stretch);
56
- // @include border-image(linear-gradient(45deg, orange, yellow));
57
- // @include border-image(linear-gradient(45deg, orange, yellow) stretch);
58
- // @include border-image(linear-gradient(45deg, orange, yellow) 20 30 40 50 stretch round);
59
- // @include border-image(radial-gradient(top, cover, orange, yellow, orange));
@@ -1,43 +0,0 @@
1
- // Used for creating the source string for fonts using @font-face
2
- // Reference: http://goo.gl/Ru1bKP
3
-
4
- @function font-url-prefixer($asset-pipeline) {
5
- @if $asset-pipeline == true {
6
- @return font-url;
7
- } @else {
8
- @return url;
9
- }
10
- }
11
-
12
- @function font-source-declaration(
13
- $font-family,
14
- $file-path,
15
- $asset-pipeline,
16
- $file-formats,
17
- $font-url) {
18
-
19
- $src: ();
20
-
21
- $formats-map: (
22
- eot: "#{$file-path}.eot?#iefix" format("embedded-opentype"),
23
- woff2: "#{$file-path}.woff2" format("woff2"),
24
- woff: "#{$file-path}.woff" format("woff"),
25
- ttf: "#{$file-path}.ttf" format("truetype"),
26
- svg: "#{$file-path}.svg##{$font-family}" format("svg")
27
- );
28
-
29
- @each $key, $values in $formats-map {
30
- @if contains($file-formats, $key) {
31
- $file-path: nth($values, 1);
32
- $font-format: nth($values, 2);
33
-
34
- @if $asset-pipeline == true {
35
- $src: append($src, font-url($file-path) $font-format, comma);
36
- } @else {
37
- $src: append($src, url($file-path) $font-format, comma);
38
- }
39
- }
40
- }
41
-
42
- @return $src;
43
- }
@@ -1,25 +0,0 @@
1
- @mixin retina-image($filename, $background-size, $extension: png, $retina-filename: null, $retina-suffix: _2x, $asset-pipeline: $asset-pipeline) {
2
- @if $asset-pipeline {
3
- background-image: image-url("#{$filename}.#{$extension}");
4
- } @else {
5
- background-image: url("#{$filename}.#{$extension}");
6
- }
7
-
8
- @include hidpi {
9
- @if $asset-pipeline {
10
- @if $retina-filename {
11
- background-image: image-url("#{$retina-filename}.#{$extension}");
12
- } @else {
13
- background-image: image-url("#{$filename}#{$retina-suffix}.#{$extension}");
14
- }
15
- } @else {
16
- @if $retina-filename {
17
- background-image: url("#{$retina-filename}.#{$extension}");
18
- } @else {
19
- background-image: url("#{$filename}#{$retina-suffix}.#{$extension}");
20
- }
21
- }
22
-
23
- background-size: $background-size;
24
- }
25
- }
@@ -1,8 +0,0 @@
1
- gh_release "trumbowyg",
2
- source: "torba-rb/Trumbowyg",
3
- tag: "1.1.6",
4
- import: %w[
5
- dist/trumbowyg.js
6
- dist/ui/trumbowyg.css
7
- dist/ui/images/
8
- ]
@@ -1,7 +0,0 @@
1
- gh_release "trumbowyg",
2
- source: "torba-rb/Trumbowyg",
3
- tag: "1.1.6",
4
- import: %w[
5
- dist/ui/trumbowyg.css
6
- dist/ui/images/icons.png
7
- ]
@@ -1,7 +0,0 @@
1
- targz "trumbowyg",
2
- url: "https://github.com/torba-rb/Trumbowyg/archive/1.1.6.tar.gz",
3
- import: %w[
4
- dist/trumbowyg.js
5
- dist/ui/trumbowyg.css
6
- dist/ui/images/
7
- ]
@@ -1,7 +0,0 @@
1
- zip "trumbowyg",
2
- url: "https://github.com/torba-rb/Trumbowyg/archive/1.1.6.zip",
3
- import: %w[
4
- dist/trumbowyg.js
5
- dist/ui/trumbowyg.css
6
- dist/ui/images/
7
- ]
@@ -1 +0,0 @@
1
- npm "lo_dash", package: "lodash", version: "0.1.0", import: ["lodash.js"]
@@ -1,5 +0,0 @@
1
- npm package: 'bourbon', version: '4.2.6', import: %w[
2
- app/assets/stylesheets/addons/_retina-image.scss
3
- app/assets/stylesheets/helpers/_font-source-declaration.scss
4
- app/assets/stylesheets/css3/_border-image.scss
5
- ]
@@ -1,2 +0,0 @@
1
- npm package: 'bourbon', version: '4.2.6'
2
- npm package: 'bourbon-neat', version: '1.7.4'
@@ -1,53 +0,0 @@
1
- require "test_helper"
2
-
3
- module Torba
4
- class ImportListTest < Minitest::Test
5
- def test_find_by_absolute_path
6
- item = ImportList::Asset.new("/dir/subdir/file.jpg", "file.jpg")
7
- list = ImportList.new([item])
8
-
9
- found = list.find_by_absolute_path("/dir/subdir/file.jpg")
10
- assert_equal item, found
11
- end
12
-
13
- def test_find_by_absolute_path_missing
14
- list = ImportList.new([])
15
-
16
- assert_raises(Errors::AssetNotFound) do
17
- list.find_by_absolute_path("file.jpg")
18
- end
19
- end
20
-
21
- def js_asset
22
- ImportList::Asset.new("/dir/script.js", "script.js")
23
- end
24
-
25
- def css_asset
26
- ImportList::Asset.new("/dir/stylesheet.css", "stylesheet.css")
27
- end
28
-
29
- def scss_asset
30
- ImportList::Asset.new("/dir/stylesheet.scss", "stylesheet.scss")
31
- end
32
-
33
- def sass_asset
34
- ImportList::Asset.new("/dir/stylesheet.sass", "stylesheet.sass")
35
- end
36
-
37
- def test_css_assets
38
- list = ImportList.new([js_asset, css_asset, scss_asset, sass_asset])
39
- assert [css_asset, scss_asset, sass_asset], list.css_assets
40
- end
41
-
42
- def test_non_css_assets
43
- list = ImportList.new([js_asset, css_asset, scss_asset, sass_asset])
44
- assert [js_asset], list.non_css_assets
45
- end
46
-
47
- def test_non_js_css_assets
48
- img_asset = ImportList::Asset.new("/dir/image.png", "image.png")
49
- list = ImportList.new([js_asset, css_asset, scss_asset, sass_asset, img_asset])
50
- assert [img_asset], list.non_js_css_assets
51
- end
52
- end
53
- end
@@ -1,142 +0,0 @@
1
- require "test_helper"
2
-
3
- module Torba
4
- class ManifestTest < Minitest::Test
5
- def manifest
6
- @manifest ||= Manifest.new
7
- end
8
-
9
- def package
10
- manifest.packages.first
11
- end
12
-
13
- def remote
14
- package.remote_source
15
- end
16
-
17
- def test_zip
18
- manifest.zip "angular", url: "http://angularjs.com/angularjs.zip"
19
-
20
- assert_equal 1, manifest.packages.size
21
- assert_equal "angular", package.name
22
- assert_instance_of RemoteSources::Zip, remote
23
- assert_equal "http://angularjs.com/angularjs.zip", remote.url
24
- end
25
-
26
- def test_targz
27
- manifest.targz "angular", url: "http://angularjs.com/angularjs.targz"
28
-
29
- assert_equal 1, manifest.packages.size
30
- assert_equal "angular", package.name
31
- assert_instance_of RemoteSources::Targz, remote
32
- assert_equal "http://angularjs.com/angularjs.targz", remote.url
33
- end
34
-
35
- def test_zip_wo_url
36
- assert_raises(KeyError) do
37
- manifest.zip "angular"
38
- end
39
- end
40
-
41
- def test_gh_release
42
- manifest.gh_release "lo-dash", source: "jashkenas/underscore", tag: "1.8.3"
43
-
44
- assert_equal 1, manifest.packages.size
45
- assert_equal "lo-dash", package.name
46
- assert_instance_of RemoteSources::GithubRelease, remote
47
- assert_equal "jashkenas/underscore", remote.source
48
- assert_equal "1.8.3", remote.tag
49
- end
50
-
51
- def test_gh_release_implicit_name
52
- manifest.gh_release source: "jashkenas/underscore", tag: "1.8.3"
53
- assert_equal "underscore", package.name
54
- end
55
-
56
- def test_gh_release_wo_source
57
- assert_raises(KeyError) do
58
- manifest.gh_release "underscore", tag: "1.8.3"
59
- end
60
- end
61
-
62
- def test_gh_release_wo_tag
63
- assert_raises(KeyError) do
64
- manifest.gh_release "underscore", source: "jashkenas/underscore"
65
- end
66
- end
67
-
68
- def test_npm
69
- manifest.npm "coffee", package: "coffee-script", version: "1.8.3"
70
-
71
- assert_equal 1, manifest.packages.size
72
- assert_equal "coffee", package.name
73
- assert_instance_of RemoteSources::Npm, remote
74
- assert_equal "coffee-script", remote.package
75
- assert_equal "1.8.3", remote.version
76
- end
77
-
78
- def test_npm_implicit_name
79
- manifest.npm package: "coffee-script", version: "1.8.3"
80
- assert_equal "coffee-script", package.name
81
- end
82
-
83
- def test_npm_wo_package
84
- assert_raises(KeyError) do
85
- manifest.npm version: "1.8.3"
86
- end
87
- end
88
-
89
- def test_npm_wo_version
90
- assert_raises(KeyError) do
91
- manifest.npm package: "underscore"
92
- end
93
- end
94
-
95
- def test_non_js_css_logical_paths
96
- manifest.zip "angular", url: "http://angularjs.com/angularjs.zip"
97
- manifest.zip "backbone", url: "http://backbonejs.com/backbonejs.zip"
98
-
99
- manifest.packages[0].stub :non_js_css_logical_paths, ["angular.png"] do
100
- manifest.packages[1].stub :non_js_css_logical_paths, ["backbone.png"] do
101
- assert_equal %w[angular.png backbone.png], manifest.non_js_css_logical_paths
102
- end
103
- end
104
- end
105
-
106
- def test_verify
107
- manifest.zip "angular", url: "http://angularjs.com/angularjs.zip"
108
- manifest.npm package: "coffee-script", version: "1.8.3"
109
-
110
- error = assert_raises(Torba::Errors::MissingPackages) { manifest.verify }
111
-
112
- assert_equal error.packages.map(&:name), %w(angular coffee-script)
113
- end
114
-
115
- def test_find_packages_by_name_empty
116
- assert_equal [], manifest.find_packages_by_name("coffee-script")
117
- end
118
-
119
- def test_find_packages_by_name_no_match
120
- manifest.npm "coffee", package: "coffee-script", version: "1.8.3"
121
- manifest.npm "angular", package: "angular", version: "1.3.5"
122
- assert_equal [], manifest.find_packages_by_name("coffee-script")
123
- end
124
-
125
- def test_find_packages_by_name_single_match
126
- manifest.npm "coffee", package: "coffee-script", version: "1.8.3"
127
- manifest.npm "angular", package: "angular", version: "1.3.5"
128
- assert_equal [manifest.packages[0]], manifest.find_packages_by_name("coffee")
129
- end
130
-
131
- def test_find_packages_by_name_multiple_match
132
- manifest.npm "angular", package: "angular", version: "1.3.5"
133
- manifest.npm "angular-routes", package: "angular-routes", version: "1.3.5"
134
- assert_equal manifest.packages, manifest.find_packages_by_name("angular")
135
- end
136
-
137
- def test_find_packages_by_name_ignorecase
138
- manifest.npm "Angular", package: "angular", version: "1.3.5"
139
- assert_equal manifest.packages, manifest.find_packages_by_name("angular")
140
- end
141
- end
142
- end
@@ -1,123 +0,0 @@
1
- require "test_helper"
2
-
3
- module Torba
4
- class PackageImportListTest < Minitest::Test
5
- def source_dir
6
- @source_dir ||= File.join(Torba.home_path, "source")
7
- end
8
-
9
- def touch(path)
10
- super File.join(source_dir, path)
11
- end
12
-
13
- def remote_source
14
- @remote_source ||= Test::RemoteSource.new(source_dir)
15
- end
16
-
17
- def test_single_file_path
18
- touch("hello.js")
19
-
20
- list = Package.new("package", remote_source, import: ["hello.js"]).import_list
21
- assert_equal 1, list.assets.size
22
- item = list.assets.first
23
- assert_equal "package/hello.js", item.logical_path
24
- assert_equal File.join(source_dir, "hello.js"), item.absolute_path
25
- end
26
-
27
- def test_single_file_path_with_subdir
28
- touch("build/hello.js")
29
-
30
- list = Package.new("package", remote_source, import: ["build/hello.js"]).import_list
31
- assert_equal 1, list.assets.size
32
- item = list.assets.first
33
- assert_equal "package/hello.js", item.logical_path
34
- assert_equal File.join(source_dir, "build/hello.js"), item.absolute_path
35
-
36
- touch("build/standalone/hello.js")
37
-
38
- list = Package.new("package", remote_source, import: ["build/standalone/hello.js"]).import_list
39
- assert_equal 1, list.assets.size
40
- item = list.assets.first
41
- assert_equal "package/hello.js", item.logical_path
42
- assert_equal File.join(source_dir, "build/standalone/hello.js"), item.absolute_path
43
- end
44
-
45
- def test_directory
46
- touch("build/standalone/hello.js")
47
-
48
- list = Package.new("package", remote_source, import: ["build/"]).import_list
49
- assert_equal 1, list.assets.size
50
- item = list.assets.first
51
- assert_equal "package/standalone/hello.js", item.logical_path
52
- assert_equal File.join(source_dir, "build/standalone/hello.js"), item.absolute_path
53
-
54
-
55
- list = Package.new("package", remote_source, import: ["build/standalone/"]).import_list
56
- assert_equal 1, list.assets.size
57
- item = list.assets.first
58
- assert_equal "package/hello.js", item.logical_path
59
- assert_equal File.join(source_dir, "build/standalone/hello.js"), item.absolute_path
60
- end
61
-
62
- def test_multiple_files
63
- touch("build/images/first.png")
64
- touch("build/images/second.png")
65
-
66
- list = Package.new("package", remote_source, import: ["build/"]).import_list
67
- assert_equal 2, list.assets.size
68
-
69
- first_item = list.assets[0]
70
- assert_equal "package/images/first.png", first_item.logical_path
71
- assert_equal File.join(source_dir, "build/images/first.png"), first_item.absolute_path
72
-
73
- second_item = list.assets[1]
74
- assert_equal "package/images/second.png", second_item.logical_path
75
- assert_equal File.join(source_dir, "build/images/second.png"), second_item.absolute_path
76
- end
77
-
78
- def test_multiple_import_paths
79
- touch("images/one.jpg")
80
- touch("js/script.js")
81
-
82
- list = Package.new("package", remote_source, import: ["images/", "js/script.js"]).import_list
83
- assert_equal 2, list.assets.size
84
-
85
- first_item = list.assets[0]
86
- assert_equal "package/one.jpg", first_item.logical_path
87
- assert_equal File.join(source_dir, "images/one.jpg"), first_item.absolute_path
88
-
89
- second_item = list.assets[1]
90
- assert_equal "package/script.js", second_item.logical_path
91
- assert_equal File.join(source_dir, "js/script.js"), second_item.absolute_path
92
- end
93
-
94
- def test_glob_pattern
95
- touch("js/hello.js")
96
- touch("build/css/bye.css")
97
-
98
- list = Package.new("package", remote_source, import: ["**/*.{js,coffee}"]).import_list
99
- assert_equal 1, list.assets.size
100
- item = list.assets.first
101
- assert_equal "package/js/hello.js", item.logical_path
102
- assert_equal File.join(source_dir, "js/hello.js"), item.absolute_path
103
-
104
- list = Package.new("package", remote_source, import: ["build/**/*.css"]).import_list
105
- assert_equal 1, list.assets.size
106
- item = list.assets.first
107
- assert_equal "package/css/bye.css", item.logical_path
108
- assert_equal File.join(source_dir, "build/css/bye.css"), item.absolute_path
109
- end
110
-
111
- def test_missing_file
112
- assert_raises(Torba::Errors::NothingToImport) do
113
- Package.new("package", remote_source, import: ["hello.js"]).import_list
114
- end
115
-
116
- touch("hello.js")
117
-
118
- assert_raises(Torba::Errors::NothingToImport) do
119
- Package.new("package", remote_source, import: ["hello.js", "another_missing.js"]).import_list
120
- end
121
- end
122
- end
123
- end
@@ -1,28 +0,0 @@
1
- require "test_helper"
2
-
3
- module Torba
4
- class PackageLogicalPathsTest < Minitest::Test
5
- def import_list
6
- js_asset = ImportList::Asset.new("/dir/script.js", "script.js")
7
- css_asset = ImportList::Asset.new("/dir/stylesheet.css", "stylesheet.css")
8
- img_asset = ImportList::Asset.new("/dir/image.svg", "image.svg")
9
- ImportList.new([js_asset, css_asset, img_asset])
10
- end
11
-
12
- def package
13
- @package ||= Package.new("hello", nil)
14
- end
15
-
16
- def test_logical_paths
17
- package.stub :import_list, import_list do
18
- assert_equal %w[script.js stylesheet.css image.svg], package.logical_paths
19
- end
20
- end
21
-
22
- def test_non_js_css_logical_paths
23
- package.stub :import_list, import_list do
24
- assert_equal %w[image.svg], package.non_js_css_logical_paths
25
- end
26
- end
27
- end
28
- end
data/test/package_test.rb DELETED
@@ -1,52 +0,0 @@
1
- require "test_helper"
2
-
3
- module Torba
4
- class PackageTest < Minitest::Test
5
- def source_dir
6
- @source_dir ||= File.join(Torba.home_path, "source")
7
- end
8
-
9
- def touch(path)
10
- super File.join(source_dir, path)
11
- end
12
-
13
- def fixture(path, content = nil)
14
- touch(path)
15
- if content
16
- File.write(File.join(source_dir, path), content)
17
- end
18
- end
19
-
20
- def test_package_css_with_urls
21
- touch "image.png"
22
- fixture "hello.css" , "body {\nbackground-image: url(image.png)\n}"
23
- source = Torba::Test::RemoteSource.new(source_dir)
24
- package = Package.new("package", source, import: ["hello.css", "image.png"])
25
-
26
- package.build
27
-
28
- assert_exists File.join(package.load_path, "package", "hello.css.erb")
29
- assert_exists File.join(package.load_path, "package", "image.png")
30
- end
31
-
32
- def test_package_css_without_urls
33
- fixture "hello.css"
34
- source = Torba::Test::RemoteSource.new(source_dir)
35
- package = Package.new("package", source, import: ["hello.css"])
36
-
37
- package.build
38
-
39
- assert_exists File.join(package.load_path, "package", "hello.css")
40
- end
41
-
42
- def test_package_css_with_urls_pointing_to_nonexisting_assets
43
- fixture "hello.css", "/*body {\nbackground-image: url(image.png)\n}*/"
44
- source = Torba::Test::RemoteSource.new(source_dir)
45
- package = Package.new("package", source, import: ["hello.css"])
46
-
47
- package.build
48
-
49
- assert_exists File.join(package.load_path, "package", "hello.css")
50
- end
51
- end
52
- end
@@ -1,69 +0,0 @@
1
- require "test_helper"
2
- require "torba/rake_task"
3
-
4
- module Torba
5
- class RakeTaskTest < Minitest::Test
6
- include Rake::DSL
7
-
8
- def setup
9
- task "environment"
10
- task "assets:precompile" => "environment"
11
- Torba::RakeTask.new("torba:pack", :before => "assets:precompile")
12
- end
13
-
14
- def teardown
15
- Rake::Task.clear
16
- end
17
-
18
- def test_torba_pack_task_is_defined
19
- assert(Rake::Task.task_defined?("torba:pack"))
20
- end
21
-
22
- def test_torba_pack_task_has_description
23
- torba_task = Rake::Task["torba:pack"]
24
- torba_task.comment =~ /Torbafile/
25
- end
26
-
27
- def test_torba_pack_is_installed_as_prerequisite
28
- precompile_task = Rake::Task["assets:precompile"]
29
- assert_equal(%w(environment torba:pack), precompile_task.prerequisites)
30
- end
31
-
32
- def test_invoking_torba_pack
33
- Torba.expects(:pack).once
34
- Rake::Task["torba:pack"].invoke
35
- end
36
-
37
- def test_calls_a_block_before_torba_pack
38
- Rake::Task.clear
39
-
40
- configuration = Object.new
41
-
42
- order = sequence("correct order")
43
- configuration.expects(:setup).in_sequence(order)
44
- Torba.expects(:pack).in_sequence(order)
45
-
46
- task = Torba::RakeTask.new("torba:pack") { configuration.setup }
47
- Rake::Task["torba:pack"].invoke
48
- end
49
-
50
- def test_defines_task_if_doesnt_exist
51
- Rake::Task.clear
52
- Torba::RakeTask.new("torba:pack", :before => "something:else")
53
-
54
- assert(Rake::Task.task_defined?("something:else"))
55
- other_task = Rake::Task["something:else"]
56
- assert_equal(%w(torba:pack), other_task.prerequisites)
57
- end
58
-
59
- def test_alternative_task_name_can_be_specified
60
- Rake::Task.clear
61
- Torba::RakeTask.new("package")
62
-
63
- assert(Rake::Task.task_defined?("package"))
64
-
65
- Torba.expects(:pack).once
66
- Rake::Task["package"].invoke
67
- end
68
- end
69
- end