hyphenify 0.0.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 743daeb8c82f89a8c3762c37faf08740be859a8a
4
- data.tar.gz: f866b5057897f134b6211fa493c7955ba2c3456e
3
+ metadata.gz: db9d5e6411ea0fb0cfe2a64deebc72004e87b62d
4
+ data.tar.gz: b20270d3bdfa43c09c2059f91e3e4fd6e6f28512
5
5
  SHA512:
6
- metadata.gz: 8a2591ef8fd3885a5d64741c00160c7b40768f9d56135912617edd8074bbb3b890b218b70ab06f927e07563f692e57fd2a61846ed9b5d1a5fe1d67b2d4e4f385
7
- data.tar.gz: 6f87b3a95f8e3fd4dc33b37e69d4d18ef05963615cfb4a4bfc1f68d917304a2224b402673f5222a87d0317e6360a29b074afab0be8dccfc46456f26d05a24edc
6
+ metadata.gz: 47b682906d87d8274ed5b7032e0c43cfb6e249d38cc67dbfa13eb3d25dcf8bcbb03030ea7bf0366df029fad4d47cb77545446d68b0f7c450cc938d1663a6d0a2
7
+ data.tar.gz: eb5cd23a3d8d43a6abbf2b37c7fb8c0f6b3f2cfafa6324f63c8fca8fd50b6a0b1de01c6e595b4a5630b77c935176d04d17d431f3bbda4c8a6d15839106d43d44
@@ -1,4 +1,4 @@
1
- Copyright 2014 Museways
1
+ Copyright 2015 Museways
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -0,0 +1,29 @@
1
+ [![Gem Version](https://badge.fury.io/rb/hyphenify.svg)](http://badge.fury.io/rb/hyphenify) [![Code Climate](https://codeclimate.com/github/museways/hyphenify/badges/gpa.svg)](https://codeclimate.com/github/museways/hyphenify) [![Build Status](https://travis-ci.org/museways/hyphenify.svg?branch=master)](https://travis-ci.org/museways/hyphenify) [![Dependency Status](https://gemnasium.com/museways/hyphenify.svg)](https://gemnasium.com/museways/hyphenify)
2
+
3
+ # Hyphenify
4
+
5
+ Makes tags helpers use hyphens in rails.
6
+
7
+ ## Install
8
+
9
+ Put this line in your Gemfile:
10
+ ```ruby
11
+ gem 'hyphenify'
12
+ ```
13
+
14
+ Then bundle:
15
+ ```
16
+ $ bundle
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ Nothing to do! Yay!
22
+
23
+ ## Credits
24
+
25
+ This gem is maintained and funded by [museways](http://museways.com).
26
+
27
+ ## License
28
+
29
+ It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
@@ -1,6 +1,5 @@
1
1
  require 'hyphenify/action_view/base'
2
2
  require 'hyphenify/railtie'
3
- require 'hyphenify/version'
4
3
 
5
4
  module Hyphenify
6
5
  end
@@ -11,8 +11,12 @@ module Hyphenify
11
11
 
12
12
  def tag_options_with_hyphen(options, escape=true)
13
13
  options.stringify_keys!
14
- %w[id class for].each { |key| options[key] = options[key].to_s.dasherize if options.has_key? key }
15
- tag_options_without_hyphen options, escape
14
+ %w[id class for].each do |key|
15
+ if options.has_key? key
16
+ options[key] = options[key].to_s.dasherize
17
+ end
18
+ end
19
+ tag_options_without_hyphen options, escape
16
20
  end
17
21
 
18
22
  end
@@ -3,11 +3,7 @@ module Hyphenify
3
3
 
4
4
  initializer 'hyphenify' do
5
5
  ::ActionView::Base.send :include, Hyphenify::ActionView::Base
6
- if Rails::VERSION::MAJOR < 4
7
- ::ActionView::Helpers::InstanceTag.send :include, Hyphenify::ActionView::Base
8
- else
9
- ::ActionView::Helpers::Tags::Base.send :include, Hyphenify::ActionView::Base
10
- end
6
+ ::ActionView::Helpers::Tags::Base.send :include, Hyphenify::ActionView::Base
11
7
  end
12
8
 
13
9
  end
@@ -1,5 +1,5 @@
1
1
  module Hyphenify
2
2
 
3
- VERSION = '0.0.9'
3
+ VERSION = '0.1.0'
4
4
 
5
5
  end
@@ -20,7 +20,11 @@ Dummy::Application.configure do
20
20
  # config.action_dispatch.rack_cache = true
21
21
 
22
22
  # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_assets = false
23
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
24
+ config.serve_static_files = false
25
+ else
26
+ config.serve_static_assets = false
27
+ end
24
28
 
25
29
  # Compress JavaScripts and CSS.
26
30
  config.assets.js_compressor = :uglifier
@@ -13,7 +13,11 @@ Dummy::Application.configure do
13
13
  config.eager_load = false
14
14
 
15
15
  # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_assets = true
16
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
17
+ config.serve_static_files = false
18
+ else
19
+ config.serve_static_assets = false
20
+ end
17
21
  config.static_cache_control = "public, max-age=3600"
18
22
 
19
23
  # Show full error reports and disable caching.
@@ -33,4 +37,8 @@ Dummy::Application.configure do
33
37
 
34
38
  # Print deprecation notices to the stderr.
35
39
  config.active_support.deprecation = :stderr
40
+
41
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
42
+ config.active_support.test_order = :random
43
+ end
36
44
  end
@@ -1,8 +1,4 @@
1
1
  Dummy::Application.routes.draw do
2
-
3
- root to: 'pages#index'
4
- get '/form', to: 'pages#form'
5
-
6
2
  # The priority is based upon order of creation: first created -> highest priority.
7
3
  # See how all your routes lay out with "rake routes".
8
4
 
@@ -101,3 +101,173 @@ Started GET "/" for 127.0.0.1 at 2014-06-08 17:57:02 -0300
101
101
  Processing by PagesController#index as HTML
102
102
  Completed 200 OK in 2ms (Views: 1.6ms | ActiveRecord: 0.0ms)
103
103
   (0.1ms) rollback transaction
104
+  (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
105
+  (0.1ms) select sqlite_version(*)
106
+  (0.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
107
+  (0.1ms) SELECT version FROM "schema_migrations"
108
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
109
+  (0.1ms) begin transaction
110
+ ----------------------------------------------------------
111
+ TagsTest: test_forms_tags_return_id_and_class_with_hyphens
112
+ ----------------------------------------------------------
113
+  (0.0ms) rollback transaction
114
+  (0.0ms) begin transaction
115
+ ----------------------------------------------------
116
+ TagsTest: test_tags_return_id_and_class_with_hyphens
117
+ ----------------------------------------------------
118
+  (0.0ms) rollback transaction
119
+  (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
120
+  (0.1ms) select sqlite_version(*)
121
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
122
+  (0.1ms) SELECT version FROM "schema_migrations"
123
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
124
+  (0.1ms) begin transaction
125
+ ----------------------------------------------------------
126
+ TagsTest: test_forms_tags_return_id_and_class_with_hyphens
127
+ ----------------------------------------------------------
128
+  (0.1ms) rollback transaction
129
+  (0.0ms) begin transaction
130
+ ----------------------------------------------------
131
+ TagsTest: test_tags_return_id_and_class_with_hyphens
132
+ ----------------------------------------------------
133
+  (0.0ms) rollback transaction
134
+  (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
135
+  (0.1ms) select sqlite_version(*)
136
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
137
+  (0.0ms) SELECT version FROM "schema_migrations"
138
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
139
+  (0.1ms) begin transaction
140
+ ----------------------------------------------------------
141
+ TagsTest: test_forms_tags_return_id_and_class_with_hyphens
142
+ ----------------------------------------------------------
143
+  (0.1ms) rollback transaction
144
+  (0.0ms) begin transaction
145
+ ----------------------------------------------------
146
+ TagsTest: test_tags_return_id_and_class_with_hyphens
147
+ ----------------------------------------------------
148
+  (0.1ms) rollback transaction
149
+  (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
150
+  (0.1ms) select sqlite_version(*)
151
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
152
+  (0.1ms) SELECT version FROM "schema_migrations"
153
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
154
+  (0.1ms) begin transaction
155
+ ----------------------------------------------------------
156
+ TagsTest: test_forms_tags_return_id_and_class_with_hyphens
157
+ ----------------------------------------------------------
158
+  (0.0ms) rollback transaction
159
+  (0.0ms) begin transaction
160
+ ----------------------------------------------------
161
+ TagsTest: test_tags_return_id_and_class_with_hyphens
162
+ ----------------------------------------------------
163
+  (0.0ms) rollback transaction
164
+  (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
165
+  (0.1ms) select sqlite_version(*)
166
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
167
+  (0.2ms) SELECT version FROM "schema_migrations"
168
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
169
+  (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
170
+  (0.1ms) select sqlite_version(*)
171
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
172
+  (0.1ms) SELECT version FROM "schema_migrations"
173
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
174
+  (0.1ms) begin transaction
175
+ ----------------------------
176
+ TagsTest: test_forms_hyphens
177
+ ----------------------------
178
+  (0.1ms) rollback transaction
179
+  (0.1ms) begin transaction
180
+ ---------------------------
181
+ TagsTest: test_tags_hyphens
182
+ ---------------------------
183
+  (0.0ms) rollback transaction
184
+  (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
185
+  (0.1ms) select sqlite_version(*)
186
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
187
+  (0.1ms) SELECT version FROM "schema_migrations"
188
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
189
+  (0.1ms) begin transaction
190
+ ----------------------------
191
+ TagsTest: test_forms_hyphens
192
+ ----------------------------
193
+  (0.1ms) rollback transaction
194
+  (0.0ms) begin transaction
195
+ ---------------------------
196
+ TagsTest: test_tags_hyphens
197
+ ---------------------------
198
+  (0.0ms) rollback transaction
199
+  (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
200
+  (0.1ms) select sqlite_version(*)
201
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
202
+  (0.1ms) SELECT version FROM "schema_migrations"
203
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
204
+  (0.1ms) begin transaction
205
+ ----------------------------
206
+ TagsTest: test_forms_hyphens
207
+ ----------------------------
208
+  (0.1ms) rollback transaction
209
+  (0.1ms) begin transaction
210
+ ---------------------------
211
+ TagsTest: test_tags_hyphens
212
+ ---------------------------
213
+  (0.0ms) rollback transaction
214
+  (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
215
+  (0.1ms) select sqlite_version(*)
216
+  (0.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
217
+  (0.1ms) SELECT version FROM "schema_migrations"
218
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
219
+  (0.4ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
220
+  (0.1ms) select sqlite_version(*)
221
+  (0.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
222
+  (0.1ms) SELECT version FROM "schema_migrations"
223
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
224
+  (0.1ms) begin transaction
225
+ ----------------------------
226
+ TagsTest: test_forms_hyphens
227
+ ----------------------------
228
+  (0.1ms) rollback transaction
229
+  (0.0ms) begin transaction
230
+ ---------------------------
231
+ TagsTest: test_tags_hyphens
232
+ ---------------------------
233
+  (0.0ms) rollback transaction
234
+  (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
235
+  (0.1ms) select sqlite_version(*)
236
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
237
+  (0.0ms) SELECT version FROM "schema_migrations"
238
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
239
+  (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
240
+  (0.1ms) select sqlite_version(*)
241
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
242
+  (0.1ms) SELECT version FROM "schema_migrations"
243
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
244
+  (0.1ms) begin transaction
245
+ ----------------------------
246
+ TagsTest: test_forms_hyphens
247
+ ----------------------------
248
+  (0.1ms) rollback transaction
249
+  (0.0ms) begin transaction
250
+ ---------------------------
251
+ TagsTest: test_tags_hyphens
252
+ ---------------------------
253
+  (0.1ms) rollback transaction
254
+  (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
255
+  (0.1ms) select sqlite_version(*)
256
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
257
+  (0.1ms) SELECT version FROM "schema_migrations"
258
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
259
+  (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
260
+  (0.1ms) select sqlite_version(*)
261
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
262
+  (0.1ms) SELECT version FROM "schema_migrations"
263
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
264
+  (0.1ms) begin transaction
265
+ ----------------------------
266
+ TagsTest: test_forms_hyphens
267
+ ----------------------------
268
+  (0.1ms) rollback transaction
269
+  (0.0ms) begin transaction
270
+ ---------------------------
271
+ TagsTest: test_tags_hyphens
272
+ ---------------------------
273
+  (0.0ms) rollback transaction
@@ -1,18 +1,19 @@
1
1
  require 'test_helper'
2
2
 
3
- class TagsTest < ActionDispatch::IntegrationTest
4
-
5
- test "tags should return id and class with hyphens" do
6
- get '/'
7
- assert_response :success
8
- assert response.body.include?('class="the-class" id="the-id"')
3
+ class TagsTest < ActionView::TestCase
4
+
5
+ test 'tags hyphens' do
6
+ div = tag(:div, class: 'the_class', id: 'test_id')
7
+ assert div.include?('class="the-class"')
8
+ assert div.include?('id="test-id"')
9
9
  end
10
10
 
11
- test "forms tags should return id and class with hyphens" do
12
- get '/form'
13
- assert_response :success
14
- assert response.body.include?('for="test-id"')
15
- assert response.body.include?('class="the-class" id="test-id"')
11
+ test 'forms hyphens' do
12
+ form = form_for(:test, url: 'http://test.com') do |f|
13
+ f.text_field :id, class: 'the_class'
14
+ end
15
+ assert form.include?('class="the-class"')
16
+ assert form.include?('id="test-id"')
16
17
  end
17
18
 
18
19
  end
@@ -19,3 +19,6 @@ config = YAML::load(File.read(File.expand_path('../dummy/config/database.yml', _
19
19
  config['test']['adapter'] = 'jdbcsqlite3' if RUBY_PLATFORM == 'java'
20
20
  ActiveRecord::Base.establish_connection(config['test'])
21
21
  load(File.expand_path('../dummy/db/schema.rb', __FILE__))
22
+
23
+ # Include helpers
24
+ ActionView::TestCase.send :include, Hyphenify::ActionView::Base
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyphenify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Museways
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-09 00:00:00.000000000 Z
11
+ date: 2015-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,8 +16,8 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.1.0
20
- - - "<"
19
+ version: 4.0.0
20
+ - - "<="
21
21
  - !ruby/object:Gem::Version
22
22
  version: 4.2.0
23
23
  type: :runtime
@@ -26,8 +26,8 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 3.1.0
30
- - - "<"
29
+ version: 4.0.0
30
+ - - "<="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 4.2.0
33
33
  - !ruby/object:Gem::Dependency
@@ -44,7 +44,7 @@ dependencies:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '1.3'
47
- description: Hacks tags helpers to always use hyphens.
47
+ description: Makes tags helpers use hyphens in rails.
48
48
  email:
49
49
  - hello@museways.com
50
50
  executables: []
@@ -52,7 +52,7 @@ extensions: []
52
52
  extra_rdoc_files: []
53
53
  files:
54
54
  - MIT-LICENSE
55
- - README.rdoc
55
+ - README.md
56
56
  - Rakefile
57
57
  - lib/hyphenify.rb
58
58
  - lib/hyphenify/action_view/base.rb
@@ -63,11 +63,8 @@ files:
63
63
  - test/dummy/app/assets/javascripts/application.js
64
64
  - test/dummy/app/assets/stylesheets/application.css
65
65
  - test/dummy/app/controllers/application_controller.rb
66
- - test/dummy/app/controllers/pages_controller.rb
67
66
  - test/dummy/app/helpers/application_helper.rb
68
67
  - test/dummy/app/views/layouts/application.html.erb
69
- - test/dummy/app/views/pages/form.html.erb
70
- - test/dummy/app/views/pages/index.html.erb
71
68
  - test/dummy/bin/bundle
72
69
  - test/dummy/bin/rails
73
70
  - test/dummy/bin/rake
@@ -124,19 +121,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
121
  version: '0'
125
122
  requirements: []
126
123
  rubyforge_project:
127
- rubygems_version: 2.2.2
124
+ rubygems_version: 2.4.5
128
125
  signing_key:
129
126
  specification_version: 4
130
- summary: Hyphens for Rails.
127
+ summary: Hyphens for rails.
131
128
  test_files:
132
129
  - test/dummy/app/assets/javascripts/application.js
133
130
  - test/dummy/app/assets/stylesheets/application.css
134
131
  - test/dummy/app/controllers/application_controller.rb
135
- - test/dummy/app/controllers/pages_controller.rb
136
132
  - test/dummy/app/helpers/application_helper.rb
137
133
  - test/dummy/app/views/layouts/application.html.erb
138
- - test/dummy/app/views/pages/form.html.erb
139
- - test/dummy/app/views/pages/index.html.erb
140
134
  - test/dummy/bin/bundle
141
135
  - test/dummy/bin/rails
142
136
  - test/dummy/bin/rake
@@ -1,17 +0,0 @@
1
- {<img src="https://badge.fury.io/rb/hyphenify.png" alt="Gem Version" />}[http://badge.fury.io/rb/hyphenify] {<img src="https://codeclimate.com/github/museways/hyphenify.png" />}[https://codeclimate.com/github/museways/hyphenify] {<img src="https://travis-ci.org/museways/hyphenify.png?branch=master" alt="Build Status" />}[https://travis-ci.org/museways/hyphenify] {<img src="https://gemnasium.com/museways/hyphenify.png" alt="Dependency Status" />}[https://gemnasium.com/museways/hyphenify]
2
-
3
- = Hyphenify
4
-
5
- Hacks rails tags helpers to always use hyphens.
6
-
7
- = Install
8
-
9
- Put this line in your Gemfile:
10
- gem 'hyphenify'
11
-
12
- Then bundle:
13
- $ bundle
14
-
15
- = Usage
16
-
17
- Nothing to do! Yay!
@@ -1,9 +0,0 @@
1
- class PagesController < ApplicationController
2
-
3
- def index
4
- end
5
-
6
- def form
7
- end
8
-
9
- end
@@ -1,4 +0,0 @@
1
- <%= form_for :test, url: 'http://test.com' do |f| %>
2
- <%= f.label :id %>
3
- <%= f.text_field :id, class: 'the_class' %>
4
- <% end %>
@@ -1 +0,0 @@
1
- <%= tag :div, class: 'the_class', id: 'the_id' %>