props 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ ### 0.1 / 2012-06-03
2
+
3
+ * Everything is new. First release
@@ -0,0 +1,5 @@
1
+ History.markdown
2
+ Manifest.txt
3
+ README.markdown
4
+ Rakefile
5
+ lib/props.rb
@@ -0,0 +1,33 @@
1
+ # `props` - Manage Settings
2
+
3
+ ## Description
4
+
5
+ TBD
6
+
7
+ ## Usage
8
+
9
+ TBD
10
+
11
+ ## Install
12
+
13
+ Just install the gem:
14
+
15
+ $ gem install props
16
+
17
+
18
+ ## Real World Usage
19
+
20
+ The [`slideshow`](http://slideshow.rubyforge.org) (also known as Slide Show (S9)) gem
21
+ that lets you create slide shows
22
+ and author slides in plain text using a wiki-style markup language that's easy-to-write and easy-to-read
23
+ ships with the `props` gem.
24
+
25
+
26
+ ## Alternatives
27
+
28
+ TBD
29
+
30
+ ## License
31
+
32
+ The `props` scripts are dedicated to the public domain.
33
+ Use it as you please with no restrictions whatsoever.
@@ -0,0 +1,20 @@
1
+ require 'hoe'
2
+ require './lib/props.rb'
3
+
4
+ Hoe.spec 'props' do
5
+
6
+ self.version = Props::VERSION
7
+
8
+ self.summary = 'props - Manage Settings'
9
+ self.description = summary
10
+
11
+ self.urls = ['http://geraldb.github.com/props']
12
+
13
+ self.author = 'Gerald Bauer'
14
+ self.email = 'webslideshow@googlegroups.com'
15
+
16
+ # switch extension to .markdown for gihub formatting
17
+ self.readme_file = 'README.markdown'
18
+ self.history_file = 'History.markdown'
19
+
20
+ end
@@ -0,0 +1,72 @@
1
+
2
+ # core and stlibs
3
+
4
+ require 'yaml'
5
+ require 'pp'
6
+ require 'logger'
7
+ require 'optparse'
8
+ require 'fileutils'
9
+
10
+
11
+
12
+ class Env
13
+
14
+ def self.home
15
+ path = if( ENV['HOME'] || ENV['USERPROFILE'] )
16
+ ENV['HOME'] || ENV['USERPROFILE']
17
+ elsif( ENV['HOMEDRIVE'] && ENV['HOMEPATH'] )
18
+ "#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}"
19
+ else
20
+ begin
21
+ File.expand_path('~')
22
+ rescue
23
+ if File::ALT_SEPARATOR
24
+ 'C:/'
25
+ else
26
+ '/'
27
+ end
28
+ end
29
+ end
30
+
31
+ puts "env home=>#{path}<"
32
+ path
33
+ end
34
+
35
+ end # class Env
36
+
37
+
38
+ class Props
39
+
40
+ VERSION = '0.1.0'
41
+
42
+ attr_reader :path
43
+ attr_reader :parent
44
+
45
+ def initialize( hash, path, parent=nil)
46
+ @hash = hash
47
+ @path = path
48
+ @parent = parent
49
+ end
50
+
51
+ def self.load_file( path, parent=nil )
52
+ h = YAML.load_file( path )
53
+ puts "dump of >#{path}<:"
54
+ pp h # todo: add debug flag (turn off for default)
55
+ Props.new( h, path, parent )
56
+ end
57
+
58
+ def [](key) get( key ); end
59
+
60
+ def fetch(key, default)
61
+ value = get( key )
62
+ value.nil? ? default : value
63
+ end
64
+
65
+ private
66
+ def get( key )
67
+ value = @hash[ key.to_s ]
68
+ # if not found try lookup in parent hash
69
+ (value.nil? && parent) ? parent[key] : value
70
+ end
71
+
72
+ end # class props
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: props
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Gerald Bauer
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-06-03 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rdoc
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 19
29
+ segments:
30
+ - 3
31
+ - 10
32
+ version: "3.10"
33
+ type: :development
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: hoe
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ hash: 7
44
+ segments:
45
+ - 3
46
+ - 0
47
+ version: "3.0"
48
+ type: :development
49
+ version_requirements: *id002
50
+ description: props - Manage Settings
51
+ email: webslideshow@googlegroups.com
52
+ executables: []
53
+
54
+ extensions: []
55
+
56
+ extra_rdoc_files:
57
+ - Manifest.txt
58
+ files:
59
+ - History.markdown
60
+ - Manifest.txt
61
+ - README.markdown
62
+ - Rakefile
63
+ - lib/props.rb
64
+ homepage: http://geraldb.github.com/props
65
+ licenses: []
66
+
67
+ post_install_message:
68
+ rdoc_options:
69
+ - --main
70
+ - README.markdown
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ hash: 3
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ requirements: []
92
+
93
+ rubyforge_project: props
94
+ rubygems_version: 1.8.24
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: props - Manage Settings
98
+ test_files: []
99
+