inventory 1.5.2 → 1.5.3
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 +4 -4
- data/README +3 -3
- data/lib/inventory-1.0.rb +8 -5
- data/lib/inventory-1.0/author.rb +2 -2
- data/lib/inventory-1.0/extension.rb +1 -1
- data/lib/inventory-1.0/version.rb +2 -2
- metadata +89 -89
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75fad515b8fa98b3b72f1da68b76810c1edb2948
|
4
|
+
data.tar.gz: 02f9ab6cf322c11c73c91b2c906b6cd1cd793ae5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 198a24f73497b6a3eb452802532dcc171b3d397aec0ece265283bd414713562a2b6c28a31c95fa30bb3f96b2baeaaa0d88d2f41483f7d545d12a19a78d247eb3
|
7
|
+
data.tar.gz: 7618e645686cd37ebcf46d164ff22b2fb2f1e192fb4504000e89d6d62cebb9155b882b038cbff39128262a29e42544a8fa6b13cec70af805d5c136ed4b97c99d
|
data/README
CHANGED
@@ -187,16 +187,16 @@
|
|
187
187
|
|
188
188
|
¹ Ruby project structure: http://guides.rubygems.org/make-your-own-gem/
|
189
189
|
² Semantic versioning: http://semver.org/
|
190
|
-
³ Inventory-Rake: http://disu.se/software/inventory-rake/
|
190
|
+
³ Inventory-Rake: http://disu.se/software/inventory-rake-1.0/
|
191
191
|
⁴ Travis: http://travis-ci.org/
|
192
|
-
⁵ Lookout-Rake: http://disu.se/software/lookout-rake/
|
192
|
+
⁵ Lookout-Rake: http://disu.se/software/lookout-rake-3.0/
|
193
193
|
|
194
194
|
§ API
|
195
195
|
|
196
196
|
If the guide above doesn’t provide you with all the answers you seek, you
|
197
197
|
may refer to the API¹ for more answers.
|
198
198
|
|
199
|
-
¹ See http://disu.se/software/inventory/api/Inventory/
|
199
|
+
¹ See http://disu.se/software/inventory-1.0/api/Inventory/
|
200
200
|
|
201
201
|
§ Financing
|
202
202
|
|
data/lib/inventory-1.0.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
# An Inventory keeps track of your Ruby project’s {Inventory#to_s version} and
|
4
4
|
# its {Inventory#to_a content}. It also allows you to {#load} your project’s
|
5
5
|
# source files in a simple manner and track its {#dependencies}. Add-ons, such
|
6
|
-
# as [Inventory-Rake](http://disu.se/software/inventory-rake/) and
|
7
|
-
# [Inventory-Rake-Tasks-YARD](http://disu.se/software/inventory-rake-tasks-yard),
|
6
|
+
# as [Inventory-Rake](http://disu.se/software/inventory-rake-1.0/) and
|
7
|
+
# [Inventory-Rake-Tasks-YARD](http://disu.se/software/inventory-rake-tasks-yard-1.0/),
|
8
8
|
# can also use this information to great effect.
|
9
9
|
#
|
10
10
|
# The basic usage pattern is to set your project’s Version constant to an
|
@@ -121,7 +121,8 @@ class Inventory
|
|
121
121
|
# @raise [RuntimeError] If no block has been given and no authors have previously been set
|
122
122
|
def authors
|
123
123
|
@authors = Authors.new(&Proc.new) if block_given?
|
124
|
-
raise 'no authors defined in inventory of %s' % self if
|
124
|
+
raise 'no authors defined in inventory of %s %s' % [package, self] if
|
125
|
+
not defined? @authors or @authors.count == 0
|
125
126
|
@authors
|
126
127
|
end
|
127
128
|
|
@@ -133,7 +134,8 @@ class Inventory
|
|
133
134
|
# set
|
134
135
|
def homepage(value = nil)
|
135
136
|
return @homepage = value if value
|
136
|
-
raise 'no homepage set in inventory of %s' % self if
|
137
|
+
raise 'no homepage set in inventory of %s %s' % [package, self] if
|
138
|
+
not defined? @homepage
|
137
139
|
@homepage
|
138
140
|
end
|
139
141
|
|
@@ -147,7 +149,8 @@ class Inventory
|
|
147
149
|
# previously been set
|
148
150
|
def licenses
|
149
151
|
@licenses = Licenses.new(&Proc.new) if block_given?
|
150
|
-
raise 'no licenses defined in inventory of %s' % self if
|
152
|
+
raise 'no licenses defined in inventory of %s %s' % [package, self] if
|
153
|
+
not defined? @licenses or @licenses.count == 0
|
151
154
|
@licenses
|
152
155
|
end
|
153
156
|
|
data/lib/inventory-1.0/author.rb
CHANGED
@@ -10,8 +10,8 @@ class Inventory::Author
|
|
10
10
|
@name, @email = name, email
|
11
11
|
end
|
12
12
|
|
13
|
-
# @return [String] The {#name} and {#email} of the author on the
|
14
|
-
# <email
|
13
|
+
# @return [String] The {#name} and {#email} of the author on the
|
14
|
+
# “`name <email>`” format
|
15
15
|
def to_s
|
16
16
|
'%s <%s>' % [name, email]
|
17
17
|
end
|
@@ -7,7 +7,7 @@
|
|
7
7
|
#
|
8
8
|
# For an inventory, an extension is a set of files that should be included in
|
9
9
|
# the project and can contain multiple extensions.
|
10
|
-
# [Inventory-Rake](http://disu.se/software/inventory-rake/) uses information
|
10
|
+
# [Inventory-Rake](http://disu.se/software/inventory-rake-1.0/) uses information
|
11
11
|
# found in these extensions to compile them for use from Ruby code.
|
12
12
|
class Inventory::Extension
|
13
13
|
# Creates an extension named NAME. A block may be given that’ll be
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
class Inventory
|
4
|
-
Version = Inventory.new(1, 5,
|
4
|
+
Version = Inventory.new(1, 5, 3){
|
5
5
|
def authors
|
6
6
|
Authors.new{
|
7
7
|
author 'Nikolai Weibull', 'now@disu.se'
|
@@ -9,7 +9,7 @@ class Inventory
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def homepage
|
12
|
-
'http://disu.se/software/inventory/'
|
12
|
+
'http://disu.se/software/inventory-1.0/'
|
13
13
|
end
|
14
14
|
|
15
15
|
def licenses
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inventory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikolai Weibull
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inventory-rake
|
@@ -97,45 +97,45 @@ dependencies:
|
|
97
97
|
description: |2
|
98
98
|
Inventory
|
99
99
|
|
100
|
-
Inventory keeps track of the contents of your Ruby
|
100
|
+
Inventory keeps track of the contents of your Ruby¹ projects. Such an
|
101
101
|
inventory can be used to load the project, create gem specifications and
|
102
|
-
gems, run unit tests, compile extensions, and verify that the project
|
102
|
+
gems, run unit tests, compile extensions, and verify that the project’s
|
103
103
|
content is what you think it is.
|
104
104
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
Let
|
110
|
-
to use. It
|
111
|
-
structure
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
Here you see a simplified version of a project called
|
105
|
+
¹ See http://ruby-lang.org/
|
106
|
+
|
107
|
+
§ Usage
|
108
|
+
|
109
|
+
Let’s begin by discussing the project structure that Inventory expects you
|
110
|
+
to use. It’s pretty much exactly the same as the standard Ruby project
|
111
|
+
structure¹:
|
112
|
+
|
113
|
+
├── README
|
114
|
+
├── Rakefile
|
115
|
+
├── lib
|
116
|
+
│ ├── foo-1.0
|
117
|
+
│ │ ├── bar.rb
|
118
|
+
│ │ └── version.rb
|
119
|
+
│ └── foo-1.0.rb
|
120
|
+
└── test
|
121
|
+
└── unit
|
122
|
+
├── foo-1.0
|
123
|
+
│ ├── bar.rb
|
124
|
+
│ └── version.rb
|
125
|
+
└── foo-1.0.rb
|
126
|
+
|
127
|
+
Here you see a simplified version of a project called “Foo”’s project
|
128
128
|
structure. The only real difference from the standard is that the main
|
129
|
-
entry point into the library is named
|
130
|
-
that the root sub-directory of
|
131
|
-
of
|
132
|
-
be the major version of the project followed by a constant
|
129
|
+
entry point into the library is named “foo-1.0.rb” instead of “foo.rb” and
|
130
|
+
that the root sub-directory of “lib” is similarly named “foo-1.0” instead
|
131
|
+
of “foo”. The difference is the inclusion of the API version. This must
|
132
|
+
be the major version of the project followed by a constant “.0”. The
|
133
133
|
reason for this is that it allows concurrent installations of different
|
134
134
|
major versions of the project and means that the wrong version will never
|
135
135
|
accidentally be loaded with require.
|
136
136
|
|
137
|
-
There
|
138
|
-
|
137
|
+
There’s a bigger difference in the content of the files.
|
138
|
+
‹Lib/foo-1.0/version.rb› will contain our inventory instead of a String:
|
139
139
|
|
140
140
|
require 'inventory-1.0'
|
141
141
|
|
@@ -167,33 +167,33 @@ description: |2
|
|
167
167
|
}
|
168
168
|
end
|
169
169
|
|
170
|
-
We
|
171
|
-
greater detail, but we begin by setting the
|
170
|
+
We’re introducing quite a few concepts at once, and we’ll look into each in
|
171
|
+
greater detail, but we begin by setting the ‹Version› constant to a new
|
172
172
|
instance of an Inventory with major, minor, and patch version atoms 1, 4,
|
173
173
|
and 0. Then we add a couple of dependencies and list the library files
|
174
174
|
that are included in this project.
|
175
175
|
|
176
|
-
The version numbers shouldn
|
177
|
-
of the API that we
|
178
|
-
allow the Inventory#to_s method to act as if you
|
179
|
-
|
176
|
+
The version numbers shouldn’t come as a surprise. These track the version
|
177
|
+
of the API that we’re shipping using {semantic versioning}². They also
|
178
|
+
allow the Inventory#to_s method to act as if you’d defined Version as
|
179
|
+
‹'1.4.0'›.
|
180
180
|
|
181
|
-
Next follows information about the authors of the project, the project
|
182
|
-
homepage, and the project
|
181
|
+
Next follows information about the authors of the project, the project’s
|
182
|
+
homepage, and the project’s licenses. Each author has a name and an email
|
183
183
|
address. The homepage is simply a string URL. Licenses have an
|
184
184
|
abbreviation, a name, and a URL where the license text can be found.
|
185
185
|
|
186
|
-
We then extend the definition of
|
187
|
-
dependencies to
|
188
|
-
the inventory project that
|
186
|
+
We then extend the definition of ‹dependencies› by adding another set of
|
187
|
+
dependencies to ‹super›. ‹Super› includes a dependency on the version of
|
188
|
+
the inventory project that’s being used with this project, so you’ll never
|
189
189
|
have to list that yourself. The other three dependencies are all of
|
190
190
|
different kinds: development, runtime, and optional. A development
|
191
|
-
dependency is one that
|
191
|
+
dependency is one that’s required while developing the project, for
|
192
192
|
example, a unit-testing framework, a documentation generator, and so on.
|
193
193
|
Runtime dependencies are requirements of the project to be able to run,
|
194
194
|
both during development and when installed. Finally, optional dependencies
|
195
195
|
are runtime dependencies that may or may not be required during execution.
|
196
|
-
The difference between runtime and optional is that the inventory won
|
196
|
+
The difference between runtime and optional is that the inventory won’t try
|
197
197
|
to automatically load an optional dependency, instead leaving that up to
|
198
198
|
you to do when and if it becomes necessary. By that logic, runtime
|
199
199
|
dependencies will be automatically loaded, which is a good reason for
|
@@ -205,38 +205,38 @@ description: |2
|
|
205
205
|
|
206
206
|
As mentioned, runtime dependencies will be automatically loaded and the
|
207
207
|
feature they try to load is based on the name of the dependency with a
|
208
|
-
|
209
|
-
Sometimes, this isn
|
208
|
+
“-X.0” tacked on the end, where ‘X’ is the major version of the dependency.
|
209
|
+
Sometimes, this isn’t correct, in which case the :feature option may be
|
210
210
|
given to specify the name of the feature.
|
211
211
|
|
212
212
|
You may also override other parts of a dependency by passing in a block to
|
213
|
-
the dependency, much like we
|
213
|
+
the dependency, much like we’re doing for inventories.
|
214
214
|
|
215
215
|
The rest of an inventory will list the various files included in the
|
216
216
|
project. This project only consists of one additional file to those that
|
217
217
|
an inventory automatically include (Rakefile, README, the main entry point,
|
218
218
|
and the version.rb file that defines the inventory itself), namely the
|
219
|
-
library file
|
220
|
-
main entry point file loads the inventory. Library files that shouldn
|
221
|
-
loaded may be listed under a different heading, namely
|
219
|
+
library file ‹bar.rb›. Library files will be loaded automatically when the
|
220
|
+
main entry point file loads the inventory. Library files that shouldn’t be
|
221
|
+
loaded may be listed under a different heading, namely “additional_libs”.
|
222
222
|
Both these sets of files will be used to generate a list of unit test files
|
223
223
|
automatically, so each library file will have a corresponding unit test
|
224
|
-
file in the inventory. We
|
224
|
+
file in the inventory. We’ll discuss the different headings of an
|
225
225
|
inventory in more detail later on.
|
226
226
|
|
227
|
-
Now that we
|
227
|
+
Now that we’ve written our inventory, let’s set it up so that it’s content
|
228
228
|
gets loaded when our main entry point gets loaded. We add the following
|
229
|
-
piece of code to
|
229
|
+
piece of code to ‹lib/foo-1.0.rb›:
|
230
230
|
|
231
231
|
module Foo
|
232
232
|
load File.expand_path('../foo-1.0/version.rb', __FILE__)
|
233
233
|
Version.load
|
234
234
|
end
|
235
235
|
|
236
|
-
That
|
236
|
+
That’s all there’s to it.
|
237
237
|
|
238
238
|
The inventory can also be used to great effect from a Rakefile using a
|
239
|
-
separate project called Inventory-Rake
|
239
|
+
separate project called Inventory-Rake³. Using it’ll give us tasks for
|
240
240
|
cleaning up our project, compiling extensions, installing dependencies,
|
241
241
|
installing and uninstalling the project itself, and creating and pushing
|
242
242
|
distribution files to distribution points.
|
@@ -252,16 +252,16 @@ description: |2
|
|
252
252
|
Lookout::Rake::Tasks::Test.new
|
253
253
|
end
|
254
254
|
|
255
|
-
It
|
255
|
+
It’s ‹Inventory::Rake::Tasks.define› that does the heavy lifting. It takes
|
256
256
|
our inventory and sets up the tasks mentioned above.
|
257
257
|
|
258
258
|
As we want to be able to use our Rakefile to install our dependencies for
|
259
259
|
us, the rest of the Rakefile is inside the conditional
|
260
260
|
#unless_installing_dependencies, which, as the name certainly implies,
|
261
261
|
executes its block unless the task being run is the one that installs our
|
262
|
-
dependencies. This becomes relevant when we set up Travis
|
262
|
+
dependencies. This becomes relevant when we set up Travis⁴ integration
|
263
263
|
next. The only conditional set-up we do in our Rakefile is creating our
|
264
|
-
test task via Lookout-Rake
|
264
|
+
test task via Lookout-Rake⁵, which also uses our inventory to find the unit
|
265
265
|
tests to run when executed.
|
266
266
|
|
267
267
|
Travis integration is straightforward. Simply put
|
@@ -270,9 +270,9 @@ description: |2
|
|
270
270
|
- gem install inventory-rake -v '~> VERSION' --no-rdoc --no-ri
|
271
271
|
- rake gem:deps:install
|
272
272
|
|
273
|
-
in the project
|
274
|
-
of Inventory-Rake that you require. This
|
275
|
-
all development, runtime, and optional dependencies that you
|
273
|
+
in the project’s ‹.travis.yml› file, replacing ‹VERSION› with the version
|
274
|
+
of Inventory-Rake that you require. This’ll make sure that Travis installs
|
275
|
+
all development, runtime, and optional dependencies that you’ve listed in
|
276
276
|
your inventory before running any tests.
|
277
277
|
|
278
278
|
You might also need to put
|
@@ -280,22 +280,22 @@ description: |2
|
|
280
280
|
env:
|
281
281
|
- RUBYOPT=rubygems
|
282
282
|
|
283
|
-
in your
|
283
|
+
in your ‹.travis.yml› file, depending on how things are set up.
|
284
284
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
285
|
+
¹ Ruby project structure: http://guides.rubygems.org/make-your-own-gem/
|
286
|
+
² Semantic versioning: http://semver.org/
|
287
|
+
³ Inventory-Rake: http://disu.se/software/inventory-rake-1.0/
|
288
|
+
⁴ Travis: http://travis-ci.org/
|
289
|
+
⁵ Lookout-Rake: http://disu.se/software/lookout-rake-3.0/
|
290
290
|
|
291
|
-
|
291
|
+
§ API
|
292
292
|
|
293
|
-
If the guide above doesn
|
294
|
-
may refer to the API
|
293
|
+
If the guide above doesn’t provide you with all the answers you seek, you
|
294
|
+
may refer to the API¹ for more answers.
|
295
295
|
|
296
|
-
|
296
|
+
¹ See http://disu.se/software/inventory-1.0/api/Inventory/
|
297
297
|
|
298
|
-
|
298
|
+
§ Financing
|
299
299
|
|
300
300
|
Currently, most of my time is spent at my day job and in my rather busy
|
301
301
|
private life. Please motivate me to spend time on this piece of software
|
@@ -305,31 +305,31 @@ description: |2
|
|
305
305
|
to have other people give me the things that I need to continue living
|
306
306
|
under the rules of said society. So, if you feel that this piece of
|
307
307
|
software has helped you out enough to warrant a reward, please PayPal a
|
308
|
-
donation to now@disu.se
|
308
|
+
donation to now@disu.se¹. Thanks! Your support won’t go unnoticed!
|
309
309
|
|
310
|
-
|
310
|
+
¹ Send a donation:
|
311
311
|
https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=now@disu.se&item_name=Inventory
|
312
312
|
|
313
|
-
|
313
|
+
§ Reporting Bugs
|
314
314
|
|
315
|
-
Please report any bugs that you encounter to the {issue tracker}
|
315
|
+
Please report any bugs that you encounter to the {issue tracker}¹.
|
316
316
|
|
317
|
-
|
317
|
+
¹ See https://github.com/now/inventory/issues
|
318
318
|
|
319
|
-
|
319
|
+
§ Authors
|
320
320
|
|
321
321
|
Nikolai Weibull wrote the code, the tests, the documentation, and this
|
322
322
|
README.
|
323
323
|
|
324
|
-
|
324
|
+
§ Licensing
|
325
325
|
|
326
326
|
Inventory is free software: you may redistribute it and/or modify it under
|
327
|
-
the terms of the {GNU Lesser General Public License, version 3}
|
328
|
-
as published by the {Free Software Foundation}
|
327
|
+
the terms of the {GNU Lesser General Public License, version 3}¹ or later²,
|
328
|
+
as published by the {Free Software Foundation}³.
|
329
329
|
|
330
|
-
|
331
|
-
|
332
|
-
|
330
|
+
¹ See http://disu.se/licenses/lgpl-3.0/
|
331
|
+
² See http://gnu.org/licenses/
|
332
|
+
³ See http://fsf.org/
|
333
333
|
email:
|
334
334
|
- now@disu.se
|
335
335
|
executables: []
|
@@ -362,7 +362,7 @@ files:
|
|
362
362
|
- test/unit/inventory-1.0/version.rb
|
363
363
|
- README
|
364
364
|
- Rakefile
|
365
|
-
homepage: http://disu.se/software/inventory/
|
365
|
+
homepage: http://disu.se/software/inventory-1.0/
|
366
366
|
licenses:
|
367
367
|
- LGPLv3+
|
368
368
|
metadata: {}
|
@@ -382,8 +382,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
382
382
|
version: '0'
|
383
383
|
requirements: []
|
384
384
|
rubyforge_project:
|
385
|
-
rubygems_version: 2.0.
|
385
|
+
rubygems_version: 2.0.14
|
386
386
|
signing_key:
|
387
387
|
specification_version: 4
|
388
|
-
summary: Inventory keeps track of the contents of your Ruby
|
388
|
+
summary: Inventory keeps track of the contents of your Ruby¹ projects.
|
389
389
|
test_files: []
|