Skip to content

Commit

Permalink
Merge branch 'feature/travis-ci-integration'
Browse files Browse the repository at this point in the history
  • Loading branch information
stgeneral committed Mar 30, 2019
2 parents 1039f30 + bdb1929 commit fc8dcf0
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
AllCops:
Exclude:
- 'auxiliary_rails.gemspec'
- auxiliary_rails.gemspec
- vendor/bundle/**/* # fix for running on Travis CI

#################### Style ###############################

Expand Down
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ cache: bundler
rvm:
- 2.6.2
before_install: gem install bundler -v 2.0.1
script:
- bundle exec rspec
- bundle exec rubocop
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Collection of classes, configs, scripts, generators for Ruby on Rails helping you get things done, better.

[![Gem](https://img.shields.io/gem/v/auxiliary_rails.svg)](https://rubygems.org/gems/auxiliary_rails)
[![Build Status](https://travis-ci.org/ergoserv/auxiliary_rails.svg?branch=master)](https://travis-ci.org/ergoserv/auxiliary_rails)
[![Maintainability](https://api.codeclimate.com/v1/badges/a317c4893a804ce577ab/maintainability)](https://codeclimate.com/github/ergoserv/auxiliary_rails/maintainability)

## Installation

Add this line to your application's Gemfile:
Expand All @@ -20,10 +24,18 @@ Or install it yourself as:

## Usage

### Generators

```sh
# avaliable generators
rails g auxiliary_rails:install_errors
rails g auxiliary_rails:install_rubocop
rails generate auxiliary_rails:install_errors
rails generate auxiliary_rails:install_rubocop
```

### View Helpers

```ruby
current_controller?(*ctrl_names)
current_action?(*action_names)
```

## Development
Expand Down
1 change: 1 addition & 0 deletions lib/auxiliary_rails.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'auxiliary_rails/abstract_error'
require 'auxiliary_rails/railtie' if defined?(Rails)
require 'auxiliary_rails/version'

module AuxiliaryRails
Expand Down
9 changes: 9 additions & 0 deletions lib/auxiliary_rails/railtie.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'auxiliary_rails/view_helpers'

module AuxiliaryRails
class Railtie < Rails::Railtie
initializer 'auxiliary_rails.view_helpers' do
ActionView::Base.send :include, ViewHelpers
end
end
end
11 changes: 11 additions & 0 deletions lib/auxiliary_rails/view_helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module AuxiliaryRails
module ViewHelpers
def current_controller?(*ctrl_names)
ctrl_names.include?(params[:controller])
end

def current_action?(*action_names)
action_names.include?(params[:action])
end
end
end

0 comments on commit fc8dcf0

Please sign in to comment.