fume 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  .DS_Store
2
+ coverage
2
3
  pkg/*
3
4
  tmp/*
data/Rakefile CHANGED
@@ -8,10 +8,12 @@ Spec::Rake::SpecTask.new(:spec) do |spec|
8
8
  spec.spec_files = FileList['spec/**/*_spec.rb']
9
9
  end
10
10
 
11
- Spec::Rake::SpecTask.new(:rcov) do |spec|
12
- spec.libs << 'lib' << 'spec'
13
- spec.pattern = 'spec/**/*_spec.rb'
14
- spec.rcov = true
11
+ namespace :spec do
12
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
13
+ spec.libs << 'lib' << 'spec'
14
+ spec.pattern = 'spec/**/*_spec.rb'
15
+ spec.rcov = true
16
+ end
15
17
  end
16
18
 
17
19
 
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :minor: 5
3
- :patch: 1
3
+ :patch: 2
4
4
  :major: 0
5
5
  :build:
data/depends.rb CHANGED
@@ -12,7 +12,8 @@ GemLoader.setup do
12
12
  scope :optional do
13
13
  gem "authlogic", ">= 2.1.3"
14
14
  gem "searchlogic", ">= 2.4.12"
15
- gem "formtastic", ">= 0.9.7"
15
+ gem "formtastic", ">= 0.9.8"
16
+ gem "cancan", ">= 1.1.1"
16
17
  end
17
18
 
18
19
  scope :test do
data/fume.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fume}
8
- s.version = "0.5.1"
8
+ s.version = "0.5.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sunteya"]
12
- s.date = %q{2010-04-15}
12
+ s.date = %q{2010-04-21}
13
13
  s.email = %q{Sunteya@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "README"
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
23
23
  "fume.gemspec",
24
24
  "lib/fume.rb",
25
25
  "lib/fume/authlogic.rb",
26
+ "lib/fume/cancan.rb",
26
27
  "lib/fume/daemon.rb",
27
28
  "lib/fume/formtastic.rb",
28
29
  "lib/fume/logger_support.rb",
@@ -70,6 +71,7 @@ Gem::Specification.new do |s|
70
71
  "rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery.ba-bbq-1.2.1.js",
71
72
  "rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery.corner-2.09.js",
72
73
  "rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery.timepicker-0.2.1.js",
74
+ "spec/fume/cancan_spec.rb",
73
75
  "spec/fume/daemon_spec.rb",
74
76
  "spec/fume/logger_support_spec.rb",
75
77
  "spec/fume/smart_logger_spec.rb",
@@ -83,7 +85,8 @@ Gem::Specification.new do |s|
83
85
  s.rubygems_version = %q{1.3.6}
84
86
  s.summary = %q{a simple rails scaffold.}
85
87
  s.test_files = [
86
- "spec/fume/daemon_spec.rb",
88
+ "spec/fume/cancan_spec.rb",
89
+ "spec/fume/daemon_spec.rb",
87
90
  "spec/fume/logger_support_spec.rb",
88
91
  "spec/fume/smart_logger_spec.rb",
89
92
  "spec/rails_stub.rb",
@@ -99,14 +102,16 @@ Gem::Specification.new do |s|
99
102
  s.add_runtime_dependency(%q<actionpack>, ["~> 2.3.5"])
100
103
  s.add_development_dependency(%q<authlogic>, [">= 2.1.3"])
101
104
  s.add_development_dependency(%q<searchlogic>, [">= 2.4.12"])
102
- s.add_development_dependency(%q<formtastic>, [">= 0.9.7"])
105
+ s.add_development_dependency(%q<formtastic>, [">= 0.9.8"])
106
+ s.add_development_dependency(%q<cancan>, [">= 1.1.1"])
103
107
  s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
104
108
  else
105
109
  s.add_dependency(%q<gem_loader>, [">= 0.2.0"])
106
110
  s.add_dependency(%q<actionpack>, ["~> 2.3.5"])
107
111
  s.add_dependency(%q<authlogic>, [">= 2.1.3"])
108
112
  s.add_dependency(%q<searchlogic>, [">= 2.4.12"])
109
- s.add_dependency(%q<formtastic>, [">= 0.9.7"])
113
+ s.add_dependency(%q<formtastic>, [">= 0.9.8"])
114
+ s.add_dependency(%q<cancan>, [">= 1.1.1"])
110
115
  s.add_dependency(%q<rspec>, [">= 1.3.0"])
111
116
  end
112
117
  else
@@ -114,7 +119,8 @@ Gem::Specification.new do |s|
114
119
  s.add_dependency(%q<actionpack>, ["~> 2.3.5"])
115
120
  s.add_dependency(%q<authlogic>, [">= 2.1.3"])
116
121
  s.add_dependency(%q<searchlogic>, [">= 2.4.12"])
117
- s.add_dependency(%q<formtastic>, [">= 0.9.7"])
122
+ s.add_dependency(%q<formtastic>, [">= 0.9.8"])
123
+ s.add_dependency(%q<cancan>, [">= 1.1.1"])
118
124
  s.add_dependency(%q<rspec>, [">= 1.3.0"])
119
125
  end
120
126
  end
@@ -0,0 +1,34 @@
1
+ module Fume
2
+ module Cancan
3
+ def self.try_enable
4
+ if defined? ::CanCan
5
+ ActionController::Base.send :include, ControllerExtensions
6
+ end
7
+ end
8
+
9
+ module ControllerExtensions
10
+ def self.included(base)
11
+ base.send :extend, ClassMehtods
12
+ base.send :include, InstanceMethods
13
+ end
14
+
15
+ module ClassMehtods
16
+ def authorize_namespace(options = {})
17
+ before_filter(:authorize_namespace, options.slice(:only, :except))
18
+ write_inheritable_hash(:authorize_namespace, options)
19
+ end
20
+ end
21
+
22
+ module InstanceMethods
23
+ protected
24
+ def authorize_namespace
25
+ options = self.class.read_inheritable_attribute(:authorize_namespace)
26
+ unauthorized! if cannot?(params[:action].to_sym, options[:namespace])
27
+ end
28
+ end
29
+ end
30
+
31
+ end
32
+ end
33
+
34
+
data/lib/fume.rb CHANGED
@@ -9,6 +9,7 @@ require 'fume/formtastic'
9
9
  require 'fume/smart_logger'
10
10
  require 'fume/logger_support'
11
11
  require 'fume/daemon'
12
+ require 'fume/cancan'
12
13
 
13
14
  # module Fume
14
15
  # def self.root
@@ -438,8 +438,8 @@ ul.list li .item .avatar {
438
438
  width: 30px;
439
439
  height: 30px;
440
440
  }
441
- .ui-datepicker select.ui-datepicker-month { width: 45%; }
442
- .ui-datepicker select.ui-datepicker-year { width: 45%; }
441
+ .ui-datepicker select.ui-datepicker-month { width: 46%; }
442
+ .ui-datepicker select.ui-datepicker-year { width: 46%; }
443
443
  .ui-widget {
444
444
  font-size: 93%;
445
445
  line-height: 1;
@@ -459,7 +459,10 @@ body {
459
459
  font-family: helvetica, arial, sans-serif;
460
460
  }
461
461
  #header_wrapper { background: #36393d; }
462
- #header h1 { font-weight: bold; }
462
+ #header h1 {
463
+ font-weight: bold;
464
+ color: #ffffff;
465
+ }
463
466
  #header h1 a { color: #ffffff; }
464
467
  #main .block .content { background: #ffffff; }
465
468
  #main .block .content h2 { font-weight: bold; }
@@ -52,6 +52,7 @@ body {
52
52
  #header {
53
53
  h1 {
54
54
  font-weight: bold;
55
+ color: #FFF;
55
56
 
56
57
  a {
57
58
  color: #FFF;
@@ -0,0 +1,13 @@
1
+ require "spec_helper"
2
+
3
+ describe Fume::Cancan do
4
+ before(:each) do
5
+ Fume::Cancan.try_enable
6
+ @controller_class = Class.new(ActionController::Base)
7
+ end
8
+
9
+ it "should add method to action controller base" do
10
+ @controller_class.methods.should be_include "authorize_namespace"
11
+ @controller_class.instance_methods.should be_include "authorize_namespace"
12
+ end
13
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 1
9
- version: 0.5.1
8
+ - 2
9
+ version: 0.5.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sunteya
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-15 00:00:00 +08:00
17
+ date: 2010-04-21 00:00:00 +08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -83,14 +83,28 @@ dependencies:
83
83
  segments:
84
84
  - 0
85
85
  - 9
86
- - 7
87
- version: 0.9.7
86
+ - 8
87
+ version: 0.9.8
88
88
  type: :development
89
89
  version_requirements: *id005
90
90
  - !ruby/object:Gem::Dependency
91
- name: rspec
91
+ name: cancan
92
92
  prerelease: false
93
93
  requirement: &id006 !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ segments:
98
+ - 1
99
+ - 1
100
+ - 1
101
+ version: 1.1.1
102
+ type: :development
103
+ version_requirements: *id006
104
+ - !ruby/object:Gem::Dependency
105
+ name: rspec
106
+ prerelease: false
107
+ requirement: &id007 !ruby/object:Gem::Requirement
94
108
  requirements:
95
109
  - - ">="
96
110
  - !ruby/object:Gem::Version
@@ -100,7 +114,7 @@ dependencies:
100
114
  - 0
101
115
  version: 1.3.0
102
116
  type: :development
103
- version_requirements: *id006
117
+ version_requirements: *id007
104
118
  description:
105
119
  email: Sunteya@gmail.com
106
120
  executables: []
@@ -118,6 +132,7 @@ files:
118
132
  - fume.gemspec
119
133
  - lib/fume.rb
120
134
  - lib/fume/authlogic.rb
135
+ - lib/fume/cancan.rb
121
136
  - lib/fume/daemon.rb
122
137
  - lib/fume/formtastic.rb
123
138
  - lib/fume/logger_support.rb
@@ -165,6 +180,7 @@ files:
165
180
  - rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery.ba-bbq-1.2.1.js
166
181
  - rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery.corner-2.09.js
167
182
  - rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery.timepicker-0.2.1.js
183
+ - spec/fume/cancan_spec.rb
168
184
  - spec/fume/daemon_spec.rb
169
185
  - spec/fume/logger_support_spec.rb
170
186
  - spec/fume/smart_logger_spec.rb
@@ -202,6 +218,7 @@ signing_key:
202
218
  specification_version: 3
203
219
  summary: a simple rails scaffold.
204
220
  test_files:
221
+ - spec/fume/cancan_spec.rb
205
222
  - spec/fume/daemon_spec.rb
206
223
  - spec/fume/logger_support_spec.rb
207
224
  - spec/fume/smart_logger_spec.rb