natra 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +2 -0
  3. data/.gitignore +11 -0
  4. data/.rspec +3 -0
  5. data/.travis.yml +4 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +14 -0
  8. data/Gemfile.lock +167 -0
  9. data/Guardfile +75 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +60 -0
  12. data/Rakefile +6 -0
  13. data/bin/console +6 -0
  14. data/bin/natra +7 -0
  15. data/bin/setup +6 -0
  16. data/lib/extensions/string.rb +37 -0
  17. data/lib/natra.rb +9 -0
  18. data/lib/natra/cli.rb +20 -0
  19. data/lib/natra/generators/app/app_generator.rb +150 -0
  20. data/lib/natra/generators/app/templates/Dockerfile +24 -0
  21. data/lib/natra/generators/app/templates/Gemfile +35 -0
  22. data/lib/natra/generators/app/templates/Guardfile +20 -0
  23. data/lib/natra/generators/app/templates/README.md +52 -0
  24. data/lib/natra/generators/app/templates/Rakefile +4 -0
  25. data/lib/natra/generators/app/templates/app/controllers/application_controller.rb +14 -0
  26. data/lib/natra/generators/app/templates/app/models/.gitkeep +0 -0
  27. data/lib/natra/generators/app/templates/app/views/layout.erb.tt +20 -0
  28. data/lib/natra/generators/app/templates/app/views/welcome.erb +22 -0
  29. data/lib/natra/generators/app/templates/bin/ci +6 -0
  30. data/lib/natra/generators/app/templates/bin/setup +7 -0
  31. data/lib/natra/generators/app/templates/config.ru +11 -0
  32. data/lib/natra/generators/app/templates/config/db.yml +35 -0
  33. data/lib/natra/generators/app/templates/config/environment.rb +19 -0
  34. data/lib/natra/generators/app/templates/config/initializers/database.rb +11 -0
  35. data/lib/natra/generators/app/templates/config/initializers/oj.rb +5 -0
  36. data/lib/natra/generators/app/templates/config/initializers/redis.rb +7 -0
  37. data/lib/natra/generators/app/templates/config/puma.rb +11 -0
  38. data/lib/natra/generators/app/templates/config/redis.yml +14 -0
  39. data/lib/natra/generators/app/templates/docker-compose.yml +22 -0
  40. data/lib/natra/generators/app/templates/gitignore +12 -0
  41. data/lib/natra/generators/app/templates/public/favicon.ico +0 -0
  42. data/lib/natra/generators/app/templates/public/images/.gitkeep +0 -0
  43. data/lib/natra/generators/app/templates/public/images/corneal-small.png +0 -0
  44. data/lib/natra/generators/app/templates/public/javascripts/.gitkeep +0 -0
  45. data/lib/natra/generators/app/templates/public/stylesheets/main.css +115 -0
  46. data/lib/natra/generators/app/templates/rspec +2 -0
  47. data/lib/natra/generators/app/templates/rubocop.yml +79 -0
  48. data/lib/natra/generators/app/templates/secrets.env +16 -0
  49. data/lib/natra/generators/app/templates/spec/application_controller_spec.rb +13 -0
  50. data/lib/natra/generators/app/templates/spec/spec_helper.rb +36 -0
  51. data/lib/natra/generators/controller/controller_generator.rb +37 -0
  52. data/lib/natra/generators/controller/templates/controller.rb.erb +37 -0
  53. data/lib/natra/generators/controller/templates/views/edit.html.erb +1 -0
  54. data/lib/natra/generators/controller/templates/views/index.html.erb +1 -0
  55. data/lib/natra/generators/controller/templates/views/new.html.erb +1 -0
  56. data/lib/natra/generators/controller/templates/views/show.html.erb +1 -0
  57. data/lib/natra/generators/model/migration.rb.erb +10 -0
  58. data/lib/natra/generators/model/model.rb.erb +2 -0
  59. data/lib/natra/generators/model/model_generator.rb +59 -0
  60. data/lib/natra/generators/scaffold/scaffold_generator.rb +22 -0
  61. data/lib/natra/version.rb +3 -0
  62. data/natra.gemspec +41 -0
  63. metadata +180 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 58a66d67e14bd0365f7988811d5e002e79ee8c6eef33dee9911a3798730c6891
