themactep-ppds-libs 1.0.0

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.
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ == PPDS libraries
2
+
3
+ Copyright (c) 2009, Paul Philippov
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10
+ * Neither the name of the Paul Philippov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13
+
@@ -0,0 +1,18 @@
1
+ = PPDS libraries
2
+
3
+ Collection of goodies shared in miscellaneous projects of mine.
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but
13
+ bump version in a commit by itself I can ignore when I pull)
14
+ * Send me a pull request. Bonus points for topic branches.
15
+
16
+ == Copyright
17
+
18
+ Copyright (c) 2009 Paul Philippov. See LICENSE for details.
@@ -0,0 +1,16 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "ppds-libs"
8
+ gem.summary = %Q{PPDS shared libraries}
9
+ gem.description = %Q{A collection of ruby code shared between different projects by PPDS}
10
+ gem.email = "paul@ppds.ws"
11
+ gem.homepage = "http://github.com/themactep/ppds-libs"
12
+ gem.authors = ["Paul Philippov"]
13
+ end
14
+ rescue LoadError
15
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
16
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,17 @@
1
+ module Ppds
2
+ class ClassFactory
3
+ def initialize(data=[])
4
+ for att in data
5
+ set(att.name.gsub(/-/,'_'), att.value)
6
+ end
7
+ end
8
+
9
+ def get(name)
10
+ instance_variable_get("@#{name}")
11
+ end
12
+
13
+ def set(name, value)
14
+ instance_variable_set("@#{name}", value)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,47 @@
1
+ require 'gconf2'
2
+
3
+ module Ppds
4
+ class Config
5
+ @@gconf = GConf::Client.default
6
+
7
+ def gconf
8
+ @@gconf
9
+ end
10
+
11
+ def initialize(app)
12
+ @root = '/apps/%s' % app
13
+ gconf.add_dir(@root)
14
+ end
15
+
16
+ def name_from_key(key)
17
+ key.split('/').last
18
+ end
19
+
20
+ def key_from_name(name)
21
+ [ @root, name ].join("/")
22
+ end
23
+
24
+ def all
25
+ gconf.all_entries(@root)
26
+ end
27
+
28
+ def get(name)
29
+ gconf[key_from_name(name)]
30
+ end
31
+
32
+ def set(name, value)
33
+ gconf[key_from_name(name)] = value
34
+ end
35
+
36
+ def save
37
+ gconf.suggest_sync
38
+ end
39
+
40
+ def destroy
41
+ for one in all
42
+ gconf.unset(one.key)
43
+ end
44
+ save
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,44 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{ppds-libs}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Paul Philippov"]
12
+ s.date = %q{2009-08-23}
13
+ s.description = %q{A collection of ruby code shared between different projects by PPDS}
14
+ s.email = %q{paul@ppds.ws}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "lib/ppds/class_factory.rb",
26
+ "lib/ppds/config.rb",
27
+ "ppds-libs.gemspec"
28
+ ]
29
+ s.homepage = %q{http://github.com/themactep/ppds-libs}
30
+ s.rdoc_options = ["--charset=UTF-8"]
31
+ s.require_paths = ["lib"]
32
+ s.rubygems_version = %q{1.3.5}
33
+ s.summary = %q{PPDS shared libraries}
34
+
35
+ if s.respond_to? :specification_version then
36
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
37
+ s.specification_version = 3
38
+
39
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
40
+ else
41
+ end
42
+ else
43
+ end
44
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: themactep-ppds-libs
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Paul Philippov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-23 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: A collection of ruby code shared between different projects by PPDS
17
+ email: paul@ppds.ws
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - LICENSE
24
+ - README.rdoc
25
+ files:
26
+ - .gitignore
27
+ - LICENSE
28
+ - README.rdoc
29
+ - Rakefile
30
+ - VERSION
31
+ - lib/ppds/class_factory.rb
32
+ - lib/ppds/config.rb
33
+ - ppds-libs.gemspec
34
+ has_rdoc: false
35
+ homepage: http://github.com/themactep/ppds-libs
36
+ licenses:
37
+ post_install_message:
38
+ rdoc_options:
39
+ - --charset=UTF-8
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ version:
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ requirements: []
55
+
56
+ rubyforge_project:
57
+ rubygems_version: 1.3.5
58
+ signing_key:
59
+ specification_version: 3
60
+ summary: PPDS shared libraries
61
+ test_files: []
62
+