Skip to content

Commit

Permalink
Lotus => Hanami
Browse files Browse the repository at this point in the history
  • Loading branch information
jodosha committed Jan 19, 2016
1 parent 7e0453f commit 66b015c
Show file tree
Hide file tree
Showing 35 changed files with 301 additions and 313 deletions.
21 changes: 4 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,14 @@ sudo: false
cache: bundler
script: 'bundle exec rake test:coverage --trace'
rvm:
- 2.0.0
- 2.1.0
- 2.1.1
- 2.1.2
- 2.1.3
- 2.1.4
- 2.1.5
- 2.1.6
- 2.1.7
- 2.1.8
- 2.2.0
- 2.2.1
- 2.2.2
- 2.2.3
- 2.2.4
- 2.3.0
- 2.2
- 2.3
- ruby-head
- jruby-head
- jruby-9000
- rbx-2

matrix:
allow_failures:
- rvm: ruby-head
- rvm: jruby-head
- rvm: jruby-9000
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Lotus::Helpers
# Hanami::Helpers
View helpers for Ruby web applications

## v0.2.6 - 2016-01-12
Expand All @@ -24,12 +24,12 @@ View helpers for Ruby web applications

## v0.2.0 - 2015-06-23
### Added
- [Luca Guidi] Introduced `Lotus::Helpers::FormHelper`. HTML5 form generator (`#form_for`).
- [Tom Kadwill & Luca Guidi] Introduced `Lotus::Helpers::NumberFormattingHelper`. Format numbers (`#format_number`).
- [Tom Kadwill] Introduced `Lotus::Helpers::LinkToHelper`. Link helper (`#link_to`).
- [Luca Guidi] Introduced `Hanami::Helpers::FormHelper`. HTML5 form generator (`#form_for`).
- [Tom Kadwill & Luca Guidi] Introduced `Hanami::Helpers::NumberFormattingHelper`. Format numbers (`#format_number`).
- [Tom Kadwill] Introduced `Hanami::Helpers::LinkToHelper`. Link helper (`#link_to`).

## v0.1.0 - 2015-03-23
### Added
- [Luca Guidi] Introduced `Lotus::Helpers::RoutingHelper`. It exposes `#routes` in views for compatibility with Lotus (`lotusrb` gem)
- [Alfonso Uceda Pompa] Introduced `Lotus::Helpers::EscapeHelper`. It implements OWASP/ESAPI suggestions for HTML, HTML attribute and URL escape helpers.
- [Luca Guidi] Introduced `Lotus::Helpers::HtmlHelper`. It allows to generate complex HTML5 markup with Ruby.
- [Luca Guidi] Introduced `Hanami::Helpers::RoutingHelper`. It exposes `#routes` in views for compatibility with Hanami (`hanamirb` gem)
- [Alfonso Uceda Pompa] Introduced `Hanami::Helpers::EscapeHelper`. It implements OWASP/ESAPI suggestions for HTML, HTML attribute and URL escape helpers.
- [Luca Guidi] Introduced `Hanami::Helpers::HtmlHelper`. It allows to generate complex HTML5 markup with Ruby.
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ unless ENV['TRAVIS']
gem 'yard', require: false
end

gem 'lotus-utils', '~> 0.6', github: 'lotus/utils', branch: '0.6.x'
gem 'lotus-validations', '~> 0.4', github: 'lotus/validations', branch: '0.4.x'
gem 'lotus-controller', '~> 0.5', github: 'lotus/controller', branch: '0.5.x'
gem 'lotus-view', '~> 0.5', github: 'lotus/view', branch: '0.5.x'
gem 'hanami-utils', '~> 0.7', github: 'hanami/utils', branch: '0.7.x'
gem 'hanami-validations', '~> 0.5', github: 'hanami/validations', branch: '0.5.x'
gem 'hanami-controller', '~> 0.6', github: 'hanami/controller', branch: '0.6.x'
gem 'hanami-view', '~> 0.6', github: 'hanami/view', branch: '0.6.x'

gem 'simplecov', require: false
gem 'coveralls', require: false
61 changes: 31 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
# Lotus::Helpers
# Hanami::Helpers

View helpers for Ruby applications

## Status

