nacho 0.0.2 → 0.0.3

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: 55069f49f226b3b6b7e0e87f1a5494a23c269c7e
4
- data.tar.gz: a27937c4b05b03b623534b4c5bf7bae828e05184
3
+ metadata.gz: 275c11a50f48a33f9ea304724622aaff3420f286
4
+ data.tar.gz: 3629522371fe416befb503c5e9b9d29db43e21ab
5
5
  SHA512:
6
- metadata.gz: 4206322c9b667de5b569bc8971408cd198a41ab5888df6621fcff7e7918d7766decb27b2dfe6fbbab71b5f691dfed3e993e852ff93280af600206ca7ca2f5c4d
7
- data.tar.gz: 3351c6fc05c495258243ab2872b178313467709f155d5583cf5101c11a0a4d1555a4f3dfb9c33ed42cb01f101f28825a134f80376047aa57016bbec207d444cf
6
+ metadata.gz: 94b479ca8c8f825eb457b76c506a7511e95cc8f41fc33d7b64a2c2a66c974ead6e02c3756e4f5f40e4084cd0d733c3e7e87339d70a1eb697365bb6e8dcaa8e44
7
+ data.tar.gz: 71c5b9d78147d00a6a8b3579030e0e87e92cf126d714e4d9a88879c00866dd4ba493a8dfece0fda73bd6a7c5605be5facd729254b2e5ada5aae54720c4b42174
@@ -1,13 +1,26 @@
1
- require 'nacho/form_builder'
2
- require 'nacho/helper'
3
-
4
-
5
1
  module Nacho
6
- module Rails
7
- class Engine < ::Rails::Engine
8
- end
9
- end
10
2
  end
11
3
 
4
+ # load Rails/Railtie
5
+ begin
6
+ require 'rails'
7
+ rescue LoadError
8
+ #do nothing
9
+ end
10
+
11
+ $stderr.puts <<-EOC if !defined?(Rails)
12
+ warning: no rails framework detected.
13
+ Your Gemfile might not be configured properly.
14
+ ---- e.g. ----
15
+ Rails:
16
+ gem 'nacho'
17
+ EOC
18
+
19
+ require 'nacho/form_builder'
20
+ require 'nacho/helper'
21
+ require 'nacho/hooks'
12
22
 
13
- ActionView::Base.send :include, Nacho::Helper
23
+ if defined? Rails
24
+ require 'nacho/railtie'
25
+ require 'nacho/engine'
26
+ end
@@ -0,0 +1,4 @@
1
+ module Nacho #:nodoc:
2
+ class Engine < ::Rails::Engine #:nodoc:
3
+ end
4
+ end
@@ -1,4 +1,4 @@
1
- require_relative 'common'
1
+ require 'nacho/common'
2
2
 
3
3
  # module Nacho
4
4
  # class FormBuilder < ActionView::Helpers::FormBuilder
@@ -1,8 +1,8 @@
1
- require_relative 'common'
1
+ require 'nacho/common'
2
2
 
3
3
  module Nacho
4
4
  module Helper
5
- include Common
5
+ include Nacho::Common
6
6
 
7
7
  # A tag helper version for a FormBuilder class. Will create the select and the needed modal that contains the given
8
8
  # form for the target model to create.
@@ -0,0 +1,9 @@
1
+ module Nacho
2
+ class Hooks
3
+ def self.init
4
+ ActiveSupport.on_load(:action_view) do
5
+ ::ActionView::Base.send :include, Nacho::Helper
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Nacho
2
+ class Railtie < ::Rails::Railtie #:nodoc:
3
+ initializer 'nacho' do |_app|
4
+ Nacho::Hooks.init
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Nacho
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nacho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Ward
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-25 00:00:00.000000000 Z
11
+ date: 2016-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -65,8 +65,11 @@ files:
65
65
  - app/assets/javascripts/nacho.js
66
66
  - lib/nacho.rb
67
67
  - lib/nacho/common.rb
68
+ - lib/nacho/engine.rb
68
69
  - lib/nacho/form_builder.rb
69
70
  - lib/nacho/helper.rb
71
+ - lib/nacho/hooks.rb
72
+ - lib/nacho/railtie.rb
70
73
  - lib/nacho/version.rb
71
74
  - lib/tasks/nacho_tasks.rake
72
75
  - test/dummy/README.rdoc