configvars_rails 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +9 -0
- data/Gemfile.lock +82 -0
- data/Rakefile +24 -33
- data/VERSION +1 -1
- data/configvars_rails.gemspec +21 -3
- data/lib/configvars_rails/model.rb +2 -2
- data/test/config_var_test.rb +10 -0
- metadata +94 -14
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
abstract (1.0.0)
|
5
|
+
actionmailer (3.0.5)
|
6
|
+
actionpack (= 3.0.5)
|
7
|
+
mail (~> 2.2.15)
|
8
|
+
actionpack (3.0.5)
|
9
|
+
activemodel (= 3.0.5)
|
10
|
+
activesupport (= 3.0.5)
|
11
|
+
builder (~> 2.1.2)
|
12
|
+
erubis (~> 2.6.6)
|
13
|
+
i18n (~> 0.4)
|
14
|
+
rack (~> 1.2.1)
|
15
|
+
rack-mount (~> 0.6.13)
|
16
|
+
rack-test (~> 0.5.7)
|
17
|
+
tzinfo (~> 0.3.23)
|
18
|
+
activemodel (3.0.5)
|
19
|
+
activesupport (= 3.0.5)
|
20
|
+
builder (~> 2.1.2)
|
21
|
+
i18n (~> 0.4)
|
22
|
+
activerecord (3.0.5)
|
23
|
+
activemodel (= 3.0.5)
|
24
|
+
activesupport (= 3.0.5)
|
25
|
+
arel (~> 2.0.2)
|
26
|
+
tzinfo (~> 0.3.23)
|
27
|
+
activeresource (3.0.5)
|
28
|
+
activemodel (= 3.0.5)
|
29
|
+
activesupport (= 3.0.5)
|
30
|
+
activesupport (3.0.5)
|
31
|
+
arel (2.0.9)
|
32
|
+
builder (2.1.2)
|
33
|
+
erubis (2.6.6)
|
34
|
+
abstract (>= 1.0.0)
|
35
|
+
git (1.2.5)
|
36
|
+
i18n (0.5.0)
|
37
|
+
jeweler (1.5.2)
|
38
|
+
bundler (~> 1.0.0)
|
39
|
+
git (>= 1.2.5)
|
40
|
+
rake
|
41
|
+
mail (2.2.15)
|
42
|
+
activesupport (>= 2.3.6)
|
43
|
+
i18n (>= 0.4.0)
|
44
|
+
mime-types (~> 1.16)
|
45
|
+
treetop (~> 1.4.8)
|
46
|
+
mime-types (1.16)
|
47
|
+
polyglot (0.3.1)
|
48
|
+
rack (1.2.2)
|
49
|
+
rack-mount (0.6.14)
|
50
|
+
rack (>= 1.0.0)
|
51
|
+
rack-test (0.5.7)
|
52
|
+
rack (>= 1.0)
|
53
|
+
rails (3.0.5)
|
54
|
+
actionmailer (= 3.0.5)
|
55
|
+
actionpack (= 3.0.5)
|
56
|
+
activerecord (= 3.0.5)
|
57
|
+
activeresource (= 3.0.5)
|
58
|
+
activesupport (= 3.0.5)
|
59
|
+
bundler (~> 1.0)
|
60
|
+
railties (= 3.0.5)
|
61
|
+
railties (3.0.5)
|
62
|
+
actionpack (= 3.0.5)
|
63
|
+
activesupport (= 3.0.5)
|
64
|
+
rake (>= 0.8.7)
|
65
|
+
thor (~> 0.14.4)
|
66
|
+
rake (0.8.7)
|
67
|
+
rcov (0.9.9)
|
68
|
+
sqlite3 (1.3.3)
|
69
|
+
thor (0.14.6)
|
70
|
+
treetop (1.4.9)
|
71
|
+
polyglot (>= 0.3.1)
|
72
|
+
tzinfo (0.3.25)
|
73
|
+
|
74
|
+
PLATFORMS
|
75
|
+
ruby
|
76
|
+
|
77
|
+
DEPENDENCIES
|
78
|
+
bundler (~> 1.0.0)
|
79
|
+
jeweler (~> 1.5.2)
|
80
|
+
rails (>= 3.0.0)
|
81
|
+
rcov
|
82
|
+
sqlite3 (>= 1.3.3)
|
data/Rakefile
CHANGED
@@ -1,25 +1,31 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
2
10
|
require 'rake'
|
3
11
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
Jeweler::GemcutterTasks.new
|
20
|
-
rescue LoadError
|
21
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
gem.name = "configvars_rails"
|
15
|
+
gem.homepage = "http://github.com/pwnall/configvars_rails"
|
16
|
+
gem.license = "MIT"
|
17
|
+
gem.summary = %Q{Global configuration variables for Rails 3 applications.}
|
18
|
+
gem.description = %Q{This gem provides a model and simple controller for
|
19
|
+
storing global application configuration in a database. This allows the
|
20
|
+
configuration to change without source code modifications.}
|
21
|
+
gem.email = "victor@costan.us"
|
22
|
+
gem.authors = ["Victor Costan"]
|
23
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
24
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
25
|
+
gem.add_runtime_dependency "rails", ">= 3.0.0"
|
26
|
+
gem.add_development_dependency "sqlite3-ruby", ">= 1.3.0"
|
22
27
|
end
|
28
|
+
Jeweler::RubygemsDotOrgTasks.new
|
23
29
|
|
24
30
|
require 'rake/testtask'
|
25
31
|
Rake::TestTask.new(:test) do |test|
|
@@ -28,21 +34,6 @@ Rake::TestTask.new(:test) do |test|
|
|
28
34
|
test.verbose = true
|
29
35
|
end
|
30
36
|
|
31
|
-
begin
|
32
|
-
require 'rcov/rcovtask'
|
33
|
-
Rcov::RcovTask.new do |test|
|
34
|
-
test.libs << 'test'
|
35
|
-
test.pattern = 'test/**/*_test.rb'
|
36
|
-
test.verbose = true
|
37
|
-
end
|
38
|
-
rescue LoadError
|
39
|
-
task :rcov do
|
40
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
task :test => :check_dependencies
|
45
|
-
|
46
37
|
task :default => :test
|
47
38
|
|
48
39
|
require 'rake/rdoctask'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.3
|
data/configvars_rails.gemspec
CHANGED
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{configvars_rails}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Victor Costan"]
|
12
12
|
s.date = %q{2011-03-27}
|
13
13
|
s.description = %q{This gem provides a model and simple controller for
|
14
|
-
|
15
|
-
|
14
|
+
storing global application configuration in a database. This allows the
|
15
|
+
configuration to change without source code modifications.}
|
16
16
|
s.email = %q{victor@costan.us}
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE",
|
@@ -20,6 +20,8 @@ Gem::Specification.new do |s|
|
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
".project",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
23
25
|
"LICENSE",
|
24
26
|
"README.rdoc",
|
25
27
|
"Rakefile",
|
@@ -59,6 +61,7 @@ Gem::Specification.new do |s|
|
|
59
61
|
"test/test_helper.rb"
|
60
62
|
]
|
61
63
|
s.homepage = %q{http://github.com/pwnall/configvars_rails}
|
64
|
+
s.licenses = ["MIT"]
|
62
65
|
s.require_paths = ["lib"]
|
63
66
|
s.rubygems_version = %q{1.6.0}
|
64
67
|
s.summary = %q{Global configuration variables for Rails 3 applications.}
|
@@ -82,13 +85,28 @@ Gem::Specification.new do |s|
|
|
82
85
|
s.specification_version = 3
|
83
86
|
|
84
87
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
88
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
|
89
|
+
s.add_runtime_dependency(%q<sqlite3>, [">= 1.3.3"])
|
90
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
91
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
92
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
85
93
|
s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
|
86
94
|
s.add_development_dependency(%q<sqlite3-ruby>, [">= 1.3.0"])
|
87
95
|
else
|
96
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
97
|
+
s.add_dependency(%q<sqlite3>, [">= 1.3.3"])
|
98
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
99
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
100
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
88
101
|
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
89
102
|
s.add_dependency(%q<sqlite3-ruby>, [">= 1.3.0"])
|
90
103
|
end
|
91
104
|
else
|
105
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
106
|
+
s.add_dependency(%q<sqlite3>, [">= 1.3.3"])
|
107
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
108
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
109
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
92
110
|
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
93
111
|
s.add_dependency(%q<sqlite3-ruby>, [">= 1.3.0"])
|
94
112
|
end
|
@@ -23,9 +23,9 @@ module ModelClassMethods
|
|
23
23
|
validates :name, :uniqueness => true, :length => 1..64, :presence => true
|
24
24
|
|
25
25
|
# The value of the configuration variable.
|
26
|
-
validates :value, :length =>
|
26
|
+
validates :value, :length => { :in => 0..1024, :allow_nil => false }
|
27
27
|
|
28
|
-
extend ModelMetaclassMethods
|
28
|
+
extend ModelMetaclassMethods
|
29
29
|
include ModelInstanceMethods
|
30
30
|
end
|
31
31
|
end # module ConfigvarsRails::Model::ModelClassMethods
|
data/test/config_var_test.rb
CHANGED
@@ -13,6 +13,16 @@ class ConfigVarTest < ActiveSupport::TestCase
|
|
13
13
|
@var.name = 'app_uri'
|
14
14
|
assert !@var.valid?
|
15
15
|
end
|
16
|
+
|
17
|
+
test "allows empty values" do
|
18
|
+
@var.value = ''
|
19
|
+
assert @var.valid?
|
20
|
+
end
|
21
|
+
|
22
|
+
test "does not allow nil values" do
|
23
|
+
@var.value = nil
|
24
|
+
assert !@var.valid?
|
25
|
+
end
|
16
26
|
|
17
27
|
test "convenience get" do
|
18
28
|
@var.save!
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configvars_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 3
|
10
|
+
version: 0.4.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Victor Costan
|
@@ -19,8 +19,7 @@ date: 2011-03-27 00:00:00 -04:00
|
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
prerelease: false
|
22
|
+
type: :runtime
|
24
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
25
|
requirements:
|
@@ -32,12 +31,90 @@ dependencies:
|
|
32
31
|
- 0
|
33
32
|
- 0
|
34
33
|
version: 3.0.0
|
35
|
-
type: :runtime
|
36
34
|
version_requirements: *id001
|
37
|
-
|
38
|
-
name: sqlite3-ruby
|
35
|
+
name: rails
|
39
36
|
prerelease: false
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
type: :runtime
|
40
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 29
|
45
|
+
segments:
|
46
|
+
- 1
|
47
|
+
- 3
|
48
|
+
- 3
|
49
|
+
version: 1.3.3
|
50
|
+
version_requirements: *id002
|
51
|
+
name: sqlite3
|
52
|
+
prerelease: false
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
type: :development
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 23
|
61
|
+
segments:
|
62
|
+
- 1
|
63
|
+
- 0
|
64
|
+
- 0
|
65
|
+
version: 1.0.0
|
66
|
+
version_requirements: *id003
|
67
|
+
name: bundler
|
68
|
+
prerelease: false
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
type: :development
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 7
|
77
|
+
segments:
|
78
|
+
- 1
|
79
|
+
- 5
|
80
|
+
- 2
|
81
|
+
version: 1.5.2
|
82
|
+
version_requirements: *id004
|
83
|
+
name: jeweler
|
84
|
+
prerelease: false
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
type: :development
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
hash: 3
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
version: "0"
|
96
|
+
version_requirements: *id005
|
97
|
+
name: rcov
|
98
|
+
prerelease: false
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
type: :runtime
|
101
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
hash: 7
|
107
|
+
segments:
|
108
|
+
- 3
|
109
|
+
- 0
|
110
|
+
- 0
|
111
|
+
version: 3.0.0
|
112
|
+
version_requirements: *id006
|
113
|
+
name: rails
|
114
|
+
prerelease: false
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
type: :development
|
117
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
41
118
|
none: false
|
42
119
|
requirements:
|
43
120
|
- - ">="
|
@@ -48,12 +125,13 @@ dependencies:
|
|
48
125
|
- 3
|
49
126
|
- 0
|
50
127
|
version: 1.3.0
|
51
|
-
|
52
|
-
|
128
|
+
version_requirements: *id007
|
129
|
+
name: sqlite3-ruby
|
130
|
+
prerelease: false
|
53
131
|
description: |-
|
54
132
|
This gem provides a model and simple controller for
|
55
|
-
|
56
|
-
|
133
|
+
storing global application configuration in a database. This allows the
|
134
|
+
configuration to change without source code modifications.
|
57
135
|
email: victor@costan.us
|
58
136
|
executables: []
|
59
137
|
|
@@ -64,6 +142,8 @@ extra_rdoc_files:
|
|
64
142
|
- README.rdoc
|
65
143
|
files:
|
66
144
|
- .project
|
145
|
+
- Gemfile
|
146
|
+
- Gemfile.lock
|
67
147
|
- LICENSE
|
68
148
|
- README.rdoc
|
69
149
|
- Rakefile
|
@@ -103,8 +183,8 @@ files:
|
|
103
183
|
- test/test_helper.rb
|
104
184
|
has_rdoc: true
|
105
185
|
homepage: http://github.com/pwnall/configvars_rails
|
106
|
-
licenses:
|
107
|
-
|
186
|
+
licenses:
|
187
|
+
- MIT
|
108
188
|
post_install_message:
|
109
189
|
rdoc_options: []
|
110
190
|
|