orats 0.9.7 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -2
  3. data/.rubocop.yml +24 -0
  4. data/.travis.yml +9 -0
  5. data/README.md +103 -194
  6. data/bin/orats +2 -5
  7. data/lib/orats/cli.rb +6 -67
  8. data/lib/orats/cli_help/destroy +11 -0
  9. data/lib/orats/cli_help/new +2 -26
  10. data/lib/orats/commands/new.rb +127 -0
  11. data/lib/orats/common.rb +0 -29
  12. data/lib/orats/templates/base/.dockerignore +5 -0
  13. data/lib/orats/templates/base/.gitignore +22 -0
  14. data/lib/orats/templates/base/.rubocop.yml +29 -0
  15. data/lib/orats/templates/base/Dockerfile +102 -0
  16. data/lib/orats/templates/base/Gemfile +69 -0
  17. data/lib/orats/templates/base/Gemfile.lock +205 -0
  18. data/lib/orats/templates/base/README.md +24 -0
  19. data/lib/orats/templates/base/Rakefile +7 -0
  20. data/lib/orats/templates/base/app/assets/config/manifest.js +3 -0
  21. data/lib/orats/templates/base/app/assets/images/.keep +0 -0
  22. data/lib/orats/templates/base/app/assets/javascripts/application.js +33 -0
  23. data/lib/orats/templates/base/app/assets/javascripts/cable.js +14 -0
  24. data/lib/orats/templates/base/app/assets/javascripts/channels/.keep +0 -0
  25. data/lib/orats/templates/base/app/assets/stylesheets/application.scss +89 -0
  26. data/lib/orats/templates/base/app/channels/application_cable/channel.rb +4 -0
  27. data/lib/orats/templates/base/app/channels/application_cable/connection.rb +4 -0
  28. data/lib/orats/templates/base/app/controllers/application_controller.rb +3 -0
  29. data/lib/orats/templates/base/app/controllers/concerns/.keep +0 -0
  30. data/lib/orats/templates/base/app/controllers/pages_controller.rb +4 -0
  31. data/lib/orats/templates/base/app/helpers/application_helper.rb +31 -0
  32. data/lib/orats/templates/base/app/helpers/pages_helper.rb +2 -0
  33. data/lib/orats/templates/base/app/jobs/application_job.rb +2 -0
  34. data/lib/orats/templates/base/app/mailers/application_mailer.rb +4 -0
  35. data/lib/orats/templates/base/app/models/application_record.rb +3 -0
  36. data/lib/orats/templates/base/app/models/concerns/.keep +0 -0
  37. data/lib/orats/templates/{includes/new/rails → base}/app/views/layouts/_flash.html.erb +1 -1
  38. data/lib/orats/templates/base/app/views/layouts/_footer.html.erb +3 -0
  39. 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
  40. data/lib/orats/templates/{includes/new/rails → base}/app/views/layouts/_navigation.html.erb +5 -4
  41. data/lib/orats/templates/base/app/views/layouts/application.html.erb +48 -0
  42. data/lib/orats/templates/base/app/views/layouts/mailer.html.erb +13 -0
  43. data/lib/orats/templates/base/app/views/layouts/mailer.text.erb +1 -0
  44. data/lib/orats/templates/base/app/views/pages/home.html.erb +46 -0
  45. data/lib/orats/templates/base/bin/bundle +3 -0
  46. data/lib/orats/templates/base/bin/rails +4 -0
  47. data/lib/orats/templates/base/bin/rake +4 -0
  48. data/lib/orats/templates/base/bin/setup +34 -0
  49. data/lib/orats/templates/base/bin/update +29 -0
  50. data/lib/orats/templates/base/cable/config.ru +4 -0
  51. data/lib/orats/templates/base/config.ru +5 -0
  52. data/lib/orats/templates/base/config/application.rb +71 -0
  53. data/lib/orats/templates/base/config/boot.rb +3 -0
  54. data/lib/orats/templates/base/config/cable.yml +14 -0
  55. data/lib/orats/templates/base/config/database.yml +13 -0
  56. data/lib/orats/templates/base/config/environment.rb +5 -0
  57. data/lib/orats/templates/base/config/environments/development.rb +49 -0
  58. data/lib/orats/templates/base/config/environments/production.rb +56 -0
  59. data/lib/orats/templates/base/config/environments/staging.rb +6 -0
  60. data/lib/orats/templates/base/config/environments/test.rb +40 -0
  61. data/lib/orats/templates/base/config/initializers/application_controller_renderer.rb +6 -0
  62. data/lib/orats/templates/base/config/initializers/assets.rb +12 -0
  63. data/lib/orats/templates/base/config/initializers/backtrace_silencers.rb +9 -0
  64. data/lib/orats/templates/base/config/initializers/cookies_serializer.rb +5 -0
  65. data/lib/orats/templates/base/config/initializers/filter_parameter_logging.rb +4 -0
  66. data/lib/orats/templates/base/config/initializers/inflections.rb +16 -0
  67. data/lib/orats/templates/base/config/initializers/mime_types.rb +4 -0
  68. data/lib/orats/templates/base/config/initializers/new_framework_defaults.rb +27 -0
  69. data/lib/orats/templates/base/config/initializers/session_store.rb +4 -0
  70. data/lib/orats/templates/{includes/new/rails → base}/config/initializers/sidekiq.rb +1 -4
  71. data/lib/orats/templates/base/config/initializers/timeout.rb +1 -0
  72. data/lib/orats/templates/base/config/initializers/wrap_parameters.rb +15 -0
  73. data/lib/orats/templates/base/config/locales/en.yml +23 -0
  74. data/lib/orats/templates/base/config/puma.rb +60 -0
  75. data/lib/orats/templates/base/config/routes.rb +3 -0
  76. data/lib/orats/templates/{includes/new/rails → base}/config/secrets.yml +3 -2
  77. data/lib/orats/templates/base/config/sidekiq.yml.erb +5 -0
  78. data/lib/orats/templates/base/config/spring.rb +6 -0
  79. data/lib/orats/templates/base/db/seeds.rb +9 -0
  80. data/lib/orats/templates/base/docker-compose.yml +59 -0
  81. data/lib/orats/templates/base/lib/assets/.keep +0 -0
  82. data/lib/orats/templates/base/lib/tasks/.keep +0 -0
  83. data/lib/orats/templates/base/log/.keep +0 -0
  84. data/lib/orats/templates/base/public/404.html +67 -0
  85. data/lib/orats/templates/base/public/422.html +67 -0
  86. data/lib/orats/templates/base/public/500.html +66 -0
  87. data/lib/orats/templates/base/public/apple-touch-icon-precomposed.png +0 -0
  88. data/lib/orats/templates/base/public/apple-touch-icon.png +0 -0
  89. data/lib/orats/templates/base/public/favicon.ico +0 -0
  90. data/lib/orats/templates/base/public/robots.txt +5 -0
  91. data/lib/orats/templates/base/test/controllers/.keep +0 -0
  92. data/lib/orats/templates/base/test/controllers/pages_controller_test.rb +9 -0
  93. data/lib/orats/templates/base/test/fixtures/.keep +0 -0
  94. data/lib/orats/templates/base/test/fixtures/files/.keep +0 -0
  95. data/lib/orats/templates/base/test/helpers/.keep +0 -0
  96. data/lib/orats/templates/base/test/integration/.keep +0 -0
  97. data/lib/orats/templates/base/test/mailers/.keep +0 -0
  98. data/lib/orats/templates/base/test/models/.keep +0 -0
  99. data/lib/orats/templates/base/test/test_helper.rb +11 -0
  100. data/lib/orats/templates/base/tmp/.keep +0 -0
  101. data/lib/orats/templates/base/vendor/assets/javascripts/.keep +0 -0
  102. data/lib/orats/templates/base/vendor/assets/stylesheets/.keep +0 -0
  103. data/lib/orats/ui.rb +5 -5
  104. data/lib/orats/util.rb +14 -0
  105. data/lib/orats/version.rb +1 -1
  106. data/orats.gemspec +3 -2
  107. data/test/integration/cli_test.rb +43 -65
  108. data/test/test_helper.rb +9 -58
  109. metadata +114 -66
  110. data/lib/orats/argv_adjust.rb +0 -61
  111. data/lib/orats/cli_help/nuke +0 -19
  112. data/lib/orats/commands/new/exec.rb +0 -59
  113. data/lib/orats/commands/new/rails.rb +0 -215
  114. data/lib/orats/commands/new/server.rb +0 -67
  115. data/lib/orats/commands/nuke.rb +0 -108
  116. data/lib/orats/postgres.rb +0 -92
  117. data/lib/orats/process.rb +0 -35
  118. data/lib/orats/redis.rb +0 -25
  119. data/lib/orats/shell.rb +0 -12
  120. data/lib/orats/templates/auth.rb +0 -394
  121. data/lib/orats/templates/base.rb +0 -546
  122. data/lib/orats/templates/includes/common/.gitignore +0 -6
  123. data/lib/orats/templates/includes/common/LICENSE +0 -22
  124. data/lib/orats/templates/includes/new/rails/.env +0 -59
  125. data/lib/orats/templates/includes/new/rails/Gemfile +0 -48
  126. data/lib/orats/templates/includes/new/rails/Procfile +0 -3
  127. data/lib/orats/templates/includes/new/rails/README.md +0 -3
  128. data/lib/orats/templates/includes/new/rails/app/assets/favicon/favicon_base.png +0 -0
  129. data/lib/orats/templates/includes/new/rails/app/helpers/application_helper.rb +0 -53
  130. data/lib/orats/templates/includes/new/rails/app/models/account.rb +0 -40
  131. data/lib/orats/templates/includes/new/rails/app/views/devise/confirmations/new.html.erb +0 -26
  132. data/lib/orats/templates/includes/new/rails/app/views/devise/mailer/confirmation_instructions.html.erb +0 -5
  133. data/lib/orats/templates/includes/new/rails/app/views/devise/mailer/reset_password_instructions.html.erb +0 -10
  134. data/lib/orats/templates/includes/new/rails/app/views/devise/mailer/unlock_instructions.html.erb +0 -8
  135. data/lib/orats/templates/includes/new/rails/app/views/devise/passwords/edit.html.erb +0 -28
  136. data/lib/orats/templates/includes/new/rails/app/views/devise/passwords/new.html.erb +0 -26
  137. data/lib/orats/templates/includes/new/rails/app/views/devise/registrations/edit.html.erb +0 -51
  138. data/lib/orats/templates/includes/new/rails/app/views/devise/registrations/new.html.erb +0 -31
  139. data/lib/orats/templates/includes/new/rails/app/views/devise/sessions/new.html.erb +0 -39
  140. data/lib/orats/templates/includes/new/rails/app/views/devise/shared/_links.html.erb +0 -38
  141. data/lib/orats/templates/includes/new/rails/app/views/devise/unlocks/new.html.erb +0 -26
  142. data/lib/orats/templates/includes/new/rails/app/views/layouts/_disqus_comments_snippet.html.erb +0 -19
  143. data/lib/orats/templates/includes/new/rails/app/views/layouts/_disqus_count_snippet.html.erb +0 -12
  144. data/lib/orats/templates/includes/new/rails/app/views/layouts/_footer.html.erb +0 -2
  145. data/lib/orats/templates/includes/new/rails/app/views/layouts/_navigation_auth.html.erb +0 -15
  146. data/lib/orats/templates/includes/new/rails/app/views/layouts/_navigation_links.html.erb +0 -3
  147. data/lib/orats/templates/includes/new/rails/app/views/layouts/application.html.erb +0 -47
  148. data/lib/orats/templates/includes/new/rails/app/views/pages/home.html.erb +0 -58
  149. data/lib/orats/templates/includes/new/rails/config/database.yml +0 -6
  150. data/lib/orats/templates/includes/new/rails/config/environments/staging.rb +0 -5
  151. data/lib/orats/templates/includes/new/rails/config/initializers/devise_async.rb +0 -1
  152. data/lib/orats/templates/includes/new/rails/config/initializers/mini_profiler.rb +0 -4
  153. data/lib/orats/templates/includes/new/rails/config/puma.rb +0 -39
  154. data/lib/orats/templates/includes/new/rails/config/schedule.rb +0 -3
  155. data/lib/orats/templates/includes/new/rails/config/sidekiq.yml +0 -7
  156. data/lib/orats/templates/includes/new/rails/config/sitemap.rb +0 -20
  157. data/lib/orats/templates/includes/new/rails/config/unicorn.rb +0 -84
  158. data/lib/orats/templates/includes/new/rails/lib/tasks/orats/favicon.rake +0 -48
  159. data/lib/orats/templates/includes/new/rails/public/404.html +0 -13
  160. data/lib/orats/templates/includes/new/rails/public/422.html +0 -13
  161. data/lib/orats/templates/includes/new/rails/public/500.html +0 -13
  162. data/lib/orats/templates/includes/new/rails/public/502.html +0 -13
  163. data/lib/orats/templates/includes/new/rails/public/deploy.html +0 -14
  164. data/lib/orats/templates/includes/new/rails/test/fixtures/accounts.yml +0 -27
  165. 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: 5abe9d05e8c6657f97543d88002d192f1fe63441
