larator 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.travis.yml +8 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exe/larator +5 -0
- data/larator.gemspec +30 -0
- data/lib/larator/cli.rb +9 -0
- data/lib/larator/generate.rb +12 -0
- data/lib/larator/generators/base.rb +46 -0
- data/lib/larator/generators/scaffold.rb +44 -0
- data/lib/larator/generators/templates/scaffold/default/controller.tt +107 -0
- data/lib/larator/generators/templates/scaffold/default/factory.tt +5 -0
- data/lib/larator/generators/templates/scaffold/default/model.tt +10 -0
- data/lib/larator/generators/templates/scaffold/default/request.tt +47 -0
- data/lib/larator/generators/templates/scaffold/default/tests/phpunit/test.tt +56 -0
- data/lib/larator/generators/templates/scaffold/default/views/_form.tt +0 -0
- data/lib/larator/generators/templates/scaffold/default/views/create.tt +7 -0
- data/lib/larator/generators/templates/scaffold/default/views/edit.tt +7 -0
- data/lib/larator/generators/templates/scaffold/default/views/index.tt +20 -0
- data/lib/larator/generators/templates/scaffold/default/views/show.tt +10 -0
- data/lib/larator/version.rb +3 -0
- data/lib/larator.rb +5 -0
- metadata +172 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ba688cf6c32c79736f1fe3b734c730ad8291391d
|
4
|
+
data.tar.gz: ad3a6b8d11274baa27ffb529f8d6d415be287ee6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a3462982f9dd3d76db11423b0b95d6fddf47f371b7be7493eea0b13fd3bc5cfc14830fae76859f6512e8e7cf13da6b3b5d495b3d801175c2175d9c6ca7d18e71
|
7
|
+
data.tar.gz: 908f01da0494cdcc29c909524fab47ea4e5aad08bf6021db0348ba780936f64a93cad3a0969d5c3a34d878f4a52cde63059f859b972f8a3bd65045e4a315f7c3
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Harry Budianto
|
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,43 @@
|
|
1
|
+
# Larator
|
2
|
+
|
3
|
+
The main purpose of this generator are:
|
4
|
+
|
5
|
+
1. Give an idea to newcomers how to create a simple CRUD application
|
6
|
+
2. Make development process faster
|
7
|
+
|
8
|
+
## Why ruby
|
9
|
+
|
10
|
+
1. Because ruby has [Thor](https://github.com/erikhuda/thor) gem, which really stable, rich feature and used by several other gems (e.g: rails, bundle)
|
11
|
+
2. Ruby has great [Inflector](http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html) library (from rails)
|
12
|
+
3. Ruby has [Rubygems](https://rubygems.org/) that make delivering process easier
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
$ gem install larator
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
```
|
21
|
+
larator generate scaffold user
|
22
|
+
```
|
23
|
+
|
24
|
+
## Development
|
25
|
+
|
26
|
+
After checking out the repo, run `bundle install` to install dependencies. Then, run `rspec` to run the tests, also run `cucumber` to run [Aruba](https://github.com/cucumber/aruba) test.
|
27
|
+
|
28
|
+
## Todo
|
29
|
+
|
30
|
+
* Read options from .larator.conf config file
|
31
|
+
* Read custom template from .larator folder
|
32
|
+
* Add generator for view, controller, request, etc
|
33
|
+
* Create gh-pages to explain all features
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/guiltry/larator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
38
|
+
|
39
|
+
|
40
|
+
## License
|
41
|
+
|
42
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
43
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "larator"
|
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
data/exe/larator
ADDED
data/larator.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'larator/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "larator"
|
8
|
+
spec.version = Larator::VERSION
|
9
|
+
spec.authors = ["Harry Budianto"]
|
10
|
+
spec.email = ["guiltry@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{The best way to generate your Laravel code}
|
13
|
+
spec.description = %q{No handcraft-code anymore, having one in your toolbox definitely will increase your productivity}
|
14
|
+
spec.homepage = "https://guiltry.github.io/larator/"
|
15
|
+
spec.license = "MIT"
|
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_dependency "thor", "0.19.1"
|
23
|
+
spec.add_dependency "activesupport", "4.2.4"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec", "3.3.0"
|
28
|
+
spec.add_development_dependency "cucumber", "2.1.0"
|
29
|
+
spec.add_development_dependency "aruba", "0.9.0"
|
30
|
+
end
|
data/lib/larator/cli.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'thor/group'
|
3
|
+
require 'active_support/inflector'
|
4
|
+
|
5
|
+
module Larator
|
6
|
+
module Generators
|
7
|
+
class Base < Thor::Group
|
8
|
+
include Thor::Actions
|
9
|
+
|
10
|
+
argument :class_name
|
11
|
+
argument :opt
|
12
|
+
|
13
|
+
def self.source_root
|
14
|
+
File.dirname(__FILE__) + "/templates/#{operation_name}/default"
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.operation_name
|
18
|
+
return self.name.split("::")[-1].downcase
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
|
23
|
+
# ex: UserPower
|
24
|
+
def model_class_name
|
25
|
+
class_name.classify
|
26
|
+
end
|
27
|
+
|
28
|
+
# ex: UserPower / UserPowers (On plural opt)
|
29
|
+
def controller_class_name
|
30
|
+
class_name.classify
|
31
|
+
end
|
32
|
+
|
33
|
+
# ex: user_power
|
34
|
+
def singular_table_name
|
35
|
+
class_name.underscore.singularize
|
36
|
+
end
|
37
|
+
|
38
|
+
# ex: user_powers
|
39
|
+
def plular_table_name
|
40
|
+
class_name.pluralize.underscore
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "larator/generators/base"
|
2
|
+
|
3
|
+
module Larator
|
4
|
+
module Generators
|
5
|
+
class Scaffold < Base
|
6
|
+
|
7
|
+
def controller
|
8
|
+
template("controller.tt", "app/Http/Controllers/#{controller_class_name}Controller.php")
|
9
|
+
end
|
10
|
+
|
11
|
+
def views
|
12
|
+
template("views/index.tt", "resources/views/#{plular_table_name}/index.blade.php")
|
13
|
+
template("views/create.tt", "resources/views/#{plular_table_name}/create.blade.php")
|
14
|
+
template("views/show.tt", "resources/views/#{plular_table_name}/show.blade.php")
|
15
|
+
template("views/edit.tt", "resources/views/#{plular_table_name}/edit.blade.php")
|
16
|
+
template("views/_form.tt", "resources/views/#{plular_table_name}/_form.blade.php")
|
17
|
+
end
|
18
|
+
|
19
|
+
def request
|
20
|
+
template("request.tt", "app/Http/Requests/#{model_class_name}Request.php")
|
21
|
+
end
|
22
|
+
|
23
|
+
def model
|
24
|
+
template("model.tt", "app/#{model_class_name}.php")
|
25
|
+
end
|
26
|
+
|
27
|
+
def migration
|
28
|
+
run("php artisan make:migration create_#{plular_table_name}_table --create=#{plular_table_name}")
|
29
|
+
end
|
30
|
+
|
31
|
+
def route
|
32
|
+
append_to_file("app/Http/routes.php", "Route::resource('#{singular_table_name}', '#{controller_class_name}Controller');")
|
33
|
+
end
|
34
|
+
|
35
|
+
def factory
|
36
|
+
template("factory.tt", "database/factories/#{model_class_name}Factory.php")
|
37
|
+
end
|
38
|
+
|
39
|
+
def test
|
40
|
+
template("tests/phpunit/test.tt", "tests/#{model_class_name}Test.php")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
<?php
|
2
|
+
namespace App\Http\Controllers;
|
3
|
+
|
4
|
+
use App\<%= model_class_name %>;
|
5
|
+
use App\Http\Requests\<%= model_class_name %>Request;
|
6
|
+
use App\Http\Controllers\Controller;
|
7
|
+
|
8
|
+
class <%= controller_class_name %>Controller extends Controller
|
9
|
+
{
|
10
|
+
<%= %{/**
|
11
|
+
* Display a listing of the #{model_class_name}.
|
12
|
+
*
|
13
|
+
* GET #{singular_table_name}
|
14
|
+
*
|
15
|
+
* @return Response
|
16
|
+
*/} %>
|
17
|
+
public function index()
|
18
|
+
{
|
19
|
+
$<%= plular_table_name %> = <%= model_class_name %>::all();
|
20
|
+
return view('<%= plular_table_name %>.index', compact('<%= plular_table_name %>'));
|
21
|
+
}
|
22
|
+
|
23
|
+
<%= %{/**
|
24
|
+
* Show the form for creating a new #{model_class_name}.
|
25
|
+
*
|
26
|
+
* GET #{singular_table_name}/create
|
27
|
+
*
|
28
|
+
* @return Response
|
29
|
+
*/} %>
|
30
|
+
public function create()
|
31
|
+
{
|
32
|
+
return view('<%= plular_table_name %>.create');
|
33
|
+
}
|
34
|
+
|
35
|
+
<%= %{/**
|
36
|
+
* Store a newly created #{model_class_name} in storage.
|
37
|
+
*
|
38
|
+
* POST #{singular_table_name}
|
39
|
+
*
|
40
|
+
* @param #{model_class_name}Request $request
|
41
|
+
* @return Response
|
42
|
+
*/} %>
|
43
|
+
public function store(<%= model_class_name %>Request $request)
|
44
|
+
{
|
45
|
+
$<%= singular_table_name %> = <%= model_class_name %>::create($request->all());
|
46
|
+
return redirect()->route('<%= singular_table_name %>.show', [$<%= singular_table_name %>->id]);
|
47
|
+
}
|
48
|
+
|
49
|
+
<%= %{/**
|
50
|
+
* Display the specified #{model_class_name}.
|
51
|
+
*
|
52
|
+
* GET #{singular_table_name}/1
|
53
|
+
*
|
54
|
+
* @param int $id
|
55
|
+
* @return Response
|
56
|
+
*/} %>
|
57
|
+
public function show($id)
|
58
|
+
{
|
59
|
+
$<%= singular_table_name %> = <%= model_class_name %>::findOrFail($id);
|
60
|
+
return view('<%= plular_table_name %>.show', compact('<%= singular_table_name %>'));
|
61
|
+
}
|
62
|
+
|
63
|
+
<%= %{/**
|
64
|
+
* Show the form for editing the specified #{model_class_name}.
|
65
|
+
*
|
66
|
+
* GET #{singular_table_name}/1/edit
|
67
|
+
*
|
68
|
+
* @param int $id
|
69
|
+
* @return Response
|
70
|
+
*/} %>
|
71
|
+
public function edit($id)
|
72
|
+
{
|
73
|
+
$<%= singular_table_name %> = <%= model_class_name %>::findOrFail($id);
|
74
|
+
return view('<%= plular_table_name %>.edit', compact('<%= singular_table_name %>'));
|
75
|
+
}
|
76
|
+
|
77
|
+
<%= %{/**
|
78
|
+
* Update the specified #{plular_table_name} in storage.
|
79
|
+
*
|
80
|
+
* PATCH/PUT #{singular_table_name}/1
|
81
|
+
*
|
82
|
+
* @param #{model_class_name}Request $request
|
83
|
+
* @param int $id
|
84
|
+
* @return Response
|
85
|
+
*/} %>
|
86
|
+
public function update(<%= model_class_name %>Request $request, $id)
|
87
|
+
{
|
88
|
+
$<%= singular_table_name %> = <%= model_class_name %>::findOrFail($id);
|
89
|
+
$<%= singular_table_name %>->fill($request->all())->update();
|
90
|
+
return redirect()->route('<%= singular_table_name %>.show', [$<%= singular_table_name %>->id]);
|
91
|
+
}
|
92
|
+
|
93
|
+
<%= %{/**
|
94
|
+
* Remove the specified #{plular_table_name} from storage.
|
95
|
+
*
|
96
|
+
* DELETE #{singular_table_name}/1
|
97
|
+
*
|
98
|
+
* @param int $id
|
99
|
+
* @return Response
|
100
|
+
*/} %>
|
101
|
+
public function destroy($id)
|
102
|
+
{
|
103
|
+
$<%= singular_table_name %> = <%= model_class_name %>::destroy($id);
|
104
|
+
return redirect()->route('<%= singular_table_name %>.index');
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<?php
|
2
|
+
namespace App\Http\Requests;
|
3
|
+
|
4
|
+
use App\Http\Requests\Request;
|
5
|
+
|
6
|
+
class <%= model_class_name %>Request extends Request
|
7
|
+
{
|
8
|
+
<%= %{/**
|
9
|
+
* Determine if the user is authorized to make this request.
|
10
|
+
*
|
11
|
+
* @return bool
|
12
|
+
*/} %>
|
13
|
+
public function authorize()
|
14
|
+
{
|
15
|
+
return true;
|
16
|
+
}
|
17
|
+
|
18
|
+
<%= %{/**
|
19
|
+
* Get the validation rules that apply to the request.
|
20
|
+
*
|
21
|
+
* @return array
|
22
|
+
*/} %>
|
23
|
+
public function rules()
|
24
|
+
{
|
25
|
+
return [];
|
26
|
+
|
27
|
+
<%= %{// Just in case you have different rules for each method
|
28
|
+
// switch($this->method())
|
29
|
+
// {
|
30
|
+
// case 'GET':
|
31
|
+
// case 'DELETE':
|
32
|
+
// {
|
33
|
+
// return [];
|
34
|
+
// }
|
35
|
+
// case 'POST':
|
36
|
+
// {
|
37
|
+
// return [];
|
38
|
+
// }
|
39
|
+
// case 'PUT':
|
40
|
+
// case 'PATCH':
|
41
|
+
// {
|
42
|
+
// return [];
|
43
|
+
// }
|
44
|
+
// default:break;
|
45
|
+
// }} %>
|
46
|
+
}
|
47
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
4
|
+
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
5
|
+
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
6
|
+
|
7
|
+
class <%= model_class_name %>Test extends TestCase
|
8
|
+
{
|
9
|
+
use WithoutMiddleware;
|
10
|
+
|
11
|
+
public function testGetIndex()
|
12
|
+
{
|
13
|
+
$response = $this->call('GET', '/<%= singular_table_name %>');
|
14
|
+
$this->assertEquals(200, $response->getStatusCode());
|
15
|
+
}
|
16
|
+
|
17
|
+
public function testGetCreate()
|
18
|
+
{
|
19
|
+
$response = $this->call('GET', '/<%= singular_table_name %>/create');
|
20
|
+
$this->assertEquals(200, $response->getStatusCode());
|
21
|
+
}
|
22
|
+
|
23
|
+
public function testPostStore()
|
24
|
+
{
|
25
|
+
$response = $this->call('POST', '/<%= singular_table_name %>', []);
|
26
|
+
$this->assertEquals(302, $response->getStatusCode());
|
27
|
+
}
|
28
|
+
|
29
|
+
public function testGetShow()
|
30
|
+
{
|
31
|
+
$<%= singular_table_name %> = factory(App\<%= model_class_name %>::class)->create();
|
32
|
+
$response = $this->call('GET', "/<%= singular_table_name %>/{$<%= singular_table_name %>->id}");
|
33
|
+
$this->assertEquals(200, $response->getStatusCode());
|
34
|
+
}
|
35
|
+
|
36
|
+
public function testGetEdit()
|
37
|
+
{
|
38
|
+
$<%= singular_table_name %> = factory(App\<%= model_class_name %>::class)->create();
|
39
|
+
$response = $this->call('GET', "/<%= singular_table_name %>/{$<%= singular_table_name %>->id}/edit");
|
40
|
+
$this->assertEquals(200, $response->getStatusCode());
|
41
|
+
}
|
42
|
+
|
43
|
+
public function testPutUpdate()
|
44
|
+
{
|
45
|
+
$<%= singular_table_name %> = factory(App\<%= model_class_name %>::class)->create();
|
46
|
+
$response = $this->call('PUT', "/<%= singular_table_name %>/{$<%= singular_table_name %>->id}", []);
|
47
|
+
$this->assertEquals(302, $response->getStatusCode());
|
48
|
+
}
|
49
|
+
|
50
|
+
public function testDeleteDestroy()
|
51
|
+
{
|
52
|
+
$<%= singular_table_name %> = factory(App\<%= model_class_name %>::class)->create();
|
53
|
+
$response = $this->call('DELETE', "/<%= singular_table_name %>/{$<%= singular_table_name %>->id}");
|
54
|
+
$this->assertRedirectedToRoute('<%= singular_table_name %>.index');
|
55
|
+
}
|
56
|
+
}
|
File without changes
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{!! Form::open(array('route' => '<%= singular_table_name %>.store')) !!}
|
2
|
+
@include('<%= plular_table_name %>._form')
|
3
|
+
|
4
|
+
{!! Form::submit('Create Me!'); !!}
|
5
|
+
{!! Form::close() !!}
|
6
|
+
|
7
|
+
{!! link_to_route('<%= singular_table_name %>.index', $title = "Back to Index", $attributes = array(), $secure = null) !!}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{!! Form::model($<%= singular_table_name %>, array('route' => array('<%= singular_table_name %>.update', $<%= singular_table_name %>->id), 'method' => 'put')) !!}
|
2
|
+
@include('<%= plular_table_name %>._form')
|
3
|
+
|
4
|
+
{!! Form::submit('Update Me!'); !!}
|
5
|
+
{!! Form::close() !!}
|
6
|
+
|
7
|
+
{!! link_to_route('<%= singular_table_name %>.index', $title = "Back to Index", $attributes = array(), $secure = null) !!}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<table border="1">
|
2
|
+
<tr>
|
3
|
+
<th>id</th>
|
4
|
+
<th>action</th>
|
5
|
+
</tr>
|
6
|
+
@foreach($<%= plular_table_name %> as $<%= singular_table_name %>)
|
7
|
+
<tr>
|
8
|
+
<td>{{$<%= singular_table_name %>->id}}</td>
|
9
|
+
<td>
|
10
|
+
{!! link_to_route('<%= singular_table_name %>.show', $title = "Show", $attributes = array('id' => $<%= singular_table_name %>->id), $secure = null) !!}
|
11
|
+
{!! link_to_route('<%= singular_table_name %>.edit', $title = "Edit", $attributes = array('id' => $<%= singular_table_name %>->id), $secure = null) !!}
|
12
|
+
{!! Form::open(['route' => ['<%= singular_table_name %>.destroy', $<%= singular_table_name %>->id], 'method' => 'DELETE']) !!}
|
13
|
+
{!! Form::submit('Delete') !!}
|
14
|
+
{!! Form::close() !!}
|
15
|
+
</td>
|
16
|
+
</tr>
|
17
|
+
@endforeach
|
18
|
+
</table>
|
19
|
+
|
20
|
+
{!! link_to_route('<%= singular_table_name %>.create', $title = "Create New", $attributes = array(), $secure = null) !!}
|
data/lib/larator.rb
ADDED
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: larator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Harry Budianto
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.19.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.19.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.2.4
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.2.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.10'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.10'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.3.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.3.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: cucumber
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.1.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.1.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: aruba
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.9.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.9.0
|
111
|
+
description: No handcraft-code anymore, having one in your toolbox definitely will
|
112
|
+
increase your productivity
|
113
|
+
email:
|
114
|
+
- guiltry@gmail.com
|
115
|
+
executables:
|
116
|
+
- larator
|
117
|
+
extensions: []
|
118
|
+
extra_rdoc_files: []
|
119
|
+
files:
|
120
|
+
- ".gitignore"
|
121
|
+
- ".rspec"
|
122
|
+
- ".travis.yml"
|
123
|
+
- CODE_OF_CONDUCT.md
|
124
|
+
- Gemfile
|
125
|
+
- LICENSE.txt
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- bin/console
|
129
|
+
- bin/setup
|
130
|
+
- exe/larator
|
131
|
+
- larator.gemspec
|
132
|
+
- lib/larator.rb
|
133
|
+
- lib/larator/cli.rb
|
134
|
+
- lib/larator/generate.rb
|
135
|
+
- lib/larator/generators/base.rb
|
136
|
+
- lib/larator/generators/scaffold.rb
|
137
|
+
- lib/larator/generators/templates/scaffold/default/controller.tt
|
138
|
+
- lib/larator/generators/templates/scaffold/default/factory.tt
|
139
|
+
- lib/larator/generators/templates/scaffold/default/model.tt
|
140
|
+
- lib/larator/generators/templates/scaffold/default/request.tt
|
141
|
+
- lib/larator/generators/templates/scaffold/default/tests/phpunit/test.tt
|
142
|
+
- lib/larator/generators/templates/scaffold/default/views/_form.tt
|
143
|
+
- lib/larator/generators/templates/scaffold/default/views/create.tt
|
144
|
+
- lib/larator/generators/templates/scaffold/default/views/edit.tt
|
145
|
+
- lib/larator/generators/templates/scaffold/default/views/index.tt
|
146
|
+
- lib/larator/generators/templates/scaffold/default/views/show.tt
|
147
|
+
- lib/larator/version.rb
|
148
|
+
homepage: https://guiltry.github.io/larator/
|
149
|
+
licenses:
|
150
|
+
- MIT
|
151
|
+
metadata: {}
|
152
|
+
post_install_message:
|
153
|
+
rdoc_options: []
|
154
|
+
require_paths:
|
155
|
+
- lib
|
156
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
requirements: []
|
167
|
+
rubyforge_project:
|
168
|
+
rubygems_version: 2.2.2
|
169
|
+
signing_key:
|
170
|
+
specification_version: 4
|
171
|
+
summary: The best way to generate your Laravel code
|
172
|
+
test_files: []
|