acts_as_configurable 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/{CHANGELOG → CHANGELOG.rdoc} +5 -0
- data/LICENSE +20 -0
- data/Rakefile +43 -8
- data/VERSION +1 -0
- data/acts_as_configurable.gemspec +39 -7
- data/spec/acts_as_configurable_spec.rb +23 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +38 -0
- metadata +61 -22
- data/Manifest +0 -7
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Create
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,11 +1,46 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = 'acts_as_configurable'
|
8
|
+
gem.summary = 'Storage of configuration values in database'
|
9
|
+
gem.description = 'Storage of configuration values in database'
|
10
|
+
gem.email = 'philipp.ullmann@create.at'
|
11
|
+
gem.homepage = 'http://github.com/create-philipp-ullmann/acts_as_configurable'
|
12
|
+
gem.authors = ['Philipp Ullmann']
|
13
|
+
gem.add_development_dependency 'rspec', '>= 1.3.0'
|
14
|
+
gem.add_development_dependency 'sqlite3-ruby', '>=1.2.5'
|
15
|
+
gem.add_development_dependency 'activerecord', '>= 2.3.5'
|
16
|
+
end
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
|
+
rescue LoadError
|
19
|
+
puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler'
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'spec/rake/spectask'
|
23
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
24
|
+
spec.libs << 'lib' << 'spec'
|
25
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
26
|
+
end
|
27
|
+
|
28
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
29
|
+
spec.libs << 'lib' << 'spec'
|
30
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
31
|
+
spec.rcov = true
|
32
|
+
end
|
33
|
+
|
34
|
+
task :spec => :check_dependencies
|
35
|
+
|
36
|
+
task :default => :spec
|
37
|
+
|
38
|
+
require 'rake/rdoctask'
|
39
|
+
Rake::RDocTask.new do |rdoc|
|
40
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
41
|
+
|
42
|
+
rdoc.rdoc_dir = 'rdoc'
|
43
|
+
rdoc.title = "test #{version}"
|
44
|
+
rdoc.rdoc_files.include('README*')
|
45
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
11
46
|
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.6
|
@@ -1,30 +1,62 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
1
4
|
# -*- encoding: utf-8 -*-
|
2
5
|
|
3
6
|
Gem::Specification.new do |s|
|
4
7
|
s.name = %q{acts_as_configurable}
|
5
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.6"
|
6
9
|
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">=
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
11
|
s.authors = ["Philipp Ullmann"]
|
9
|
-
s.date = %q{2010-04-
|
12
|
+
s.date = %q{2010-04-20}
|
10
13
|
s.description = %q{Storage of configuration values in database}
|
11
14
|
s.email = %q{philipp.ullmann@create.at}
|
12
|
-
s.extra_rdoc_files = [
|
13
|
-
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".gitignore",
|
21
|
+
"CHANGELOG.rdoc",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"acts_as_configurable.gemspec",
|
27
|
+
"lib/acts_as_configurable.rb",
|
28
|
+
"lib/dummy_access.rb",
|
29
|
+
"spec/acts_as_configurable_spec.rb",
|
30
|
+
"spec/spec.opts",
|
31
|
+
"spec/spec_helper.rb"
|
32
|
+
]
|
14
33
|
s.homepage = %q{http://github.com/create-philipp-ullmann/acts_as_configurable}
|
15
|
-
s.rdoc_options = ["--
|
34
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
16
35
|
s.require_paths = ["lib"]
|
17
|
-
s.rubyforge_project = %q{acts_as_configurable}
|
18
36
|
s.rubygems_version = %q{1.3.6}
|
19
37
|
s.summary = %q{Storage of configuration values in database}
|
38
|
+
s.test_files = [
|
39
|
+
"spec/acts_as_configurable_spec.rb",
|
40
|
+
"spec/spec_helper.rb"
|
41
|
+
]
|
20
42
|
|
21
43
|
if s.respond_to? :specification_version then
|
22
44
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
45
|
s.specification_version = 3
|
24
46
|
|
25
47
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
48
|
+
s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
|
49
|
+
s.add_development_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
50
|
+
s.add_development_dependency(%q<activerecord>, [">= 2.3.5"])
|
26
51
|
else
|
52
|
+
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
53
|
+
s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
54
|
+
s.add_dependency(%q<activerecord>, [">= 2.3.5"])
|
27
55
|
end
|
28
56
|
else
|
57
|
+
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
58
|
+
s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
59
|
+
s.add_dependency(%q<activerecord>, [">= 2.3.5"])
|
29
60
|
end
|
30
61
|
end
|
62
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe 'A User' do
|
4
|
+
before(:each) do
|
5
|
+
setup_db
|
6
|
+
@user = User.create!
|
7
|
+
end
|
8
|
+
|
9
|
+
after(:each) do
|
10
|
+
teardown_db
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should be able to create configuration values' do
|
14
|
+
@user.configure.name = 'a'
|
15
|
+
@user.configurable?.should == true
|
16
|
+
@user.configure.name.should == 'a'
|
17
|
+
|
18
|
+
Configuration.count.should == 1
|
19
|
+
conf = Configuration.first
|
20
|
+
conf.name.should == 'name'
|
21
|
+
conf.value.should == 'a'
|
22
|
+
end
|
23
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'active_record'
|
4
|
+
require 'acts_as_configurable'
|
5
|
+
require 'spec'
|
6
|
+
require 'spec/autorun'
|
7
|
+
|
8
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
|
9
|
+
|
10
|
+
def setup_db
|
11
|
+
ActiveRecord::Schema.define(:version => 1) do
|
12
|
+
create_table :users do |t|
|
13
|
+
t.string :name
|
14
|
+
end
|
15
|
+
|
16
|
+
create_table :configurations do |t|
|
17
|
+
t.string :configurable_type, :name, :value
|
18
|
+
t.integer :configurable_id
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def teardown_db
|
24
|
+
ActiveRecord::Base.connection.tables.each do |table|
|
25
|
+
ActiveRecord::Base.connection.drop_table table
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class User < ActiveRecord::Base
|
30
|
+
acts_as_configurable
|
31
|
+
end
|
32
|
+
|
33
|
+
class Configuration < ActiveRecord::Base
|
34
|
+
belongs_to :configurable, :polymorphic => true
|
35
|
+
end
|
36
|
+
|
37
|
+
Spec::Runner.configure do |config|
|
38
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Philipp Ullmann
|
@@ -14,10 +14,51 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-20 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rspec
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 3
|
30
|
+
- 0
|
31
|
+
version: 1.3.0
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: sqlite3-ruby
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 1
|
43
|
+
- 2
|
44
|
+
- 5
|
45
|
+
version: 1.2.5
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: activerecord
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 2
|
57
|
+
- 3
|
58
|
+
- 5
|
59
|
+
version: 2.3.5
|
60
|
+
type: :development
|
61
|
+
version_requirements: *id003
|
21
62
|
description: Storage of configuration values in database
|
22
63
|
email: philipp.ullmann@create.at
|
23
64
|
executables: []
|
@@ -25,30 +66,28 @@ executables: []
|
|
25
66
|
extensions: []
|
26
67
|
|
27
68
|
extra_rdoc_files:
|
28
|
-
-
|
69
|
+
- LICENSE
|
29
70
|
- README.rdoc
|
30
|
-
- lib/acts_as_configurable.rb
|
31
|
-
- lib/dummy_access.rb
|
32
71
|
files:
|
33
|
-
-
|
72
|
+
- .gitignore
|
73
|
+
- CHANGELOG.rdoc
|
74
|
+
- LICENSE
|
34
75
|
- README.rdoc
|
35
76
|
- Rakefile
|
77
|
+
- VERSION
|
36
78
|
- acts_as_configurable.gemspec
|
37
79
|
- lib/acts_as_configurable.rb
|
38
80
|
- lib/dummy_access.rb
|
39
|
-
-
|
81
|
+
- spec/acts_as_configurable_spec.rb
|
82
|
+
- spec/spec.opts
|
83
|
+
- spec/spec_helper.rb
|
40
84
|
has_rdoc: true
|
41
85
|
homepage: http://github.com/create-philipp-ullmann/acts_as_configurable
|
42
86
|
licenses: []
|
43
87
|
|
44
88
|
post_install_message:
|
45
89
|
rdoc_options:
|
46
|
-
- --
|
47
|
-
- --inline-source
|
48
|
-
- --title
|
49
|
-
- Acts_as_configurable
|
50
|
-
- --main
|
51
|
-
- README.rdoc
|
90
|
+
- --charset=UTF-8
|
52
91
|
require_paths:
|
53
92
|
- lib
|
54
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -63,15 +102,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
102
|
- - ">="
|
64
103
|
- !ruby/object:Gem::Version
|
65
104
|
segments:
|
66
|
-
-
|
67
|
-
|
68
|
-
version: "1.2"
|
105
|
+
- 0
|
106
|
+
version: "0"
|
69
107
|
requirements: []
|
70
108
|
|
71
|
-
rubyforge_project:
|
109
|
+
rubyforge_project:
|
72
110
|
rubygems_version: 1.3.6
|
73
111
|
signing_key:
|
74
112
|
specification_version: 3
|
75
113
|
summary: Storage of configuration values in database
|
76
|
-
test_files:
|
77
|
-
|
114
|
+
test_files:
|
115
|
+
- spec/acts_as_configurable_spec.rb
|
116
|
+
- spec/spec_helper.rb
|