4
+ data.tar.gz: e808c74bfdd4b21ffeb3e53ed816af672cf2c4aa61d08a078586a35d34fff31b
5
+ SHA512:
6
+ metadata.gz: e85b8faf9141c2f8236c0001c17c2f7c9b080f24bfcd43c3be4d4d5f2c3f5ea1135a76cbe60351293d0ecc3519a70a2a76ee76dad1cb5be9b022f2036112bbf1
7
+ data.tar.gz: e3636f6ff986165c094ff29f6f40ea1699ad00c338dec4d2e961e2773f1391ed37b1af8ed5e71e09316425014867263673d590d60f2eab6e395052055c8498ee
@@ -0,0 +1,2 @@
1
+ service_name: travis-pro
2
+ repo_token: 8OEMw8ExmIqo7cLyL2qAlvBuxZO1N9SjO
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.5.3
4
+ # before_install: gem install bundler
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at uriht@outlook.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source 'https://rubygems.org/'
2
+
3
+ gemspec
4
+
5
+ gem 'active_model_serializers', '~> 0.10.0.rc1'
6
+ gem 'coveralls', '~> 0'
7
+ group :development do
8
+ gem "rake", '~> 0'
9
+ gem "pry"
10
+ gem 'guard'
11
+ gem 'rspec'
12
+ gem 'guard-rubocop'
13
+ gem 'guard-rspec', require: false
14
+ end
@@ -0,0 +1,167 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ natra (0.0.1)
5
+ activesupport (~> 5.0)
6
+ thor (~> 0.18)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (5.2.1)
12
+ actionview (= 5.2.1)
13
+ activesupport (= 5.2.1)
14
+ rack (~> 2.0)
15
+ rack-test (>= 0.6.3)
16
+ rails-dom-testing (~> 2.0)
17
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
18
+ actionview (5.2.1)
19
+ activesupport (= 5.2.1)
20
+ builder (~> 3.1)
21
+ erubi (~> 1.4)
22
+ rails-dom-testing (~> 2.0)
23
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
24
+ active_model_serializers (0.10.7)
25
+ actionpack (>= 4.1, < 6)
26
+ activemodel (>= 4.1, < 6)
27
+ case_transform (>= 0.2)
28
+ jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
29
+ activemodel (5.2.1)
30
+ activesupport (= 5.2.1)
31
+ activesupport (5.2.1)
32
+ concurrent-ruby (~> 1.0, >= 1.0.2)
33
+ i18n (>= 0.7, < 2)
34
+ minitest (~> 5.1)
35
+ tzinfo (~> 1.1)
36
+ ast (2.4.0)
37
+ builder (3.2.3)
38
+ case_transform (0.2)
39
+ activesupport
40
+ coderay (1.1.2)
41
+ concurrent-ruby (1.0.5)
42
+ coveralls (0.8.22)
43
+ json (>= 1.8, < 3)
44
+ simplecov (~> 0.16.1)
45
+ term-ansicolor (~> 1.3)
46
+ thor (~> 0.19.4)
47
+ tins (~> 1.6)
48
+ crass (1.0.4)
49
+ diff-lcs (1.3)
50
+ docile (1.3.1)
51
+ erubi (1.7.1)
52
+ ffi (1.9.25)
53
+ formatador (0.2.5)
54
+ guard (2.14.2)
55
+ formatador (>= 0.2.4)
56
+ listen (>= 2.7, < 4.0)
57
+ lumberjack (>= 1.0.12, < 2.0)
58
+ nenv (~> 0.1)
59
+ notiffany (~> 0.0)
60
+ pry (>= 0.9.12)
61
+ shellany (~> 0.0)
62
+ thor (>= 0.18.1)
63
+ guard-compat (1.2.1)
64
+ guard-rspec (4.7.3)
65
+ guard (~> 2.1)
66
+ guard-compat (~> 1.1)
67
+ rspec (>= 2.99.0, < 4.0)
68
+ guard-rubocop (1.3.0)
69
+ guard (~> 2.0)
70
+ rubocop (~> 0.20)
71
+ i18n (1.1.1)
72
+ concurrent-ruby (~> 1.0)
73
+ jaro_winkler (1.5.1)
74
+ json (2.1.0)
75
+ jsonapi-renderer (0.2.0)
76
+ listen (3.1.5)
77
+ rb-fsevent (~> 0.9, >= 0.9.4)
78
+ rb-inotify (~> 0.9, >= 0.9.7)
79
+ ruby_dep (~> 1.2)
80
+ loofah (2.2.2)
81
+ crass (~> 1.0.2)
82
+ nokogiri (>= 1.5.9)
83
+ lumberjack (1.0.13)
84
+ method_source (0.9.0)
85
+ mini_portile2 (2.3.0)
86
+ minitest (5.11.3)
87
+ nenv (0.3.0)
88
+ nokogiri (1.8.5)
89
+ mini_portile2 (~> 2.3.0)
90
+ notiffany (0.1.1)
91
+ nenv (~> 0.1)
92
+ shellany (~> 0.0)
93
+ parallel (1.12.1)
94
+ parser (2.5.1.2)
95
+ ast (~> 2.4.0)
96
+ powerpack (0.1.2)
97
+ pry (0.11.3)
98
+ coderay (~> 1.1.0)
99
+ method_source (~> 0.9.0)
100
+ rack (2.0.5)
101
+ rack-test (1.1.0)
102
+ rack (>= 1.0, < 3)
103
+ rails-dom-testing (2.0.3)
104
+ activesupport (>= 4.2.0)
105
+ nokogiri (>= 1.6)
106
+ rails-html-sanitizer (1.0.4)
107
+ loofah (~> 2.2, >= 2.2.2)
108
+ rainbow (3.0.0)
109
+ rake (0.9.6)
110
+ rb-fsevent (0.10.3)
111
+ rb-inotify (0.9.10)
112
+ ffi (>= 0.5.0, < 2)
113
+ rspec (3.8.0)
114
+ rspec-core (~> 3.8.0)
115
+ rspec-expectations (~> 3.8.0)
116
+ rspec-mocks (~> 3.8.0)
117
+ rspec-core (3.8.0)
118
+ rspec-support (~> 3.8.0)
119
+ rspec-expectations (3.8.2)
120
+ diff-lcs (>= 1.2.0, < 2.0)
121
+ rspec-support (~> 3.8.0)
122
+ rspec-mocks (3.8.0)
123
+ diff-lcs (>= 1.2.0, < 2.0)
124
+ rspec-support (~> 3.8.0)
125
+ rspec-support (3.8.0)
126
+ rubocop (0.60.0)
127
+ jaro_winkler (~> 1.5.1)
128
+ parallel (~> 1.10)
129
+ parser (>= 2.5, != 2.5.1.1)
130
+ powerpack (~> 0.1)
131
+ rainbow (>= 2.2.2, < 4.0)
132
+ ruby-progressbar (~> 1.7)
133
+ unicode-display_width (~> 1.4.0)
134
+ ruby-progressbar (1.10.0)
135
+ ruby_dep (1.5.0)
136
+ shellany (0.0.1)
137
+ simplecov (0.16.1)
138
+ docile (~> 1.1)
139
+ json (>= 1.8, < 3)
140
+ simplecov-html (~> 0.10.0)
141
+ simplecov-html (0.10.2)
142
+ term-ansicolor (1.6.0)
143
+ tins (~> 1.0)
144
+ thor (0.19.4)
145
+ thread_safe (0.3.6)
146
+ tins (1.17.0)
147
+ tzinfo (1.2.5)
148
+ thread_safe (~> 0.1)
149
+ unicode-display_width (1.4.0)
150
+
151
+ PLATFORMS
152
+ ruby
153
+
154
+ DEPENDENCIES
155
+ active_model_serializers (~> 0.10.0.rc1)
156
+ bundler (~> 1.16)
157
+ coveralls (~> 0)
158
+ guard
159
+ guard-rspec
160
+ guard-rubocop
161
+ natra!
162
+ pry
163
+ rake (~> 0)
164
+ rspec
165
+
166
+ BUNDLED WITH
167
+ 1.16.6
@@ -0,0 +1,75 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ # Note: The cmd option is now required due to the increasing number of ways
19
+ # rspec may be run, below are examples of the most common uses.
20
+ # * bundler: 'bundle exec rspec'
21
+ # * bundler binstubs: 'bin/rspec'
22
+ # * spring: 'bin/rspec' (This will use spring if running and you have
23
+ # installed the spring binstubs per the docs)
24
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
25
+ # * 'just' rspec: 'rspec'
26
+
27
+ guard :rspec, cmd: "bundle exec rspec" do
28
+ require "guard/rspec/dsl"
29
+ dsl = Guard::RSpec::Dsl.new(self)
30
+
31
+ # Feel free to open issues for suggestions and improvements
32
+
33
+ # RSpec files
34
+ rspec = dsl.rspec
35
+ watch(rspec.spec_helper) { rspec.spec_dir }
36
+ watch(rspec.spec_support) { rspec.spec_dir }
37
+ watch(rspec.spec_files)
38
+
39
+ # Ruby files
40
+ ruby = dsl.ruby
41
+ dsl.watch_spec_files_for(ruby.lib_files)
42
+
43
+ # Rails files
44
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
45
+ dsl.watch_spec_files_for(rails.app_files)
46
+ dsl.watch_spec_files_for(rails.views)
47
+
48
+ watch(rails.controllers) do |m|
49
+ [
50
+ rspec.spec.call("routing/#{m[1]}_routing"),
51
+ rspec.spec.call("controllers/#{m[1]}_controller"),
52
+ rspec.spec.call("acceptance/#{m[1]}")
53
+ ]
54
+ end
55
+
56
+ # Rails config changes
57
+ watch(rails.spec_helper) { rspec.spec_dir }
58
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
59
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
60
+
61
+ # Capybara features specs
62
+ watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
63
+ watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
64
+
65
+ # Turnip features and steps
66
+ watch(%r{^spec/acceptance/(.+)\.feature$})
67
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
68
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
69
+ end
70
+ end
71
+
72
+ guard :rubocop do
73
+ watch(%r{.+\.rb$})
74
+ watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
75
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Thiru Njuguna
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,60 @@
1
+ # Natra
2
+ [![Coverage Status](https://coveralls.io/repos/github/thirunjuguna/natra/badge.svg?branch=master)](https://coveralls.io/github/thirunjuguna/natra?branch=master)
3
+ [![Build Status](https://travis-ci.com/thirunjuguna/natra.svg?branch=master)](https://travis-ci.com/thirunjuguna/natra)
4
+
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'natra'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install natra
21
+
22
+ ## Commands
23
+ ```
24
+ natra -v # Show Natra version number
25
+ natra help [COMMAND] # Describe available commands or one specific command
26
+ natra new APP-NAME # Creates a new Sinatra application
27
+ natra model NAME # Generate a model
28
+ natra controller NAME # Generate a controller
29
+ natra scaffold NAME # Generate a model with its associated views and controllers
30
+ ```
31
+ The controller generator also have an optional views flag `--no-views` to create controllers without views.
32
+
33
+ ## Using Natra
34
+
35
+ To generate your app:
36
+
37
+ natra new APP-NAME
38
+
39
+ After natra is done generating your app, run `bundle install` from your app's directory:
40
+
41
+ cd APP-NAME
42
+ bundle install
43
+
44
+ ## Development
45
+
46
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
47
+
48
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
49
+
50
+ ## Contributing
51
+
52
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/natra. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
53
+
54
+ ## License
55
+
56
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
57
+
58
+ ## Code of Conduct
59
+
60
+ Everyone interacting in the Natra project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/natra/blob/master/CODE_OF_CONDUCT.md).