fast_crud 0.1.9

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: 38ba475cb26f365d1412baa84ddf8a47b2327a8c
4
+ data.tar.gz: d0871af84586c684da9c817d6a4aa401bd8cffc6
5
+ SHA512:
6
+ metadata.gz: 748bb377a3193f2998153d6e5a6330cbb475e4ab1be5a7a4d83403503a7cb10014a4f66c02191327344dd7dd7ce6b37c2eabf8982d2747db67209c51eb19b841
7
+ data.tar.gz: 275054bc55689dba545bf4b6114f3db132b90048ee9641b53449c466a8ed057187a445e092bd543cf721ec7bc39dbb3b33063b91434f9aa3008e8103880e1a86
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fast_crud.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 lou
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # FastCrud
2
+
3
+ Fast Crud is here to help you write faster CRUD controllers and DRY in your project. It implement the basic CRUD methods on your controllers as described in [the getting started of rails documentation](http://guides.rubyonrails.org/getting_started.html)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'fast_crud'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install fast_crud
20
+
21
+ ## Usage
22
+
23
+ \# To come
24
+
25
+ ## License
26
+
27
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "fast_crud"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/fast_crud.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fast_crud/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "fast_crud"
8
+ spec.version = '0.1.9'
9
+ spec.authors = ["lou"]
10
+ spec.email = ["louguenier@gmail.com"]
11
+
12
+ spec.summary = "fast_crud is a superclass that will design the basic implementation of CRUD controller"
13
+ spec.homepage = "http://github.com/lguenier/fast_crud"
14
+ spec.license = "MIT"
15
+
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.12"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ end
@@ -0,0 +1,3 @@
1
+ module FastCrud
2
+ VERSION = "0.1.9"
3
+ end
data/lib/fast_crud.rb ADDED
@@ -0,0 +1,57 @@
1
+ require "fast_crud/version"
2
+
3
+ module FastCrud
4
+ class FastCrud < ActionController::Base
5
+ def index
6
+ @collection = model.all
7
+ end
8
+
9
+ def show
10
+ @resource = model.find(params[:id])
11
+ end
12
+
13
+ def new
14
+ @resource = model.new
15
+ end
16
+
17
+ def edit
18
+ @resource = model.find(params[:id])
19
+ end
20
+
21
+ def create
22
+ @resource = model.new(model_params)
23
+
24
+ if @resource.save
25
+ flash[:success] = "#{model} successfully created!"
26
+ redirect_to @resource
27
+ else
28
+ flash[:danger] = "Error creating #{model}: #{@resource.errors.full_messages.join(' - ')}"
29
+ render 'new'
30
+ end
31
+ end
32
+
33
+ def update
34
+ @resource = model.find(params[:id])
35
+
36
+ if @resource.update(model_params)
37
+ flash[:success] = "#{model} successfully updated!"
38
+ redirect_to @resource
39
+ else
40
+ flash[:danger] = "Error updating #{model}: #{@resource.errors.full_messages.join(' - ')}"
41
+ render 'edit'
42
+ end
43
+ end
44
+
45
+ def destroy
46
+ @resource = model.find(params[:id])
47
+ @resource.destroy
48
+
49
+ redirect_to eval("#{controller_name}_path")
50
+ end
51
+
52
+ private
53
+ def model
54
+ controller_name.singularize.capitalize.constantize
55
+ end
56
+ end
57
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fast_crud
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.9
5
+ platform: ruby
6
+ authors:
7
+ - lou
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-06-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description:
42
+ email:
43
+ - louguenier@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - bin/console
54
+ - bin/setup
55
+ - fast_crud.gemspec
56
+ - lib/fast_crud.rb
57
+ - lib/fast_crud/version.rb
58
+ homepage: http://github.com/lguenier/fast_crud
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.5.1
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: fast_crud is a superclass that will design the basic implementation of CRUD
82
+ controller
83
+ test_files: []