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.
Files changed (45) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +0 -1
  3. data/.travis.yml +6 -2
  4. data/.yardopts +2 -0
  5. data/CHANGELOG.md +59 -0
  6. data/README.md +16 -78
  7. data/lib/torba.rb +15 -1
  8. data/lib/torba/cli.rb +45 -0
  9. data/lib/torba/css_url_to_erb_asset_path.rb +5 -1
  10. data/lib/torba/manifest.rb +11 -1
  11. data/lib/torba/package.rb +12 -8
  12. data/lib/torba/rake_task.rb +10 -3
  13. data/lib/torba/remote_sources/common.rb +1 -1
  14. data/lib/torba/remote_sources/targz.rb +1 -1
  15. data/lib/torba/ui.rb +13 -0
  16. data/lib/torba/verify.rb +4 -11
  17. data/test/acceptance-cli/open_test.rb +101 -0
  18. data/test/acceptance-cli/pack_test.rb +49 -0
  19. data/test/acceptance-cli/show_test.rb +61 -0
  20. data/test/acceptance-cli/verify_test.rb +25 -0
  21. data/test/css_url_to_erb_asset_path_test.rb +5 -0
  22. data/test/fixtures/home_path/01/trumbowyg/icons-2x.png +0 -0
  23. data/test/fixtures/home_path/01/trumbowyg/icons.png +0 -0
  24. data/test/fixtures/home_path/01/trumbowyg/trumbowyg.css.erb +471 -0
  25. data/test/fixtures/home_path/01/trumbowyg/trumbowyg.js +1124 -0
  26. data/test/fixtures/home_path/02/lo_dash/lodash.js +2793 -0
  27. data/test/fixtures/home_path/03/bourbon/_border-image.scss +59 -0
  28. data/test/fixtures/home_path/03/bourbon/_font-source-declaration.scss +43 -0
  29. data/test/fixtures/home_path/03/bourbon/_retina-image.scss +25 -0
  30. data/test/fixtures/torbafiles/01_gh_release.rb +8 -0
  31. data/test/fixtures/torbafiles/01_image_asset_not_specified.rb +7 -0
  32. data/test/fixtures/torbafiles/01_targz.rb +7 -0
  33. data/test/fixtures/torbafiles/01_zip.rb +7 -0
  34. data/test/fixtures/torbafiles/02_npm.rb +1 -0
  35. data/test/fixtures/torbafiles/03_not_existed_assets.rb +5 -0
  36. data/test/fixtures/torbafiles/04_similar_names.rb +2 -0
  37. data/test/manifest_test.rb +27 -0
  38. data/test/package_test.rb +10 -0
  39. data/test/rake_task_test.rb +13 -0
  40. data/test/test_helper.rb +55 -8
  41. data/test/torba_test.rb +13 -0
  42. data/torba.gemspec +5 -4
  43. metadata +73 -18
  44. data/lib/torba/rails.rb +0 -13
  45. 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
@@ -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