rails new mytest doesn't create correct folder structure - structure

I've just installed rails 6.0.2.1 with rvm
ruby version 2.6.3p62 ( using ruby-2.7.0-preview1 delivers the same result )
and the output is this:
rails new mytest
create
create README.md
create Rakefile
create .ruby-version
create config.ru
create .gitignore
create Gemfile
run git init from "."
instead of rails 3.2.22( output summary ):
rails new mytest
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
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
...
run bundle install
any ideas? is just a bug or am I wrong?

Resolved, the problem was simple no git installation on this machine
rails new mytest --skip-git
run as aspected!
Thank to this post

Related

mix: create new module in existing project

Is there any handy mix command to add a new module to an existing elixir project?
I use elixir 1.10.3 and I have such project structure:
apps
--api
----mix.exs
----lib
----test
--inventory
----mix.exs
----lib
----test
--mix.exs
I would like to add a monitoring module.
There is no command to create new modules, just add a file in the correct folder.

How can I load the rails environment from within a gem?

I need to require config/environment.rb. How can I do this from within a gem?
You need to create a new project to get the config/environment.rb file and all other support files like environment folder, app, etc.,
When you create a new project it should automatically created these files. You don't need to create it manually.

How to make rvmrc file in project root folder?

I have just installed RVM in my machine and facing problem with rvmrc file, can anyone help me out, how to create rvmrc?
I just did:
rvmrc --create ruby-1.8.7-p352#gemset
but didn't get the result...
It seems that there is a small mistake. Inside your .rvmrc file add:
rvm use ruby-1.8.7-p352#gemset --create
Also you might want to change the name of your gemset to something that is a bit more intuitive to read :)
UPDATE
Using the rvmrc file has now been deemed deprecated. Instead a .ruby-version file with the ruby version e.g. '2.0.0' and a .ruby-gemset file with the gemset name e.g. 'monkeys_of_doom'
This way developers using other version managers such as rbenv can pick up the ruby version in an automated fashion.
rvm --rvmrc --create ruby-1.8.7-p352#gemset
Read this article. http://net.tutsplus.com/tutorials/why-you-should-use-rvm/
If the gemset already exists, it is sufficent to add rvm ruby-1.8.7-p352#gemset to the .rvmrc file, which can be achieve for instance by
echo "rvm ruby-1.8.7-p352#gemset" > .rvmrc
UPDATE: it looks like the .rvmrc file format is deprecated, and the usage of .ruby-gemset and .ruby-version files is encouraged instead. If "rails2.3.5" is your gemset name, then one would require the following two commands
echo "ruby-1.8.7-p352" > .ruby-version
echo "rails2.3.5" > .ruby-gemset
I found working solution (http://sirupsen.com/get-started-right-with-rvm/)
rvm --create --rvmrc 1.8.7#project
you can also do this
rvm --rvmrc --create use ruby-1.9.3-p194#myproject
Instead of rvmc use:
rvm --create --ruby-version ruby-2.1.04#my-project
will generates the .ruby-gemset and .ruby-version files
The definitive documentation is at https://rvm.io/workflow/rvmrc/ for how to create rvmrc files, and the global .rvmrc parameters that affect them.
The --rvmrc parameter is what actually creates the rvmrc files, then you have to run
rvm rvmrc trust .
in the project directory to generate, and record, the security md5 hash to use that rvmrc file. The command 'trusts' the file so you're not prompted to trust it every time you enter the directory.
here is another much simpler approach
rvm use 1.8.7#gemset --create
first you need to create a rvmrc like -
rvm --rvmrc --create use ruby-2.2.1#gemset_name
Then run
rvm rvmrc trust .
That will resolve the issue for selecting rvm for differnt application.
Hope you enjoy. :)
For creating rvmrc file with specific ruby and gemset then use below command -
rvm --rvmrc --create ruby-with-version#gemset_name
like:
rvm --rvmrc --create ruby-2.3.3#rails5
Now we should need to select project location for change reflection so type cd .. and hit enter in terminal
Again type cd project_name/ for selecting our project but now you get * Notices something like below image so here you just type y and hit enter.
Now you have successfully created rvmrc file so from now no need to select gemset each time on selecting different projects.

Getting error: Could not find generator uploader. (Rails 3 project)

I am trying to create a simple project in ruby on rails 3 to do simple file upload. I thought of using Carrierwave.
I created a new rails project:
C:\Sites>rails new fileupload
create
create README
:
:
Using sqlite3 (1.3.4)
Using turn (0.8.2)
Using uglifier (1.0.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
C:\Sites>cd fileupload
C:\Sites\fileupload>rails g uploader file
Could not find generator uploader.
What should I do?
If you want to use carrierwave and use rails generate uploader File then you have to be sure that this gem is installed properly. You can check it by command gem list carrierwave. If you didn't install it properly then go to https://github.com/jnicklas/carrierwave and fallow the installation instruction.
As a bonus - there is a complete guide to create file uploader using a good alternative to carrierwave - paperclip: http://www.iamseree.com/application-development/file-upload-handling-with-ruby-on-rails-3-using-paperclip
I had the same error. Try this:
gem uninstall carrierwave
add this line to your gem file: gem 'carrierwave'
bundle install
rails g uploader file
I'm sure that what has happen is that the carrierwave gem was installed improper, not installing the uploader file into your project.
The only reason you get the error
could not find generator uploader
is when there is improper installation of CarrierWave. CarrierWave provides a generator called uploader to generate an uploader class to which we can pass the name we want to give our uploader. Check that you added in your project-directory Gemfile the code:
gem 'carrierwave'
and then:
bundle install
before you run:
rails generate uploader uploader-name

In Ruby on Rails, why is "bundle install" so slow to create Gemfile.lock and "rails g foo name:string" creates it so quickly?

I already have all the gems, and each time I do
rails trytry02
cd trytry02
bundle install
to create the Gemfile.lock, it takes a long time to fetch data from rubygems.org. But I noticed that if I do a
rails g scaffold foo name:string
before doing the bundle install, then the Gemfile.lock is created very fast. Is there a way to create it fast but not using rails g scaffold?
Douglas is correct, this is because bundle install is doing a round trip to rubygems.org to look for newer versions. If you want to just use the local versions...
bundle install --local
But - why are you generating your Gemfile.lock so often that this is an issue? Your Gemfile.lock should be under version control, ie. part of your project, and so should only change occasionally.
Try to change https to http in the Gemfile and see if this increases its speed.