News for hackers. Stuff that matters.
Re:Rails 7.1 Released by steve_gh on Friday October 06, 2023 @01:42AM (#37787448)
Don't get me wrong, I love Rails, and have been using it off and on since Rails 2.

It's a really good framework, and for someone like me who needs to stand up a website from time to time it really is the path of least resistance.

What bugs me is the pain of setting up a new laptop to run Rails. I need node, which means npm. I'm a backend guy, I don't understand how to set up node, what order to do things in, etc. I do it rarely enough that it always seems a fight. Eventually I get it done, but I'm never sure why it finally all comes together.

An installer that puts together all the requirements so my rails just works would be great. The rvm installer will set up rails on top of ruby but won't set up the node system underneath it.

Re:Rails 7.1 Released by tauchunfall on Friday October 06, 2023 @02:12AM (#37787604)
>I'm a backend guy, I don't understand how to set up node

I understand that Node is mostly known as a frontend tool and Rails uses it for that, but as far as I remember Node was as least initially developed to bring JavaScript runtime to backends.

Even without a package manager node is just a node.exe under Windows, and I think you just have to download and unpack npm and then put node and npm into your PATH environment variable.

Re:Rails 7.1 Released by bnt on Friday October 06, 2023 @03:13AM (#37787974)
I recently set up a new Win11 laptop and all it took was download Node and install it via the installer. You’re up and running in 90 seconds. Yarn was another 30 seconds (npm i yarn). Even Ruby works well with RubyInstaller, and you can normally develop Rails without WSL if you really want to.
Re:Rails 7.1 Released by keyle on Friday October 06, 2023 @02:00AM (#37787554)
I've never done rails, please tell me, why does "ruby on rails" need nodejs for?

Also it's fairly easy to install node. Too easy in fact. I wish it was much harder, and required a degree.

Re:Rails 7.1 Released by teaearlgraycold on Friday October 06, 2023 @02:06AM (#37787577)
Rails lets you use modern JS frontend tools.
Re:Rails 7.1 Released by gls2ro on Friday October 06, 2023 @10:32AM (#37791306)
It lets you use modern JS frontend tool but you can also choose importmaps route that comes as default in Rails 7 so there is no need for nodejs and you can also say goodbye to the big folder "node_modules"
Re:Rails 7.1 Released by ulizzle on Friday October 06, 2023 @02:07AM (#37787582)
It’s still a problem, especially in mid size or large apps. Unless you have someone taking care of the bootstrap process, it inevitably breaks down.

Eventually only one person can get it working so I suppose it’s job security so perhaps it’s not so bad

That’s for every framework though, Rails isn’t that bad, relatively

Re:Rails 7.1 Released by roboben on Friday October 06, 2023 @01:46AM (#37787472)
thats the whole premise of rails7: dropping the node dependency...
Re:Rails 7.1 Released by JamesBrooks on Friday October 06, 2023 @01:45AM (#37787469)
If you opt to use import-maps I think you can get away without needing node these days, though then you're using import maps and have to deal with that can of worms.
Re:Rails 7.1 Released by jgilias on Friday October 06, 2023 @01:45AM (#37787466)
Have you used nvm? It’s pretty painless in my experience.
Re:Rails 7.1 Released by abigail95 on Friday October 06, 2023 @01:48AM (#37787488)
What are you comparing Node to?

Other typical back ends are more complicated (except Go) Java, C#, Python for example

Re:Rails 7.1 Released by lolinder on Friday October 06, 2023 @01:51AM (#37787501)
For Java, sdkman is great—essentially as convenient as nvm.

Python is a disaster.

Re:Rails 7.1 Released by metaltyphoon on Friday October 06, 2023 @09:36AM (#37790611)
dotnet new webapi - for apis

dotnet new webapp - for crud

dotnet new react - using react

How is that complicated?

Re:Rails 7.1 Released by 0xblinq on Friday October 06, 2023 @03:19AM (#37788015)
The Ruby/Rails community is one of the best and most friendly I've seen. But the worst part of it, by far is the hate for JavaScript.

JavaScript is just a tool, like any other. And it's a very important one like it or not. And like it or not it's going to stay here for a long time.

Just have a bit of an open mind and try to learn the basics at least, it will make things easier.

Re:Rails 7.1 Released by brigandish on Friday October 06, 2023 @03:43AM (#37788150)
What led you to think that Ruby devs don't know the basics of Javascript?
Re:Rails 7.1 Released by 0xblinq on Friday October 06, 2023 @04:35AM (#37788376)
[delayed]
Re:Rails 7.1 Released by andrei_says_ on Friday October 06, 2023 @05:10AM (#37788572)
A couple of Rails versions ago, I had to deal with webpack and that surely felt like an enemy trying to fight me at every step.

Luckily, I no longer need a PhD in webpack or node packages in order to run rails s successfully.

Re:Rails 7.1 Released by gls2ro on Friday October 06, 2023 @01:10PM (#37793354)
Here is what bothered me with JS and it might sound very stupid:

The idea to have a node_modules that has tens of thousands of folders/files for the simplest package that I needed to install. Ruby has gems, but they have few files, I can easily know where to go to understand how something works or add a debugger.

But just trying to read the name of all those seemed for me always like a task that I dont want to do.

The language itself letting aside some warts is good, can be enjoyed and good code maybe can be written.

Re:Rails 7.1 Released by jot on Friday October 06, 2023 @03:27AM (#37788063)
One of these should help with setting up a new laptop to run Rails:

https://rails.new

https://rubyonmac.dev

Re:Rails 7.1 Released by mrgill on Friday October 06, 2023 @08:48AM (#37790070)
Cool, but why not just use Docker? 2-4GB extra ram overhead and some initial learning curve, add a decent Makefile and.. never worry about local env ever again. Switch back and forth between Mac, Windows, Linux like it's nothing.
Re:Rails 7.1 Released by gls2ro on Friday October 06, 2023 @10:33AM (#37791321)
Add to this that Rails 7.1 comes with a pre-generated Dockerfile that works quite well out of the box
Re:Rails 7.1 Released by arcanemachiner on Friday October 06, 2023 @03:37AM (#37788122)
'asdf' (a version manager) is great for managing nodejs. I haven't dealt with Ruby before, though.

https://asdf-vm.com/

Re:Rails 7.1 Released by michaelteter on Friday October 06, 2023 @06:09AM (#37788869)
asdf handles Ruby just fine also. I use asdf for Ruby, Python, Elixir/Erlang, Node, and probably a couple more that I've forgotten.
Re:Rails 7.1 Released by 0xblinq on Friday October 06, 2023 @01:03PM (#37793267)
asdf is awesome. It renders useless each language's own version manager.
Re:Rails 7.1 Released by gls2ro on Friday October 06, 2023 @10:30AM (#37791267)
The latest version of Rails 7 works out of the box with importmaps so no node (nor yarn or any other version manager) is required.