torba 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74c50af6fd600841ed420a3ffe0df1b6b471d97f
4
- data.tar.gz: 976c74cdce2db8e851ae2e7c439bdc2ce7827b91
3
+ metadata.gz: 75e1e95a66cde782c37ba9ccf8d2f721d803b794
4
+ data.tar.gz: a15d3348dcd9f0fbd6b3fa8c5776f5321f101729
5
5
  SHA512:
6
- metadata.gz: a4c5a9cad8a21318f7dc823937bd046aec8cde1735831620580240b9b87d3c1dec258a009fe499e0bd639dfd43c89ccd1a1bf039c3550ed10dc19572617957a2
7
- data.tar.gz: 73718d27fe6bf5ce7e204926397c76b40fa16487dc689554e93d2adb2838dce0fc4182f5b08fea2be211f9f0253dc6cc8a95691cc52257e507db996c9c01a5d6
6
+ metadata.gz: 5e206200cdcd65c93721a5dd71dbc9a2fa14186157de91d848017d567823e18a7e9c98a2800315ee169553995def7c0bb6c72dd8038ddd766e2269306822fd91
7
+ data.tar.gz: eea4d450cdb3d0f8803373b518f1a1da51e0e3ed93723f3e3293fb786fc77f15dea8c4d5c62578254d2bd6ebbee76c4d634226ac1720eb459ab4f51d3b575386
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## Unreleased
2
2
 
3
+ ## Version 0.4.0
4
+
5
+ ### Enhancements
6
+
7
+ * The exception that gets raised during `torba verify` now list the missing
8
+ packages
9
+
3
10
  ## Version 0.3.1
4
11
 
