tweaks 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -31,6 +31,8 @@ the config to tweaks_config.rb
31
31
 
32
32
  * Multiple tweaks could be stored in your own gem, and then loaded by a rails/init.rb file like the one in this gem
33
33
 
34
+ Developed at RailsCamp Perth 2010
35
+
34
36
  == FEATURES/PROBLEMS:
35
37
 
36
38
  * untested with Rails 3
data/VERSION CHANGED
@@ -1,2 +1,2 @@
1
- 0.1.0
1
+ 0.2.0
2
2
 
data/lib/tweak_config.rb CHANGED
@@ -82,7 +82,6 @@ class TweakConfig < Hash
82
82
  d_class = (d.is_a?(Class) ? d : d.class)
83
83
  cname = d_class.name.to_sym
84
84
  case cname
85
- when :NilClass then ;
86
85
  when :String then self[aKey] = aHash[aKey].to_s unless aHash[aKey].nil?
87
86
  when :Float then set_float(aKey,aHash[aKey]);
88
87
  when :Fixnum then set_int(aKey,aHash[aKey]);
@@ -96,7 +95,7 @@ class TweakConfig < Hash
96
95
 
97
96
  def read(aSource,aLimitToDefaults=false)
98
97
  aSource.each do |k,v|
99
- copy_item(aSource,k) unless aLimitToDefaults && !default_values.include?[k]
98
+ copy_item(aSource,k) unless aLimitToDefaults && !default_values.include?(k)
100
99
  end
101
100
  self
102
101
  end
data/lib/tweaks.rb CHANGED
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__),'tweak_config')
3
3
  class Tweaks
4
4
 
5
5
  def self.reset
6
- @@configs = {}
6
+ @@configs = {} # may contain defaults or config
7
7
  @@procs = {}
8
8
  @@installed = []
9
9
  end
@@ -66,14 +66,14 @@ class Tweaks
66
66
  # returns config hash for modification
67
67
  def self.configure(aName,aConfig=nil)
68
68
  aName = aName.to_sym
69
- if have_defaults = have_config?(aName) # will be defaults from define, so merge in app config
69
+ if have_config?(aName) # will be defaults from define, so merge in app config
70
70
  config = @@configs[aName]
71
71
  config.read(aConfig) if aConfig
72
72
  @@configs[aName] = config
73
73
  else # store app config for merge later
74
74
  @@configs[aName] = TweakConfig.new(aConfig)
75
75
  end
76
- do_it(aName) if have_defaults && !installed?(aName)
76
+ do_it(aName) if @@procs[aName] && !installed?(aName) # we have configured here, so install if we have define proc and not already installed
77
77
  @@configs[aName]
78
78
  end
79
79
 
data/tweaks.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{tweaks}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["buzzware"]
12
- s.date = %q{2010-11-15}
12
+ s.date = %q{2011-11-25}
13
13
  s.description = %q{Tweaks provides a minimal framework for implementing, configuring and distributing those
14
14
  little pieces of code you develop and collect through developing multiple rails projects.}
15
15
  s.email = %q{contact@buzzware.com.au}
@@ -39,7 +39,7 @@ little pieces of code you develop and collect through developing multiple rails
39
39
  s.homepage = %q{http://github.com/buzzware/tweaks}
40
40
  s.rdoc_options = ["--charset=UTF-8"]
41
41
  s.require_paths = ["lib"]
42
- s.rubygems_version = %q{1.3.7}
42
+ s.rubygems_version = %q{1.5.3}
43
43
  s.summary = %q{A minimal framework for implementing, configuring and distributing those little pieces of code}
44
44
  s.test_files = [
45
45
  "test/config_spec.rb",
@@ -48,7 +48,6 @@ little pieces of code you develop and collect through developing multiple rails
48
48
  ]
49
49
 
50
50
  if s.respond_to? :specification_version then
51
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
52
51
  s.specification_version = 3
53
52
 
54
53
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tweaks
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
4
+ hash: 23
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - buzzware
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-15 00:00:00 +08:00
18
+ date: 2011-11-25 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  requirements: []
92
92
 
93
93
  rubyforge_project:
94
- rubygems_version: 1.3.7
94
+ rubygems_version: 1.5.3
95
95
  signing_key:
96
96
  specification_version: 3
97
97
  summary: A minimal framework for implementing, configuring and distributing those little pieces of code