I can see you're working hard on Cream since you just released cream-0.8.7.
I am curious about what development environment you use? You have
released several versions of Cream that you say work for you, yet I keep
getting errors when I run it. I want to know why so I can get to the
bottom of all of this.
I am using Ubuntu 9.10 with ruby-1.9.2-p136.
I just tried a full config and got the output below. I looked into it a
little and the immediate cause is that
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/cream-0.8.7/lib/generators/devise/users/helper.rb
at line 11, in `inherit_model' winds up capitalizing the file name of
editor.rb which it then can't find because the filename is lowercase. I
tried changing this line, and that problem went away, but other problems
then cropped up.
The roles stuff still seems to have a problem finding the User model
even though the model is there. I don't know why.
-- Will
====================================================
will@silver:~/rails/cream_app$ rails g cream:full_config --strategy
role_string --roles user editor
[Rails3::Assist::Logging]
Generate Cream locale files
create config/locales/cream.en.yml
create config/locales/cream.da.yml
rails g cream:app --orm active_record
run rails g cream:app --orm active_record from "."
[Rails3::Assist::Logging]
insert_flash_displayer: alert
insert_flash_displayer: notice
rails g devise:config User --orm active_record
run rails g devise:config User --orm active_record from "."
Configuring devise gems for orm: active_record
[Rails3::Assist::Logging]
gem: devise already in Gemfile
Configuring for Active Record
run bundle install from "."
<<<< snip >>>>>
Configure Devise Users
rails g devise User
run rails g devise User from "."
invoke active_record
create app/models/user.rb
invoke test_unit
create test/unit/user_test.rb
create test/fixtures/users.yml
create db/migrate/20110109031043_devise_create_users.rb
insert app/models/user.rb
route devise_for :users
create_user: editor
rails g devise editor
run rails g devise editor from "."
invoke active_record
create app/models/editor.rb
invoke test_unit
create test/unit/editor_test.rb
create test/fixtures/editors.yml
create db/migrate/20110109031055_devise_create_editors.rb
insert app/models/editor.rb
route devise_for :editors
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/sugar-high-0.3.3/lib/sugar-high/file.rb:61:in
`read': No such file or directory -
/home/will/rails/cream_app/app/models/Editor.rb (Errno::ENOENT)
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/sugar-high-0.3.3/lib/sugar-high/file.rb:61:in
`replace_content_from'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/cream-0.8.7/lib/generators/devise/users/helper.rb:11:in
`inherit_model'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/cream-0.8.7/lib/generators/devise/users/users_generator.rb:77:in
`create_user'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/cream-0.8.7/lib/generators/devise/users/users_generator.rb:48:in
`block in configure_devise_users'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/cream-0.8.7/lib/generators/devise/users/users_generator.rb:47:in
`each'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/cream-0.8.7/lib/generators/devise/users/users_generator.rb:47:in
`configure_devise_users'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/thor-0.14.6/lib/thor/task.rb:22:in
`run'
Wow, that is curious, I never had any problems with the framework not finding files because of lower/uppercase naming problems in my environment (Mac OSX 10.6).
I will release a new version shortly which fixes this problem, which I assume is Linux/Unix related and not a problem on Windows or Mac OS?
That should resolve all your troubles for now I hope... ;)
You may also debug and solve those problems in your own environment (on your own clones repo) and then make a pull-request and I will integrate it into master.
Thanks!
Kristian
Please try the latest Cream and Roles AR directly from master on my github. Hope the latest commits solves your problems with filenames ;)
Kristian
On Jan 9, 2011, at 4:37 AM, Will Merrell wrote:
Well, it looks like the filename issue is fine now, but it's not quite
there yet. Below is a complete run output for the latest try.
There are a couple of things to notice in this:
1) The error message:
[WARNING] You provided devise_for :editors but there is no model
Editor defined in your application
is because for some reason the Editor class defined in editor.rb does
not inherit from User as it should. That section of code that is
supposed to insert it into the file did not do so. Since it did not
raise an error, I don't know why it failed.
2) I notice that in the bundle install that I did before running the
generator, the cream gem and the roles_active_record gem both load from
source as follows:
Using cream (0.8.7) from source at /home/will/rails/cream
Using roles_active_record (0.4.4) from source at
/home/will/rails/roles_active_record
but in the bundle installs that occur as part of the generation they do
not appear to do so. I am not sure why that would be since the gemfile
should be the same. I wonder if this is causing some problems.
3) You will notice that the following line:
rails g active_record:roles User --strategy role_string --roles user
editor guest admin --default-roles
raises an error. I don't know what that is all about, but I have seen it
several times before when I have mentioned that roles stuff does not
seem to work properly.
4) Just after 3) is this line:
/home/will/rails/cream/lib/generators/roles/config/config_generator.rb:98:in
`user_exist_check': ERROR: User model missing. Please create a User
model before running this generator (RuntimeError)
I can't quite tell if this is part of 3) or a separate problem, but
there certainly is a User model and it looks right although it is
unmodified from what the devise user command creates. I don't know if
the roles command is supposed to add anything to the User file. If it is
supposed to add anything, then it is failing to do so.
We do seem to be getting closer, and I really wonder why these issue do
not show up for you, but I cannot even comment on whether your design
choices are good or bad until I can get this to run so I can see what it
is supposed to do.
I have worked with Devise and Cancan before, and I am very curious to
see what your roles approach brings to this.
-- Will
==========================================================
will@silver:~/rails$ rails new cream_app
create
create README
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/mailers
create app/models
create app/views/layouts/application.html.erb
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create doc
create doc/README_FOR_APP
create lib
create lib/tasks
create lib/tasks/.gitkeep
create log
create log/server.log
create log/production.log
create log/development.log
create log/test.log
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/index.html
create public/robots.txt
create public/images
create public/images/rails.png
create public/stylesheets
create public/stylesheets/.gitkeep
create public/javascripts
create public/javascripts/application.js
create public/javascripts/controls.js
create public/javascripts/dragdrop.js
create public/javascripts/effects.js
create public/javascripts/prototype.js
create public/javascripts/rails.js
create script
create script/rails
create test
create test/fixtures
create test/functional
create test/integration
create test/performance/browsing_test.rb
create test/test_helper.rb
create test/unit
create tmp
create tmp/sessions
create tmp/sockets
create tmp/cache
create tmp/pids
create vendor/plugins
create vendor/plugins/.gitkeep
will@silver:~/rails$ cd cream_app/
will@silver:~/rails/cream_app$ bundle install
Fetching source index for http://rubygems.org/
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.23)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.14)
Using actionmailer (3.0.3)
Using arel (2.0.6)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bcrypt-ruby (2.1.4)
Using bundler (1.0.7)
Using cancan (1.4.1)
Using log4r (1.1.9)
Using require_all (1.2.0)
Using mocha (0.9.10)
Using sugar-high (0.3.3)
Using logging_assist (0.1.6)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Using migration_assist (0.1.8)
Using rails3_assist (0.3.7)
Using rspec-core (2.4.0)
Using diff-lcs (1.1.2)
Using rspec-expectations (2.4.0)
Using rspec-mocks (2.4.0)
Using rspec (2.4.0)
Using rails3_artifactor (0.3.2)
Using cancan-permits (0.3.9)
Using r3_plugin_toolbox (0.4.0)
Using cancan-rest-links (0.2.1)
Using colorize (0.5.8)
Using warden (1.0.3)
Using devise (1.1.5)
Using devise-links (0.2.1)
Using cream (0.8.7) from source at /home/will/rails/cream
Using meta_where (0.9.10)
Using roles_generic (0.3.6)
Using roles_active_record (0.4.4) from source at
/home/will/rails/roles_active_record
Using sqlite3-ruby (1.3.2)
Your bundle is complete! Use `bundle show [gemname]` to see where a
bundled gem is installed.
will@silver:~/rails/cream_app$ rails g cream:full_config -m --strategy
role_string --roles user editor
[Rails3::Assist::Logging]
Generate Cream locale files
create config/locales/cream.en.yml
create config/locales/cream.da.yml
rails g cream:app --orm active_record
run rails g cream:app --orm active_record from "."
[Rails3::Assist::Logging]
insert_flash_displayer: alert
insert_flash_displayer: notice
rails g devise:config User --orm active_record
run rails g devise:config User --orm active_record from "."
Configuring devise gems for orm: active_record
[Rails3::Assist::Logging]
gem: devise already in Gemfile
Configuring for Active Record
run bundle install from "."
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.23)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.14)
Using actionmailer (3.0.3)
Using arel (2.0.6)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bcrypt-ruby (2.1.4)
Using bundler (1.0.7)
Using cancan (1.4.1)
Using log4r (1.1.9)
Using require_all (1.2.0)
Using mocha (0.9.10)
Using sugar-high (0.3.3)
Using logging_assist (0.1.6)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Using migration_assist (0.1.8)
Using rails3_assist (0.3.7)
Using rspec-core (2.4.0)
Using diff-lcs (1.1.2)
Using rspec-expectations (2.4.0)
Using rspec-mocks (2.4.0)
Using rspec (2.4.0)
Using rails3_artifactor (0.3.2)
Using cancan-permits (0.3.9)
Using r3_plugin_toolbox (0.4.0)
Using cancan-rest-links (0.2.1)
Using colorize (0.5.8)
Using warden (1.0.3)
Using devise (1.1.5)
Using devise-links (0.2.1)
Using cream (0.8.7)
Using meta_where (0.9.10)
Using roles_generic (0.3.6)
Using roles_active_record (0.4.4)
Using sqlite3-ruby (1.3.2)
Your bundle is complete! Use `bundle show [gemname]` to see where a
bundled gem is installed.
initializers/devise.rb was NOT found so devise:install will now be run
rails g devise:install
run rails g devise:install from "."
create config/initializers/devise.rb
create config/locales/devise.en.yml
===============================================================================
Some setup you must do manually if you haven't yet:
1. Setup default url options for your specific environment. Here is an
example of development environment:
config.action_mailer.default_url_options = { :host =>
'localhost:3000' }
This is a required Rails configuration. In production it must be the
actual host of your application
2. Ensure you have defined root_url to *something* in your
config/routes.rb.
For example:
root :to => "home#index"
3. Ensure you have flash messages in
app/views/layouts/application.html.erb.
For example:
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
===============================================================================
Configuring: devise mailer
Configuring: devise authentication filter
rails g devise:users --orm active_record --roles user editor guest
admin --no-gems
run rails g devise:users --orm active_record --roles user
editor guest admin --no-gems from "."
[Rails3::Assist::Logging]
Configure Devise Users
rails g devise User
run rails g devise User from "."
invoke active_record
create app/models/user.rb
invoke test_unit
create test/unit/user_test.rb
create test/fixtures/users.yml
create db/migrate/20110109145743_devise_create_users.rb
insert app/models/user.rb
route devise_for :users
create_user: editor
rails g devise editor
run rails g devise editor from "."
invoke active_record
create app/models/editor.rb
invoke test_unit
create test/unit/editor_test.rb
create test/fixtures/editors.yml
create db/migrate/20110109145755_devise_create_editors.rb
insert app/models/editor.rb
route devise_for :editors
create_user: admin
rails g devise admin
run rails g devise admin from "."
[WARNING] You provided devise_for :editors but there is no model Editor
defined in your application
invoke active_record
create app/models/admin.rb
invoke test_unit
create test/unit/admin_test.rb
create test/fixtures/admins.yml
create db/migrate/20110109145806_devise_create_admins.rb
insert app/models/admin.rb
route devise_for :admins
Customize controller action if needed to render individual registration
form for each role
Example:
- routes.rb:
match "/editors/sign_up" => "user_registrations#new_editor", :as =>
:editor_signup
- user_registrations_controller.rb:
def new_editor
build_resource({})
end
Then create the registration form (view) for the :editor user in
'views/user_registrations/new_editor.html.erb'
See comments in routes.rb for more info. There is also a page on the
wiki about advanced routes customization.
Devise credentials not customized since --customize option was not used
to say so!
rails g cancan:config --orm active_record --no-gems
run rails g cancan:config --orm active_record --no-gems from "."
[WARNING] You provided devise_for :editors but there is no model Editor
defined in your application
[Rails3::Assist::Logging]
Insert cancan rescue statement into application controller
rails g roles:config User --orm active_record --roles user editor guest
admin --strategy role_string
run rails g roles:config User --orm active_record --roles user
editor guest admin --strategy role_string from "."
[WARNING] You provided devise_for :editors but there is no model Editor
defined in your application
[Rails3::Assist::Logging]
gem: roles_active_record already in Gemfile
run bundle install from "."
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.23)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.14)
Using actionmailer (3.0.3)
Using arel (2.0.6)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bcrypt-ruby (2.1.4)
Using bundler (1.0.7)
Using cancan (1.4.1)
Using log4r (1.1.9)
Using require_all (1.2.0)
Using mocha (0.9.10)
Using sugar-high (0.3.3)
Using logging_assist (0.1.6)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Using migration_assist (0.1.8)
Using rails3_assist (0.3.7)
Using rspec-core (2.4.0)
Using diff-lcs (1.1.2)
Using rspec-expectations (2.4.0)
Using rspec-mocks (2.4.0)
Using rspec (2.4.0)
Using rails3_artifactor (0.3.2)
Using cancan-permits (0.3.9)
Using r3_plugin_toolbox (0.4.0)
Using cancan-rest-links (0.2.1)
Using colorize (0.5.8)
Using warden (1.0.3)
Using devise (1.1.5)
Using devise-links (0.2.1)
Using cream (0.8.7)
Using meta_where (0.9.10)
Using roles_generic (0.3.6)
Using roles_active_record (0.4.4)
Using sqlite3-ruby (1.3.2)
Your bundle is complete! Use `bundle show [gemname]` to see where a
bundled gem is installed.
rails g active_record:roles User --strategy role_string --roles user
editor guest admin --default-roles
run rails g active_record:roles User --strategy role_string
--roles user editor guest admin --default-roles from "."
[WARNING] You provided devise_for :editors but there is no model Editor
defined in your application
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`require': no such file to load -- active_record/roles/core_ext (LoadError)
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`block in require'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in
`block in load_dependency'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in
`new_constants_in'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in
`load_dependency'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`require'
from
/home/will/rails/roles_active_record/lib/generators/active_record/roles/roles_generator.rb:3:in
`<top (required)>'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`require'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`block in require'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in
`block in load_dependency'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in
`new_constants_in'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in
`load_dependency'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`require'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/generators.rb:286:in
`block (2 levels) in lookup'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/generators.rb:282:in
`each'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/generators.rb:282:in
`block in lookup'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/generators.rb:281:in
`each'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/generators.rb:281:in
`lookup'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/generators.rb:141:in
`find_by_namespace'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/generators.rb:161:in
`invoke'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/commands/generate.rb:10:in
`<top (required)>'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`require'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`block in require'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in
`block in load_dependency'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in
`new_constants_in'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in
`load_dependency'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`require'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/commands.rb:17:in
`<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
/home/will/rails/cream/lib/generators/roles/config/config_generator.rb:98:in
`user_exist_check': ERROR: User model missing. Please create a User
model before running this generator (RuntimeError)
from
/home/will/rails/cream/lib/generators/roles/config/config_generator.rb:62:in
`set_valid_roles_cream'
from
/home/will/rails/cream/lib/generators/roles/config/config_generator.rb:39:in
`configure_roles'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/thor-0.14.6/lib/thor/task.rb:22:in
`run'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/thor-0.14.6/lib/thor/invocation.rb:118:in
`invoke_task'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
`block in invoke_all'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
`each'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
`map'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
`invoke_all'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/thor-0.14.6/lib/thor/group.rb:226:in
`dispatch'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/thor-0.14.6/lib/thor/base.rb:389:in
`start'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/generators.rb:163:in
`invoke'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/commands/generate.rb:10:in
`<top (required)>'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`require'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`block in require'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in
`block in load_dependency'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in
`new_constants_in'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in
`load_dependency'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`require'
from
/home/will/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/commands.rb:17:in
`<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
rails g permits:config --orm active_record --roles user editor guest
admin --no-gems
run rails g permits:config --orm active_record --roles user
editor guest admin --no-gems from "."
[WARNING] You provided devise_for :editors but there is no model Editor
defined in your application
[Rails3::Assist::Logging]
Configure Permits
rails g cancan:permits --roles user editor guest admin --orm active_record
run rails g cancan:permits --roles user editor guest admin
--orm active_record from "."
[WARNING] You provided devise_for :editors but there is no model Editor
defined in your application
create app/permits/guest_permit.rb
create app/permits/admin_permit.rb
create app/permits/any_permit.rb
create app/permits/system_permit.rb
rails g cancan:licenses
run rails g cancan:licenses from "."
[WARNING] You provided devise_for :editors but there is no model Editor
defined in your application
create app/licenses/user_admin_license.rb
create app/licenses/blogging_license.rb
will@silver:~/rails/cream_app$
By the way, I have yet to see any evidence that the -m argument does
anything. Runs that I have done with and without this flag appear to be
identical, and in all cases, if I run rake db:migrate afterwards, it
runs all of the migrations at that time.
Hope that helps,
-- Will
I fixed a few bugs/issues you mentioned. I also discovered that the guard code for autorunning migrations was outdated. Should work now ;)
Here is my latest run:
$ rails g cream:full_config --user-class User --roles editor publisher
[Rails3::Assist::Logging]
Generate Cream locale files
identical config/locales/cream.en.yml
identical config/locales/cream.da.yml
rails g cream:app --orm active_record
run rails g cream:app --orm active_record from "."
rails g devise:config User --orm active_record
run rails g devise:config User --orm active_record from "."
Configuring devise gems for orm: active_record
[Rails3::Assist::Logging]
gem: devise already in Gemfile
Configuring for Active Record
run bundle install from "."
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.23)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.14)
Using actionmailer (3.0.3)
Using arel (2.0.6)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bcrypt-ruby (2.1.4)
Using bundler (1.0.7)
Using cancan (1.4.1)
Using colorize (0.5.8)
Using thrift (0.5.0)
Using thrift_client (0.6.0)
Using scribe (0.2.2)
Using log4r (1.1.11)
Using require_all (1.2.0)
Using mocha (0.9.10)
Using sugar-high (0.3.3)
Using logging_assist (0.1.6)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Using migration_assist (0.1.8)
Using rails3_assist (0.3.7)
Using rspec-core (2.4.0)
Using diff-lcs (1.1.2)
Using rspec-expectations (2.4.0)
Using rspec-mocks (2.4.0)
Using rspec (2.4.0)
Using rails3_artifactor (0.3.2)
Using cancan-permits (0.3.9)
Using r3_plugin_toolbox (0.4.0)
Using cancan-rest-links (0.2.1)
Using warden (1.0.3)
Using devise (1.1.5)
Using devise-links (0.2.1)
Using cream (0.8.7)
Using meta_where (0.9.9.2)
Using roles_generic (0.3.6)
Using roles_active_record (0.4.4)
Using sqlite3-ruby (1.3.2)
Your bundle is complete! It was installed into /Users/kristianconsult/.rvm/gems/ruby-1.9.2-p136
initializers/devise.rb was found so devise:install will not be run
Configuring: devise mailer
Configuring: devise authentication filter
rails g devise:users --orm active_record --roles editor publisher guest admin --no-gems
run rails g devise:users --orm active_record --roles editor publisher guest admin --no-gems from "."
[Rails3::Assist::Logging]
Configure Devise Users
Customize controller action if needed to render individual registration form for each role
Example:
- routes.rb:
match "/editors/sign_up" => "user_registrations#new_editor", :as => :editor_signup
- user_registrations_controller.rb:
def new_editor
build_resource({})
end
Then create the registration form (view) for the :editor user in 'views/user_registrations/new_editor.html.erb'
See comments in routes.rb for more info. There is also a page on the wiki about advanced routes customization.
Devise credentials not customized since --customize option was not used to say so!
rails g cancan:config --orm active_record --no-gems
run rails g cancan:config --orm active_record --no-gems from "."
[Rails3::Assist::Logging]
Insert cancan rescue statement into application controller
rails g roles:config User --orm active_record --roles editor publisher guest admin --strategy role_string
run rails g roles:config User --orm active_record --roles editor publisher guest admin --strategy role_string from "."
[Rails3::Assist::Logging]
gem: roles_active_record already in Gemfile
run bundle install from "."
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.23)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.14)
Using actionmailer (3.0.3)
Using arel (2.0.6)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bcrypt-ruby (2.1.4)
Using bundler (1.0.7)
Using cancan (1.4.1)
Using colorize (0.5.8)
Using thrift (0.5.0)
Using thrift_client (0.6.0)
Using scribe (0.2.2)
Using log4r (1.1.11)
Using require_all (1.2.0)
Using mocha (0.9.10)
Using sugar-high (0.3.3)
Using logging_assist (0.1.6)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Using migration_assist (0.1.8)
Using rails3_assist (0.3.7)
Using rspec-core (2.4.0)
Using diff-lcs (1.1.2)
Using rspec-expectations (2.4.0)
Using rspec-mocks (2.4.0)
Using rspec (2.4.0)
Using rails3_artifactor (0.3.2)
Using cancan-permits (0.3.9)
Using r3_plugin_toolbox (0.4.0)
Using cancan-rest-links (0.2.1)
Using warden (1.0.3)
Using devise (1.1.5)
Using devise-links (0.2.1)
Using cream (0.8.7)
Using meta_where (0.9.9.2)
Using roles_generic (0.3.6)
Using roles_active_record (0.4.4)
Using sqlite3-ruby (1.3.2)
Your bundle is complete! It was installed into /Users/kristianconsult/.rvm/gems/ruby-1.9.2-p136
rails g active_record:roles User --strategy role_string --roles editor publisher guest admin --default-roles
run rails g active_record:roles User --strategy role_string --roles editor publisher guest admin --default-roles from "."
[Rails3::Assist::Logging]
apply_role_strategy for : role_string in model User
rails g permits:config --orm active_record --roles editor publisher guest admin --no-gems
run rails g permits:config --orm active_record --roles editor publisher guest admin --no-gems from "."
[Rails3::Assist::Logging]
Configure Permits
rails g cancan:permits --roles editor publisher guest admin --orm active_record
run rails g cancan:permits --roles editor publisher guest admin --orm active_record from "."
identical app/permits/guest_permit.rb
identical app/permits/admin_permit.rb
identical app/permits/any_permit.rb
identical app/permits/system_permit.rb
rails g cancan:licenses
run rails g cancan:licenses from "."
identical app/licenses/user_admin_license.rb
identical app/licenses/blogging_license.rb
--
Kris
On Jan 9, 2011, at 4:46 PM, Will Merrell wrote:
Well, we are getting closer.
The roles thing still looks broken.
The migrations issue is better, but not quite right yet, look at the
last lines. I don't think you want "generate" a rake command, I think
you want to "do" a rake command.
-- Will
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.23)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.14)
Using actionmailer (3.0.3)
Using arel (2.0.6)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bcrypt-ruby (2.1.4)
Using bundler (1.0.7)
Using cancan (1.4.1)
Using log4r (1.1.9)
Using require_all (1.2.0)
Using mocha (0.9.10)
Using sugar-high (0.3.3)
Using logging_assist (0.1.6)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Using migration_assist (0.1.8)
Using rails3_assist (0.3.7)
Using rspec-core (2.4.0)
Using diff-lcs (1.1.2)
Using rspec-expectations (2.4.0)
Using rspec-mocks (2.4.0)
Using rspec (2.4.0)
Using rails3_artifactor (0.3.2)
Using cancan-permits (0.3.9)
Using r3_plugin_toolbox (0.4.0)
Using cancan-rest-links (0.2.1)
Using colorize (0.5.8)
Using warden (1.0.3)
Using devise (1.1.5)
Using devise-links (0.2.1)
Using cream (0.8.7) from source at /home/will/rails/cream
Using meta_where (0.9.10)
Using roles_generic (0.3.6)
Using roles_active_record (0.4.4) from source at
/home/will/rails/roles_active_record
Using sqlite3-ruby (1.3.2)
Your bundle is complete! Use `bundle show [gemname]` to see where a
bundled gem is installed.
will@silver:~/rails/cream_app$ rails g cream:full_config -m true
--strategy role_string --roles user editor
[Rails3::Assist::Logging]
Generate Cream locale files
create config/locales/cream.en.yml
create config/locales/cream.da.yml
rails g cream:app --orm active_record
run rails g cream:app --orm active_record from "."
[Rails3::Assist::Logging]
insert_flash_displayer: alert
insert_flash_displayer: notice
rails g devise:config User --orm active_record
run rails g devise:config User --orm active_record from "."
Configuring devise gems for orm: active_record
[Rails3::Assist::Logging]
gem: devise already in Gemfile
Configuring for Active Record
run bundle install from "."
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.23)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.14)
Using actionmailer (3.0.3)
Using arel (2.0.6)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bcrypt-ruby (2.1.4)
Using bundler (1.0.7)
Using cancan (1.4.1)
Using log4r (1.1.9)
Using require_all (1.2.0)
Using mocha (0.9.10)
Using sugar-high (0.3.3)
Using logging_assist (0.1.6)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Using migration_assist (0.1.8)
Using rails3_assist (0.3.7)
Using rspec-core (2.4.0)
Using diff-lcs (1.1.2)
Using rspec-expectations (2.4.0)
Using rspec-mocks (2.4.0)
Using rspec (2.4.0)
Using rails3_artifactor (0.3.2)
Using cancan-permits (0.3.9)
Using r3_plugin_toolbox (0.4.0)
Using cancan-rest-links (0.2.1)
Using colorize (0.5.8)
Using warden (1.0.3)
Using devise (1.1.5)
Using devise-links (0.2.1)
Using cream (0.8.7)
Using meta_where (0.9.10)
Using roles_generic (0.3.6)
Using roles_active_record (0.4.4)
Using sqlite3-ruby (1.3.2)
===============================================================================
root :to => "home#index"
===============================================================================
Configuring: devise mailer
Configuring: devise authentication filter
rails g devise:users --orm active_record --roles user editor guest
admin --no-gems
run rails g devise:users --orm active_record --roles user
editor guest admin --no-gems from "."
[Rails3::Assist::Logging]
Configure Devise Users
rails g devise User
run rails g devise User from "."
invoke active_record
create app/models/user.rb
invoke test_unit
create test/unit/user_test.rb
create test/fixtures/users.yml
create db/migrate/20110109193415_devise_create_users.rb
insert app/models/user.rb
route devise_for :users
create_user: editor
rails g devise editor
run rails g devise editor from "."
invoke active_record
create app/models/editor.rb
invoke test_unit
create test/unit/editor_test.rb
create test/fixtures/editors.yml
create db/migrate/20110109193427_devise_create_editors.rb
insert app/models/editor.rb
route devise_for :editors
create_user: admin
rails g devise admin
run rails g devise admin from "."
invoke active_record
create app/models/admin.rb
invoke test_unit
create test/unit/admin_test.rb
create test/fixtures/admins.yml
create db/migrate/20110109193439_devise_create_admins.rb
insert app/models/admin.rb
route devise_for :admins
Customize controller action if needed to render individual registration
form for each role
Example:
- routes.rb:
match "/editors/sign_up" => "user_registrations#new_editor", :as =>
:editor_signup
- user_registrations_controller.rb:
def new_editor
build_resource({})
end
Then create the registration form (view) for the :editor user in
'views/user_registrations/new_editor.html.erb'
See comments in routes.rb for more info. There is also a page on the
wiki about advanced routes customization.
removing old devise routing for: user
removing old devise routing for: editor
removing old devise routing for: admin
performing devise role routing for: ["user", "editor", "admin"]
Insert into routes:
# customize controller action if needed to render individual
registration form for each role
# Example:
# match "/editors/sign_up" => "user_registrations#new_editor", :as =>
:editor_signup
# 'user_registrations_controller.rb' with the action #new_editor
# def new_editor
# build_resource({})
# end
#
# and the registration form in
'views/user_registrations/new_editor.html.erb'
#
devise_for :users, :class_name => 'User'
as :user do
match "/users/sign_up" => "devise/registrations#new", :as =>
:user_signup
end
devise_for :editors, :class_name => 'Editor'
as :editor do
match "/editors/sign_up" => "devise/registrations#new", :as =>
:editor_signup
end
devise_for :admins, :class_name => 'Admin'
as :admin do
match "/admins/sign_up" => "devise/registrations#new", :as =>
:admin_signup
end
Devise credentials not customized since --customize option was not used
to say so!
rails g cancan:config --orm active_record --no-gems
run rails g cancan:config --orm active_record --no-gems from "."
[Rails3::Assist::Logging]
Insert cancan rescue statement into application controller
rails g roles:config User --orm active_record --roles user editor guest
admin --strategy role_string
run rails g roles:config User --orm active_record --roles user
editor guest admin --strategy role_string from "."
[Rails3::Assist::Logging]
gem: roles_active_record already in Gemfile
run bundle install from "."
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.23)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.14)
Using actionmailer (3.0.3)
Using arel (2.0.6)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bcrypt-ruby (2.1.4)
Using bundler (1.0.7)
Using cancan (1.4.1)
Using log4r (1.1.9)
Using require_all (1.2.0)
Using mocha (0.9.10)
Using sugar-high (0.3.3)
Using logging_assist (0.1.6)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Using migration_assist (0.1.8)
Using rails3_assist (0.3.7)
Using rspec-core (2.4.0)
Using diff-lcs (1.1.2)
Using rspec-expectations (2.4.0)
Using rspec-mocks (2.4.0)
Using rspec (2.4.0)
Using rails3_artifactor (0.3.2)
Using cancan-permits (0.3.9)
Using r3_plugin_toolbox (0.4.0)
Using cancan-rest-links (0.2.1)
Using colorize (0.5.8)
Using warden (1.0.3)
Using devise (1.1.5)
Using devise-links (0.2.1)
Using cream (0.8.7)
Using meta_where (0.9.10)
Using roles_generic (0.3.6)
Using roles_active_record (0.4.4)
Using sqlite3-ruby (1.3.2)
Your bundle is complete! Use `bundle show [gemname]` to see where a
bundled gem is installed.
rails g active_record:roles User --strategy role_string --roles user
editor guest admin --default-roles
run rails g active_record:roles User --strategy role_string
--roles user editor guest admin --default-roles from "."
rails g permits:config --orm active_record --roles user editor guest
admin --no-gems
run rails g permits:config --orm active_record --roles user
editor guest admin --no-gems from "."
[Rails3::Assist::Logging]
Configure Permits
rails g cancan:permits --roles user editor guest admin --orm active_record
run rails g cancan:permits --roles user editor guest admin
--orm active_record from "."
create app/permits/guest_permit.rb
create app/permits/admin_permit.rb
create app/permits/any_permit.rb
create app/permits/system_permit.rb
rails g cancan:licenses
run rails g cancan:licenses from "."
create app/licenses/user_admin_license.rb
create app/licenses/blogging_license.rb
Running DB migrations
rails g rake db:migrate
run rails g rake db:migrate from "."
Could not find generator rake.
will@silver:~/rails/cream_app$
Kris
I see you put out a new gem version. However, something is not right.
when I try to run the initial bundle install, I get:
will@silver:~/rails/cream_app$ bundle install
Fetching source index for http://rubygems.org/
Bundler could not find compatible versions for gem "logging_assist":
In snapshot (Gemfile.lock):
logging_assist (0.1.6)
In Gemfile:
cream (~> 0.8.8) depends on
logging_assist
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
will@silver:~/rails/cream_app$
Any Ideas?
-- Will
As a further update on this, I see two things. When I try to cleanup my
gems I get this:
will@silver:~/rails/cream_app$ gem cleanup
Cleaning up installed gems...
Attempting to uninstall logging_assist-0.1.6
You have requested to uninstall the gem:
logging_assist-0.1.6
roles_generic-0.3.6 depends on [logging_assist (>= 0.1.6)]
cream-0.8.8 depends on [logging_assist (>= 0.1.6)]
devise-links-0.2.1 depends on [logging_assist (~> 0.1.6)]
cancan-permits-0.3.9 depends on [logging_assist (>= 0.1.6)]
cancan-permits-0.3.9 depends on [logging_assist (>= 0.1.6)]
roles_active_record-0.4.5 depends on [logging_assist (>= 0.1.6)]
roles_active_record-0.4.5 depends on [logging_assist (>= 0.1.6)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn] n
Unable to uninstall logging_assist-0.1.6:
Gem::DependencyRemovalException: Uninstallation aborted due to
dependent gem(s)
Clean Up Complete
When I look at the cream gemspec I see that you have a dependency on
both logging_assist-0.1.6 and logging_assist-0.2.0
I think you need to clean up your gem specifications for a bunch of you
stuff.
Now for the good news, when I download it locally, remove all references
to logging_assist-0.2.0, (leaving references to logging_assist-0.1.6)
and try again, it works right including the migrations. All of the files
look right.
One problem seems to remain,
[Rails3::Assist::Logging]
apply_role_strategy for : role_string in model User
Could not apply roles strategy to User model since the model file
was not found
The User file is there, and looks right, so why did it not find it and
apply the stategy?
One other little niggling point, it says to insert some stuff into the
routes file, but it appears to have already done so, so why tell me to
do it?
For now, it looks really close to right.
Thanks,
-- Will
Kris