guachiman-rails 1.0.2 → 1.1.0
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.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/generators/guachiman/install/install_generator.rb +3 -3
- data/lib/guachiman/rails/authorizable.rb +1 -1
- data/lib/guachiman/rails/railtie.rb +1 -1
- data/lib/guachiman/rails/version.rb +1 -1
- data/lib/guachiman-rails.rb +4 -4
- data/test/generators/install_generator_test.rb +9 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e0ad3b3545e4f9d8db485c329053e8bc413a861
|
4
|
+
data.tar.gz: 8c0b23aea7bd7d56cbb51c524f6dee2c47a86af1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09d638622867ae6486d6cc56fa7acf72e3115c0420ec56d9fed4b00d0f82c4933a727d3644a9fa2f4ddcb777ed73462b35542ce5ffafca15e10f3cfd3ef97c7f
|
7
|
+
data.tar.gz: f8c04739b2574a3cd88a9373bb22332de9858d69c5072ebd0bb18d92ce4ac38731047ab984bfdc032e2d7c52c7215b3dda51fb9089802c4d6bd514a1acab0d33
|
data/README.md
CHANGED
@@ -35,7 +35,7 @@ $ gem install guachiman-rails
|
|
35
35
|
Upgrade Notice
|
36
36
|
--------------
|
37
37
|
|
38
|
-
**Version 1.0.0 is incompatible with version
|
38
|
+
**Version `>= 1.0.0` is incompatible with version `=< 0.3.2`.**
|
39
39
|
|
40
40
|
Usage
|
41
41
|
-----
|
@@ -44,7 +44,8 @@ Run `rails g guachiman:install`
|
|
44
44
|
|
45
45
|
This will generate a `authorization.rb` file in `app/models`.
|
46
46
|
|
47
|
-
Include `Guachiman::Authorizable` in `ApplicationController` and implement a
|
47
|
+
Include `Guachiman::Authorizable` in `ApplicationController` and optionally implement a
|
48
|
+
`current_user` method there (it defaults to `nil`).
|
48
49
|
|
49
50
|
```ruby
|
50
51
|
# app/controllers/application_controller.rb
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module Guachiman
|
2
2
|
module Generators
|
3
3
|
class InstallGenerator < ::Rails::Generators::Base
|
4
|
-
desc
|
5
|
-
source_root File.expand_path
|
4
|
+
desc "Create Authorization model"
|
5
|
+
source_root File.expand_path("../templates", __FILE__)
|
6
6
|
|
7
7
|
def copy_authorization_model
|
8
|
-
template
|
8
|
+
template("authorization.rb", "app/models/authorization.rb")
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/lib/guachiman-rails.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "guachiman"
|
2
|
+
require "guachiman/rails/version"
|
3
|
+
require "guachiman/rails/railtie"
|
4
|
+
require "guachiman/rails/authorizable"
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "test_helper"
|
2
|
+
require "rails/generators/test_case"
|
3
|
+
require "generators/guachiman/install/install_generator"
|
4
4
|
|
5
5
|
class InstallGeneratorTest < Rails::Generators::TestCase
|
6
|
-
DESTINATION = File.expand_path File.join(File.dirname(__FILE__),
|
6
|
+
DESTINATION = File.expand_path File.join(File.dirname(__FILE__), "..", "..", "tmp")
|
7
7
|
FileUtils.mkdir_p(DESTINATION) unless Dir.exist?(DESTINATION)
|
8
8
|
|
9
9
|
destination DESTINATION
|
@@ -12,17 +12,17 @@ class InstallGeneratorTest < Rails::Generators::TestCase
|
|
12
12
|
setup :prepare_destination
|
13
13
|
|
14
14
|
def prepare_destination
|
15
|
-
if Dir.
|
16
|
-
FileUtils.rm_r
|
15
|
+
if Dir.exist?("#{ DESTINATION }/app")
|
16
|
+
FileUtils.rm_r("#{ DESTINATION }/app")
|
17
17
|
end
|
18
18
|
|
19
|
-
FileUtils.mkdir_p
|
19
|
+
FileUtils.mkdir_p("#{ DESTINATION }/app/models")
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
def test_create_authorization_model
|
23
23
|
run_generator
|
24
24
|
|
25
|
-
assert_file
|
25
|
+
assert_file "app/models/authorization.rb" do |f|
|
26
26
|
assert_match(/include Guachiman/, f)
|
27
27
|
end
|
28
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guachiman-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francesco Rodriguez
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-07-
|
12
|
+
date: 2014-07-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guachiman
|