makandra / katapult

Kickstart Rails development!
MIT License
22 stars 2 forks source link

Katapult doesn't fire #1

Closed firedev closed 8 years ago

firedev commented 9 years ago

Tried to generate the test fixtures from application_model.rb. Just for the record date doesn't seem to work now, but that is not the case.

Attribute type :date is not supported. Use one of [:string, :email, :url, :integer, :money, :text, :markdown, :flag, :datetime]. (Katapult::Attribute::UnknownTypeError)

Changed it to datetime:

# Here you define the fundamentals of your application.
#
# Add a model:
model 'customer' do |customer|
  customer.attr :name
  customer.attr :birth, type: :datetime
  customer.attr :email
end
#
# Add a web user interface:
wui 'customer' do |wui|
  wui.action :index
  wui.action :show
  wui.action :lock, scope: :member, method: :post
end
#
# Add navigation
navigation :main

But anyway it could not generate the views. Please advise. Thanks.

Here is the output:

$ katapult fire
Loading katapult ...
       parse  lib/katapult/application_model.rb
      render  into katatest
      create  db/migrate/20150327173025_create_customers.rb
      create  app/models/customer.rb
      create  spec/models/customer_spec.rb
      create  app/controllers/customers_controller.rb
       route  resources :customers, only: [:index, :show] do
    member do
      post 'lock'
    end
    collection do
    end
  end
      remove  app/views/layouts/application.html.erb
      create  app/views/layouts/application.html.haml
      create  app/views/customers/index.html.haml
/Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/katapult-0.1.0/lib/katapult/wui.rb:54:in `path': Unknown action 'new' (Katapult::WUI::UnknownActionError)
    from (erb):5:in `template'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/2.2.0/erb.rb:863:in `eval'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/2.2.0/erb.rb:863:in `result'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/file_manipulation.rb:116:in `block in template'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in `call'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in `render'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `block (2 levels) in invoke!'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `open'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `block in invoke!'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `call'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `invoke_with_conflict_check'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:60:in `invoke!'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions.rb:94:in `action'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:25:in `create_file'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/file_manipulation.rb:115:in `template'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/generators/named_base.rb:26:in `block in template'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/generators/named_base.rb:60:in `inside_template'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/generators/named_base.rb:25:in `template'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/katapult-0.1.0/lib/generators/katapult/haml/haml_generator.rb:74:in `create_view'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/katapult-0.1.0/lib/generators/katapult/haml/haml_generator.rb:27:in `block in create_rails_standard_action_views'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/katapult-0.1.0/lib/generators/katapult/haml/haml_generator.rb:24:in `each'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/katapult-0.1.0/lib/generators/katapult/haml/haml_generator.rb:24:in `create_rails_standard_action_views'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/katapult-0.1.0/lib/generators/katapult/w_u_i/w_u_i_generator.rb:25:in `generate_views'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/katapult-0.1.0/lib/katapult/wui.rb:73:in `render'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/katapult-0.1.0/lib/katapult/application_model.rb:40:in `each'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/katapult-0.1.0/lib/katapult/application_model.rb:40:in `render'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/katapult-0.1.0/lib/generators/katapult/transform/transform_generator.rb:23:in `transform_application_model'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/generators.rb:157:in `invoke'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/generate.rb:13:in `<top (required)>'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:123:in `require_command!'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:130:in `generate_or_destroy'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:50:in `generate'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
    from /Users/pain/Sites/katatest/bin/rails:8:in `<top (required)>'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/pain/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'
codener commented 9 years ago

Dear firedev,

indeed this is an issue. Katapult relies on the new action being always present, which is wrong. As a hotfix, add wui.action :create to your Web User Interface and run again. After a successful transform, remove the new and create actions, routes and views.

Sorry for the inconveniences. I'll release a fix.

firedev commented 9 years ago

Also this

/Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/katapult-0.1.0/lib/katapult/wui.rb:54:in `path': Unknown action 'edit' (Katapult::WUI::UnknownActionError)
firedev commented 9 years ago
/Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/katapult-0.1.0/lib/katapult/wui.rb:54:in `path': Unknown action 'destroy' (Katapult::WUI::UnknownActionError)
firedev commented 9 years ago

And maybe this:

run  bin/rake db:create db:migrate RAILS_ENV=test from "."
/Users/pain/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:538:in `add_route': Invalid route name, already in use: 'root'
firedev commented 9 years ago
def customer_scope
    customer.scoped # should be Customer
  end
firedev commented 9 years ago

View:

%dl.values
  %dt
    = customer.human_attribute_name(:name) # Customer
  %dd
    = @customer.name
  %dt
    = customer.human_attribute_name(:birth) # Customer
  %dd
codener commented 9 years ago

Ok, that's many issues. I'm sorry. However, thank you for trying katapult and reporting those bugs. I will look into that.

You may want to look into https://github.com/makandra/katapult/blob/5854bbb4b2b99f5bd7c6da2279179a72f2947b2f/features/wui.feature and try that application model there. The feature was green when I last ran it, so you should get it going. As for the customer vs. Customer – I have no idea how that went wrong.

firedev commented 9 years ago

No problem, I got it all running, just reporting so you could fix it when you have time.

codener commented 9 years ago

My commit only fixes the capitalization issue (Customer. vs customer.).

codener commented 9 years ago

0.1.2 fixes the multiple routes issue.

codener commented 8 years ago

Ok, 0.2.0 fixes all of these issues except for one: Katapult still requires all crud actions in a WUI, which will be fixed some day. Closing this issue.