orats 0.9.7 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -2
- data/.rubocop.yml +24 -0
- data/.travis.yml +9 -0
- data/README.md +103 -194
- data/bin/orats +2 -5
- data/lib/orats/cli.rb +6 -67
- data/lib/orats/cli_help/destroy +11 -0
- data/lib/orats/cli_help/new +2 -26
- data/lib/orats/commands/new.rb +127 -0
- data/lib/orats/common.rb +0 -29
- data/lib/orats/templates/base/.dockerignore +5 -0
- data/lib/orats/templates/base/.gitignore +22 -0
- data/lib/orats/templates/base/.rubocop.yml +29 -0
- data/lib/orats/templates/base/Dockerfile +102 -0
- data/lib/orats/templates/base/Gemfile +69 -0
- data/lib/orats/templates/base/Gemfile.lock +205 -0
- data/lib/orats/templates/base/README.md +24 -0
- data/lib/orats/templates/base/Rakefile +7 -0
- data/lib/orats/templates/base/app/assets/config/manifest.js +3 -0
- data/lib/orats/templates/base/app/assets/images/.keep +0 -0
- data/lib/orats/templates/base/app/assets/javascripts/application.js +33 -0
- data/lib/orats/templates/base/app/assets/javascripts/cable.js +14 -0
- data/lib/orats/templates/base/app/assets/javascripts/channels/.keep +0 -0
- data/lib/orats/templates/base/app/assets/stylesheets/application.scss +89 -0
- data/lib/orats/templates/base/app/channels/application_cable/channel.rb +4 -0
- data/lib/orats/templates/base/app/channels/application_cable/connection.rb +4 -0
- data/lib/orats/templates/base/app/controllers/application_controller.rb +3 -0
- data/lib/orats/templates/base/app/controllers/concerns/.keep +0 -0
- data/lib/orats/templates/base/app/controllers/pages_controller.rb +4 -0
- data/lib/orats/templates/base/app/helpers/application_helper.rb +31 -0
- data/lib/orats/templates/base/app/helpers/pages_helper.rb +2 -0
- data/lib/orats/templates/base/app/jobs/application_job.rb +2 -0
- data/lib/orats/templates/base/app/mailers/application_mailer.rb +4 -0
- data/lib/orats/templates/base/app/models/application_record.rb +3 -0
- data/lib/orats/templates/base/app/models/concerns/.keep +0 -0
- data/lib/orats/templates/{includes/new/rails → base}/app/views/layouts/_flash.html.erb +1 -1
- data/lib/orats/templates/base/app/views/layouts/_footer.html.erb +3 -0
- data/lib/orats/templates/{includes/new/rails/app/views/layouts/_google_analytics_snippet.html.erb → base/app/views/layouts/_google_analytics.html.erb} +5 -9
- data/lib/orats/templates/{includes/new/rails → base}/app/views/layouts/_navigation.html.erb +5 -4
- data/lib/orats/templates/base/app/views/layouts/application.html.erb +48 -0
- data/lib/orats/templates/base/app/views/layouts/mailer.html.erb +13 -0
- data/lib/orats/templates/base/app/views/layouts/mailer.text.erb +1 -0
- data/lib/orats/templates/base/app/views/pages/home.html.erb +46 -0
- data/lib/orats/templates/base/bin/bundle +3 -0
- data/lib/orats/templates/base/bin/rails +4 -0
- data/lib/orats/templates/base/bin/rake +4 -0
- data/lib/orats/templates/base/bin/setup +34 -0
- data/lib/orats/templates/base/bin/update +29 -0
- data/lib/orats/templates/base/cable/config.ru +4 -0
- data/lib/orats/templates/base/config.ru +5 -0
- data/lib/orats/templates/base/config/application.rb +71 -0
- data/lib/orats/templates/base/config/boot.rb +3 -0
- data/lib/orats/templates/base/config/cable.yml +14 -0
- data/lib/orats/templates/base/config/database.yml +13 -0
- data/lib/orats/templates/base/config/environment.rb +5 -0
- data/lib/orats/templates/base/config/environments/development.rb +49 -0
- data/lib/orats/templates/base/config/environments/production.rb +56 -0
- data/lib/orats/templates/base/config/environments/staging.rb +6 -0
- data/lib/orats/templates/base/config/environments/test.rb +40 -0
- data/lib/orats/templates/base/config/initializers/application_controller_renderer.rb +6 -0
- data/lib/orats/templates/base/config/initializers/assets.rb +12 -0
- data/lib/orats/templates/base/config/initializers/backtrace_silencers.rb +9 -0
- data/lib/orats/templates/base/config/initializers/cookies_serializer.rb +5 -0
- data/lib/orats/templates/base/config/initializers/filter_parameter_logging.rb +4 -0
- data/lib/orats/templates/base/config/initializers/inflections.rb +16 -0
- data/lib/orats/templates/base/config/initializers/mime_types.rb +4 -0
- data/lib/orats/templates/base/config/initializers/new_framework_defaults.rb +27 -0
- data/lib/orats/templates/base/config/initializers/session_store.rb +4 -0
- data/lib/orats/templates/{includes/new/rails → base}/config/initializers/sidekiq.rb +1 -4
- data/lib/orats/templates/base/config/initializers/timeout.rb +1 -0
- data/lib/orats/templates/base/config/initializers/wrap_parameters.rb +15 -0
- data/lib/orats/templates/base/config/locales/en.yml +23 -0
- data/lib/orats/templates/base/config/puma.rb +60 -0
- data/lib/orats/templates/base/config/routes.rb +3 -0
- data/lib/orats/templates/{includes/new/rails → base}/config/secrets.yml +3 -2
- data/lib/orats/templates/base/config/sidekiq.yml.erb +5 -0
- data/lib/orats/templates/base/config/spring.rb +6 -0
- data/lib/orats/templates/base/db/seeds.rb +9 -0
- data/lib/orats/templates/base/docker-compose.yml +59 -0
- data/lib/orats/templates/base/lib/assets/.keep +0 -0
- data/lib/orats/templates/base/lib/tasks/.keep +0 -0
- data/lib/orats/templates/base/log/.keep +0 -0
- data/lib/orats/templates/base/public/404.html +67 -0
- data/lib/orats/templates/base/public/422.html +67 -0
- data/lib/orats/templates/base/public/500.html +66 -0
- data/lib/orats/templates/base/public/apple-touch-icon-precomposed.png +0 -0
- data/lib/orats/templates/base/public/apple-touch-icon.png +0 -0
- data/lib/orats/templates/base/public/favicon.ico +0 -0
- data/lib/orats/templates/base/public/robots.txt +5 -0
- data/lib/orats/templates/base/test/controllers/.keep +0 -0
- data/lib/orats/templates/base/test/controllers/pages_controller_test.rb +9 -0
- data/lib/orats/templates/base/test/fixtures/.keep +0 -0
- data/lib/orats/templates/base/test/fixtures/files/.keep +0 -0
- data/lib/orats/templates/base/test/helpers/.keep +0 -0
- data/lib/orats/templates/base/test/integration/.keep +0 -0
- data/lib/orats/templates/base/test/mailers/.keep +0 -0
- data/lib/orats/templates/base/test/models/.keep +0 -0
- data/lib/orats/templates/base/test/test_helper.rb +11 -0
- data/lib/orats/templates/base/tmp/.keep +0 -0
- data/lib/orats/templates/base/vendor/assets/javascripts/.keep +0 -0
- data/lib/orats/templates/base/vendor/assets/stylesheets/.keep +0 -0
- data/lib/orats/ui.rb +5 -5
- data/lib/orats/util.rb +14 -0
- data/lib/orats/version.rb +1 -1
- data/orats.gemspec +3 -2
- data/test/integration/cli_test.rb +43 -65
- data/test/test_helper.rb +9 -58
- metadata +114 -66
- data/lib/orats/argv_adjust.rb +0 -61
- data/lib/orats/cli_help/nuke +0 -19
- data/lib/orats/commands/new/exec.rb +0 -59
- data/lib/orats/commands/new/rails.rb +0 -215
- data/lib/orats/commands/new/server.rb +0 -67
- data/lib/orats/commands/nuke.rb +0 -108
- data/lib/orats/postgres.rb +0 -92
- data/lib/orats/process.rb +0 -35
- data/lib/orats/redis.rb +0 -25
- data/lib/orats/shell.rb +0 -12
- data/lib/orats/templates/auth.rb +0 -394
- data/lib/orats/templates/base.rb +0 -546
- data/lib/orats/templates/includes/common/.gitignore +0 -6
- data/lib/orats/templates/includes/common/LICENSE +0 -22
- data/lib/orats/templates/includes/new/rails/.env +0 -59
- data/lib/orats/templates/includes/new/rails/Gemfile +0 -48
- data/lib/orats/templates/includes/new/rails/Procfile +0 -3
- data/lib/orats/templates/includes/new/rails/README.md +0 -3
- data/lib/orats/templates/includes/new/rails/app/assets/favicon/favicon_base.png +0 -0
- data/lib/orats/templates/includes/new/rails/app/helpers/application_helper.rb +0 -53
- data/lib/orats/templates/includes/new/rails/app/models/account.rb +0 -40
- data/lib/orats/templates/includes/new/rails/app/views/devise/confirmations/new.html.erb +0 -26
- data/lib/orats/templates/includes/new/rails/app/views/devise/mailer/confirmation_instructions.html.erb +0 -5
- data/lib/orats/templates/includes/new/rails/app/views/devise/mailer/reset_password_instructions.html.erb +0 -10
- data/lib/orats/templates/includes/new/rails/app/views/devise/mailer/unlock_instructions.html.erb +0 -8
- data/lib/orats/templates/includes/new/rails/app/views/devise/passwords/edit.html.erb +0 -28
- data/lib/orats/templates/includes/new/rails/app/views/devise/passwords/new.html.erb +0 -26
- data/lib/orats/templates/includes/new/rails/app/views/devise/registrations/edit.html.erb +0 -51
- data/lib/orats/templates/includes/new/rails/app/views/devise/registrations/new.html.erb +0 -31
- data/lib/orats/templates/includes/new/rails/app/views/devise/sessions/new.html.erb +0 -39
- data/lib/orats/templates/includes/new/rails/app/views/devise/shared/_links.html.erb +0 -38
- data/lib/orats/templates/includes/new/rails/app/views/devise/unlocks/new.html.erb +0 -26
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_disqus_comments_snippet.html.erb +0 -19
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_disqus_count_snippet.html.erb +0 -12
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_footer.html.erb +0 -2
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_navigation_auth.html.erb +0 -15
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_navigation_links.html.erb +0 -3
- data/lib/orats/templates/includes/new/rails/app/views/layouts/application.html.erb +0 -47
- data/lib/orats/templates/includes/new/rails/app/views/pages/home.html.erb +0 -58
- data/lib/orats/templates/includes/new/rails/config/database.yml +0 -6
- data/lib/orats/templates/includes/new/rails/config/environments/staging.rb +0 -5
- data/lib/orats/templates/includes/new/rails/config/initializers/devise_async.rb +0 -1
- data/lib/orats/templates/includes/new/rails/config/initializers/mini_profiler.rb +0 -4
- data/lib/orats/templates/includes/new/rails/config/puma.rb +0 -39
- data/lib/orats/templates/includes/new/rails/config/schedule.rb +0 -3
- data/lib/orats/templates/includes/new/rails/config/sidekiq.yml +0 -7
- data/lib/orats/templates/includes/new/rails/config/sitemap.rb +0 -20
- data/lib/orats/templates/includes/new/rails/config/unicorn.rb +0 -84
- data/lib/orats/templates/includes/new/rails/lib/tasks/orats/favicon.rake +0 -48
- data/lib/orats/templates/includes/new/rails/public/404.html +0 -13
- data/lib/orats/templates/includes/new/rails/public/422.html +0 -13
- data/lib/orats/templates/includes/new/rails/public/500.html +0 -13
- data/lib/orats/templates/includes/new/rails/public/502.html +0 -13
- data/lib/orats/templates/includes/new/rails/public/deploy.html +0 -14
- data/lib/orats/templates/includes/new/rails/test/fixtures/accounts.yml +0 -27
- data/lib/orats/templates/includes/new/rails/test/models/account_test.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06fab17fd14bb8740672f7ae0c2749953746d90b
|
4
|
+
data.tar.gz: c70918b29df7deaac005e8245b50b61ed2bdfb62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa7d3505bd4c763fec9da8801e5ad0d4b7c6a536c6dde57c859143fc08345e22c4c0127210db5878589a3afd1de89fd5952b4f0cc3f39c195308ade89970ed99
|
7
|
+
data.tar.gz: 496decb1ff4dfd0824566b63d56f10b2e320a1dc62cb378f7a855b5c505fbf45f16a6eaa158a5f38cf40fa5701ce2d659415ff61fc823a3fee1aa730d78440a6
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.0
|
3
|
+
|
4
|
+
Documentation:
|
5
|
+
# Skips checking to make sure top level modules / classes have a comment.
|
6
|
+
Enabled: false
|
7
|
+
|
8
|
+
Style/ClassAndModuleChildren:
|
9
|
+
# Skips checking the style of children definitions at classes and modules.
|
10
|
+
#
|
11
|
+
# Basically there are two different styles:
|
12
|
+
#
|
13
|
+
# `nested` - have each child on a separate line
|
14
|
+
# class Foo
|
15
|
+
# class Bar
|
16
|
+
# end
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# `compact` - combine definitions as much as possible
|
20
|
+
# class Foo::Bar
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# With it disabled, either or is valid.
|
24
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,87 +1,66 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/orats.png)](http://badge.fury.io/rb/orats)
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/orats.png)](http://badge.fury.io/rb/orats) [![Build Status](https://secure.travis-ci.org/nickjj/orats.png)](http://travis-ci.org/nickjj/orats)
|
2
2
|
|
3
|
-
## What is orats
|
3
|
+
## What is orats?
|
4
4
|
|
5
|
-
It stands for opinionated rails application templates.
|
5
|
+
It stands for opinionated rails application templates.
|
6
6
|
|
7
|
-
|
7
|
+
The goal is to provide you an excellent base application that you can use on
|
8
|
+
your next Rails project.
|
8
9
|
|
9
|
-
|
10
|
+
You're meant to generate a project using orats and then build your custom
|
11
|
+
application on top of it.
|
10
12
|
|
11
|
-
|
13
|
+
It also happens to use Docker so that your app can be ran on any major
|
14
|
+
platform -- even without needing Ruby installed.
|
15
|
+
|
16
|
+
## What versions are you targeting?
|
17
|
+
|
18
|
+
#### Ruby 2.3+
|
19
|
+
|
20
|
+
#### Rails 5+
|
21
|
+
|
22
|
+
#### Docker 1.11+
|
12
23
|
|
13
24
|
## Contents
|
14
|
-
- [System dependencies](#system-dependencies)
|
15
25
|
- [Installation](#installation)
|
16
26
|
- [Commands](#commands)
|
17
27
|
- [New](#new)
|
18
28
|
- [Try it](#try-the-new-command)
|
19
|
-
- [Nuke](#nuke)
|
20
|
-
- [Try it](#try-the-nuke-command)
|
21
29
|
- [Templates](#templates)
|
22
30
|
- [Try it](#try-the-templates-command)
|
23
31
|
- [Available templates](#available-templates)
|
24
32
|
- [Base](#base)
|
25
|
-
|
26
|
-
- [
|
27
|
-
|
28
|
-
- [
|
29
|
-
|
30
|
-
- [FAQ](#custom-faq)
|
31
|
-
- [Any guides on how to make custom templates?](#any-guides-on-how-to-make-custom-templates)
|
32
|
-
- [The .oratsrc file](#the-oratsrc-file)
|
33
|
-
- [Wiki](https://github.com/nickjj/orats/wiki)
|
34
|
-
- [What to look at after making a new project](https://github.com/nickjj/orats/wiki/What-to-look-at-after-making-a-new-project)
|
35
|
-
|
36
|
-
## System dependencies
|
37
|
-
|
38
|
-
Before running orats...
|
39
|
-
|
40
|
-
#### You must install
|
41
|
-
|
42
|
-
- [Git](http://git-scm.com/book/en/Getting-Started-Installing-Git)
|
43
|
-
- [Postgres](https://wiki.postgresql.org/wiki/Detailed_installation_guides)
|
44
|
-
- [Redis](http://redis.io/topics/quickstart)
|
45
|
-
- Ruby 2.1.x - [chruby](https://github.com/postmodern/chruby) | [rbenv](https://github.com/sstephenson/rbenv) | [rvm](https://rvm.io/)
|
46
|
-
- Rails 4.2.x - `gem install rails -v '~> 4.2.0'`
|
47
|
-
|
48
|
-
#### You should install
|
49
|
-
|
50
|
-
- [Imagemagick](https://www.google.com/search?q=install+imagemagick)
|
51
|
-
- If you want favicons to be automatically created (optional)
|
52
|
-
|
53
|
-
#### You need these processes to be running
|
54
|
-
|
55
|
-
- Postgres
|
56
|
-
- Redis
|
33
|
+
- [FAQ](#faq)
|
34
|
+
- [How can I learn about the Docker specific aspects of the project?](#how-can-i-learn-about-the-docker-specific-aspects-of-the-project)
|
35
|
+
- [What do I do after I generate the application?](#what-do-i-do-after-i-generate-the-application)
|
36
|
+
- [What's the bare minimum to get things running?](#whats-the-bare-minimum-to-get-things-running)
|
37
|
+
- [Do I need to install orats to use the base app?](#do-i-need-to-install-orats-to-use-the-base-app)
|
57
38
|
|
58
39
|
## Installation
|
59
40
|
|
60
41
|
`gem install orats`
|
61
42
|
|
62
|
-
Or if you already have orats then run `gem update orats` to upgrade to the
|
43
|
+
Or if you already have orats then run `gem update orats` to upgrade to the
|
44
|
+
latest version.
|
45
|
+
|
46
|
+
If you don't have Ruby installed, then you can
|
47
|
+
[generate an app easily with bash](#do-i-need-to-install-orats-to-use-the-base-app).
|
63
48
|
|
64
49
|
## Commands
|
65
50
|
|
66
|
-
To get the details of each command then please run `orats help` from the
|
51
|
+
To get the details of each command then please run `orats help` from the
|
52
|
+
terminal. Here's a high level overview:
|
67
53
|
|
68
54
|
### New
|
69
55
|
|
70
|
-
The new command
|
71
|
-
|
72
|
-
You can also supply your own custom template which is explained in the [custom template](#custom) section.
|
73
|
-
|
74
|
-
Get started by checking out what the [base template](#base) provides.
|
56
|
+
The new command generates a new orats app, which is just a Rails app in the end.
|
75
57
|
|
76
|
-
|
58
|
+
Currently there is only 1 template, which is the "base" template but others may
|
59
|
+
be added in the future.
|
77
60
|
|
78
|
-
|
61
|
+
#### Try the new command
|
79
62
|
|
80
|
-
|
81
|
-
|
82
|
-
You will need to have generated an app before trying this. Check out the [try the base template](#try-the-base-template) section to learn how to generate an app.
|
83
|
-
|
84
|
-
`orats nuke /tmp/someapp --pg-password foo`
|
63
|
+
`orats new myproject`
|
85
64
|
|
86
65
|
### Templates
|
87
66
|
|
@@ -95,181 +74,111 @@ Return a list of available templates to choose from.
|
|
95
74
|
|
96
75
|
### Base
|
97
76
|
|
98
|
-
This is the starter template that every other template will
|
99
|
-
|
100
|
-
|
77
|
+
This is the starter template that every other template will be based upon. I
|
78
|
+
feel like when I make a new project, 95% of the time it includes these features
|
79
|
+
and when I do not want a specific thing it is much quicker to remove it than
|
80
|
+
add it.
|
101
81
|
|
102
|
-
|
82
|
+
#### Main changes vs a fresh Rails project
|
103
83
|
|
104
84
|
- **Core changes**:
|
105
85
|
- Use `postgres` as the primary SQL database
|
106
86
|
- Use `redis` as the cache backend
|
107
|
-
- Use `
|
108
|
-
- Use
|
87
|
+
- Use `sidekiq` as a background worker through Active Job
|
88
|
+
- Use a standalone Action Cable server
|
109
89
|
- **Features**:
|
110
|
-
-
|
111
|
-
- Pagination and a route concern mapped to `/page` using `kaminari`
|
112
|
-
- Keep a sitemap up to date using `sitemap_generator`
|
113
|
-
- Add a `pages` controller with `home` action that has points of interest
|
114
|
-
- **Rake tasks**:
|
115
|
-
- Generate favicons for many devices based off a single source png
|
90
|
+
- Add a `pages` controller with `home` action
|
116
91
|
- **Config**:
|
117
|
-
- Extract a bunch of configuration to environment variables
|
118
|
-
- Rewrite the database.yml and secrets.yml files
|
92
|
+
- Extract a bunch of configuration settings to environment variables
|
93
|
+
- Rewrite the `database.yml` and `secrets.yml` files
|
119
94
|
- Add a staging environment
|
120
95
|
- **Development mode only**:
|
121
|
-
- Use
|
122
|
-
- Use `foreman` to manage the app's processes
|
123
|
-
- Use `bullet`, `rack mini profiler` and `meta_request` for profiling/analysis
|
124
|
-
- Log everything to 1 file and rotate it
|
125
|
-
- Set `scss`/`coffee` as the default generator engines
|
96
|
+
- Use `rack mini profiler` for profiling / analysis
|
126
97
|
- **Production mode only**:
|
127
|
-
-
|
128
|
-
|
129
|
-
|
130
|
-
- Change validation errors to output inline on each element instead of a big list
|
98
|
+
- Add popular file types to the assets pre-compile list
|
99
|
+
- Log to STDOUT so that Docker can consume and deal with log entries
|
100
|
+
- Change validation errors to output in-line on each element instead of a big list
|
131
101
|
- **Helpers**:
|
132
102
|
- `title`, `meta_description`, `heading` to easily set those values per view
|
133
|
-
- `humanize_boolean` to convert true/false into Yes/No
|
134
|
-
- `css_for_boolean` to convert true/false into a css class success/danger
|
103
|
+
- `humanize_boolean` to convert true / false into Yes / No
|
104
|
+
- `css_for_boolean` to convert true / false into a css class success / danger
|
135
105
|
- **Views**:
|
136
|
-
- Use `
|
137
|
-
- Use `bootstrap 3.x` and `font-awesome`
|
106
|
+
- Use `scss` and `javascript`
|
107
|
+
- Use `bootstrap 3.x` and `font-awesome 4.x`
|
138
108
|
- Add a minimal and modern layout file
|
139
|
-
- Load `jquery` 1.10.x through a CDN
|
140
109
|
- Conditionally load `html5shiv`, `json3` and `respondjs` for IE < 9 support
|
141
110
|
- **Partials**:
|
142
|
-
- Add navigation
|
111
|
+
- Add navigation
|
143
112
|
- Add flash message
|
144
113
|
- Add footer
|
145
|
-
- Add
|
146
|
-
- Add disqus
|
147
|
-
- **Public**:
|
148
|
-
- Add 404, 422, 500 and 502 pages so they can be served directly from your reverse proxy
|
149
|
-
- Add a deploy page that could be swapped in/out during server deploys
|
150
|
-
- Add all of the favicons output by the favicon generator
|
151
|
-
|
152
|
-
#### Try the base template
|
153
|
-
|
154
|
-
`orats new myapp --pg-password foo`
|
114
|
+
- Add Google Analytics
|
155
115
|
|
156
|
-
|
116
|
+
## FAQ
|
157
117
|
|
158
|
-
|
118
|
+
#### How can I learn about the Docker specific aspects of the project?
|
159
119
|
|
160
|
-
|
120
|
+
Check out the blog post "[Learn how this application was Dockerized](#)".
|
161
121
|
|
162
|
-
|
122
|
+
#### What do I do after I generate the application?
|
163
123
|
|
164
|
-
|
124
|
+
Start by reading the above blog post, because the Docker blog post explains
|
125
|
+
how you can run the project. It also goes over a few Docker related caveats
|
126
|
+
that may hang you up if you're not already familiar with Docker.
|
165
127
|
|
166
|
-
|
128
|
+
After that, just dive into the project's source code and write your awesome app!
|
167
129
|
|
168
|
-
|
130
|
+
#### What's the bare minimum to get things running?
|
169
131
|
|
170
|
-
|
132
|
+
If you don't feel like reading the blog post, this is the bare minimum to get
|
133
|
+
everything up and running -- assuming you have Docker and Docker Compose installed.
|
171
134
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
- Inform users of their last login attempt when failing to login
|
188
|
-
- Add en-locale strings for authorization messages
|
189
|
-
- Add devise queue to the sidekiq config
|
190
|
-
- Add pundit related code to the application controller
|
191
|
-
- **Routes**:
|
192
|
-
- Protect the `/sidekiq` end point so only logged in admins can see it
|
193
|
-
- Enable/Disable users from publicly registering by commenting out a few lines
|
194
|
-
- **Database**:
|
195
|
-
- Add a seed user that you should change the details of ASAP once you deploy
|
196
|
-
- **Models**:
|
197
|
-
- Add `Account` devise model with an extra `role` field
|
198
|
-
- Add `admin` and `guest` roles
|
199
|
-
- Add `.is?` method to compare roles
|
200
|
-
- Add `generate_password` method
|
201
|
-
- Add a way to cache the `current_account`
|
202
|
-
- **Controllers**:
|
203
|
-
- Alias `current_user` to `current_account`
|
204
|
-
- Allow you to override devise's default sign in URL by uncommenting a few lines
|
205
|
-
- **Views**:
|
206
|
-
- Use bootstrap for all of the devise views
|
207
|
-
- Add authentication links to the navbar
|
208
|
-
- **Tests**:
|
209
|
-
- Add `Account` fixtures
|
210
|
-
- Add model tests for `Account`
|
211
|
-
|
212
|
-
#### Try the auth template
|
213
|
-
|
214
|
-
`orats new myauthapp --template auth --pg-password foo`
|
215
|
-
|
216
|
-
### Custom
|
217
|
-
|
218
|
-
You can pass custom templates into the `new` command. It works exactly like passing a custom application template to `rails new`.
|
219
|
-
|
220
|
-
Pass in a custom template by providing the `--custom` flag along with either a local path or a URL.
|
221
|
-
|
222
|
-
Here is a simple example of a custom template:
|
223
|
-
|
224
|
-
```
|
225
|
-
# /tmp/foo.rb
|
226
|
-
|
227
|
-
file 'app/components/foo.rb', <<-S
|
228
|
-
class Foo
|
229
|
-
end
|
230
|
-
S
|
135
|
+
```sh
|
136
|
+
# 1) Read the .env file carefully and change any user specific settings, such
|
137
|
+
# as e-mail credentials and platform specific settings (check the comments).
|
138
|
+
#
|
139
|
+
# 2) Build and run the project with Docker Compose
|
140
|
+
docker-compose up --build
|
141
|
+
#
|
142
|
+
# 3) Reset and Migrate the database (run this in a 2nd Docker-enabled terminal)
|
143
|
+
# OSX / Windows users can skip adding the --user "$(id -u):$(id -g)" flag
|
144
|
+
docker-compose exec --user "$(id -u):$(id -g)" website rails db:reset
|
145
|
+
docker-compose exec --user "$(id -u):$(id -g)" website rails db:migrate
|
146
|
+
#
|
147
|
+
# 4a) Running Docker natively? Visit http://localhost:3000
|
148
|
+
# 4b) Running Docker with the Toolbox? Visit http://192.168.99.100:3000
|
149
|
+
# (you may need to replace 192.168.99.100 with your Docker machine IP)
|
231
150
|
```
|
232
151
|
|
233
|
-
####
|
234
|
-
|
235
|
-
`orats new /tmp/customexample -p foo --custom /tmp/foo.rb`
|
236
|
-
|
237
|
-
#### Custom FAQ
|
152
|
+
#### Do I need to install orats to use the base app?
|
238
153
|
|
239
|
-
|
240
|
-
|
154
|
+
Not really. The base application is already generated and you can view it
|
155
|
+
[directly in this repo](https://github.com/nickjj/orats/tree/master/lib/orats/templates/base).
|
241
156
|
|
242
|
-
|
243
|
-
|
157
|
+
The main benefit of the orats gem is that it will do a recursive find / replace
|
158
|
+
on a few strings to personalize the project for your project's name. It will
|
159
|
+
also make it easy to pick different templates when they are available.
|
244
160
|
|
245
|
-
You
|
161
|
+
You could easily do this yourself if you don't have Ruby installed on your work
|
162
|
+
station. The 3 strings you'll want to replace are:
|
246
163
|
|
247
|
-
|
164
|
+
- `OratsBase` (used as class names and in the generated home page)
|
165
|
+
- `orats_base` (used for a number of Rails specific prefixes and more)
|
166
|
+
- `VERSION` (used to set the current orats version in the generated home page)
|
248
167
|
|
249
|
-
|
168
|
+
You could whip up a simple bash script to do this, such as:
|
250
169
|
|
251
|
-
|
170
|
+
```sh
|
171
|
+
# Clone this repo to a directory of your choosing.
|
172
|
+
git clone https://github.com/nickjj/orats /tmp/orats
|
252
173
|
|
253
|
-
|
254
|
-
|
255
|
-
- `--pg-username` (defaults to postgres)
|
256
|
-
- `--pg-password` (defaults to an empty string)
|
257
|
-
- `--redis-location` (defaults to localhost)
|
258
|
-
- `--redis-port` (defaults to 6379)
|
259
|
-
- `--redis-password` (defaults to an empty string)
|
174
|
+
# Copy the base project to a directory of your choosing.
|
175
|
+
cp -r /tmp/orats/lib/orats/templates/base /tmp/foo_bar
|
260
176
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
This file can contain the above flags. You might have one created at `~/.oratsrc`
|
266
|
-
and it could look like this:
|
177
|
+
# Swap a few custom values into the base project.
|
178
|
+
find /tmp/foo_bar -type f -exec sed -i -e 's/OratsBase/FooBar/g' {} \;
|
179
|
+
find /tmp/foo_bar -type f -exec sed -i -e 's/orats_base/foo_bar/g' {} \;
|
180
|
+
find /tmp/foo_bar -type f -exec sed -i -e 's/VERSION/5.0.0/g' {} \;
|
267
181
|
|
182
|
+
# Clean up the cloned directory.
|
183
|
+
rm -rf /tmp/orats
|
268
184
|
```
|
269
|
-
--pg-location 192.168.144.101
|
270
|
-
--pg-username nick
|
271
|
-
--pg-password pleasedonthackme
|
272
|
-
--redis-location 192.168.144.101
|
273
|
-
```
|
274
|
-
|
275
|
-
You can supply as many or little flags as you want.
|
data/bin/orats
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# inject ../../lib into the $LOAD_PATH, this is useful because
|
4
|
-
# when developing locally on a gem the require paths will be
|
4
|
+
# when developing locally on a gem the, require paths will be
|
5
5
|
# different because the lib directory is not on the $LOAD_PATH
|
6
6
|
|
7
7
|
# since git directories are not included in gem releases we can
|
@@ -14,7 +14,4 @@ if File.exist?(git_path)
|
|
14
14
|
end
|
15
15
|
|
16
16
|
require 'orats/cli'
|
17
|
-
|
18
|
-
|
19
|
-
argv = Orats::ARGVAdjust.new.init
|
20
|
-
Orats::CLI.start(argv)
|
17
|
+
Orats::CLI.start
|
data/lib/orats/cli.rb
CHANGED
@@ -1,88 +1,27 @@
|
|
1
1
|
require 'thor'
|
2
|
-
require 'orats/commands/new
|
3
|
-
require 'orats/commands/nuke'
|
2
|
+
require 'orats/commands/new'
|
4
3
|
require 'orats/version'
|
5
4
|
|
6
5
|
module Orats
|
7
|
-
#
|
6
|
+
# thor driven command line interface
|
8
7
|
class CLI < Thor
|
9
|
-
|
10
|
-
# of having options not set for the command it was ran for
|
11
|
-
|
12
|
-
# for example the new command has a --template flag but the nuke command
|
13
|
-
# does not. thor will throw an error if you have --template in the
|
14
|
-
# .oratsrc config because it does not exist for the nuke command
|
15
|
-
|
16
|
-
# the code below gets a list of options that came from the .oratsrc file
|
17
|
-
# and compares them to the current options for the current command
|
18
|
-
|
19
|
-
# this is good, but now we need a way to somehow add these options into
|
20
|
-
# the command to fool thor into thinking they exist. we need to add
|
21
|
-
# the option somehow, thoughts?
|
22
|
-
|
23
|
-
# for now none of the code below is in action and the readme explicitly
|
24
|
-
# says you can only store the postgres and redis credentials since
|
25
|
-
# the args only get inserted into the new and nuke commands
|
26
|
-
def initialize(args, local_options, config)
|
27
|
-
super
|
28
|
-
|
29
|
-
matched_options = []
|
30
|
-
|
31
|
-
config[:current_command].options.each do |key|
|
32
|
-
aliases = key[1].aliases
|
33
|
-
option = key[0].to_s.gsub('_', '-')
|
34
|
-
|
35
|
-
aliases.each do |item|
|
36
|
-
matched_options << item if local_options.join.include?(item)
|
37
|
-
end
|
38
|
-
|
39
|
-
matched_options << option if local_options.include?("--#{option}")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
option :pg_location, default: 'localhost', aliases: '-l'
|
44
|
-
option :pg_port, default: '5432', aliases: '-o'
|
45
|
-
option :pg_username, default: 'postgres', aliases: '-u'
|
46
|
-
option :pg_password, default: '', aliases: '-p'
|
47
|
-
option :redis_location, default: 'localhost', aliases: '-n'
|
48
|
-
option :redis_port, default: '6379', aliases: '-r'
|
49
|
-
option :redis_password, default: '', aliases: '-d'
|
50
|
-
option :template, default: '', aliases: '-t'
|
51
|
-
option :custom, default: '', aliases: '-c'
|
52
|
-
option :skip_server_start, type: :boolean, default: false, aliases: '-S'
|
53
|
-
option :backend, default: 'unicorn', aliases: '-b'
|
54
|
-
option :rc, default: ''
|
8
|
+
option :template, default: 'base', aliases: '-t'
|
55
9
|
desc 'new PATH [options]', 'Create a new orats application'
|
56
10
|
long_desc File.read(File.join(File.dirname(__FILE__), 'cli_help/new'))
|
57
11
|
def new(target_path)
|
58
|
-
Commands::New
|
59
|
-
end
|
60
|
-
|
61
|
-
option :pg_location, default: 'localhost', aliases: '-l'
|
62
|
-
option :pg_port, default: '5432', aliases: '-o'
|
63
|
-
option :pg_username, default: 'postgres', aliases: '-u'
|
64
|
-
option :pg_password, default: '', aliases: '-p'
|
65
|
-
option :redis_location, default: 'localhost', aliases: '-n'
|
66
|
-
option :redis_port, default: '6379', aliases: '-r'
|
67
|
-
option :redis_password, default: '', aliases: '-d'
|
68
|
-
option :skip_data, type: :boolean, default: false, aliases: '-D'
|
69
|
-
option :rc, default: ''
|
70
|
-
desc 'nuke PATH [options]', 'Delete a path and optionally its data'
|
71
|
-
long_desc File.read(File.join(File.dirname(__FILE__), 'cli_help/nuke'))
|
72
|
-
def nuke(target_path)
|
73
|
-
Commands::Nuke.new(target_path, options).init
|
12
|
+
Commands::New.new(target_path, options).init
|
74
13
|
end
|
75
14
|
|
76
15
|
desc 'templates', 'Return a list of available templates'
|
77
16
|
long_desc 'Return a list of available built in templates.'
|
78
17
|
def templates
|
79
|
-
Commands::New
|
18
|
+
Commands::New.new.available_templates
|
80
19
|
end
|
81
20
|
|
82
21
|
desc 'version', 'The current version of orats'
|
83
22
|
long_desc 'Print the current version.'
|
84
23
|
def version
|
85
|
-
puts "
|
24
|
+
puts "orats version #{VERSION}"
|
86
25
|
end
|
87
26
|
|
88
27
|
map %w(-v --version) => :version
|