props 1.1.0 → 1.1.1
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.
- data/README.md +100 -2
- data/lib/props/db/models.rb +31 -1
- data/lib/props/version.rb +1 -1
- metadata +6 -6
data/README.md
CHANGED
@@ -8,9 +8,11 @@
|
|
8
8
|
|
9
9
|
## Usage
|
10
10
|
|
11
|
+
### Props
|
12
|
+
|
11
13
|
Example:
|
12
14
|
|
13
|
-
|
15
|
+
~~~
|
14
16
|
class Config
|
15
17
|
|
16
18
|
DEFAULTS = { 'libs' => [ 'kramdown' ],
|
@@ -59,7 +61,99 @@ class Config
|
|
59
61
|
...
|
60
62
|
|
61
63
|
end # class Config
|
62
|
-
|
64
|
+
~~~
|
65
|
+
|
66
|
+
|
67
|
+
### Environment
|
68
|
+
|
69
|
+
Example:
|
70
|
+
|
71
|
+
~~~
|
72
|
+
>> Env.home
|
73
|
+
# => '/home/gerald'
|
74
|
+
~~~
|
75
|
+
|
76
|
+
Backstage the `Env.home` code looks something like:
|
77
|
+
|
78
|
+
~~~
|
79
|
+
path = if( ENV['HOME'] || ENV['USERPROFILE'] )
|
80
|
+
ENV['HOME'] || ENV['USERPROFILE']
|
81
|
+
elsif( ENV['HOMEDRIVE'] && ENV['HOMEPATH'] )
|
82
|
+
"#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}"
|
83
|
+
else
|
84
|
+
begin
|
85
|
+
File.expand_path('~')
|
86
|
+
rescue
|
87
|
+
if File::ALT_SEPARATOR
|
88
|
+
'C:/'
|
89
|
+
else
|
90
|
+
'/'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
~~~
|
95
|
+
|
96
|
+
|
97
|
+
`Env.path` returns `ENV[ 'PATH' ]` - splits all path entries
|
98
|
+
w/ file separator (e.g. `;` or `:`) and returns string array
|
99
|
+
|
100
|
+
~~~
|
101
|
+
>> Env.path
|
102
|
+
# => ['/usr/local/sbin',
|
103
|
+
'/usr/local/bin',
|
104
|
+
'/usr/sbin',
|
105
|
+
...
|
106
|
+
]
|
107
|
+
~~~
|
108
|
+
|
109
|
+
|
110
|
+
### INI
|
111
|
+
|
112
|
+
Example:
|
113
|
+
|
114
|
+
~~~
|
115
|
+
config_path = './ruby.ini'
|
116
|
+
~~~
|
117
|
+
|
118
|
+
Opt 1) `INI.load` - load from string. Example:
|
119
|
+
|
120
|
+
~~~
|
121
|
+
text = File.read( config_path )
|
122
|
+
config = INI.load( text )
|
123
|
+
~~~
|
124
|
+
|
125
|
+
Opt 2) `INI.load_file` - load from file (shortcut). Example:
|
126
|
+
|
127
|
+
~~~
|
128
|
+
config = INI.load_file( config_path )
|
129
|
+
~~~
|
130
|
+
|
131
|
+
|
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
|
+
~~~
|
63
157
|
|
64
158
|
|
65
159
|
## Install
|
@@ -76,10 +170,14 @@ The [`slideshow`](http://slideshow-s9.github.io) gem (also known as Slide Show (
|
|
76
170
|
that lets you create slide shows
|
77
171
|
and author slides in plain text using a wiki-style markup language that's easy-to-write and easy-to-read.
|
78
172
|
|
173
|
+
The [`pluto`](http://feedreader.github.io) gem
|
174
|
+
that lets you auto-build web pages from web feeds.
|
175
|
+
|
79
176
|
The [`markdown`](https://github.com/rubylibs/markdown) gem that lets you use your markdown library
|
80
177
|
of choice.
|
81
178
|
|
82
179
|
|
180
|
+
|
83
181
|
## Alternatives
|
84
182
|
|
85
183
|
### Config / Settings
|
data/lib/props/db/models.rb
CHANGED
@@ -5,7 +5,37 @@ module ConfDb
|
|
5
5
|
|
6
6
|
|
7
7
|
class Prop < ActiveRecord::Base
|
8
|
-
|
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
|
+
|
9
39
|
end # class Prop
|
10
40
|
|
11
41
|
end # module Model
|
data/lib/props/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: props
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdoc
|
16
|
-
requirement: &
|
16
|
+
requirement: &69774410 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.10'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *69774410
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hoe
|
27
|
-
requirement: &
|
27
|
+
requirement: &69774110 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '3.3'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *69774110
|
36
36
|
description: props - Manage Settings Hierachies (Commandline, User, Home, Defaults,
|
37
37
|
etc.)
|
38
38
|
email: webslideshow@googlegroups.com
|