torba 0.5.1 → 1.1.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 +5 -5
- data/.gitignore +0 -1
- data/.travis.yml +6 -2
- data/.yardopts +2 -0
- data/CHANGELOG.md +59 -0
- data/README.md +16 -78
- data/lib/torba.rb +15 -1
- data/lib/torba/cli.rb +45 -0
- data/lib/torba/css_url_to_erb_asset_path.rb +5 -1
- data/lib/torba/manifest.rb +11 -1
- data/lib/torba/package.rb +12 -8
- data/lib/torba/rake_task.rb +10 -3
- data/lib/torba/remote_sources/common.rb +1 -1
- data/lib/torba/remote_sources/targz.rb +1 -1
- data/lib/torba/ui.rb +13 -0
- data/lib/torba/verify.rb +4 -11
- data/test/acceptance-cli/open_test.rb +101 -0
- data/test/acceptance-cli/pack_test.rb +49 -0
- data/test/acceptance-cli/show_test.rb +61 -0
- data/test/acceptance-cli/verify_test.rb +25 -0
- data/test/css_url_to_erb_asset_path_test.rb +5 -0
- 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 +471 -0
- data/test/fixtures/home_path/01/trumbowyg/trumbowyg.js +1124 -0
- data/test/fixtures/home_path/02/lo_dash/lodash.js +2793 -0
- data/test/fixtures/home_path/03/bourbon/_border-image.scss +59 -0
- data/test/fixtures/home_path/03/bourbon/_font-source-declaration.scss +43 -0
- data/test/fixtures/home_path/03/bourbon/_retina-image.scss +25 -0
- data/test/fixtures/torbafiles/01_gh_release.rb +8 -0
- data/test/fixtures/torbafiles/01_image_asset_not_specified.rb +7 -0
- data/test/fixtures/torbafiles/01_targz.rb +7 -0
- data/test/fixtures/torbafiles/01_zip.rb +7 -0
- data/test/fixtures/torbafiles/02_npm.rb +1 -0
- data/test/fixtures/torbafiles/03_not_existed_assets.rb +5 -0
- data/test/fixtures/torbafiles/04_similar_names.rb +2 -0
- data/test/manifest_test.rb +27 -0
- data/test/package_test.rb +10 -0
- data/test/rake_task_test.rb +13 -0
- data/test/test_helper.rb +55 -8
- data/test/torba_test.rb +13 -0
- data/torba.gemspec +5 -4
- metadata +73 -18
- data/lib/torba/rails.rb +0 -13
- data/test/acceptance_test.rb +0 -87
data/lib/torba/rails.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
module Torba
|
2
|
-
class Engine < Rails::Engine
|
3
|
-
initializer "torba.assets" do |app|
|
4
|
-
Rails.application.config.assets.paths.concat(Torba.load_path)
|
5
|
-
Rails.application.config.assets.precompile.concat(Torba.non_js_css_logical_paths)
|
6
|
-
end
|
7
|
-
|
8
|
-
rake_tasks do
|
9
|
-
require "torba/rake_task"
|
10
|
-
Torba::RakeTask.new("torba:pack", :before => "assets:precompile")
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
data/test/acceptance_test.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module Torba
|
4
|
-
class AcceptanceTest < Minitest::Test
|
5
|
-
def manifest
|
6
|
-
@manifest ||= Manifest.build("test/Torbafile")
|
7
|
-
end
|
8
|
-
|
9
|
-
def find_path(file_path)
|
10
|
-
manifest.load_path.map{ |lp| File.join(lp, file_path) }.find{ |full_path| File.exists?(full_path) }
|
11
|
-
end
|
12
|
-
|
13
|
-
def assert_exists(file_path)
|
14
|
-
assert find_path(file_path), "'#{file_path}' should exist"
|
15
|
-
end
|
16
|
-
|
17
|
-
def refute_exists(file_path)
|
18
|
-
refute find_path(file_path), "'#{file_path}' should not exist"
|
19
|
-
end
|
20
|
-
|
21
|
-
def read_path(file_path)
|
22
|
-
File.read(find_path(file_path))
|
23
|
-
end
|
24
|
-
|
25
|
-
def pack_torbafile(content)
|
26
|
-
File.write("test/Torbafile", content)
|
27
|
-
manifest.pack
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_zip
|
31
|
-
pack_torbafile <<-TORBA
|
32
|
-
zip "trumbowyg-from-zip",
|
33
|
-
url: "https://github.com/torba-rb/Trumbowyg/archive/1.1.6.zip",
|
34
|
-
import: ["dist/trumbowyg.js"]
|
35
|
-
TORBA
|
36
|
-
|
37
|
-
assert_exists "trumbowyg-from-zip/trumbowyg.js"
|
38
|
-
refute_exists "trumbowyg-from-zip/trumbowyg.css.erb"
|
39
|
-
refute_exists "trumbowyg-from-zip/icons.png"
|
40
|
-
refute_exists "trumbowyg-from-zip/icons-2x.png"
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_gh_release
|
44
|
-
pack_torbafile <<-TORBA
|
45
|
-
gh_release "trumbowyg", source: "torba-rb/Trumbowyg", tag: "1.1.7", import: %w[
|
46
|
-
dist/trumbowyg.js
|
47
|
-
dist/ui/*.css
|
48
|
-
dist/ui/images/
|
49
|
-
]
|
50
|
-
TORBA
|
51
|
-
|
52
|
-
assert_exists "trumbowyg/trumbowyg.js"
|
53
|
-
assert_exists "trumbowyg/trumbowyg.css.erb"
|
54
|
-
assert_exists "trumbowyg/icons.png"
|
55
|
-
assert_exists "trumbowyg/icons-2x.png"
|
56
|
-
|
57
|
-
css = read_path "trumbowyg/trumbowyg.css.erb"
|
58
|
-
assert_includes css, %[background: transparent url("<%= asset_path('trumbowyg/icons.png') %>") no-repeat;]
|
59
|
-
assert_includes css, %[background-image: url("<%= asset_path('trumbowyg/icons-2x.png') %>")]
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_targz
|
63
|
-
pack_torbafile <<-TORBA
|
64
|
-
targz "trumbowyg-from-tar",
|
65
|
-
url: "https://github.com/torba-rb/Trumbowyg/archive/1.1.7.tar.gz",
|
66
|
-
import: ["dist/ui/"]
|
67
|
-
TORBA
|
68
|
-
|
69
|
-
refute_exists "trumbowyg-from-tar/trumbowyg.js"
|
70
|
-
assert_exists "trumbowyg-from-tar/trumbowyg.css.erb"
|
71
|
-
assert_exists "trumbowyg-from-tar/images/icons.png"
|
72
|
-
assert_exists "trumbowyg-from-tar/images/icons-2x.png"
|
73
|
-
|
74
|
-
css = read_path "trumbowyg-from-tar/trumbowyg.css.erb"
|
75
|
-
assert_includes css, %[background: transparent url("<%= asset_path('trumbowyg-from-tar/images/icons.png') %>") no-repeat;]
|
76
|
-
assert_includes css, %[background-image: url("<%= asset_path('trumbowyg-from-tar/images/icons-2x.png') %>")]
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_npm
|
80
|
-
pack_torbafile <<-TORBA
|
81
|
-
npm "lo_dash", package: "lodash", version: "0.1.0", import: ["lodash.js"]
|
82
|
-
TORBA
|
83
|
-
|
84
|
-
assert_exists "lo_dash/lodash.js"
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|