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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +14 -14
- data/lib/torba.rb +5 -1
- data/lib/torba/manifest.rb +16 -1
- data/lib/torba/package.rb +2 -4
- data/test/manifest_test.rb +9 -0
- data/torba.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75e1e95a66cde782c37ba9ccf8d2f721d803b794
|
4
|
+
data.tar.gz: a15d3348dcd9f0fbd6b3fa8c5776f5321f101729
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e206200cdcd65c93721a5dd71dbc9a2fa14186157de91d848017d567823e18a7e9c98a2800315ee169553995def7c0bb6c72dd8038ddd766e2269306822fd91
|
7
|
+
data.tar.gz: eea4d450cdb3d0f8803373b518f1a1da51e0e3ed93723f3e3293fb786fc77f15dea8c4d5c62578254d2bd6ebbee76c4d634226ac1720eb459ab4f51d3b575386
|
data/CHANGELOG.md
CHANGED
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.
|
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
|
-
|
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::
|
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
|
data/lib/torba/manifest.rb
CHANGED
@@ -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.
|
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
|
-
# @
|
59
|
+
# @return [false] if package is not build.
|
62
60
|
def verify
|
63
|
-
|
61
|
+
built?
|
64
62
|
end
|
65
63
|
|
66
64
|
# Cache remote source and import specified assets to {#load_path}.
|
data/test/manifest_test.rb
CHANGED
@@ -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
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.
|
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-
|
11
|
+
date: 2015-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|