roda_api_generator 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +2 -0
  3. data/.gitignore +38 -0
  4. data/.rspec +4 -0
  5. data/.rubocop.yml +26 -0
  6. data/.travis.yml +23 -0
  7. data/CHANGELOG.md +37 -0
  8. data/CONTRIBUTING.md +29 -0
  9. data/Gemfile +6 -0
  10. data/Gemfile.lock +63 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +29 -0
  13. data/Rakefile +6 -0
  14. data/bin/console +14 -0
  15. data/bin/setup +8 -0
  16. data/example/.env +4 -0
  17. data/example/.rspec +2 -0
  18. data/example/Gemfile +28 -0
  19. data/example/Gemfile.lock +104 -0
  20. data/example/LICENSE +22 -0
  21. data/example/README.md +38 -0
  22. data/example/Rakefile +15 -0
  23. data/example/application/api.rb +17 -0
  24. data/example/application/api/api_support.rb +14 -0
  25. data/example/application/api/models/user.rb +6 -0
  26. data/example/application/api/operations/user_service.rb +15 -0
  27. data/example/application/api/routes/main.rb +20 -0
  28. data/example/application/config/database.rb +2 -0
  29. data/example/application/config/sequel.rb +11 -0
  30. data/example/application/db/migrations/20180930152809_add_user_table.rb +15 -0
  31. data/example/application/db/migrations/migration_template.rb +4 -0
  32. data/example/application/tasks/db.rake +30 -0
  33. data/example/config.ru +3 -0
  34. data/example/spec/root_view_spec.rb +17 -0
  35. data/example/spec/spec_helper.rb +69 -0
  36. data/exe/api_generators +6 -0
  37. data/lib/roda_api_generator.rb +6 -0
  38. data/lib/roda_api_generator/cli.rb +28 -0
  39. data/lib/roda_api_generator/generators/roda.rb +101 -0
  40. data/lib/roda_api_generator/templates/roda/.env +4 -0
  41. data/lib/roda_api_generator/templates/roda/Gemfile +28 -0
  42. data/lib/roda_api_generator/templates/roda/LICENSE +22 -0
  43. data/lib/roda_api_generator/templates/roda/README.md +38 -0
  44. data/lib/roda_api_generator/templates/roda/Rakefile +15 -0
  45. data/lib/roda_api_generator/templates/roda/application/api.rb +17 -0
  46. data/lib/roda_api_generator/templates/roda/application/api/api_support.rb +14 -0
  47. data/lib/roda_api_generator/templates/roda/application/api/models/user.rb +6 -0
  48. data/lib/roda_api_generator/templates/roda/application/api/operations/user_service.rb +15 -0
  49. data/lib/roda_api_generator/templates/roda/application/api/routes/main.rb +20 -0
  50. data/lib/roda_api_generator/templates/roda/application/config/database.rb +2 -0
  51. data/lib/roda_api_generator/templates/roda/application/config/sequel.rb +11 -0
  52. data/lib/roda_api_generator/templates/roda/application/db/migrations/20180930152809_add_user_table.rb +15 -0
  53. data/lib/roda_api_generator/templates/roda/application/db/migrations/migration_template.rb +4 -0
  54. data/lib/roda_api_generator/templates/roda/application/tasks/db.rake +30 -0
  55. data/lib/roda_api_generator/templates/roda/config.ru +3 -0
  56. data/lib/roda_api_generator/templates/roda/spec/root_view_spec.rb +17 -0
  57. data/lib/roda_api_generator/templates/roda/spec/rspec.options +2 -0
  58. data/lib/roda_api_generator/templates/roda/spec/spec_helper.rb.erb +69 -0
  59. data/lib/roda_api_generator/version.rb +3 -0
  60. data/roda_api_generator.gemspec +30 -0
  61. metadata +188 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2ec79a2d37b219e25220b761efbdddf954b4826450cb73fb52e0058f7f738260