[![Gem Version](http://img.shields.io/gem/v/lotus-helpers.svg)](https://badge.fury.io/rb/lotus-helpers)
[![Build Status](http://img.shields.io/travis/lotus/helpers/master.svg)](https://travis-ci.org/lotus/helpers?branch=master)
[![Coverage](http://img.shields.io/coveralls/lotus/helpers/master.svg)](https://coveralls.io/r/lotus/helpers)
[![Code Climate](http://img.shields.io/codeclimate/github/lotus/helpers.svg)](https://codeclimate.com/github/lotus/helpers)
[![Dependencies](http://img.shields.io/gemnasium/lotus/helpers.svg)](https://gemnasium.com/lotus/helpers)
[![Inline Docs](http://inch-ci.org/github/lotus/helpers.svg)](http://inch-ci.org/github/lotus/helpers)
[![Gem Version](http://img.shields.io/gem/v/hanami-helpers.svg)](https://badge.fury.io/rb/hanami-helpers)
[![Build Status](http://img.shields.io/travis/hanami/helpers/master.svg)](https://travis-ci.org/hanami/helpers?branch=master)
[![Coverage](http://img.shields.io/coveralls/hanami/helpers/master.svg)](https://coveralls.io/r/hanami/helpers)
[![Code Climate](http://img.shields.io/codeclimate/github/hanami/helpers.svg)](https://codeclimate.com/github/hanami/helpers)
[![Dependencies](http://img.shields.io/gemnasium/hanami/helpers.svg)](https://gemnasium.com/hanami/helpers)
[![Inline Docs](http://inch-ci.org/github/hanami/helpers.svg)](http://inch-ci.org/github/hanami/helpers)

## Contact

* Home page: http://lotusrb.org
* Mailing List: http://lotusrb.org/mailing-list
* API Doc: http://rdoc.info/gems/lotus-helpers
* Bugs/Issues: https://github.com/lotus/helpers/issues
* Support: http://stackoverflow.com/questions/tagged/lotus-ruby
* Chat: https://gitter.im/lotus/chat
* Home page: http://hanamirb.org
* Mailing List: http://hanamirb.org/mailing-list
* API Doc: http://rdoc.info/gems/hanami-helpers
* Bugs/Issues: https://github.com/hanami/helpers/issues
* Support: http://stackoverflow.com/questions/tagged/hanami
* Chat: https//chat.hanamirb.org

## Rubies

__Lotus::Helpers__ supports Ruby (MRI) 2+
__Hanami::Helpers__ supports Ruby (MRI) 2+

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'lotus-helpers'
gem 'hanami-helpers'
```

And then execute:
Expand All @@ -41,12 +41,12 @@ $ bundle
Or install it yourself as:

```shell
$ gem install lotus-helpers
$ gem install hanami-helpers
```

## Usage

`Lotus::Helpers` offers a set of utilities to enrich web views.
`Hanami::Helpers` offers a set of utilities to enrich web views.

### HTML helper

Expand All @@ -57,7 +57,7 @@ View:
```ruby
module Users
class Show
include Lotus::Helpers
include Hanami::Helpers

def sidebar
html.aside(id: 'sidebar') do
Expand Down Expand Up @@ -126,7 +126,7 @@ View:
```ruby
module Books
class New
include Lotus::Helpers
include Hanami::Helpers

def form
form_for :book, routes.books_path do
Expand Down Expand Up @@ -161,7 +161,7 @@ Views:
```ruby
module Books
class New
include Lotus::Helpers
include Hanami::Helpers

def form
Form.new(:book, routes.books_path)
Expand All @@ -173,7 +173,7 @@ module Books
end

class Edit
include Lotus::Helpers
include Hanami::Helpers

def form
Form.new(:book, routes.book_path(id: book.id), {book: book}, {method: :patch})
Expand Down Expand Up @@ -237,7 +237,7 @@ View:
```ruby
module Users
class Show
include Lotus::Helpers
include Hanami::Helpers

def home_page_link
%(<a href="#{ hu(user.home_page_url) }" title="#{ ha(user.name} }'s website">#{ h(user.website_name) }</a>)
Expand Down Expand Up @@ -266,14 +266,14 @@ Output:

### Routing Helper

Lotus and Lotus::Router integration (`#routes`).
Hanami and Hanami::Router integration (`#routes`).

View:

```ruby
module Home
class Index
include Lotus::Helpers
include Hanami::Helpers

def link_to_home
%(<a href="#{ routes.home_path }">Home</a>)
Expand Down Expand Up @@ -303,7 +303,7 @@ View:
```ruby
module Home
class Index
include Lotus::Helpers
include Hanami::Helpers

def visitors_count
format_number '1000'
Expand All @@ -326,7 +326,7 @@ Output:

## Philosophy

All the Lotus helpers are modules to include.
All the Hanami helpers are modules to include.

Most of the time they inject **private** methods.
This restriction prevents helper methods to be used on the outside (eg. in a template).
Expand All @@ -338,7 +338,7 @@ We want to encourage developers to use **meaningful** and **simple APIs** in the
```ruby
module Users
class Show
include Lotus::Helpers
include Hanami::Helpers
end
end
```
Expand All @@ -354,7 +354,7 @@ This style increases the complexity of the template and it makes testing hard.
```ruby
module Users
class Show
include Lotus::Helpers
include Hanami::Helpers

def followers_count
format_number user.followers_count
Expand All @@ -372,11 +372,11 @@ In order to test the value that will be printed becomes easier: `Users::Show#fol

## Versioning

__Lotus::Helpers__ uses [Semantic Versioning 2.0.0](http://semver.org)
__Hanami::Helpers__ uses [Semantic Versioning 2.0.0](http://semver.org)

## Contributing

1. Fork it ( https://github.com/lotus/helpers/fork )
1. Fork it ( https://github.com/hanami/helpers/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
Expand All @@ -385,3 +385,4 @@ __Lotus::Helpers__ uses [Semantic Versioning 2.0.0](http://semver.org)
## Copyright

Copyright © 2014-2016 Luca Guidi – Released under MIT License
This project was formerly known as Lotus (`lotus-helpers`).
14 changes: 7 additions & 7 deletions lotus-helpers.gemspec → hanami-helpers.gemspec
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'lotus/helpers/version'
require 'hanami/helpers/version'

Gem::Specification.new do |spec|
spec.name = 'lotus-helpers'
spec.version = Lotus::Helpers::VERSION
spec.name = 'hanami-helpers'
spec.version = Hanami::Helpers::VERSION
spec.authors = ['Luca Guidi', 'Trung Lê', 'Alfonso Uceda']
spec.email = ['me@lucaguidi.com', 'trung.le@ruby-journal.com', 'uceda73@gmail.com']
spec.summary = %q{Lotus helpers}
spec.summary = %q{Hanami helpers}
spec.description = %q{View helpers for Ruby applications}
spec.homepage = 'http://lotusrb.org'
spec.homepage = 'http://hanamirb.org'
spec.license = 'MIT'

spec.files = `git ls-files -- lib/* CHANGELOG.md LICENSE.md README.md lotus-helpers.gemspec`.split($/)
spec.files = `git ls-files -- lib/* CHANGELOG.md LICENSE.md README.md hanami-helpers.gemspec`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
spec.required_ruby_version = '>= 2.0.0'

spec.add_dependency 'lotus-utils', '~> 0.6'
spec.add_dependency 'hanami-utils', '~> 0.6'

spec.add_development_dependency 'bundler', '~> 1.6'
spec.add_development_dependency 'rake', '~> 10.0'
Expand Down
1 change: 1 addition & 0 deletions lib/hanami-helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'hanami/helpers'
33 changes: 33 additions & 0 deletions lib/hanami/helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require 'hanami/helpers/version'
require 'hanami/helpers/html_helper'
require 'hanami/helpers/escape_helper'
require 'hanami/helpers/routing_helper'
require 'hanami/helpers/link_to_helper'
require 'hanami/helpers/form_helper'
require 'hanami/helpers/number_formatting_helper'

module Hanami
# View helpers for Ruby applications
#
# @since 0.1.0
module Helpers
# Override for Module.included
#
# It injects all the available helpers.
#
# @since 0.1.0
# @api private
#
# @see http://www.ruby-doc.org/core/Module.html#method-i-included
def self.included(base)
base.class_eval do
include Hanami::Helpers::HtmlHelper
include Hanami::Helpers::EscapeHelper
include Hanami::Helpers::RoutingHelper
include Hanami::Helpers::LinkToHelper
include Hanami::Helpers::FormHelper
include Hanami::Helpers::NumberFormattingHelper
end
end
end
end
Loading

0 comments on commit 66b015c

Please sign in to comment.