3

I'm planing to create a simple Ruby gem. The functionality is depending on some .js files. My plan is to install the gem via Github.

My questions are:

  1. should I write a generator to copy the js files?
  2. what is the best place to keep the js files (is it vendor/assets/javascripts?)
  3. how to write test cases for this (rspec2) ?

I'm using Rails > 3, Ruby 1.9.x and Ruby 2.x.

1 Answer 1

1

We can easily use Javascripts library in ruby in following way -

1) We can put all js libararies in Vendor section and for their use we can define then application.js in following way

//= require datatable-pagination . .

2) Next if you want to use your own javascript then u put them into your assets folder and use then application.js in above way.

3) And if you want to make your own js library, then you can put your js libarary in lin folder.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi @amit, thanks for the answer, I want to do the same via a ruby gem. instead of manually copying the js files around

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.