4
+ data.tar.gz: 9b47e474936576a4b3f84fe21d52d5d450e18d33d40c0ba70c1552da74ccbbe5
5
+ SHA512:
6
+ metadata.gz: 2dd3c7889cad7415832b446eebbb637a1a8be83b8442bafc827ad3f29bb23689f3af6aec38018a9eecf0849f3577afb44fb02588a8cd6cd75e40f453f1d707d0
7
+ data.tar.gz: 99ebe7c4c6d7cd19d53f2967803e68ad3b09a449dcf0d99d121f9ac16fd10c5cace231adcaeb537b2f7e2ce6b27c44466a9df54ef8bd7e953b26495427a46b7d
@@ -0,0 +1,2 @@
1
+ exclude_patterns:
2
+ - "examples"
@@ -0,0 +1,38 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+
8
+ /example/.bundle/
9
+ /example/coverage/
10
+
11
+ ## Specific to RubyMotion:
12
+ .dat*
13
+ .repl_history
14
+ build/
15
+ *.bridgesupport
16
+ build-iPhoneOS/
17
+ build-iPhoneSimulator/
18
+
19
+ ## Documentation cache and generated files:
20
+ /.yardoc/
21
+ /_yardoc/
22
+ /doc/
23
+ /rdoc/
24
+
25
+ ## Environment normalization:
26
+ /.bundle/
27
+ /vendor/bundle
28
+ /lib/bundler/man/
29
+
30
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
31
+ .rvmrc
32
+
33
+ # OS generated files #
34
+ .DS_Store
35
+ .DS_Store?
36
+ ._*
37
+ .Spotlight-V100
38
+ .Trashes
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --format documentation
2
+ --color
3
+ --tty
4
+ --require spec_helper
@@ -0,0 +1,26 @@
1
+ Metrics/BlockLength:
2
+ Exclude:
3
+ - 'roda_api_generator.gemspec'
4
+
5
+ Metrics/LineLength:
6
+ Max: 100
7
+
8
+ Metrics/MethodLength:
9
+ Max: 20
10
+
11
+ Metrics/AbcSize:
12
+ Max: 20
13
+
14
+ Layout/SpaceBeforeSemicolon:
15
+ Enabled: false
16
+
17
+ Style/Documentation:
18
+ Enabled: false
19
+
20
+ Style/RedundantReturn:
21
+ AllowMultipleReturnValues: true
22
+
23
+ Style/PercentLiteralDelimiters:
24
+ PreferredDelimiters:
25
+ default: ()
26
+ '%w': '()'
@@ -0,0 +1,23 @@
1
+ env:
2
+ global:
3
+ - CC_TEST_REPORTER_ID=d1da4b827312990bcb30ba473ab79555ba4aa9758eae2811c7ed3349d9e5e5ec
4
+ sudo: false
5
+ language: ruby
6
+ cache: bundler
7
+ rvm:
8
+ - 2.3.0
9
+ - 2.4.4
10
+ - 2.5.1
11
+ - ruby-head
12
+ before_script:
13
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
14
+ - chmod +x ./cc-test-reporter
15
+ - ./cc-test-reporter before-build
16
+ script:
17
+ - bundle exec rspec
18
+ - bundle exec rubocop
19
+ after_script:
20
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
21
+ matrix:
22
+ allow_failures:
23
+ - rvm: ruby-head
@@ -0,0 +1,37 @@
1
+ # Changelog
2
+
3
+ ## HEAD Unreleased
4
+ ### Latest update: 2018-10-04
5
+
6
+ ### Chores
7
+ - [PR #9](https://github.com/napice/roda_api_generator/pull/9) Rename project_name folder to examples [@vbrazo](https://github.com/vbrazo)
8
+
9
+ ### Feature Request
10
+ - [PR #13](https://github.com/napice/roda_api_generator/pull/13) Add migration template file for Roda generator [@vbrazo](https://github.com/vbrazo)
11
+ - [PR #12](https://github.com/napice/roda_api_generator/pull/12) Add roda-http-auth and update Rakefile [@vbrazo](https://github.com/vbrazo)
12
+
13
+ ------------------------------------------------------------------------------
14
+
15
+ ## v0.1.1 (2018-09-29)
16
+ ### Latest update: 2018-09-28
17
+
18
+ ### Chores
19
+ - [PR #7](https://github.com/napice/roda_api_generator/pull/7) Add gem badge after pushing to rubygems [@vbrazo](https://github.com/vbrazo)
20
+ - [PR #6](https://github.com/napice/roda_api_generator/pull/6) Add .codeclimate.yml [@vbrazo](https://github.com/vbrazo)
21
+
22
+ ### Feature Request
23
+ - [PR #8](https://github.com/napice/roda_api_generator/pull/8) Add /operations to Roda Generator [@vbrazo](https://github.com/vbrazo)
24
+
25
+ ------------------------------------------------------------------------------
26
+
27
+ ## v0.1.0 (2018-09-29)
28
+ ### Latest update: 2018-09-28
29
+
30
+ ### Documentation
31
+ - [PR #2](https://github.com/napice/roda_api_generator/pull/2) Add changelog.md and contributing.md [@vbrazo](https://github.com/vbrazo)
32
+
33
+ ### Feature Request
34
+ - [PR #5](https://github.com/napice/roda_api_generator/pull/5) Add Roda generator [@vbrazo](https://github.com/vbrazo)
35
+ - [PR #4](https://github.com/napice/roda_api_generator/pull/4) Add Thor and CLI [@vbrazo](https://github.com/vbrazo)
36
+ - [PR #3](https://github.com/napice/roda_api_generator/pull/3) Add Travis, Code Climate and SimpleCov [@vbrazo](https://github.com/vbrazo)
37
+ - [PR #1](https://github.com/napice/roda_api_generator/pull/1) Set up project [@vbrazo](https://github.com/vbrazo)
@@ -0,0 +1,29 @@
1
+ We love pull requests. Here's a quick guide:
2
+
3
+ 1. Fork the repo.
4
+
5
+ 2. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate: `bundle exec rspec`
6
+
7
+ 3. Please add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, we need a test! We use [Rspec](http://rspec.info/) in this project.
8
+
9
+ 4. We care about code coverage and use `SimpleCov` to analyze the code and generate test coverage reports. If you want to see the report, just run `open coverage/index.html` in your terminal.
10
+
11
+ 5. Push to your fork and submit a pull request.
12
+
13
+ ### Github Flow for contributors and collaborators
14
+
15
+ For those of you with commit access, please check out Scott Chacon's blog post about [github flow](http://scottchacon.com/2011/08/31/github-flow.html)
16
+
17
+ > * Anything in the master branch is deployable
18
+ > * To work on something new, create a descriptively named branch off of master (ie: new-oauth2-scopes)
19
+ > * Commit to that branch locally and regularly push your work to the same named branch on the server
20
+ > * When you need feedback or help, or you think the branch is ready for merging, open a pull request
21
+ > * After someone else has reviewed and signed off on the feature, you can merge it into master
22
+
23
+ If you're reviewing a PR, you should ask youserlf:
24
+ > * Does it work as described? A PR should have a great description.
25
+ > * Is it understandable?
26
+ > * Is it well implemented?
27
+ > * Is it well tested?
28
+ > * Is it well documented?
29
+ > * Is it following the structure of the project?
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in roda_api_generator.gemspec
6
+ gemspec
@@ -0,0 +1,63 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ roda_api_generator (0.1.1)
5
+ thor
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.0)
11
+ diff-lcs (1.3)
12
+ docile (1.3.1)
13
+ jaro_winkler (1.5.1)
14
+ json (2.1.0)
15
+ parallel (1.12.1)
16
+ parser (2.5.1.2)
17
+ ast (~> 2.4.0)
18
+ powerpack (0.1.2)
19
+ rainbow (3.0.0)
20
+ rake (10.5.0)
21
+ rspec (3.8.0)
22
+ rspec-core (~> 3.8.0)
23
+ rspec-expectations (~> 3.8.0)
24
+ rspec-mocks (~> 3.8.0)
25
+ rspec-core (3.8.0)
26
+ rspec-support (~> 3.8.0)
27
+ rspec-expectations (3.8.1)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.8.0)
30
+ rspec-mocks (3.8.0)
31
+ diff-lcs (>= 1.2.0, < 2.0)
32
+ rspec-support (~> 3.8.0)
33
+ rspec-support (3.8.0)
34
+ rubocop (0.59.2)
35
+ jaro_winkler (~> 1.5.1)
36
+ parallel (~> 1.10)
37
+ parser (>= 2.5, != 2.5.1.1)
38
+ powerpack (~> 0.1)
39
+ rainbow (>= 2.2.2, < 4.0)
40
+ ruby-progressbar (~> 1.7)
41
+ unicode-display_width (~> 1.0, >= 1.0.1)
42
+ ruby-progressbar (1.10.0)
43
+ simplecov (0.16.1)
44
+ docile (~> 1.1)
45
+ json (>= 1.8, < 3)
46
+ simplecov-html (~> 0.10.0)
47
+ simplecov-html (0.10.2)
48
+ thor (0.20.0)
49
+ unicode-display_width (1.4.0)
50
+
51
+ PLATFORMS
52
+ ruby
53
+
54
+ DEPENDENCIES
55
+ bundler (~> 1.16)
56
+ rake (~> 10.0)
57
+ rspec (~> 3.0)
58
+ rubocop (= 0.59.2)
59
+ roda_api_generator!
60
+ simplecov (= 0.16.1)
61
+
62
+ BUNDLED WITH
63
+ 1.16.4
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Vitor Oliveira
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.
@@ -0,0 +1,29 @@
1
+ # [Napice](http://napice.com) Roda API Generator [![Build Status](https://travis-ci.org/Napice/roda_api_generator.svg?branch=master)](https://travis-ci.org/Napice/roda_api_generator) [![Gem Version](https://badge.fury.io/rb/roda_api_generator.svg)](https://badge.fury.io/rb/roda_api_generator) [![Maintainability](https://api.codeclimate.com/v1/badges/7cde798649fb102fd5b2/maintainability)](https://codeclimate.com/github/Napice/roda_api_generator/maintainability)
2
+
3
+ A useful Roda API generator script to scaffold your API.
4
+
5
+ ## Setup
6
+
7
+ Install it yourself as:
8
+
9
+ $ gem install roda_api_generator
10
+
11
+ ## Included generator
12
+
13
+ Roda API scaffolding: `api_generators roda --name=your_project_name`
14
+
15
+ To view the README for each generator, run it with the help option.
16
+
17
+ $ api_generators help
18
+
19
+ ## Found a bug?
20
+
21
+ If you are having a problem with this gem, please submit an issue.
22
+
23
+ ## Contributing
24
+
25
+ See [CONTRIBUTING.md](https://github.com/napice/roda_api_generator/blob/master/CONTRIBUTING.md).
26
+
27
+ ## License
28
+
29
+ The gem is available as open source under the terms of the [MIT License](https://github.com/Napice/roda_api_generator/blob/master/LICENSE.txt).
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'roda_api_generator'
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(__FILE__)
@@ -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
@@ -0,0 +1,4 @@
1
+ DATABASE_ENV=postgres://root@localhost/db_development
2
+
3
+ RACK_COOKIE_KEY=something
4
+ RACK_COOKIE_SECRET=oEwNzxGhy6Xpw81dPyVQc1GI1Tb49pn0vie+nwwHnyDBuu0IwKbcR9WoXBDTXNQAeso=
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,28 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'rake', '11.2.2'
5
+ end
6
+
7
+ gem 'dotenv', '2.5.0'
8
+ gem 'pg', '0.18.4'
9
+ gem 'puma', '3.12.0'
10
+ gem 'rack-protection', '1.5.5'
11
+ gem 'roda', '~> 2.26.0'
12
+ gem 'roda-http-auth'
13
+ gem 'sequel', '4.35.0'
14
+ gem 'simplecov', '0.16.1'
15
+
16
+ group :development, :test do
17
+ gem 'awesome_print', '1.8.0'
18
+ gem 'pry', '0.11.3'
19
+ gem 'rubocop'
20
+ end
21
+
22
+ group :test do
23
+ gem 'factory_bot', '4.8.2'
24
+ gem 'faker', '1.8.7'
25
+ gem 'rack-test', '1.0.0'
26
+ gem 'rspec', '3.7.0'
27
+ gem 'rspec_sequel_matchers', '0.4.0'
28
+ end
@@ -0,0 +1,104 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ activesupport (5.2.1)
5
+ concurrent-ruby (~> 1.0, >= 1.0.2)
6
+ i18n (>= 0.7, < 2)
7
+ minitest (~> 5.1)
8
+ tzinfo (~> 1.1)
9
+ ast (2.4.0)
10
+ awesome_print (1.8.0)
11
+ coderay (1.1.2)
12
+ concurrent-ruby (1.0.5)
13
+ diff-lcs (1.3)
14
+ docile (1.3.1)
15
+ dotenv (2.5.0)
16
+ factory_bot (4.8.2)
17
+ activesupport (>= 3.0.0)
18
+ faker (1.8.7)
19
+ i18n (>= 0.7)
20
+ i18n (1.1.0)
21
+ concurrent-ruby (~> 1.0)
22
+ jaro_winkler (1.5.1)
23
+ json (2.1.0)
24
+ method_source (0.9.0)
25
+ minitest (5.11.3)
26
+ parallel (1.12.1)
27
+ parser (2.5.1.2)
28
+ ast (~> 2.4.0)
29
+ pg (0.18.4)
30
+ powerpack (0.1.2)
31
+ pry (0.11.3)
32
+ coderay (~> 1.1.0)
33
+ method_source (~> 0.9.0)
34
+ puma (3.12.0)
35
+ rack (2.0.5)
36
+ rack-protection (1.5.5)
37
+ rack
38
+ rack-test (1.0.0)
39
+ rack (>= 1.0, < 3)
40
+ rainbow (3.0.0)
41
+ rake (11.2.2)
42
+ roda (2.26.0)
43
+ rack
44
+ roda-http-auth (0.2.0)
45
+ roda (>= 2.0, < 4.0)
46
+ rspec (3.7.0)
47
+ rspec-core (~> 3.7.0)
48
+ rspec-expectations (~> 3.7.0)
49
+ rspec-mocks (~> 3.7.0)
50
+ rspec-core (3.7.1)
51
+ rspec-support (~> 3.7.0)
52
+ rspec-expectations (3.7.0)
53
+ diff-lcs (>= 1.2.0, < 2.0)
54
+ rspec-support (~> 3.7.0)
55
+ rspec-mocks (3.7.0)
56
+ diff-lcs (>= 1.2.0, < 2.0)
57
+ rspec-support (~> 3.7.0)
58
+ rspec-support (3.7.1)
59
+ rspec_sequel_matchers (0.4.0)
60
+ sequel (>= 3.8.0)
61
+ rubocop (0.59.2)
62
+ jaro_winkler (~> 1.5.1)
63
+ parallel (~> 1.10)
64
+ parser (>= 2.5, != 2.5.1.1)
65
+ powerpack (~> 0.1)
66
+ rainbow (>= 2.2.2, < 4.0)
67
+ ruby-progressbar (~> 1.7)
68
+ unicode-display_width (~> 1.0, >= 1.0.1)
69
+ ruby-progressbar (1.10.0)
70
+ sequel (4.35.0)
71
+ simplecov (0.16.1)
72
+ docile (~> 1.1)
73
+ json (>= 1.8, < 3)
74
+ simplecov-html (~> 0.10.0)
75
+ simplecov-html (0.10.2)
76
+ thread_safe (0.3.6)
77
+ tzinfo (1.2.5)
78
+ thread_safe (~> 0.1)
79
+ unicode-display_width (1.4.0)
80
+
81
+ PLATFORMS
82
+ ruby
83
+
84
+ DEPENDENCIES
85
+ awesome_print (= 1.8.0)
86
+ dotenv (= 2.5.0)
87
+ factory_bot (= 4.8.2)
88
+ faker (= 1.8.7)
89
+ pg (= 0.18.4)
90
+ pry (= 0.11.3)
91
+ puma (= 3.12.0)
92
+ rack-protection (= 1.5.5)
93
+ rack-test (= 1.0.0)
94
+ rake (= 11.2.2)
95
+ roda (~> 2.26.0)
96
+ roda-http-auth
97
+ rspec (= 3.7.0)
98
+ rspec_sequel_matchers (= 0.4.0)
99
+ rubocop
100
+ sequel (= 4.35.0)
101
+ simplecov (= 0.16.1)
102
+
103
+ BUNDLED WITH
104
+ 1.16.4