activeadmin-therole 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b7dd6cdda383477748a718518f8669618345731a
4
+ data.tar.gz: 67ae025974368a363c7f8484811ec10b57ce44a6
5
+ SHA512:
6
+ metadata.gz: 115b365d27c3d4663b48661ef5b1b0e7c5324a2f1bf03123ce4bcbf7aaefd11636f5d268c76a209dd4181467c88c930ff568505e37aeec8e08ce101b734df668
7
+ data.tar.gz: 4996b8e018a83dd8adb0f528aa934368f7b127a27c7956e986034e51cb8f3900af6f0d62a5ecfb07c7fbf1eec67cbcd99e647d84eeab81a35d06d96705db8aea
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in activeadmin-therole.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 daanforever
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Activeadmin-TheRole
2
+
3
+ Pre-alpha version.
4
+ It is strongly recommended not to use yet.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'activeadmin', github: 'gregbell/active_admin', branch: 'rails4'
11
+ gem 'activeadmin-therole'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+ $ rails g activeadmin_therole:install
17
+
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task :default => :spec
7
+ task :test => :spec
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'activeadmin-therole/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "activeadmin-therole"
8
+ spec.version = ActiveadminTheRole::VERSION
9
+ spec.authors = ["daanforever"]
10
+ spec.email = ["daan.forever@gmail.com"]
11
+ spec.description = "ActiveAdmin and TheRole integration"
12
+ spec.summary = "Provides ActiveAdmin and TheRole integration"
13
+ spec.homepage = "https://github.com/daanforever/activeadmin-therole"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "rails", ">= 4.0.0"
22
+ spec.add_dependency "the_role", ">= 2.1.0"
23
+ # spec.add_dependency "activeadmin", ">= 0.6.0"
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.3"
26
+ spec.add_development_dependency "rake"
27
+ spec.add_development_dependency "rspec", "~> 2.14.1"
28
+ spec.add_development_dependency "factory_girl"
29
+ spec.add_development_dependency "shoulda"
30
+
31
+ end
@@ -0,0 +1,3 @@
1
+ module ActiveadminTheRole
2
+ VERSION = "0.0.4"
3
+ end
@@ -0,0 +1,5 @@
1
+ require "activeadmin-therole/version"
2
+
3
+ module ActiveadminTheRole
4
+ # Your code goes here...
5
+ end
File without changes
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate install Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,61 @@
1
+ module ActiveadminTherole
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ include Rails::Generators::Migration
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ def self.next_migration_number(dirname)
8
+ orm = Rails.configuration.generators.options[:rails][:orm]
9
+ require "rails/generators/#{orm}"
10
+ "#{orm.to_s.camelize}::Generators::Base".constantize.next_migration_number(dirname)
11
+ end
12
+
13
+ # Action: generate active_admin:install
14
+ def activeadmin_install
15
+ if File.exists?(File.join(destination_root, "config", "initializers", "active_admin.rb"))
16
+ log :generate, "No need to install ActiveAdmin, already done."
17
+ else
18
+ generate "active_admin:install"
19
+ end
20
+ end
21
+
22
+ # Action: generate devise User
23
+ def user_model_create
24
+ if File.exists?(File.join(destination_root, "app", "models", "user.rb"))
25
+ log :generate, "No need to create User model, already done."
26
+ else
27
+ generate "devise", "User"
28
+ end
29
+ end
30
+
31
+ # Action: generate the_role install
32
+ def therole_install
33
+ if File.exists?(File.join(destination_root, "config", "initializers", "the_role.rb"))
34
+ log :generate, "No need to install TheRole, already done."
35
+ else
36
+ generate "the_role", "install"
37
+ rake "the_role_engine:install:migrations"
38
+ migration_template 'db/migrate/add_role_id_to_user.rb', 'db/migrate/add_role_id_to_user.rb'
39
+ inject_into_file File.join(destination_root, "app", "models", "user.rb"), "\n\tinclude TheRoleUserModel\n\n", after: "class User < ActiveRecord::Base\n"
40
+ rake "db:migrate" if ActiveRecord::Migrator.needs_migration?
41
+ generate "the_role", "admin"
42
+ end
43
+ end
44
+
45
+ def invoke_db_migrate
46
+ rake "db:migrate" if ActiveRecord::Migrator.needs_migration?
47
+ end
48
+
49
+ # Execute all steps for Devise, ActiveAdmin and TheRole
50
+ def install
51
+ if File.exists?(File.join(destination_root, "app", "admin", "roles.rb"))
52
+ log :generate, "No need to copy admin/roles.rb, already done."
53
+ else
54
+ # copy our section
55
+ copy_file "app/admin/roles.rb", "app/admin/roles.rb"
56
+ end
57
+ end
58
+
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,62 @@
1
+ ActiveAdmin.register Role do
2
+
3
+ config.filters = false
4
+
5
+ index :download_links => false do
6
+ column :name
7
+ column :title
8
+ column :description
9
+ default_actions
10
+ end
11
+
12
+ form do |f|
13
+ f.inputs "Roles Details" do
14
+ f.input :name, required: true
15
+ f.input :title, required: false
16
+ f.input :description, required: false
17
+ end
18
+ f.actions
19
+ end
20
+ end
21
+
22
+ ActiveAdmin.register User do
23
+
24
+ filter :email
25
+
26
+ index :download_links => false do
27
+ column :email
28
+ column :role
29
+ column :last_sign_in_at
30
+ default_actions
31
+ end
32
+
33
+ form do |f|
34
+ f.inputs "Users Details" do
35
+ f.input :email, required: true
36
+ f.input :password, required: true
37
+ f.input :password_confirmation, required: true
38
+ f.input :role, as: :select, collection: Role.all, required: true
39
+ end
40
+ f.actions
41
+ end
42
+
43
+ show do
44
+ attributes_table do
45
+ row :email
46
+ row :id
47
+ row :role
48
+ row :sign_in_count
49
+ row :current_sign_in_at
50
+ row :current_sign_in_ip
51
+ row :last_sign_in_at
52
+ row :last_sign_in_ip
53
+ end
54
+ end
55
+
56
+ controller do
57
+ def permitted_params
58
+ params.permit :utf8, :authenticity_token, :commit, user: [:email, :password, :password_confirmation, :role_id]
59
+ end
60
+ end
61
+
62
+ end
@@ -0,0 +1,5 @@
1
+ class AddRoleIdToUser < ActiveRecord::Migration
2
+ def change
3
+ add_column :users, :role_id, :integer
4
+ end
5
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'InstallGenerator' do
4
+ it { should be }
5
+ end
@@ -0,0 +1,21 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+
8
+ require 'rubygems'
9
+ require 'bundler/setup'
10
+
11
+ RSpec.configure do |config|
12
+ config.treat_symbols_as_metadata_keys_with_true_values = true
13
+ config.run_all_when_everything_filtered = true
14
+ config.filter_run :focus
15
+
16
+ # Run specs in random order to surface order dependencies. If you find an
17
+ # order dependency and want to debug it, you can fix the order by providing
18
+ # the seed, which is printed after each run.
19
+ # --seed 1234
20
+ config.order = 'random'
21
+ end
metadata ADDED
@@ -0,0 +1,175 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activeadmin-therole
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - daanforever
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: the_role
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 2.1.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 2.1.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 2.14.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 2.14.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: factory_girl
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: shoulda
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: ActiveAdmin and TheRole integration
112
+ email:
113
+ - daan.forever@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gitignore
119
+ - .rspec
120
+ - Gemfile
121
+ - LICENSE.txt
122
+ - README.md
123
+ - Rakefile
124
+ - activeadmin-therole.gemspec
125
+ - lib/activeadmin-therole/version.rb
126
+ - lib/activeadmin_the_role.rb
127
+ - lib/generators/.keep
128
+ - lib/generators/activeadmin_therole/.keep
129
+ - lib/generators/activeadmin_therole/install/USAGE
130
+ - lib/generators/activeadmin_therole/install/install_generator.rb
131
+ - lib/generators/activeadmin_therole/install/templates/.keep
132
+ - lib/generators/activeadmin_therole/install/templates/app/.keep
133
+ - lib/generators/activeadmin_therole/install/templates/app/admin/.keep
134
+ - lib/generators/activeadmin_therole/install/templates/app/admin/roles.rb
135
+ - lib/generators/activeadmin_therole/install/templates/db/.keep
136
+ - lib/generators/activeadmin_therole/install/templates/db/migrate/.keep
137
+ - lib/generators/activeadmin_therole/install/templates/db/migrate/add_role_id_to_user.rb
138
+ - lib/tasks/.keep
139
+ - spec/lib/.keep
140
+ - spec/lib/generators/.keep
141
+ - spec/lib/generators/activeadmin_therole/.keep
142
+ - spec/lib/generators/activeadmin_therole/install/.keep
143
+ - spec/lib/generators/activeadmin_therole/install/install_generator_spec.rb
144
+ - spec/spec_helper.rb
145
+ homepage: https://github.com/daanforever/activeadmin-therole
146
+ licenses:
147
+ - MIT
148
+ metadata: {}
149
+ post_install_message:
150
+ rdoc_options: []
151
+ require_paths:
152
+ - lib
153
+ required_ruby_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ required_rubygems_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - '>='
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ requirements: []
164
+ rubyforge_project:
165
+ rubygems_version: 2.0.3
166
+ signing_key:
167
+ specification_version: 4
168
+ summary: Provides ActiveAdmin and TheRole integration
169
+ test_files:
170
+ - spec/lib/.keep
171
+ - spec/lib/generators/.keep
172
+ - spec/lib/generators/activeadmin_therole/.keep
173
+ - spec/lib/generators/activeadmin_therole/install/.keep
174
+ - spec/lib/generators/activeadmin_therole/install/install_generator_spec.rb
175
+ - spec/spec_helper.rb