-
Notifications
You must be signed in to change notification settings - Fork 20
Development Workflow and Contribution guide
# to clone from git
`apt-get update && apt-get install -y git`
# to use gem
`apt-get update && apt-get install -y rubygems`
# nokogiri gem install error , fixed via these commands:
` apt-get update && apt-get install -y ruby`ruby -e 'puts RUBY_VERSION[/\d+\.\d+/]'`-dev`
`apt-get install -y build-essential patch ruby-dev zlib1g-dev liblzma-dev`
# install bundler
` gem install bundler`
# to install ruby gem daru-view and it's dependencies from rubygems.org/gems/daru-view
# ` gem install daru-view`
# to install jupter notebook to run iruby notebook
# - install python
# a) to install 2.7 and pip
# RUN apt-get update && apt-get -y install python2.7 python-pip python-dev
# b) to install 3.6 and pip
# to use `add-apt-repository` system has to installed software-properties-common
RUN apt-get update && apt-get -y install software-properties-common
RUN apt-get update && add-apt-repository ppa:jonathonf/python-3.6
RUN apt-get update && apt-get -y install python3.6 python-pip python-dev
# - check versions using these commands: python --version && pip --version
# - installing ipython notebook
`apt-get update && apt-get -y install ipython ipython-notebook`
# Now we can move on to installing Jupyter Notebook
`pip install --upgrade pip && pip install jupyter`
# now we can run jupyter notebook using command : `jupyter notebook`.
# note: IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
# When using Python 2.7, please install IPython 5.x LTS Long Term Support
# version.
# Beginning with IPython 6.0, Python 3.3 and above is required.
# for `gem install iruby`
# (dependencies are under daru/view/spec/dummy_iruby/Gemfile)
`apt-get update && apt-get -y install autoconf`
# note : for iruby notebook we must have libtool and autoconf installed.
# we can check them using `libtool -V` and `autoconf -V` ,
# `automake --version`.
Install Daru dependencies : installing-daru-development-dependencies
Note: If you find any issue installing rbcmzq
gem then try this once CPPFLAGS='-Wno-error=deprecated-declarations' gem install rbczmq -v '1.7.9'
Then install remaining dependencies:
bundle install
And run the test suite (should be all green with pending tests):
bundle exec rspec
To run a specific spec file or spec :
bundle exec rspec path/to/spec/file
e.g. To run whole spec file :
bundle exec rspec spec/table_spec.rb
To run a specific test case, mention the line number of the spec
bundle exec rspec spec/table_spec.rb:23
If you have problems installing nmatrix, please consult the mailing list.
While preparing your pull requests, don't forget to check your code with Rubocop:
bundle exec rubocop
[Optional] Install all Ruby versions which Daru currently supports with rake spec setup
.
-
The standard way is writing a new spec. Means a test case where expected input and output will be checked. Now start code changes and once you are done with your changes run the
bundle exec rspec
to check whether your newly written test case(s) is passing or not. -
Another way is run
bundle console
. Now, the terminal is running using your changes and you can run your sample code to see the output. For more information you can read bunlder doc. -
You can use Ruby debugger like byebug, pry-debugger or other gem. Follow their README file about how to use those gems. For
byebug
we need to require it on the file where you want to usebyebug
and addbyebug
line in the class or method as breakpoint.
I personally like pry-byebug. We just have to put the line binding.pry
in the class or method, where my code changes will go through.
- Create a new branch with
git checkout -b <branch_name>
. - Make your changes. Write tests covering every case how your feature will be used. If creating new files for tests, refer to the 'Testing' section below.
- Try out these changes with
rake pry
. - Run the test suite with
rake spec
. (Alternatively you can useguard
as described here. Also run Rubocop coding style guidelines withrake cop
. - Commit the changes with
git commit -am "briefly describe what you did"
and submit pull request.
[Optional] You can run rspec for all Ruby versions at once with rake spec run all
. But remember to first have all Ruby versions installed with ruby spec setup
.
bundle exec rspec
Run test suite skipping the update of googleCharts and HighCharts js files:
bundle exec rspec --tag ~local
NOTE: Please make sure that you place test for your file at the same level and with same itermediatary directories. For example if code file lies in lib/xyz/abc.rb
then its corresponding test should lie in spec/xyz/abc_spec.rb
. This is to ensure correct working of Guard.
GSoc 2017 Blog posts : http://shekharrajak.github.io/gsoc_2017_posts/
If you want to add a new library (adapter) to use it as the plotting library in daru-view
,
then you just need to define all the methods, that are present for Plot
object. Few main methods are div
(to get the HTML, JS code for the chart), init_script
(to return the all the dependent css, js files for the library which is needed to run the HTML code of the chart), export_html_file
(to export the HTML file of the chart), init_iruby
(this method will load the dependent JS files in IRuby notebook).
You can define these methods in daru/view/adapter
(for reference see the other adapter).