acesuares / inline_forms

Inline Forms
MIT License
24 stars 15 forks source link

INSTALLER #45

Open ortegacmanuel opened 5 years ago

ortegacmanuel commented 5 years ago

Installing steps

For instance, let's say you have a fresh machine. You want to install in ~/railsapps

What are the steps to do that?

If you just go to ~/railsapps and do 'gem install inline_forms' nothing work.

But on my machine, there's rvm and a lot of rubies. The ruby in ~/railsapps differs (of course) from the rubies in the apps.

So in ~/railsapps/Papiamentu is ruby-2.4.2, in ~/railsapps/yavetracker is ruby-2.0.2 (as example).

But the in ~/railsapps I do 'rvm current' and I get ruby-2.3.1@global so, questions: how to setup the rails environment that you need BEFORE you make en app with inline_forms.

Dependencies

What dependencies does inline_forms need, i.e 'apt install mysqldev, libxml, etc...'

To test this, best to make a clean ubuntu 18.04 virtual machine and try to install the gem inline_forms and see what happens.

For now I am on ruby-2.4.2 ('rvm current' gives 'ruby-2.4.2' but with no gemset, so no @global ...!) and execute 'inline_forms create MyApp -d sqlite --example'

bootsnap

Ruby version

@@ -1 +1 @@ -ruby-2.4.2 +ruby-2.4.2 \ No newline at end of file

I choose 'Y' to overwrite.

Errors or warnings during gem installing:

Installing capistrano 3.11.0 GemWrappers: Can not wrap missing file: cap GemWrappers: Can not wrap missing file: capify

Installing sass 3.4.25 GemWrappers: Can not wrap missing file: sass GemWrappers: Can not wrap missing file: sass-convert GemWrappers: Can not wrap missing file: scss

Installing compass 1.0.3 GemWrappers: Can not wrap missing file: compass

Installing tilt 2.0.8 GemWrappers: Can not wrap missing file: tilt

Installing diff-lcs 1.3 GemWrappers: Can not wrap missing file: htmldiff GemWrappers: Can not wrap missing file: ldiff

Installing figaro 1.1.1 GemWrappers: Can not wrap missing file: figaro

Installing listen 3.1.5 GemWrappers: Can not wrap missing file: listen

Installing rspec-core 3.8.0 GemWrappers: Can not wrap missing file: rspec

Installing shoulda-context 1.2.2 GemWrappers: Can not wrap missing file: convert_to_should_syntax

Installing unicorn 5.4.1 with native extensions GemWrappers: Can not wrap missing file: unicorn GemWrappers: Can not wrap missing file: unicorn_rails

run bundle exec rails g devise:install from "." /local-home/ace/.rvm/gems/ruby-2.4.2@MyApp/gems/activemodel-5.2.1/lib/active_model/validations/clusivity.rb:8: warning: already initialized constant ActiveModel::Validations::Clusivity::ERROR_MESSAGE /home/ace/.rvm/gems/ruby-2.4.2@MyApp/gems/activemodel-5.2.1/lib/active_model/validations/clusivity.rb:8: warning: previous definition of ERROR_MESSAGE was here

(this error repeats several times)

Admin user not created via db.seed

To fix it for now, I just run 'bundle exec db:seed' manually again, it adds the user and fails on the other two line of course, but now the admin user is correctly created.

Application.yml, Secrets and Figaro

Application.yml is empty (has all keys, but no values). Of course most settings can not be created by the installer, but shouldn't it create:

DEVISE_SECRET_KEY: SECRET_TOKEN: SECRET_KEY_BASE:

Those can all be safely generated,right???

Move away from Figaro if possible

config/environments/development.rb:

There should be two newlines before '# for devise'. Also fix indenting.

config.file_watcher = ActiveSupport::EventedFileUpdateChecker# for devise config.action_mailer.default_url_options = { protocol: 'http', host: 'localhost', port: 3000 } config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { address: 'YOURMAILSERVER', enable_starttls_auto: true, password: 'YOURPASSWORD', user_name: 'YOURUSERNAME' }

config/environments/production.rb:

Fix double insertion of the '#for devise' part. File is now broken I think!

if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new(STDOUT) logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger)

for devise config.action_mailer.default_url_options = { protocol: 'https', host: 'YOURHOSTNAME' } config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { address: 'YOURMAILSERVER', enable_starttls_auto: true, password: 'YOURPASSWORD', user_name: 'YOURUSERNAME' }

end

Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false

for devise config.action_mailer.default_url_options = { protocol: 'https', host: 'YOURHOSTNAME' } config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { address: 'YOURMAILSERVER', enable_starttls_auto: true, password: 'YOURPASSWORD', user_name: 'YOURUSERNAME' }

end

config/deploy.rb

Default value for :linked_files is [] set :linked_files, fetch(:linked_files, []) .push("config/application.yml")

master.key needs to be deployed, and if we loose figaro, application.yml can be removed

Default value for linked_dirs is [] set :linked_dirs, fetch(:linked_dirs, []) .push("log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/system", "vendor/bundle")

I think public/uploads is missing. This made a big boo-boo in SAZON when every release forgot about previous uploads! DANGEROUS!

config/initializers/switch_user is missing

Maybe not needed actually. If switch user works out of the box, then it's not needed. Or maybe it's needed to display the :name instead of the :email.

available_users_names is a hash,
# keys in this hash should match a key in the available_users hash
# value is the column name which will be displayed in select box
config.available_users_names = { :user => :email }

should be ':user  => :name' ??

bootstrap and foundation

Is it possible to choose between bootstrap and foundation? So if I don't specify anything with 'inline_forms create' I will get foundation and if I specify 'bootstrap' then it will install bootstrap? Is this a lot of extra work? Or is it possible to switch branch on basis of the --bootstrap option? I am not ready to have my new apps created with incomplete bootstrap, but I want to start experimenting with it. What is best solution?

cancan(can) and switch_user.

cancan or cancancan: decide on correct version for new apps.

I have now in some apps:

gem 'cancan', :git => 'https://github.com/acesuares/cancan.git', :branch => '2.0'

in other:

gem 'cancan', :git => 'https://github.com/ortegacmanuel/cancan.git', :branch => '3.0'

and in new apps: gem 'cancancan', '~> 2.0'

fix the menu.

Some Structural thing: form_element should be overridden in the app.

lib/inline_forms/helpers/form_helper/your-own-helper.rb

for instance in some apps I needed some special helper, but I put them in inline_forms, like the new absence_list, but those are specific to the app and it would be good if the app can put them in some place. Also, that those will override the ones in inline_forms, so you could redefine 'text_area' to use another editor for example.

ortegacmanuel commented 5 years ago

@acesuares please explore this issue, I made it from you email, we should one a new issue for each checkbox, I already did for the cancan and the bootstrap ones