acesuares/inline_forms

INSTALLER

ortegacmanuel opened this issue · 1 comments

Installing steps

  • installing steps

  • How to install in Ubuntu 18.04. What needs to be done first. First install RVM?

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

  • Dependencies

  • Dependencies. For now, assume that I have rvm and I am at ruby-2.4.2 and in ~/railsapps I do 'gem install inline_forms'. It breaks for instance on nokogiri or mysql, it misses the development files.

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

  • bootsnap
  • bootsnap. I added --skip-bootsnap to the installer. Because it broke last time I tried. This needs to be tested why it doesn't work and fix it, so we can use bootsnap, or decide we won't use it if it's useless.

Ruby version

  • ruby version

  • .ruby-version. Somehow there is already a .ruby-version in MyApp. 'Overwrite /home/ace/Documents/610A/MyApp/.ruby-version? '. Why is that. Does 'rails new' make this now? It didn't use to. It complains about 'no newline' when you press 'd' for difference.

@@ -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:

  • 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

  • Admin user not created via db.seed.
    I think this is because it first needs to create the locale and the role, and after that create the user. Creating the user fails because it is the first statement in the seed file. Easy fix, just move the line that creates the user to the end!!!

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, 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

  • Move away from Figaro if possible
    the new 'master key' stuff could work much better than Figaro I think.

config/environments/development.rb:

  • 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:

  • 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

  • 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

  • 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

  • bootstrap and foundation
    Moved into its own issue #46

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.

  • This happens when trying to switch_user (there is no config/initializer/switch_user in this case)

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

  • cancan or cancancan
    Moved into its own issue #43

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.

  • In the example app only 'Apparment' is there in the dropdown menu, it should at least list User and maybe some other models like locale

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

  • It would be great if in an app, you could have

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.

@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