facterdb 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +13 -0
- data/README.md +10 -0
- data/bin/facterdb +5 -0
- data/lib/facterdb/bin.rb +14 -0
- data/lib/facterdb/version.rb +1 -1
- data/lib/facterdb.rb +10 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODY1NjM0YjhhNTVlMDE4OGRhNDQ2NDNmMmM4N2I3ZTAxNmU4YmVmYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODBiNDM0NDU2NjE2N2RkZGFmMzU1YThkMTY1ZGE1ZTM0MGRhYjdiYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTI4MWE2MWQ4ZWEyMzMyNzYwNWZjNWMzYjRlNDFiNjgzOTc4YTdjMDk5NGE5
|
10
|
+
N2Q0NDcwNGExMjQ3MDBlOGIxY2MxMzYwNjkzOTMxMmYxNjVhNzEwZGVkNGVj
|
11
|
+
YzJmNDVkYzgwYjBhZmYxZThkYzQzOGIwNTZjODdkOGU1OGNjYTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
M2RhMjdmZjNlMDc5YTYzN2RmZmE1NzYyZTNlNTRhYzk4YjAwNjRmYzFjMzVk
|
14
|
+
MmI5ODFkNTY1YzRlYzUwYWIwNzBlMmFkMzRmNzhkYjdlYmE5NTFjMTIyNGUz
|
15
|
+
NDBkZmQ0MTg3MDMzODM0YmQ4YTY2M2M2NGEzMjM4MTQwYWUwMGU=
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [0.2.0](https://rubygems.org/gems/facterdb/versions/0.2.0) (2015-08-31)
|
4
|
+
[Full Changelog](https://github.com/camptocamp/facterdb/compare/0.1.0...0.2.0)
|
5
|
+
|
6
|
+
**Implemented enhancements:**
|
7
|
+
|
8
|
+
- Add CLI [\#9](https://github.com/camptocamp/facterdb/issues/9)
|
9
|
+
- Allow Hash or String for filter [\#8](https://github.com/camptocamp/facterdb/issues/8)
|
10
|
+
|
11
|
+
**Fixed bugs:**
|
12
|
+
|
13
|
+
- Fix project homepage [\#10](https://github.com/camptocamp/facterdb/issues/10)
|
14
|
+
- Hash keys should be symbolized [\#11](https://github.com/camptocamp/facterdb/pull/11) ([mcanevet](https://github.com/mcanevet))
|
15
|
+
|
3
16
|
## [0.1.0](https://rubygems.org/gems/facterdb/versions/0.1.0) (2015-08-27)
|
4
17
|
[Full Changelog](https://github.com/camptocamp/facterdb/compare/0.0.1...0.1.0)
|
5
18
|
|
data/README.md
CHANGED
@@ -11,6 +11,16 @@ A Gem that contains a lot of facts for a lot of Operating Systems.
|
|
11
11
|
|
12
12
|
# Usage
|
13
13
|
|
14
|
+
## CLI
|
15
|
+
|
16
|
+
```shell
|
17
|
+
facterdb 'facterversion=/^2.4\./ and (operatingsystem=Debian and operatingsystemrelease>=7 or operatingsystem=RedHat and operatingsystemrelease=/^7/)'
|
18
|
+
```
|
19
|
+
|
20
|
+
Will return a JSON containing the facts for Debian 7, Debian 8 and RedHat 7 generated by Facter 2.4.
|
21
|
+
|
22
|
+
## Ruby
|
23
|
+
|
14
24
|
```ruby
|
15
25
|
require 'facterdb'
|
16
26
|
FacterDB::get_os_facts()
|
data/bin/facterdb
ADDED
data/lib/facterdb/bin.rb
ADDED
data/lib/facterdb/version.rb
CHANGED
data/lib/facterdb.rb
CHANGED
@@ -4,8 +4,17 @@ require 'jgrep'
|
|
4
4
|
module FacterDB
|
5
5
|
|
6
6
|
def self.get_os_facts(facter_version='*', filter=[])
|
7
|
+
if filter.is_a?(Array)
|
8
|
+
filter_str = filter.map { |f| f.map { |k,v | "#{k}=#{v}" }.join(' and ') }.join(' or ')
|
9
|
+
elsif filter.is_a?(Hash)
|
10
|
+
filter_str = filter.map { |k,v | "#{k}=#{v}" }.join(' and ')
|
11
|
+
elsif filter.is_a?(String)
|
12
|
+
filter_str = filter
|
13
|
+
else
|
14
|
+
raise 'filter must be either an Array a Hash or a String'
|
15
|
+
end
|
16
|
+
|
7
17
|
facts_dir = File.expand_path(File.join(File.dirname(__FILE__), '../facts'))
|
8
|
-
filter_str = filter.map { |f| f.map { |k,v | "#{k}=#{v}" }.join(' and ') }.join(' or ')
|
9
18
|
|
10
19
|
jsons = Dir.glob("#{facts_dir}/#{facter_version}/*.facts").map { |f| File.read(f) }
|
11
20
|
json = "[#{jsons.join(',')}]\n"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facterdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mickaël Canévet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coveralls
|
@@ -111,7 +111,8 @@ dependencies:
|
|
111
111
|
description: Contains facts from many Facter version on many Operating Systems
|
112
112
|
email:
|
113
113
|
- mickael.canevet@camptocamp.com
|
114
|
-
executables:
|
114
|
+
executables:
|
115
|
+
- facterdb
|
115
116
|
extensions: []
|
116
117
|
extra_rdoc_files: []
|
117
118
|
files:
|
@@ -122,6 +123,7 @@ files:
|
|
122
123
|
- LICENSE
|
123
124
|
- README.md
|
124
125
|
- Rakefile
|
126
|
+
- bin/facterdb
|
125
127
|
- facterdb.gemspec
|
126
128
|
- facts/1.6/archlinux-i386.facts
|
127
129
|
- facts/1.6/archlinux-x86_64.facts
|
@@ -557,6 +559,7 @@ files:
|
|
557
559
|
- facts/Vagrantfile
|
558
560
|
- facts/get_facts.sh
|
559
561
|
- lib/facterdb.rb
|
562
|
+
- lib/facterdb/bin.rb
|
560
563
|
- lib/facterdb/version.rb
|
561
564
|
- spec/facterdb_spec.rb
|
562
565
|
- spec/spec_helper.rb
|