props 1.1.1 → 1.1.2
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 +7 -0
- data/Manifest.txt +0 -3
- data/README.md +0 -26
- data/Rakefile +1 -1
- data/lib/props.rb +1 -14
- data/lib/props/version.rb +22 -2
- data/test/helper.rb +0 -3
- data/test/test_ini.rb +2 -2
- metadata +28 -25
- data/lib/props/db.rb +0 -45
- data/lib/props/db/models.rb +0 -46
- data/lib/props/db/schema.rb +0 -23
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9c63a383991a49afc70efa89d982e2855eb99cfc
|
4
|
+
data.tar.gz: 716a1d2d01d3b8d2eb071883e2b2dbd1bbb64b3f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0565dc3e9df6e002ec7d92c4ae6f31421e150481123dc98acc0030cb19ab746cf529464d805090c06d38d27d64ddbc092e21f7e46494d3583b6a25d90638e524
|
7
|
+
data.tar.gz: 6ea4e12bc301929f8664f9b0ef703764c86cd53a3e6e045a6b7b7562a0359313b2fb2886235062b777a188147afe87eb98c266cf7e12d402dec13350552f9260
|
data/Manifest.txt
CHANGED
data/README.md
CHANGED
@@ -130,32 +130,6 @@ config = INI.load_file( config_path )
|
|
130
130
|
|
131
131
|
|
132
132
|
|
133
|
-
### DB - Config Database / Schema / Model
|
134
|
-
|
135
|
-
|
136
|
-
Example:
|
137
|
-
|
138
|
-
~~~
|
139
|
-
require 'props/db' # include database support
|
140
|
-
|
141
|
-
ConfDb.create # build schema / tables (props)
|
142
|
-
|
143
|
-
Prop.create!( key: 'db.schema.version', '1.0.0' )
|
144
|
-
|
145
|
-
puts "Props:"
|
146
|
-
Prop.order( 'created_at asc' ).all.each do |prop|
|
147
|
-
puts " #{prop.key} / #{prop.value} | #{prop.created_at}"
|
148
|
-
end
|
149
|
-
~~~
|
150
|
-
|
151
|
-
More examples:
|
152
|
-
|
153
|
-
~~~
|
154
|
-
ConfDb.tables # dump stats to console
|
155
|
-
ConfDb.delete! # delete all records
|
156
|
-
~~~
|
157
|
-
|
158
|
-
|
159
133
|
## Install
|
160
134
|
|
161
135
|
Just install the gem:
|
data/Rakefile
CHANGED
data/lib/props.rb
CHANGED
@@ -34,18 +34,5 @@ module INI
|
|
34
34
|
end # module INI
|
35
35
|
|
36
36
|
|
37
|
-
module ConfUtils
|
38
37
|
|
39
|
-
|
40
|
-
# todo: add RUBY_PATCHLEVEL or RUBY_PATCH_LEVEL??
|
41
|
-
"props/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.root
|
45
|
-
"#{File.expand_path( File.dirname(File.dirname(__FILE__)) )}"
|
46
|
-
end
|
47
|
-
|
48
|
-
end # module ConfUtils
|
49
|
-
|
50
|
-
|
51
|
-
puts ConfUtils.banner if $DEBUG # say hello
|
38
|
+
puts ConfUtils.banner if $DEBUG || (defined?($RUBYLIBS_DEBUG) && $RUBYLIBS_DEBUG) # say hello
|
data/lib/props/version.rb
CHANGED
@@ -1,4 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
|
2
3
|
module ConfUtils
|
3
|
-
|
4
|
-
|
4
|
+
|
5
|
+
MAJOR = 1 ## todo: namespace inside version or something - why? why not??
|
6
|
+
MINOR = 1
|
7
|
+
PATCH = 2
|
8
|
+
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
9
|
+
|
10
|
+
def self.version
|
11
|
+
VERSION
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.banner
|
15
|
+
# todo: add RUBY_PATCHLEVEL or RUBY_PATCH_LEVEL??
|
16
|
+
"confutils/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.root
|
20
|
+
"#{File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )}"
|
21
|
+
end
|
22
|
+
|
23
|
+
end # module ConfUtils
|
24
|
+
|
data/test/helper.rb
CHANGED
data/test/test_ini.rb
CHANGED
metadata
CHANGED
@@ -1,87 +1,90 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: props
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Gerald Bauer
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-03
|
11
|
+
date: 2014-12-03 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rdoc
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
19
|
+
version: '4.0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: hoe
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- - ~>
|
31
|
+
- - "~>"
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version: '3.
|
33
|
+
version: '3.13'
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.13'
|
36
41
|
description: props - Manage Settings Hierachies (Commandline, User, Home, Defaults,
|
37
42
|
etc.)
|
38
43
|
email: webslideshow@googlegroups.com
|
39
44
|
executables: []
|
40
45
|
extensions: []
|
41
46
|
extra_rdoc_files:
|
47
|
+
- HISTORY.md
|
42
48
|
- Manifest.txt
|
49
|
+
- README.md
|
43
50
|
files:
|
51
|
+
- ".gemtest"
|
44
52
|
- HISTORY.md
|
45
53
|
- Manifest.txt
|
46
54
|
- README.md
|
47
55
|
- Rakefile
|
48
56
|
- lib/props.rb
|
49
|
-
- lib/props/db.rb
|
50
|
-
- lib/props/db/models.rb
|
51
|
-
- lib/props/db/schema.rb
|
52
57
|
- lib/props/env.rb
|
53
58
|
- lib/props/ini.rb
|
54
59
|
- lib/props/props.rb
|
55
60
|
- lib/props/version.rb
|
56
61
|
- test/helper.rb
|
57
62
|
- test/test_ini.rb
|
58
|
-
- .gemtest
|
59
63
|
homepage: https://github.com/rubylibs/props
|
60
64
|
licenses:
|
61
65
|
- Public Domain
|
66
|
+
metadata: {}
|
62
67
|
post_install_message:
|
63
68
|
rdoc_options:
|
64
|
-
- --main
|
69
|
+
- "--main"
|
65
70
|
- README.md
|
66
71
|
require_paths:
|
67
72
|
- lib
|
68
73
|
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
74
|
requirements:
|
71
|
-
- -
|
75
|
+
- - ">="
|
72
76
|
- !ruby/object:Gem::Version
|
73
77
|
version: 1.9.2
|
74
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
79
|
requirements:
|
77
|
-
- -
|
80
|
+
- - ">="
|
78
81
|
- !ruby/object:Gem::Version
|
79
82
|
version: '0'
|
80
83
|
requirements: []
|
81
|
-
rubyforge_project:
|
82
|
-
rubygems_version:
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.4.2
|
83
86
|
signing_key:
|
84
|
-
specification_version:
|
87
|
+
specification_version: 4
|
85
88
|
summary: props - Manage Settings Hierachies (Commandline, User, Home, Defaults, etc.)
|
86
89
|
test_files:
|
87
90
|
- test/test_ini.rb
|
data/lib/props/db.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
#########################################
|
2
|
-
# NB: only load on demand
|
3
|
-
# we do NOT want to pull in activerecord gem/dep for simple scripts
|
4
|
-
|
5
|
-
# rubygems / 3rd party libs
|
6
|
-
|
7
|
-
require 'active_record' ## todo: add sqlite3? etc.
|
8
|
-
|
9
|
-
# our own code
|
10
|
-
|
11
|
-
require 'props/db/schema'
|
12
|
-
require 'props/db/models'
|
13
|
-
|
14
|
-
|
15
|
-
module ConfDb
|
16
|
-
|
17
|
-
def self.banner
|
18
|
-
# todo: add RUBY_PATCHLEVEL or RUBY_PATCH_LEVEL??
|
19
|
-
"confdb/#{ConfUtils::VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.create
|
23
|
-
CreateDb.new.up
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
# delete ALL records (use with care!)
|
28
|
-
def self.delete!
|
29
|
-
puts '*** deleting props table records/data...'
|
30
|
-
Model::Prop.delete_all
|
31
|
-
end # method delete!
|
32
|
-
|
33
|
-
## def self.stats ## remove ? -- duplicate - use tables - why?? why not????
|
34
|
-
## puts "#{Model::Prop} props"
|
35
|
-
## end
|
36
|
-
|
37
|
-
def self.tables
|
38
|
-
puts "#{Model::Prop} props"
|
39
|
-
end
|
40
|
-
|
41
|
-
end # module ConfDb
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
puts ConfDb.banner # say hello
|
data/lib/props/db/models.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module ConfDb
|
4
|
-
module Model
|
5
|
-
|
6
|
-
|
7
|
-
class Prop < ActiveRecord::Base
|
8
|
-
|
9
|
-
### todo/fix: move create_from_fixture! method to textutils ??? - why? why not?
|
10
|
-
## yes - move to textutils! - fixture concept/notion is part of textutils
|
11
|
-
|
12
|
-
def self.create_from_fixture!( name, path )
|
13
|
-
key = "db.#{fixture_name_to_prop_key(name)}.version"
|
14
|
-
|
15
|
-
value = "txt.#{File.mtime(path).strftime('%Y.%m.%d')}"
|
16
|
-
|
17
|
-
Prop.create!( key: key, value: value )
|
18
|
-
end
|
19
|
-
|
20
|
-
### todo:
|
21
|
-
## add latest scope -> order props by creation date desc!!!!
|
22
|
-
|
23
|
-
## add dump -> dump latest props to console via puts
|
24
|
-
## check - dump already taken by activerecord??
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
# helper
|
29
|
-
# change at/2012_13/bl to at.2012/13.bl
|
30
|
-
# or quali_2012_13_europe_c to quali.2012/13.europe.c
|
31
|
-
|
32
|
-
def self.fixture_name_to_prop_key( name )
|
33
|
-
prop_key = name.gsub( '/', '.' )
|
34
|
-
prop_key = prop_key.gsub( /(\d{4})_(\d{2})/, '\1/\2' ) # 2012_13 => 2012/13
|
35
|
-
prop_key = prop_key.gsub( '_', '.' )
|
36
|
-
prop_key
|
37
|
-
end
|
38
|
-
|
39
|
-
end # class Prop
|
40
|
-
|
41
|
-
end # module Model
|
42
|
-
|
43
|
-
##### add convenience module alias in plural e.g. lets you use include ConfDb::Models
|
44
|
-
Models = Model
|
45
|
-
|
46
|
-
end # module ConfDb
|
data/lib/props/db/schema.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
module ConfDb
|
2
|
-
|
3
|
-
|
4
|
-
class CreateDb < ActiveRecord::Migration
|
5
|
-
|
6
|
-
def up
|
7
|
-
|
8
|
-
create_table :props do |t|
|
9
|
-
t.string :key, null: false
|
10
|
-
t.string :value, null: false
|
11
|
-
t.string :kind # e.g. version|user|sys(tem)|db etc. # note: can NOT use type - already used by ActiveRecord
|
12
|
-
t.timestamps
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
def down
|
18
|
-
raise ActiveRecord::IrreversibleMigration
|
19
|
-
end
|
20
|
-
|
21
|
-
end # class CreateDb
|
22
|
-
|
23
|
-
end # module ConfDb
|