maiha-acts_as_bits 0.2 → 0.2.1
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.
- data/README +6 -4
- data/Rakefile +52 -0
- data/lib/acts_as_bits.rb +8 -1
- metadata +12 -12
- data/acts_as_bits.gemspec +0 -12
- data/init.rb +0 -1
- data/install.rb +0 -1
data/README
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
ActsAsBits
|
|
2
2
|
==========
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
ActiveRecord plugin that maintains massive flags in one column
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Table Definition
|
|
@@ -59,10 +59,12 @@ This is useful for initial setting like all allow/deny.
|
|
|
59
59
|
user.operations # => "0000"
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
Environment
|
|
63
|
+
===========
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
tested on
|
|
66
|
+
|
|
67
|
+
* Rails 1.2.6-2.3.2
|
|
66
68
|
|
|
67
69
|
|
|
68
70
|
Author
|
data/Rakefile
CHANGED
|
@@ -20,3 +20,55 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
|
20
20
|
rdoc.rdoc_files.include('README')
|
|
21
21
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
22
22
|
end
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
######################################################################
|
|
26
|
+
### for gem
|
|
27
|
+
|
|
28
|
+
require 'rubygems'
|
|
29
|
+
require 'rake/gempackagetask'
|
|
30
|
+
|
|
31
|
+
GEM_NAME = "acts_as_bits"
|
|
32
|
+
AUTHOR = "maiha"
|
|
33
|
+
EMAIL = "maiha@wota.jp"
|
|
34
|
+
HOMEPAGE = "http://github.com/maiha/acts_as_bits"
|
|
35
|
+
SUMMARY = "ActiveRecord plugin that maintains massive flags in one column"
|
|
36
|
+
GEM_VERSION = "0.2.1"
|
|
37
|
+
|
|
38
|
+
spec = Gem::Specification.new do |s|
|
|
39
|
+
# s.rubyforge_project = 'merb'
|
|
40
|
+
s.name = GEM_NAME
|
|
41
|
+
s.version = GEM_VERSION
|
|
42
|
+
s.platform = Gem::Platform::RUBY
|
|
43
|
+
s.has_rdoc = true
|
|
44
|
+
s.extra_rdoc_files = ["README", "LICENSE"]
|
|
45
|
+
s.summary = SUMMARY
|
|
46
|
+
s.description = s.summary
|
|
47
|
+
s.author = AUTHOR
|
|
48
|
+
s.email = EMAIL
|
|
49
|
+
s.homepage = HOMEPAGE
|
|
50
|
+
s.require_path = 'lib'
|
|
51
|
+
s.files = %w(LICENSE README Rakefile) + Dir.glob("{core_ext,lib,spec,tasks,test}/**/*")
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
|
55
|
+
pkg.gem_spec = spec
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
desc "Install the gem"
|
|
59
|
+
task :install do
|
|
60
|
+
Merb::RakeHelper.install(GEM_NAME, :version => GEM_VERSION)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
desc "Uninstall the gem"
|
|
64
|
+
task :uninstall do
|
|
65
|
+
Merb::RakeHelper.uninstall(GEM_NAME, :version => GEM_VERSION)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
desc "Create a gemspec file"
|
|
69
|
+
task :gemspec do
|
|
70
|
+
File.open("#{GEM_NAME}.gemspec", "w") do |file|
|
|
71
|
+
file.puts spec.to_ruby
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
data/lib/acts_as_bits.rb
CHANGED
|
@@ -57,7 +57,14 @@ module ActsAsBits
|
|
|
57
57
|
"#{bit_column} %s '1'" % (flag ? '=' : '<>')
|
|
58
58
|
else
|
|
59
59
|
values << value
|
|
60
|
-
|
|
60
|
+
case ActiveRecord::Base.method(:attribute_condition).arity
|
|
61
|
+
when 1 # Rails 2.0-2.2
|
|
62
|
+
"#{table_name}.#{connection.quote_column_name(attr)} #{attribute_condition(value)}"
|
|
63
|
+
when 2 # Rails 2.3-
|
|
64
|
+
attribute_condition("#{table_name}.#{connection.quote_column_name(attr)}", value)
|
|
65
|
+
else
|
|
66
|
+
raise NotImplementedError, "unknown AR::Base#attribute_condition type"
|
|
67
|
+
end
|
|
61
68
|
end
|
|
62
69
|
end.join(' AND ')
|
|
63
70
|
replace_bind_variables(conditions, expand_range_bind_variables(values))
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: maiha-acts_as_bits
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- maiha
|
|
@@ -9,35 +9,35 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-
|
|
12
|
+
date: 2009-03-20 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies: []
|
|
15
15
|
|
|
16
|
-
description:
|
|
16
|
+
description: ActiveRecord plugin that maintains massive flags in one column
|
|
17
17
|
email: maiha@wota.jp
|
|
18
18
|
executables: []
|
|
19
19
|
|
|
20
20
|
extensions: []
|
|
21
21
|
|
|
22
|
-
extra_rdoc_files:
|
|
23
|
-
|
|
22
|
+
extra_rdoc_files:
|
|
23
|
+
- README
|
|
24
|
+
- LICENSE
|
|
24
25
|
files:
|
|
26
|
+
- LICENSE
|
|
25
27
|
- README
|
|
26
28
|
- Rakefile
|
|
27
|
-
- acts_as_bits.gemspec
|
|
28
|
-
- init.rb
|
|
29
|
-
- install.rb
|
|
30
29
|
- lib/acts_as_bits.rb
|
|
31
30
|
- tasks/acts_as_bits_tasks.rake
|
|
32
|
-
- test/acts_as_bits_test.rb
|
|
33
31
|
- test/database.yml
|
|
34
|
-
- test/
|
|
32
|
+
- test/fixtures
|
|
35
33
|
- test/fixtures/mixin.rb
|
|
36
34
|
- test/fixtures/mixins.yml
|
|
37
|
-
- test/prefix_test.rb
|
|
38
35
|
- test/schema.rb
|
|
36
|
+
- test/prefix_test.rb
|
|
37
|
+
- test/acts_as_bits_test.rb
|
|
39
38
|
- test/spec_helper.rb
|
|
40
39
|
- test/test_helper.rb
|
|
40
|
+
- test/dirty_spec.rb
|
|
41
41
|
has_rdoc: true
|
|
42
42
|
homepage: http://github.com/maiha/acts_as_bits
|
|
43
43
|
post_install_message:
|
|
@@ -63,6 +63,6 @@ rubyforge_project:
|
|
|
63
63
|
rubygems_version: 1.2.0
|
|
64
64
|
signing_key:
|
|
65
65
|
specification_version: 2
|
|
66
|
-
summary:
|
|
66
|
+
summary: ActiveRecord plugin that maintains massive flags in one column
|
|
67
67
|
test_files: []
|
|
68
68
|
|
data/acts_as_bits.gemspec
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Gem::Specification.new do |s|
|
|
2
|
-
s.name = "acts_as_bits"
|
|
3
|
-
s.version = "0.2"
|
|
4
|
-
s.date = "2009-01-21"
|
|
5
|
-
s.summary = ""
|
|
6
|
-
s.email = "maiha@wota.jp"
|
|
7
|
-
s.homepage = "http://github.com/maiha/acts_as_bits"
|
|
8
|
-
s.description = ""
|
|
9
|
-
s.has_rdoc = true
|
|
10
|
-
s.authors = ["maiha"]
|
|
11
|
-
s.files = ["README", "Rakefile", "acts_as_bits.gemspec", "init.rb", "install.rb", "lib/acts_as_bits.rb", "tasks/acts_as_bits_tasks.rake", "test/acts_as_bits_test.rb", "test/database.yml", "test/dirty_spec.rb", "test/fixtures/mixin.rb", "test/fixtures/mixins.yml", "test/prefix_test.rb", "test/schema.rb", "test/spec_helper.rb", "test/test_helper.rb"]
|
|
12
|
-
end
|
data/init.rb
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require 'acts_as_bits'
|
data/install.rb
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Install hook code here
|