4
- data.tar.gz: 5538141bb24b25497ee79e90c6c25dce0de58a29
3
+ metadata.gz: 06fab17fd14bb8740672f7ae0c2749953746d90b
4
+ data.tar.gz: c70918b29df7deaac005e8245b50b61ed2bdfb62
5
5
  SHA512:
6
- metadata.gz: a857f0c572737d4decf3fe2c7db396bdef80b6774c0e80ae661bf0efff3fc906095b7009d8ffd547da8c9b902baed1267f73e94e9f2ddf6e23274f9c19c3ed77
7
- data.tar.gz: 647b5a8cca08342a4ba915ae156924c29aefb0d11312c447847f632d75d7b5bf658cbc5261a9171a78415b9e2fa75bc9004bfd3e65bc3d5a38524053d426bb6d
6
+ metadata.gz: aa7d3505bd4c763fec9da8801e5ad0d4b7c6a536c6dde57c859143fc08345e22c4c0127210db5878589a3afd1de89fd5952b4f0cc3f39c195308ade89970ed99
7
+ data.tar.gz: 496decb1ff4dfd0824566b63d56f10b2e320a1dc62cb378f7a855b5c505fbf45f16a6eaa158a5f38cf40fa5701ce2d659415ff61fc823a3fee1aa730d78440a6
data/.gitignore CHANGED
@@ -5,5 +5,4 @@
5
5
  *~
