1

I usually do a project and deploy it on the client machine, but all the Ruby/WATIR scripts are clearly visible to everyone. Is there any way to hide my code? Or is there any way I can secure my code? Or Is there any way to lock a folder through Ruby?

sawa
  • 165,429
  • 45
  • 277
  • 381
RAJ
  • 898
  • 7
  • 16
  • there are some ways, but nothing that cannot be circumvented with 5 minutes of effort. – Karoly Horvath Apr 15 '15 at 06:00
  • It is worth noting that hiding your code does not make it more secure. See this answer for more information: http://stackoverflow.com/questions/29529822/should-i-disclose-database-ids-in-the-url/29532281#29532281 – Drenmi Apr 15 '15 at 09:56
  • Three different requirements in your question. Locking folders, hiding code, and security, are all very different questions. – vgoff Apr 15 '15 at 20:25
  • I know all are very different question, but my motto was whether any of the way could help me to achieve what's required. – RAJ Apr 16 '15 at 06:25

2 Answers2

2

You could use jRuby and create a JAR using Warbler but that will only stop non-geek users. Here a link about using watir in jRuby

Converting the script to an executable file like with Ocra is also an option.

Securing the script and let it run in another security context could work.

But what I would do is make it a web-app that can be run anywhere while nobody can see the source code. With a nice framework like Sinatra that shouldn't be that hard.

Community
  • 1
  • 1
peter
  • 41,770
  • 5
  • 64
  • 108
  • I don't remember well, but doesn't Ocra temporarily extract all necessary files to run the program? The source files become visible, if the user knows where to search. – Saturn Apr 15 '15 at 08:07
  • yes I believe it does, I would put it in the same category as the first solution for non-geek users – peter Apr 15 '15 at 09:10
  • @peter I need to run WATIR scripts as well, Do JRuby supports WATIR? If it supports, Can I do everything what I do using Ruby? – RAJ Apr 15 '15 at 11:22
  • @RAJ, it should, i added a link to the response – peter Apr 15 '15 at 12:32
0

Code obfuscation is one option. You can use tools like RubyScript2Exe or AllInOneRuby to obfuscate your code or make them difficult to understand. However these tools have their own flaws which are nicely discussed here.

Community
  • 1
  • 1
shivam
  • 16,048
  • 3
  • 56
  • 71