Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the size of the gem #127

Open
Shekharrajak opened this issue Dec 6, 2018 · 14 comments
Open

Reduce the size of the gem #127

Shekharrajak opened this issue Dec 6, 2018 · 14 comments

Comments

@Shekharrajak
Copy link
Member

We can see the gem size here : https://rubygems.org/gems/daru-view

image

Looks like our dummy_iruby notebook examples and js files increasing the gem size.But

  • we should have all the features demo in iruby notebook.
  • we should have dependent js files present in source code, so that it can work offline.

Is there anything else that causes, this much size ?

@Shekharrajak
Copy link
Member Author

It should download the js, css files to vendor/assests/ folder while installing the gem. It will reduce the size.

@snpd25
Copy link
Contributor

snpd25 commented Jan 19, 2019

Hi @Shekharrajak,
I would like to fix this issue but need some guidance.
Thanks.

@Shekharrajak
Copy link
Member Author

@snpd25 , first step will be , to find out the files and folders which can be removed from the gem source . You can see there are many js ,css files present in the vendor/assets folder , so that highcharts can work offline as well. (I think we can remove the googlecharts js files , since any way it requrie internet - You can find out more about it in blog or wiki page).

Now we have only highcharts js , css files. We want daru-view highcharts library working without internet as well, so we need it (after or while the installation). Since we can update the js and css file : #83 . Similarly we need to download it if internet is available (or it should be present already while the installation - may be compressed).

@snpd25
Copy link
Contributor

snpd25 commented Jan 20, 2019

So , I need to remove the googlecharts js , css files and leave the highcharts js, css files as it is?

@Shekharrajak
Copy link
Member Author

See how daru-view googlechart adapter is using those js files and what will be the impact when you remove it (understand how it will work without those files - by running IRuby notebook examples present in spec/dummy_iruby).

You can create a PR so that I can understand your approach (I just want to see other approaches, so I have just given a hint).

@snpd25
Copy link
Contributor

snpd25 commented Jan 20, 2019

I guess many unnecessary files are already removed, presently there are 3 files : jspdf.min.js , loader.js and google_visualr.js . The command daru-view update --googlecharts can generate jspdf.min.js and loader.js .So should I remove them?

@Shekharrajak
Copy link
Member Author

You must try it and check if any testcase is failing. I hope you have gone through development workflow.

@snpd25
Copy link
Contributor

snpd25 commented Jan 21, 2019

Yes I have checked that, the testsuits are running the same after regenerating those js files, without throwing any error with respect to googlecharts.

@Shekharrajak
Copy link
Member Author

Yes, that is for developers. In the user perspective, the gem will not be having those files. Without running any command how it will plot graphs?

@snpd25
Copy link
Contributor

snpd25 commented Jan 26, 2019

I think I haven't understood about the files you are referring to. As I have checked, from the user perspective as well, those three js files of googlecharts are present.

@Shekharrajak
Copy link
Member Author

Please let me know what are steps you followed.

@snpd25
Copy link
Contributor

snpd25 commented Jan 26, 2019

I ran the test-suite using bundle exec rspec then I removed the js files and regenerated them using daru-view update --googlecharts and then I ran the test-suite, which showed no changes except when I removed the file google_visualr.js . Was I required to do something else?

@Shekharrajak
Copy link
Member Author

Shekharrajak commented Jan 26, 2019

Can you figure it out where daru-view gem will be installed when a user run gem install daru-view in the system?

Can you remove these JS files and build a local gem using gem build daru-view.gemspec and installed in your system?

So users should not run any command after the installation right? Gem should be able to handle this task automatically when the internet is available (what should it do when the internet is not available while installing the gem? Can it generate the charts without internet as well - may be we can do some changes in our code and rather than loading the js file we can use script tag provided the link)

I removed the js files

It seems you deleted the js files of your cloned repo folder.

@snpd25
Copy link
Contributor

snpd25 commented Jan 27, 2019

The gem will be found in /home/user/.rvm/gems/ruby-2.4.1/gems/daru-view-0.2.4. It can't generate those js files without the internet. I tried building a local gem but it threw error, due to the absence of those files. Either I will have to edit the gem specifications or these files are too necessary to be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants