arpa 0.0.2 → 0.0.3
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 +12 -12
- data/lib/arpa.rb +1 -1
- data/lib/arpa/version.rb +1 -1
- data/lib/generators/{ar → arpa}/install_generator.rb +0 -0
- data/lib/generators/{ar → arpa}/templates/migration.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e57f3dc5e68514780add5b470969b9e0b9aae4c
|
4
|
+
data.tar.gz: e9b27144accd8a4674d3f54b11edb150d25234dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f23c79a7c2d75f4ef9079a7f95dddfbcd110616cd402fa2a942b962d50218ebaa84e117a106577ce3f5cd3f6ed84b7a91ca39d6d39e7932749e2aba5f9564883
|
7
|
+
data.tar.gz: e55e79c4a83003e099f62bc7f01abc0e56afe64cb0cfcef6044ca9eacc7a316e8b63389a748deb27c450ad692886f97659125cc62a6937015725c1b30ddf1d0d
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install arpa
|
20
20
|
|
21
|
-
After you install
|
21
|
+
After you install Arpa and add it to your Gemfile, you need to run the generator:
|
22
22
|
|
23
23
|
$ rails generate arpa:install
|
24
24
|
|
@@ -26,14 +26,14 @@ This command will create some files that are needed to run the Gem.
|
|
26
26
|
|
27
27
|
| File | Purpose |
|
28
28
|
|----------|:-------------:|
|
29
|
-
| db/migrate/20140120201010_create_arpa_tables.rb | Migration to create the all **
|
30
|
-
| config/locales/arpa.en.yml | Locales to use in
|
31
|
-
| app/assets/stylesheets/arpa/arpa_accordion.scss | Basic stylesheet to use with
|
29
|
+
| db/migrate/20140120201010_create_arpa_tables.rb | Migration to create the all **Arpa** tables in your database (your name will include a different timestamp) |
|
30
|
+
| config/locales/arpa.en.yml | Locales to use in Arpa classes |
|
31
|
+
| app/assets/stylesheets/arpa/arpa_accordion.scss | Basic stylesheet to use with Arpa views |
|
32
32
|
| app/controllers/arpa/resources_controller.rb app/controllers/arpa/roles_controller.rb app/controllers/arpa/profiles_controller.rb | Controllers to use the CRUD actions for each one |
|
33
33
|
| app/views/arpa/resources/ app/controllers/arpa/roles/ app/controllers/arpa/profiles/ | All views to use the CRUD actions for each controller above |
|
34
|
-
| config/routes.rb | Will add all routes into this file with all resources of
|
34
|
+
| config/routes.rb | Will add all routes into this file with all resources of Arpa |
|
35
35
|
|
36
|
-
After generate, you need to run the migration to create all
|
36
|
+
After generate, you need to run the migration to create all Arpa tables:
|
37
37
|
|
38
38
|
$ rake db:migrate
|
39
39
|
|
@@ -41,7 +41,7 @@ After generate, you need to run the migration to create all Ar tables:
|
|
41
41
|
|
42
42
|
## Usage
|
43
43
|
|
44
|
-
First of all you must create the Resources, Roles and Profiles (each is avaliable in the paths listed above). After that you need associate **Profiles** with **User** (to do this, you need create by your own the associate form view, saving some profiles in some user). Done that you can use some Helpers generated by
|
44
|
+
First of all you must create the Resources, Roles and Profiles (each is avaliable in the paths listed above). After that you need associate **Profiles** with **User** (to do this, you need create by your own the associate form view, saving some profiles in some user). Done that you can use some Helpers generated by Arpa.
|
45
45
|
|
46
46
|
### Association between Profiles and Users
|
47
47
|
|
@@ -51,14 +51,14 @@ You just add a HBTM association in User model:
|
|
51
51
|
|
52
52
|
```ruby
|
53
53
|
class User < ActiveRecord::Base
|
54
|
-
has_and_belongs_to_many :profiles, class_name: '
|
54
|
+
has_and_belongs_to_many :profiles, class_name: 'Arpa::Repositories::Profiles::RepositoryProfile'
|
55
55
|
end
|
56
56
|
```
|
57
57
|
With this you will be able to use the :profile_ids method.
|
58
58
|
|
59
59
|
### Controller helpers
|
60
60
|
|
61
|
-
|
61
|
+
Arpa will create some helpers to use inside your controllers and views.
|
62
62
|
|
63
63
|
To verify if a user has access to some :controler and :action, use the following helper:
|
64
64
|
|
@@ -68,12 +68,12 @@ has_access?('users', 'index')
|
|
68
68
|
**Obs.:** To that helper method works. You must have **:session** (In Rails app already has) and **:current_user** attribute or method.
|
69
69
|
|
70
70
|
---
|
71
|
-
If you want use that method inside another object you should use the **
|
71
|
+
If you want use that method inside another object you should use the **Arpa::Services::Verifier** class;
|
72
72
|
|
73
73
|
You just need pass as arguments the :session and :current_user:
|
74
74
|
|
75
75
|
```ruby
|
76
|
-
verifier =
|
76
|
+
verifier = Arpa::Services::Verifier.new(session, current_user)
|
77
77
|
verifier.has_access?('users', 'index')
|
78
78
|
```
|
79
79
|
|
@@ -96,7 +96,7 @@ class ApplicationController < ActionController::Base
|
|
96
96
|
end
|
97
97
|
```
|
98
98
|
|
99
|
-
**Obs.:** The **has_access?** method come from Controller Helper method which
|
99
|
+
**Obs.:** The **has_access?** method come from Controller Helper method which Arpa gem has been created.
|
100
100
|
|
101
101
|
|
102
102
|
## Information
|
data/lib/arpa.rb
CHANGED
data/lib/arpa/version.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arpa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rachid Calazans
|
@@ -245,8 +245,8 @@ files:
|
|
245
245
|
- lib/arpa/views/roles/new.html.erb
|
246
246
|
- lib/arpa/views/roles/show.html.erb
|
247
247
|
- lib/config/locales/arpa.en.yml
|
248
|
-
- lib/generators/
|
249
|
-
- lib/generators/
|
248
|
+
- lib/generators/arpa/install_generator.rb
|
249
|
+
- lib/generators/arpa/templates/migration.rb
|
250
250
|
- spec/factories/repository_actions.rb
|
251
251
|
- spec/factories/repository_profiles.rb
|
252
252
|
- spec/factories/repository_resources.rb
|