6
6
  .idea/
7
7
  *.gem
8
- Gemfile.lock
9
- .rubocop.yml
8
+ /Gemfile.lock
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
@@ -0,0 +1,9 @@
1
+ ---
2
+
3
+ language: ruby
4
+ rvm:
5
+ - 2.3
6
+
7
+ script:
8
+ - 'rubocop'
9
+ - 'ruby test/integration/cli_test.rb'
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 and what problem does it solve?
3
+ ## What is orats?
4
4
 
5
- It stands for opinionated rails application templates. The templates include solving tedious tasks that you would do for most projects. It handles creating a rails application with a bunch of opinions and best practices.
5
+ It stands for opinionated rails application templates.
6
6
 
7
- ## What version of Rails and Ruby are you targeting?
7
+ The goal is to provide you an excellent base application that you can use on
8
+ your next Rails project.
8
9
 
9
- #### Rails 4.2.x and Ruby 2.1.x
10
+ You're meant to generate a project using orats and then build your custom
11
+ application on top of it.
10
12
 
11
- Gems will also be updated once they are proven to work on the target rails/ruby versions. The gems are locked using the pessimistic operator `~>` to ensure your installation works over time as long as rubygems.org's API is working.
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
- - [Try it](#try-the-base-template)
26
- - [Auth](#auth)
27
- - [Try it](#try-the-auth-template)
28
- - [Custom](#custom)
29
- - [Try it](#try-the-custom-template)
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 latest version.
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 terminal. Below is a high level overview of what the main commands do.
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 kicks off a new orats app. It will always use the base template and optionally allows you to provide the `--template foo` flag where `foo` would be an available template provided by orats.
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
- ### Nuke
58
+ Currently there is only 1 template, which is the "base" template but others may
59
+ be added in the future.
77
60
 
78
- You can delete an app using the nuke command. It is much better than just using `rm -rf` because it will clean up the postgres and redis namespace as long as you don't disable that functionality with the `--skip-data` flag.
61
+ #### Try the new command
79
62
 
80
- #### Try the nuke command
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 append to. I feel like when I make a new project, 95% of the time it includes these features and when I do not want a specific thing it is much quicker to remove it than add it.
99
-
100
- #### Changes vs the standard rails project
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
- All of the changes have git commits to go with them. After generating a project you can type `git reflog` to get a list of changes.
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 `unicorn` or `puma` as the web backend
108
- - Use `sidekiq` as a background worker
87
+ - Use `sidekiq` as a background worker through Active Job
88
+ - Use a standalone Action Cable server
109
89
  - **Features**:
110
- - Configure scheduled jobs and tasks using `whenever`
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 to be more dry
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 the `dotenv` gem to manage environment variables
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
- - Log everything to 1 file and write the rails output to syslog
128
- - Add popular file types to the assets precompile list
129
- - Compress `css`/`js` when running `rake assets:precompile`
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 `sass` and `coffeescript`
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 and navigation links
111
+ - Add navigation
143
112
  - Add flash message
144
113
  - Add footer
145
- - Add google analytics
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
- #### Base FAQ
116
+ ## FAQ
157
117
 
158
- ##### What is `--pg-password`?
118
+ #### How can I learn about the Docker specific aspects of the project?
159
119
 
160
- Orats will automatically start your server (you can turn this off with a flag) and also run database migrations or generators depending on what you're doing.
120
+ Check out the blog post "[Learn how this application was Dockerized](#)".
161
121
 
162
- In order to do this it must know your postgres location, username and password. By default it will use localhost for the *location* and *postgres* as the username but if you need to supply those values because yours are different you can use `--pg-location foo` and `--pg-username bar`.
122
+ #### What do I do after I generate the application?
163
123
 
164
- ##### Does your redis server use a password?
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
- If your redis server is configured to use a password then you must also pass in `--redis-password foo`.
128
+ After that, just dive into the project's source code and write your awesome app!
167
129
 
168
- ### Auth
130
+ #### What's the bare minimum to get things running?
169
131
 
170
- This is the auth template which gets merged into the base template. It contains a basic authentication setup using devise and pundit.
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
- #### Changes vs the base template
173
-
174
- All of the changes have git commits to go with them. After generating a project you can type `git reflog` to get a list of changes.
175
-
176
- - **Core**:
177
- - Handle authentication with `devise`
178
- - Handle devise e-mails with `devise-async`
179
- - Handle authorization with `pundit`
180
- - Add `app/policies` with a basic pundit policy included
181
- - **Config**:
182
- - Add devise related environment variables
183
- - Set the session timeout to 2 hours
184
- - Expire the auth token on timeout
185
- - Enable account locking based on failed attempts (7 tries)
186
- - Allow unlocking by e-mail or after 2 hours
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
- #### Try the custom template
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
- <a name="any-guides-on-how-to-make-custom-templates"></a>
240
- ##### Any guides on how to make custom templates?
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
- There's the official [rails guide on custom application templates]
243
- (http://guides.rubyonrails.org/rails_application_templates.html).
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 can also view the [orats templates](https://github.com/nickjj/orats/tree/master/lib/orats/templates) to use as inspiration. All of the template files are self contained.
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
- ## The .oratsrc file
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
- Both the `new` and `nuke` commands are dependent on having your postgres and redis login information because they need to connection to those databases to perform various tasks.
168
+ You could whip up a simple bash script to do this, such as:
250
169
 
251
- There are 7 flags to configure for this:
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
- - `--pg-location` (defaults to localhost)
254
- - `--pg-port` (defaults to 5432)
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
- For most people you will only need to supply the postgres password but still it's annoying to have to type those flags in every time you create a new app or nuke an app. It's really annoying if you develop inside of linux containers like myself which means the location is not localhost.
262
-
263
- This is where the `.oratsrc` file comes into play. By default it will look for one in your home directory but you can pass in a location directly with the `--rc` flag.
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
- require 'orats/argv_adjust'
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/exec'
3
- require 'orats/commands/nuke'
2
+ require 'orats/commands/new'
4
3
  require 'orats/version'
5
4
 
6
5
  module Orats
7
- # the thor driven command line interface
6
+ # thor driven command line interface
8
7
  class CLI < Thor
9
- # if options are added through the .oratsrc file then we run the risk
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::Exec.new(target_path, options).init
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::Exec.new.available_templates
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 "Orats version #{VERSION}"
24
+ puts "orats version #{VERSION}"
86
25
  end
87
26
 
88
27
  map %w(-v --version) => :version