js_from_routes 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b404b3e7cc0394a4a79ecb225b36fbcf0f29d07391ee6df877cd068f1af438fb
4
- data.tar.gz: 646668b779ea86c0aeee8327fba4355619ac2d72231e9053e4ec1569a3fc4293
3
+ metadata.gz: 0d4be8ed220b3710b57134de5269c2bd823ceb9c796d8df9156d919062c680c1
4
+ data.tar.gz: 7d7d2c8009889180159e6054192f1a860137107fc0672131befc5b4fa9be0fe0
5
5
  SHA512:
6
- metadata.gz: 8fd27cf2b1388f455c42a68b3ba892f9344e13cae2f46654e4ec0a9554c1d3e932366898ffdf1860027b0eec0a4be1112f7289d40f22a5426889ae4c16766d8c
7
- data.tar.gz: ce4f56fd37aa81378d41633da4eb7b59486052115d4a9224e472d7f14330e62d39e14f5ef8d2ea8f7a2f8e03e9f6221419d6ee73a764145aac7a47b0030726b0
6
+ metadata.gz: dddde4bcf699938557a19a3cabcf0914a3ba62c75601e4ab14be079b2fa6e8494ff88799fae9e50325bf9adced2b3acd2ba1922089975ec5de31a42bf94c0a5b
7
+ data.tar.gz: 553f6492bc3ddfed435c4e678986d45b4fc292bfdc09993aef35b0adab40e40ea78219f3f3c2148f6b54ac71ec41fbc57cbfd874654c5a24d9246a0bb51b304a
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  <h1 align="center">
2
2
  JS From Rails Routes
3
3
  <p align="center">
4
- <a href="https://rubygems.org/gems/js_from_routes"><img alt="Gem Version" src="https://img.shields.io/gem/v/js_from_routes.svg?colorB=e9573f"/></a>
5
4
  <a href="https://travis-ci.org/ElMassimo/js_from_routes"><img alt="Build Status" src="https://travis-ci.org/ElMassimo/js_from_routes.svg"/></a>
6
- <a href="https://codeclimate.com/github/ElMassimo/js_from_routes"><img alt="Coverage Status" src="https://codeclimate.com/github/ElMassimo/request_store_rails/badges/coverage.svg"/></a>
7
- <a href="https://codeclimate.com/github/ElMassimo/js_from_routes"><img alt="Code Quality" src="https://codeclimate.com/github/ElMassimo/js_from_routes/badges/gpa.svg"/></a>
8
5
  <a href="http://inch-ci.org/github/ElMassimo/js_from_routes"><img alt="Inline docs" src="http://inch-ci.org/github/ElMassimo/js_from_routes.svg"/></a>
6
+ <a href="https://codeclimate.com/github/ElMassimo/js_from_routes"><img alt="Maintainability" src="https://codeclimate.com/github/ElMassimo/js_from_routes/badges/gpa.svg"/></a>
7
+ <a href="https://codeclimate.com/github/ElMassimo/js_from_routes"><img alt="Test Coverage" src="https://codeclimate.com/github/ElMassimo/request_store_rails/badges/coverage.svg"/></a>
8
+ <a href="https://rubygems.org/gems/js_from_routes"><img alt="Gem Version" src="https://img.shields.io/gem/v/js_from_routes.svg?colorB=e9573f"/></a>
9
9
  <a href="https://github.com/ElMassimo/js_from_routes/blob/master/LICENSE.txt"><img alt="License" src="https://img.shields.io/badge/license-MIT-428F7E.svg"/></a>
10
10
  </p>
11
11
  </h1>
@@ -14,10 +14,10 @@ _JS from Routes_ helps you by automatically generating path and API helpers from
14
14
  Rails route definitions, allowing you to save development effort and focus on
15
15
  the things that matter.
16
16
 
17
- ## Why? 🤔
17
+ ### Why? 🤔
18
18
 
19
- Path helpers in Rails are useful to ensure the constructed URLs match endpoints
20
- defined in the app.
19
+ Path helpers in Rails are useful, and make it easier to build urls, avoiding
20
+ typos and mistakes.
21
21
 
22
22
  With this library, it's possible the enjoy the same benefits in JS:
23
23
 
@@ -102,7 +102,7 @@ if you prefer a different convention.
102
102
  ##### [`helper_mappings`](https://github.com/ElMassimo/js_from_routes/blob/master/lib/js_from_routes/generator.rb#L80)
103
103
 
104
104
  By default it maps `index` to `list` and `show` to `get`, which helps to make
105
- the JS code read more natural.
105
+ the JS code read more naturally.
106
106
 
107
107
  ##### [`output_folder`](https://github.com/ElMassimo/js_from_routes/blob/master/lib/js_from_routes/generator.rb#L78), default: `app/javascript/requests`
108
108
 
@@ -39,7 +39,12 @@ module JsFromRoutes
39
39
 
40
40
  # Public: Whether it should export only the path.
41
41
  def path_only?
42
- @route.defaults[:export] == :path_only
42
+ export_setting == :path_only
43
+ end
44
+
45
+ # Public: The `export` setting specified for the action.
46
+ def export_setting
47
+ @route.defaults[:export]
43
48
  end
44
49
 
45
50
  # Public: Whether it should export only the path.
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Public: Automatically generates JS for Rails routes with { export: true }.
4
+ # Generates one file per controller, and one function per route.
3
5
  module JsFromRoutes
4
6
  # Public: This library adheres to semantic versioning.
5
- VERSION = '1.0.0'
7
+ VERSION = '1.0.1'
6
8
  end
@@ -0,0 +1,5 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+ config.cache_classes = true
4
+ config.eager_load = true
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js_from_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Máximo Mussini
@@ -79,6 +79,7 @@ files:
79
79
  - spec/support/sample_app/config/boot.rb
80
80
  - spec/support/sample_app/config/environment.rb
81
81
  - spec/support/sample_app/config/environments/development.rb
82
+ - spec/support/sample_app/config/environments/test.rb
82
83
  - spec/support/sample_app/config/initializers/application_controller_renderer.rb
83
84
  - spec/support/sample_app/config/initializers/assets.rb
84
85
  - spec/support/sample_app/config/initializers/backtrace_silencers.rb
@@ -125,6 +126,7 @@ test_files:
125
126
  - spec/support/sample_app/app/controllers/user_preferences_controller.rb
126
127
  - spec/support/sample_app/config/routes.rb
127
128
  - spec/support/sample_app/config/environments/development.rb
129
+ - spec/support/sample_app/config/environments/test.rb
128
130
  - spec/support/sample_app/config/environment.rb
129
131
  - spec/support/sample_app/config/application.rb
130
132
  - spec/support/sample_app/config/puma.rb