Skip to content

Latest commit

 

History

History
125 lines (88 loc) · 5.87 KB

CONTRIBUTING.md

File metadata and controls

125 lines (88 loc) · 5.87 KB

Contributing to OSEM

Our open source project is open to contributions. Open your issue and send a PR!

We welcome new developers, and we actively participate in mentoring programs, such as GSoC and RGSoC.

Request for contributions

We are always looking for contributions to OSEM. Read this guide on how to do that.

In particular, this community seeks the following types of contributions:

  • code: contribute your expertise in an area by helping us expand OSEM
  • ideas: participate in an issues thread or start your own to have your voice heard.
  • code editing: fix typos, clarify language, and generally improve the quality of the content of OSEM

Running OSEM in development

We are using Vagrant to create our development environments.

  1. Install Vagrant and VirtualBox 5.0.10. Both tools support Linux, MacOS and Windows.

  2. Install vagrant-exec:

    vagrant plugin install vagrant-exec
    
  3. Clone this code repository:

    git clone https://github.com/openSUSE/osem.git
    
  4. Execute Vagrant in the cloned directory:

    vagrant up
    
  5. Start your OSEM rails app:

    vagrant exec /vagrant/bin/rails server -b 0.0.0.0
    
  6. Check out your OSEM rails app: You can access the app localhost:3000. Whatever you change in your cloned repository will have effect in the development environment. Sign up, the first user will be automatically assigned the admin role.

  7. Changed something? Test your changes!:

    vagrant exec bundle exec rspec spec
    
  8. Explore the development environment:

    vagrant ssh
    
  9. Or issue any standard rails/rake/bundler command by prepending vagrant exec

    vagrant exec bundle exec rake db:migrate
    

How to contribute code

  • Prerequisite: familiarity with GitHub Pull Requests and issues.
  • Fork the repository and make a pull-request with your changes
    • Make sure that the test suite passes before you request a pull and that you comply to our ruby styleguide.
    • Please increase code coverage by your pull request (coveralls or simplecov locally will give you insight)
  • One of the OSEM maintainers will review your pull-request
    • If you are already a contributor and you get a positive review, you can merge your pull-request yourself
    • If you are not already a contributor please request a merge via the pull-request comments

Coding Style

We are using rubocop as a style checker. It is checking code style each time the test suite runs. You can run it locally with

vagrant exec bundle exec rubocop

You can read through current enabled rules in .rubocop.yml file. Explanations of the defined rules can be found in modules Cop::Lint and Cop::Style and Cop:Rails. Additionally you can read through the ruby style-guide to better understand core principles.

Test Suite

We are using rspec+capybara+factory girl as a test suite. You can run it locally

vagrant exec bundle exec rspec

Email Notifications

Note: We use letter_opener in development environment. You can check out your mails by visiting localhost:3000/letter_opener.

Using iChain in test mode

devise_ichain_authenticatable comes with test mode, which can be useful in development phase in which an iChain proxy is not usually configured or even available. You can enable ichain authentication by setting OSEM_ICHAIN_ENABLED equal to true in .env file. You would also need to set following options in devise.rb:

# Activate the test mode
config.ichain_test_mode = true

# 'testuser' user will be permanently signed in.
config.ichain_force_test_username = "testuser"

# set email of 'testuser'
config.ichain_force_test_attributes = {:email => "[email protected]"}

Using OpenID in developement

OSEM supports OpenID logins via OmniAuth and related provider specific gems. OmniAuth provides the ablity to define per-provider mock accounts for testing. The supported providers are Facebook, Google, openSUSE and GitHub. If you want to use the OSEM provided mock accounts you need to set the appropriate OSEM_PROVIDER_KEY and OSEM_PROVIDER_SECRET environment variables to a non empty string in the .env file.

e.g.

OSEM_GITHUB_KEY='sample'
OSEM_GITHUB_SECRET='sample'

If you don't already have a .env file you can use the dotenv.example as a template.

Code of Conduct

OSEM is part of the openSUSE project. We follow all the openSUSE Guiding Principles! If you think someone doesn't do that, please let us know at [email protected]

Contact

GitHub issues are the primary way for communicating about specific proposed changes to this project. If you have other questions feel free to subscribe to the [email protected] mailinglist, all OSEM contributors are on that list! Additionally you can use #osem channel on freenode IRC.