Konstantin
Konstantin

Reputation: 3123

What is the right way to share / reuse Ruby code on different machines?

I have a VPS and usually I write Ruby scripts for daily tasks. Sometimes I want to use the same scripts / methods on my home machine too. How should I share and reuse the already written codes between the too machine? Should I write a gem and install on both machine? Or is there a way to use the "load" method to load Ruby modules from a HTTP or maybe NFS share? HTTP would be preferable like in JavaScript / HTML, I think, however the "load" method seems to be not working with a HTTP url.

Upvotes: 0

Views: 105

Answers (5)

Radek
Radek

Reputation: 1054

My tool of choice for sharing scripts between various machines is Dropbox - cheap and quick solution. For me works perfectly.

Upvotes: 0

Jörg W Mittag
Jörg W Mittag

Reputation: 369438

Ruby comes with a powerful package management system called RubyGems that was created for exactly this purpose.

Upvotes: 0

daremkd
daremkd

Reputation: 8424

Version control system like Github or BitBucket is perfect for this. You'll basically have a central repository (on their server) where you'll store your code. Suppose computer A makes a change and "pushes" it to the server, now you can easily let know computer B, C etc. that there was a change made and they can update the code that's there.

Upvotes: 0

Sean
Sean

Reputation: 983

I think using github or some other source control software would be the most appropriate idea.

Upvotes: 1

spickermann
spickermann

Reputation: 106802

Sharing code via HTTP or NFS seems very weird to me. I can think of problems with loading from external sources according to reliability and security.

I would prefer a Gem or at least a git repo that I can check out when I need the code on a different machine.

Upvotes: 0

Related Questions