load_resources 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 95eb82094091dea100ec8c889c2a6164fa4933a1
4
+ data.tar.gz: a5a1046e7678ef24dcd5c1476b7678ef117e97c7
5
+ SHA512:
6
+ metadata.gz: 89025822b49da3d72d9be3e78bfbd4dd4cfb06be4cd58c8ac15bcc128027e458e3f9dc937781cb25758c8a60fc4c5a07c81f1850b094b3cb38450ea10795c131
7
+ data.tar.gz: 2a82cda96e37d01f54c37e252bce2924308369310fbf5baf4764066a8cb0a428f1de86c7495dadf5de3570c9f296f98de56e395d89d54ddae03c3eb8ed5ede1a
checksums.yaml.gz.sig ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'railties'
4
+ # Specify your gem's dependencies in load_resources.gemspec
5
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Renan Oronfle
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # LoadResources
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'load_resources'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install load_resources
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/load_resources/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,24 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
+ require 'rdoc/task'
6
+
7
+ desc 'Run tests for LoadResources.'
8
+ Rake::TestTask.new(:test) do |t|
9
+ t.pattern = 'test/**/*_test.rb'
10
+ t.verbose = true
11
+ end
12
+
13
+ desc 'Generate documentation for Load Resources.'
14
+ Rake::RDocTask.new(:rdoc) do |rdoc|
15
+ rdoc.rdoc_dir = 'rdoc'
16
+ rdoc.title = 'LoadResources'
17
+ rdoc.options << '--line-numbers' << '--inline-source'
18
+ rdoc.rdoc_files.include('README.rdoc')
19
+ rdoc.rdoc_files.include('MIT-LICENSE')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ # Make test the default task.
24
+ task :default => :test
@@ -0,0 +1,7 @@
1
+ require 'rails/railtie'
2
+
3
+ module LoadResources
4
+ class Railtie < Rails::Railtie
5
+ config.eager_load_namespaces << LoadResources
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module LoadResources
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,46 @@
1
+ require "load_resources/version"
2
+
3
+ module LoadResources
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ before_action :load_resource, only: [:show, :edit, :destroy, :update]
8
+ before_action :new_resource, only: [:new, :create]
9
+ before_action :load_resources, only: :index
10
+ end
11
+
12
+ def automatic_resources(resource_names = {}, actions = {})
13
+
14
+ end
15
+
16
+ # criar metodo para fazer o load ou o new do resource parecido com o before_action
17
+ # automatic_resource :resource_name, only: [:new, :create]
18
+ # automatic_resource :resource_name, except: [:new, :create]
19
+ # automatic_resource :crud,
20
+ # poder especificar o tipo do resource se é um new, um find simples, all, ou a conditions
21
+ # automatic_resource :resource_name, only: [:nova_action], options: [:new, :all, :find ou find: {key: find_id}, conditions: {name: 'seila'} ]
22
+ # automatic_resource [:resource_name, :resource_name2], only: [:nova_action], options: [:new, :all, :find ou find: {key: find_id}, conditions: {name: 'seila'} ]
23
+
24
+ def load_resources
25
+ instance_variable_set resource_instance_name.pluralize, resource_class.all
26
+ end
27
+
28
+ def new_resource
29
+ binding.pry
30
+ instance_variable_set resource_instance_name, resource_class.new
31
+ end
32
+
33
+ def load_resource
34
+ clazz = resource_class
35
+ instance_variable_set resource_instance_name,
36
+ clazz.find_by(id: params[:id])
37
+ end
38
+
39
+ def resource_instance_name
40
+ "@#{params['controller'].singularize}"
41
+ end
42
+
43
+ def resource_class
44
+ Object.const_get(params['controller'].classify)
45
+ end
46
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'load_resources/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "load_resources"
8
+ spec.version = LoadResources::VERSION
9
+ spec.authors = ["Renan Oronfle"]
10
+ spec.email = ["renanoronfle@gmail.com"]
11
+ spec.summary = %q{Load boring resources.}
12
+ spec.description = %q{load resources.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
File without changes
File without changes
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: load_resources
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Renan Oronfle
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDgDCCAmigAwIBAgIBATANBgkqhkiG9w0BAQUFADBDMRUwEwYDVQQDDAxyZW5h
14
+ bm9yb25mbGUxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkW
15
+ A2NvbTAeFw0xNjAyMTgxMjQ0NDNaFw0xNzAyMTcxMjQ0NDNaMEMxFTATBgNVBAMM
16
+ DHJlbmFub3JvbmZsZTEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPy
17
+ LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2qFcWCLD
18
+ /GV9m4dbQXkx87YEAC0rtmszNUsoRkW5WWPleusl5wntb6UxWDs0xD0VCLDs5h4z
19
+ MfIIOagnHmXqMwWnMibbY3E1UeYyeKtkJgWDOHTpAmPyT4nu6V9eIO4vsrONSZqX
20
+ 3dpl1SzHUxdNJ5UMw3sbzSTvj/4Q6SdhNAX+CJ3i8a2TYPqA+8gN09SJ3pjpkpSs
21
+ 3KcsK1VgaDgxDPTOiUldoA4aWk6RxzjyfsgHz2GG7aEtVuGXhoXGjoCULgGJ8m2Y
22
+ hgI+8H8CigMfBR4MLrtgJsaIepfGBXIvC47KLpjvTJdQj59f95iiMXHiMqIhOArj
23
+ tlumYtCfasfiPQIDAQABo38wfTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
24
+ HQ4EFgQUQoIXauzdEqMLBRPzo1KobSFG+7UwIQYDVR0RBBowGIEWcmVuYW5vcm9u
25
+ ZmxlQGdtYWlsLmNvbTAhBgNVHRIEGjAYgRZyZW5hbm9yb25mbGVAZ21haWwuY29t
26
+ MA0GCSqGSIb3DQEBBQUAA4IBAQCo0fkqTlrGXlq+fAujVU6CYRZDpoiCSrTLfO68
27
+ p+iNlgFzh9lJF9KZUtf9ZHMV2qYRjniKxVvK1ehD94PPNxbhuArxdOChXbFk2B6t
28
+ 1UkgclnHd0hfWY/9pJbc4Bx95UYKtAToJe5ZXE5bK3ZWqoJDf/PV2SWDlFsWQ+1o
29
+ IMbpp4WkpLf6loX97D50/mmRsLeJMYjhCfmlPPXvEraZLYsq3Yj3uICdvnPzIbQu
30
+ G/deCkh3WDUtBeEKSz3F0EeN+83rUs3YsHC8BLBWYijdvcBPipD8GZgTqnKW9aSY
31
+ h+9WLcjUsXPxXVT9F0v/eS3W3q334RUrEpGGbTFJyt+W4K+t
32
+ -----END CERTIFICATE-----
33
+ date: 2016-02-18 00:00:00.000000000 Z
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: bundler
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.7'
42
+ type: :development
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '1.7'
49
+ - !ruby/object:Gem::Dependency
50
+ name: rake
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '10.0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '10.0'
63
+ description: load resources.
64
+ email:
65
+ - renanoronfle@gmail.com
66
+ executables: []
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - ".gitignore"
71
+ - Gemfile
72
+ - LICENSE.txt
73
+ - README.md
74
+ - Rakefile
75
+ - lib/load_resources.rb
76
+ - lib/load_resources/railtie.rb
77
+ - lib/load_resources/version.rb
78
+ - load_resources.gemspec
79
+ - test/load_resources_test.rb
80
+ - test/test_helper.rb
81
+ homepage: ''
82
+ licenses:
83
+ - MIT
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.4.5.1
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: Load boring resources.
105
+ test_files:
106
+ - test/load_resources_test.rb
107
+ - test/test_helper.rb
metadata.gz.sig ADDED
@@ -0,0 +1 @@
1
+ �s^���*�ְ��^������0�pɒ��T����|��'jJ