5
12
  ### Bug fixes
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/0.3.0)
20
+ [Released version](http://rubydoc.info/gems/torba/0.4.0)
21
21
 
22
22
  ## Why
23
23
 
@@ -68,7 +68,7 @@ in boot.rb
68
68
  +require 'torba/verify'
69
69
  ```
70
70
 
71
- it config/application.rb
71
+ in config/application.rb
72
72
 
73
73
  ```diff
74
74
  # Require the gems listed in Gemfile, including any gems
@@ -105,13 +105,13 @@ Allows to download and unpack asset package from any source accessible by curl.
105
105
 
106
106
  The syntax is:
107
107
 
108
- ```
108
+ ```ruby
109
109
  zip "name", url: "..." [, import: %w(...)]
110
110
  ```
111
111
 
112
112
  where "name" is an arbitrary name for the package, more on "import" below. For example,
113
113
 
114
- ```
114
+ ```ruby
115
115
  zip "scroll_magic", url: "https://github.com/janpaepke/ScrollMagic/archive/v2.0.0.zip"
116
116
  ```
117
117
 
@@ -119,13 +119,13 @@ zip "scroll_magic", url: "https://github.com/janpaepke/ScrollMagic/archive/v2.0.
119
119
 
120
120
  The syntax is same as for a zip package:
121
121
 
122
- ```
122
+ ```ruby
123
123
  targz "name", url: "..." [, import: %w(...)]
124
124
  ```
125
125
 
126
126
  for example,
127
127
 
128
- ```
128
+ ```ruby
129
129
  targz "scroll_magic", url: "https://github.com/janpaepke/ScrollMagic/archive/v2.0.0.tar.gz"
130
130
  ```
131
131
 
@@ -135,20 +135,20 @@ This is a more readable version/shortcut for "https://github.com/.../archive/...
135
135
 
136
136
  The syntax is:
137
137
 
138
- ```
138
+ ```ruby
139
139
  gh_release "name", source: "...", tag: "..." [, import: %w(...)]
140
140
  ```
141
141
 
142
142
  where "source" is the user + repository and "tag" is the repository tag (exactly as on Github,
143
143
  i.e. with "v" prefix if present), more on "import" below. For example,
144
144
 
145
- ```
145
+ ```ruby
146
146
  gh_release "scroll_magic", source: "janpaepke/ScrollMagic", tag: "v.2.0.0"
147
147
  ```
148
148
 
149
149
  You can omit the name, it will be equal to the repository name:
150
150
 
151
- ```
151
+ ```ruby
152
152
  gh_release source: "janpaepke/ScrollMagic", tag: "v.2.0.0" # "ScrollMagic" is assumed
153
153
  ```
154
154
 
@@ -158,20 +158,20 @@ Allows to download packages from npm registry.
158
158
 
159
159
  The syntax is:
160
160
 
161
- ```
161
+ ```ruby
162
162
  npm "name", package: "...", version: "..." [, import: %w(...)]
163
163
  ```
164
164
 
165
165
  where "package" is the package name as published on npm registry and "version" is its version,
166
166
  more on "import" below. For example,
167
167
 
168
- ```
168
+ ```ruby
169
169
  npm "coffee", package: "coffee-script", version: "1.9.2"
170
170
  ```
171
171
 
172
172
  You can omit the name, it will be equal to the package name:
173
173
 
174
- ```
174
+ ```ruby
175
175
  npm package: "coffee-script", version: "1.9.2"
176
176
  ```
177
177
 
@@ -220,7 +220,7 @@ to mention it:
220
220
 
221
221
  To mitigate this you can cherry-pick files from the source via the "import" option, for example:
222
222
 
223
- ```
223
+ ```ruby
224
224
  gh_release "lightslider", source: "sachinchoolur/lightslider", tag: "1.1.2", import: %w[
225
225
  dist/css/lightslider.css
226
226
  ]
@@ -235,7 +235,7 @@ can omit unnecessary paths:
235
235
 
236
236
  You can use any Dir.glob pattern:
237
237
 
238
- ```
238
+ ```ruby
239
239
  gh_release "lightslider", source: "sachinchoolur/lightslider", tag: "1.1.2", import: %w[
240
240
  dist/css/lightslider.css
241
241
  dist/img/*.png
data/lib/torba.rb CHANGED
@@ -73,8 +73,12 @@ module Torba
73
73
  # @yield a block, converts common exceptions into useful messages
74
74
  def self.pretty_errors
75
75
  yield
76
- rescue Errors::UnbuiltPackage
76
+ rescue Errors::MissingPackages => e
77
77
  ui.error "Your Torba is not packed yet."
78
+ ui.error "Missing packages:"
79
+ e.packages.each do |package|
80
+ ui.error " * #{package.name}"
81
+ end
78
82
  ui.suggest "Run `bundle exec torba pack` to install missing packages."
79
83
  exit(false)
80
84
  rescue Errors::ShellCommandFailed => e
@@ -5,6 +5,16 @@ require "torba/remote_sources/targz"
5
5
  require "torba/remote_sources/npm"
6
6
 
7
7
  module Torba
8
+ module Errors
9
+ class MissingPackages < StandardError
10
+ attr_reader :packages
11
+
12
+ def initialize(packages)
13
+ @packages = packages
14
+ super
15
+ end
16
+ end
17
+ end
8
18
  # Represents Torbafile.
9
19
  class Manifest
10
20
  # all packages defined in Torbafile
@@ -102,8 +112,13 @@ module Torba
102
112
 
103
113
  # Verifies all {#packages}
104
114
  # @return [void]
115
+ # @raise [Errors::MissingPackages] if at least one package is not build.
105
116
  def verify
106
- packages.each(&:verify)
117
+ missing = packages.reject(&:verify)
118
+
119
+ if missing.any?
120
+ raise Errors::MissingPackages.new(missing)
121
+ end
107
122
  end
108
123
  end
109
124
  end
data/lib/torba/package.rb CHANGED
@@ -5,8 +5,6 @@ require "torba/import_list"
5
5
 
6
6
  module Torba
7
7
  module Errors
8
- UnbuiltPackage = Class.new(StandardError)
9
-
10
8
  class NothingToImport < StandardError
11
9
  attr_reader :package, :path
12
10
 
@@ -58,9 +56,9 @@ module Torba
58
56
  end
59
57
  end
60
58
 
61
- # @raise [Errors::UnbuiltPackage] if package is not build.
59
+ # @return [false] if package is not build.
62
60
  def verify
63
- raise Errors::UnbuiltPackage.new(name) unless built?
61
+ built?
64
62
  end
65
63
 
66
64
  # Cache remote source and import specified assets to {#load_path}.
@@ -102,5 +102,14 @@ module Torba
102
102
  end
103
103
  end
104
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
105
114
  end
106
115
  end
data/torba.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "torba"
3
- spec.version = "0.3.1"
3
+ spec.version = "0.4.0"
4
4
  spec.authors = ["Andrii Malyshko"]
5
5
  spec.email = ["mail@nashbridges.me"]
6
6
  spec.description = "Bundler for Sprockets"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrii Malyshko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-02 00:00:00.000000000 Z
11
+ date: 2015-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor