cancan-rest-links 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +7 -5
- data/VERSION +1 -1
- data/cancan-rest-links.gemspec +76 -0
- data/lib/cancan-rest-links.rb +2 -0
- data/lib/cancan-rest-links/helpers/rest_links.rb +4 -3
- data/lib/cancan-rest-links/rails/configure.rb +2 -2
- data/log/development.log +0 -0
- data/spec/cancan-rest-links/link_helpers_spec.rb +1 -1
- data/spec/cancan-rest-links/rails/configure_spec.rb +8 -1
- data/spec/spec_helper.rb +2 -2
- metadata +49 -13
data/Rakefile
CHANGED
@@ -7,11 +7,13 @@ begin
|
|
7
7
|
gem.email = "kmandrup@gmail.com"
|
8
8
|
gem.homepage = "http://github.com/kristianmandrup/cancan-rest-links"
|
9
9
|
gem.authors = ["Kristian Mandrup"]
|
10
|
-
gem.add_development_dependency "rspec",
|
11
|
-
gem.
|
12
|
-
|
13
|
-
gem.add_dependency '
|
14
|
-
|
10
|
+
gem.add_development_dependency "rspec", "~> 2.0.0.beta.22"
|
11
|
+
gem.add_development_dependency "rspec-action_view", "~> 0.3.1"
|
12
|
+
|
13
|
+
gem.add_dependency 'cancan', "~> 1.3"
|
14
|
+
gem.add_dependency 'require_all', "~> 1.1.0"
|
15
|
+
gem.add_dependency 'sugar-high', "~> 0.2.10"
|
16
|
+
gem.add_dependency 'r3_plugin_toolbox', "~> 0.3.6"
|
15
17
|
end
|
16
18
|
Jeweler::GemcutterTasks.new
|
17
19
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{cancan-rest-links}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Kristian Mandrup"]
|
12
|
+
s.date = %q{2010-09-19}
|
13
|
+
s.description = %q{Guard your links with permissions}
|
14
|
+
s.email = %q{kmandrup@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
".rspec",
|
23
|
+
"LICENSE",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"cancan-rest-links.gemspec",
|
28
|
+
"lib/cancan-rest-links.rb",
|
29
|
+
"lib/cancan-rest-links/helpers/rest_links.rb",
|
30
|
+
"lib/cancan-rest-links/namespaces.rb",
|
31
|
+
"lib/cancan-rest-links/rails/configure.rb",
|
32
|
+
"log/development.log",
|
33
|
+
"spec/cancan-rest-links/link_helpers_spec.rb",
|
34
|
+
"spec/cancan-rest-links/rails/configure_spec.rb",
|
35
|
+
"spec/spec_helper.rb"
|
36
|
+
]
|
37
|
+
s.homepage = %q{http://github.com/kristianmandrup/cancan-rest-links}
|
38
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
39
|
+
s.require_paths = ["lib"]
|
40
|
+
s.rubygems_version = %q{1.3.7}
|
41
|
+
s.summary = %q{Rest link helpers for CanCan}
|
42
|
+
s.test_files = [
|
43
|
+
"spec/cancan-rest-links/link_helpers_spec.rb",
|
44
|
+
"spec/cancan-rest-links/rails/configure_spec.rb",
|
45
|
+
"spec/spec_helper.rb"
|
46
|
+
]
|
47
|
+
|
48
|
+
if s.respond_to? :specification_version then
|
49
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
50
|
+
s.specification_version = 3
|
51
|
+
|
52
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
|
54
|
+
s.add_development_dependency(%q<rspec-action_view>, ["~> 0.3.1"])
|
55
|
+
s.add_runtime_dependency(%q<cancan>, ["~> 1.3"])
|
56
|
+
s.add_runtime_dependency(%q<require_all>, ["~> 1.1.0"])
|
57
|
+
s.add_runtime_dependency(%q<sugar-high>, ["~> 0.2.10"])
|
58
|
+
s.add_runtime_dependency(%q<r3_plugin_toolbox>, ["~> 0.3.6"])
|
59
|
+
else
|
60
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
|
61
|
+
s.add_dependency(%q<rspec-action_view>, ["~> 0.3.1"])
|
62
|
+
s.add_dependency(%q<cancan>, ["~> 1.3"])
|
63
|
+
s.add_dependency(%q<require_all>, ["~> 1.1.0"])
|
64
|
+
s.add_dependency(%q<sugar-high>, ["~> 0.2.10"])
|
65
|
+
s.add_dependency(%q<r3_plugin_toolbox>, ["~> 0.3.6"])
|
66
|
+
end
|
67
|
+
else
|
68
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
|
69
|
+
s.add_dependency(%q<rspec-action_view>, ["~> 0.3.1"])
|
70
|
+
s.add_dependency(%q<cancan>, ["~> 1.3"])
|
71
|
+
s.add_dependency(%q<require_all>, ["~> 1.1.0"])
|
72
|
+
s.add_dependency(%q<sugar-high>, ["~> 0.2.10"])
|
73
|
+
s.add_dependency(%q<r3_plugin_toolbox>, ["~> 0.3.6"])
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
data/lib/cancan-rest-links.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module CanCan::Link
|
2
2
|
module Rest
|
3
|
+
include Rails3::Assist::BaseHelper
|
4
|
+
|
3
5
|
def index_link(object, label = nil)
|
4
6
|
label ||= auth_labels[:index]
|
5
7
|
obj = index_obj(object)
|
@@ -21,9 +23,8 @@ module CanCan::Link
|
|
21
23
|
|
22
24
|
def create_link(object, label = nil)
|
23
25
|
label ||= auth_labels[:new]
|
24
|
-
|
25
|
-
|
26
|
-
link = link_to(label, [:new, object.name.underscore.to_sym]) if can?(:create, object)
|
26
|
+
path = send :"new_#{object.class.to_s.downcase}_path"
|
27
|
+
link = link_to(label, path) if can?(:create, object)
|
27
28
|
end
|
28
29
|
|
29
30
|
def edit_link(object, label = nil)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'active_support/railtie'
|
2
|
-
require '
|
2
|
+
require 'r3_plugin_toolbox'
|
3
3
|
|
4
|
-
Rails3::
|
4
|
+
Rails3::Plugin::Extender.new do
|
5
5
|
# extend action_view with methods from some modules
|
6
6
|
extend_rails :view do
|
7
7
|
extend_with CanCan::Link::Rest
|
data/log/development.log
ADDED
File without changes
|
@@ -1,10 +1,17 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'cancan-rest-links/rails/configure'
|
3
3
|
|
4
|
+
module Minimal
|
5
|
+
class Application < Rails::Application
|
6
|
+
config.active_support.deprecation = :log
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
|
4
11
|
describe 'CanCan REST Links rails View extension' do
|
5
12
|
it "should extend Action View with REST Link helpers" do
|
6
13
|
after_init :view do
|
7
|
-
:view.should be_extended_with CanCan::
|
14
|
+
:view.should be_extended_with CanCan::Link::Rest
|
8
15
|
end
|
9
16
|
|
10
17
|
init_app_railties :minimal, :view
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kristian Mandrup
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-09-
|
17
|
+
date: 2010-09-19 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -29,13 +29,30 @@ dependencies:
|
|
29
29
|
- 2
|
30
30
|
- 0
|
31
31
|
- 0
|
32
|
-
|
32
|
+
- beta
|
33
|
+
- 22
|
34
|
+
version: 2.0.0.beta.22
|
33
35
|
type: :development
|
34
36
|
version_requirements: *id001
|
35
37
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
38
|
+
name: rspec-action_view
|
37
39
|
prerelease: false
|
38
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
- 3
|
48
|
+
- 1
|
49
|
+
version: 0.3.1
|
50
|
+
type: :development
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: cancan
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
39
56
|
none: false
|
40
57
|
requirements:
|
41
58
|
- - ~>
|
@@ -45,11 +62,11 @@ dependencies:
|
|
45
62
|
- 3
|
46
63
|
version: "1.3"
|
47
64
|
type: :runtime
|
48
|
-
version_requirements: *
|
65
|
+
version_requirements: *id003
|
49
66
|
- !ruby/object:Gem::Dependency
|
50
67
|
name: require_all
|
51
68
|
prerelease: false
|
52
|
-
requirement: &
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
53
70
|
none: false
|
54
71
|
requirements:
|
55
72
|
- - ~>
|
@@ -57,23 +74,40 @@ dependencies:
|
|
57
74
|
segments:
|
58
75
|
- 1
|
59
76
|
- 1
|
60
|
-
|
77
|
+
- 0
|
78
|
+
version: 1.1.0
|
61
79
|
type: :runtime
|
62
|
-
version_requirements: *
|
80
|
+
version_requirements: *id004
|
63
81
|
- !ruby/object:Gem::Dependency
|
64
82
|
name: sugar-high
|
65
83
|
prerelease: false
|
66
|
-
requirement: &
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
67
85
|
none: false
|
68
86
|
requirements:
|
69
87
|
- - ~>
|
70
88
|
- !ruby/object:Gem::Version
|
71
89
|
segments:
|
72
90
|
- 0
|
73
|
-
-
|
74
|
-
|
91
|
+
- 2
|
92
|
+
- 10
|
93
|
+
version: 0.2.10
|
75
94
|
type: :runtime
|
76
|
-
version_requirements: *
|
95
|
+
version_requirements: *id005
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: r3_plugin_toolbox
|
98
|
+
prerelease: false
|
99
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ~>
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
- 3
|
107
|
+
- 6
|
108
|
+
version: 0.3.6
|
109
|
+
type: :runtime
|
110
|
+
version_requirements: *id006
|
77
111
|
description: Guard your links with permissions
|
78
112
|
email: kmandrup@gmail.com
|
79
113
|
executables: []
|
@@ -91,10 +125,12 @@ files:
|
|
91
125
|
- README.rdoc
|
92
126
|
- Rakefile
|
93
127
|
- VERSION
|
128
|
+
- cancan-rest-links.gemspec
|
94
129
|
- lib/cancan-rest-links.rb
|
95
130
|
- lib/cancan-rest-links/helpers/rest_links.rb
|
96
131
|
- lib/cancan-rest-links/namespaces.rb
|
97
132
|
- lib/cancan-rest-links/rails/configure.rb
|
133
|
+
- log/development.log
|
98
134
|
- spec/cancan-rest-links/link_helpers_spec.rb
|
99
135
|
- spec/cancan-rest-links/rails/configure_spec.rb
|
100
136
|
- spec/spec_helper.rb
|