gnarails 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +227 -0
- data/.gitignore +5 -0
- data/.pronto.yml +2 -0
- data/.railsrc +2 -0
- data/.rspec +2 -0
- data/.rubocop.yml +3 -0
- data/.ruby-version +1 -0
- data/Brewfile +3 -0
- data/CHANGELOG.md +63 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTING.md +48 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +213 -0
- data/LICENSE +21 -0
- data/README.md +136 -0
- data/Rakefile +6 -0
- data/bin/ci_pronto +6 -0
- data/bin/console +14 -0
- data/bin/generate-react-test-app.sh +2 -0
- data/bin/generate-test-app.sh +22 -0
- data/bin/setup +8 -0
- data/bin/test-setup.sh +8 -0
- data/exe/gnarails +4 -0
- data/gnarails.gemspec +34 -0
- data/gnarly.rb +395 -0
- data/lib/gnarails/cli/application.rb +192 -0
- data/lib/gnarails/version.rb +3 -0
- data/lib/gnarails.rb +8 -0
- data/templates/.circleci/config.yml +66 -0
- data/templates/.env.development +5 -0
- data/templates/.env.docker/.env.docker-standard +1 -0
- data/templates/.env.docker/.env.docker-webpack +2 -0
- data/templates/.env.docker-assets +1 -0
- data/templates/.env.test +5 -0
- data/templates/.gitignore +20 -0
- data/templates/.pronto.yml +2 -0
- data/templates/.rspec +3 -0
- data/templates/.rubocop.yml +3 -0
- data/templates/.ruby-version +1 -0
- data/templates/.scss-lint.yml +33 -0
- data/templates/Dockerfile +20 -0
- data/templates/Dockerfile-assets +24 -0
- data/templates/README.md +83 -0
- data/templates/database.yml +20 -0
- data/templates/docker-compose.yml/docker-compose-standard.yml +15 -0
- data/templates/docker-compose.yml/docker-compose-webpack.yml +26 -0
- data/templates/react/.babelrc +18 -0
- data/templates/react/.eslintrc.js +45 -0
- data/templates/react/controllers/home_controller.rb +4 -0
- data/templates/react/js/Router/Router.jsx +22 -0
- data/templates/react/js/Router/index.js +3 -0
- data/templates/react/js/api/index.js +17 -0
- data/templates/react/js/api/sessions.js +8 -0
- data/templates/react/js/app_constants/index.js +6 -0
- data/templates/react/js/components/App/App.jsx +15 -0
- data/templates/react/js/components/App/App.tests.jsx +15 -0
- data/templates/react/js/components/App/_styles.scss +3 -0
- data/templates/react/js/components/App/index.js +3 -0
- data/templates/react/js/index.scss +2 -0
- data/templates/react/js/packs/main.jsx +13 -0
- data/templates/react/js/redux/entity_getter.js +7 -0
- data/templates/react/js/redux/history.js +5 -0
- data/templates/react/js/redux/initial_state.js +5 -0
- data/templates/react/js/redux/middlewares/authentication_middleware/authentication_middleware.tests.js +109 -0
- data/templates/react/js/redux/middlewares/authentication_middleware/helpers.js +21 -0
- data/templates/react/js/redux/middlewares/authentication_middleware/helpers.tests.js +84 -0
- data/templates/react/js/redux/middlewares/authentication_middleware/index.js +20 -0
- data/templates/react/js/redux/middlewares/index.js +11 -0
- data/templates/react/js/redux/nodes/app/actions.js +36 -0
- data/templates/react/js/redux/nodes/app/config.js +12 -0
- data/templates/react/js/redux/nodes/app/reducer.js +35 -0
- data/templates/react/js/redux/nodes/app/reducer.tests.js +78 -0
- data/templates/react/js/redux/reducers.js +11 -0
- data/templates/react/js/redux/store.js +14 -0
- data/templates/react/js/storage.js +15 -0
- data/templates/react/js/styles/_variables.scss +1 -0
- data/templates/react/js/test/.setup.js +51 -0
- data/templates/react/js/test/connect_wrapper.jsx +28 -0
- data/templates/react/js/test/create_request_mock.js +29 -0
- data/templates/react/js/test/mock_store.js +12 -0
- data/templates/react/layout.html.erb +16 -0
- data/templates/react/rails_routes.rb +5 -0
- data/templates/react/views/home/default.html.erb +1 -0
- data/templates/script/brakeman +15 -0
- data/templates/script/ci_pronto +6 -0
- data/templates/spec/support/factory_bot.rb +5 -0
- data/templates/spec/support/system_test_configuration.rb +13 -0
- data/test-app/app/controllers/job_postings_controller.rb +5 -0
- data/test-app/app/models/comment.rb +3 -0
- data/test-app/app/models/job_posting.rb +20 -0
- data/test-app/app/views/job_postings/index.html.erb +23 -0
- data/test-app/app/views/layouts/application.html.erb +14 -0
- data/test-app/config/routes.rb +5 -0
- data/test-app/db/migrate/20170918002433_create_job_postings.rb +12 -0
- data/test-app/db/migrate/20170918002455_create_comments.rb +10 -0
- data/test-app/spec/factories/job_postings.rb +5 -0
- data/test-app/spec/models/job_posting_spec.rb +21 -0
- data/test-app/spec/requests/status_spec.rb +11 -0
- data/test-app/spec/system/viewing_all_job_postings_spec.rb +36 -0
- metadata +270 -0
@@ -0,0 +1,192 @@
|
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
module Gnarails
|
4
|
+
module Cli
|
5
|
+
class Application < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
add_runtime_options!
|
9
|
+
|
10
|
+
WEBPACKS = %w[react vue angular elm stimulus].freeze
|
11
|
+
|
12
|
+
method_option :ruby,
|
13
|
+
type: :string,
|
14
|
+
aliases: "-r",
|
15
|
+
default: Thor::Util.ruby_command,
|
16
|
+
desc: "Path to the Ruby binary of your choice", banner: "PATH"
|
17
|
+
|
18
|
+
method_option :skip_namespace,
|
19
|
+
type: :boolean,
|
20
|
+
default: false,
|
21
|
+
desc: "Skip namespace (affects only isolated applications)"
|
22
|
+
|
23
|
+
method_option :skip_yarn,
|
24
|
+
type: :boolean,
|
25
|
+
default: false,
|
26
|
+
desc: "Don't use Yarn for managing JavaScript dependencies"
|
27
|
+
|
28
|
+
method_option :skip_gemfile,
|
29
|
+
type: :boolean,
|
30
|
+
default: false,
|
31
|
+
desc: "Don't create a Gemfile"
|
32
|
+
|
33
|
+
method_option :skip_git,
|
34
|
+
type: :boolean,
|
35
|
+
aliases: "-G",
|
36
|
+
default: false,
|
37
|
+
desc: "Skip .gitignore file"
|
38
|
+
|
39
|
+
method_option :skip_keeps,
|
40
|
+
type: :boolean,
|
41
|
+
default: false,
|
42
|
+
desc: "Skip source control .keep files"
|
43
|
+
|
44
|
+
method_option :skip_action_mailer,
|
45
|
+
type: :boolean,
|
46
|
+
aliases: "-M",
|
47
|
+
default: false,
|
48
|
+
desc: "Skip Action Mailer files"
|
49
|
+
|
50
|
+
method_option :skip_active_record,
|
51
|
+
type: :boolean,
|
52
|
+
aliases: "-O",
|
53
|
+
default: false,
|
54
|
+
desc: "Skip Active Record files"
|
55
|
+
|
56
|
+
method_option :skip_active_storage,
|
57
|
+
type: :boolean,
|
58
|
+
default: false,
|
59
|
+
desc: "Skip Active Storage files"
|
60
|
+
|
61
|
+
method_option :skip_puma,
|
62
|
+
type: :boolean,
|
63
|
+
aliases: "-P",
|
64
|
+
default: false,
|
65
|
+
desc: "Skip Puma related files"
|
66
|
+
|
67
|
+
method_option :skip_action_cable,
|
68
|
+
type: :boolean,
|
69
|
+
aliases: "-C",
|
70
|
+
default: false,
|
71
|
+
desc: "Skip Action Cable files"
|
72
|
+
|
73
|
+
method_option :skip_sprockets,
|
74
|
+
type: :boolean,
|
75
|
+
aliases: "-S",
|
76
|
+
default: false,
|
77
|
+
desc: "Skip Sprockets files"
|
78
|
+
|
79
|
+
method_option :skip_spring,
|
80
|
+
type: :boolean,
|
81
|
+
default: false,
|
82
|
+
desc: "Don't install Spring application preloader"
|
83
|
+
|
84
|
+
method_option :skip_listen,
|
85
|
+
type: :boolean,
|
86
|
+
default: false,
|
87
|
+
desc: "Don't generate configuration that depends on the listen gem"
|
88
|
+
|
89
|
+
method_option :skip_coffee,
|
90
|
+
type: :boolean,
|
91
|
+
default: false,
|
92
|
+
desc: "Don't use CoffeeScript"
|
93
|
+
|
94
|
+
method_option :skip_javascript,
|
95
|
+
type: :boolean,
|
96
|
+
aliases: "-J",
|
97
|
+
default: false,
|
98
|
+
desc: "Skip JavaScript files"
|
99
|
+
|
100
|
+
method_option :skip_turbolinks,
|
101
|
+
type: :boolean,
|
102
|
+
default: false,
|
103
|
+
desc: "Skip turbolinks gem"
|
104
|
+
|
105
|
+
method_option :skip_test,
|
106
|
+
type: :boolean,
|
107
|
+
aliases: "-T",
|
108
|
+
default: false,
|
109
|
+
desc: "Skip test files"
|
110
|
+
|
111
|
+
method_option :skip_system_test,
|
112
|
+
type: :boolean,
|
113
|
+
default: false,
|
114
|
+
desc: "Skip system test files"
|
115
|
+
|
116
|
+
method_option :skip_bootsnap,
|
117
|
+
type: :boolean,
|
118
|
+
default: false,
|
119
|
+
desc: "Skip bootsnap gem"
|
120
|
+
|
121
|
+
method_option :dev,
|
122
|
+
type: :boolean,
|
123
|
+
default: false,
|
124
|
+
desc: "Setup the application with Gemfile pointing to your Rails checkout"
|
125
|
+
|
126
|
+
method_option :edge,
|
127
|
+
type: :boolean,
|
128
|
+
default: false,
|
129
|
+
desc: "Setup the application with Gemfile pointing to Rails repository"
|
130
|
+
|
131
|
+
method_option :rc,
|
132
|
+
type: :string,
|
133
|
+
default: nil,
|
134
|
+
desc: "Path to file containing extra configuration options for rails command"
|
135
|
+
|
136
|
+
method_option :no_rc,
|
137
|
+
type: :boolean,
|
138
|
+
default: false,
|
139
|
+
desc: "Skip loading of extra configuration options from .railsrc file"
|
140
|
+
|
141
|
+
method_option :api,
|
142
|
+
type: :boolean,
|
143
|
+
desc: "Preconfigure smaller stack for API only apps"
|
144
|
+
|
145
|
+
method_option :skip_bundle,
|
146
|
+
type: :boolean,
|
147
|
+
aliases: "-B",
|
148
|
+
default: false,
|
149
|
+
desc: "Don't run bundle install"
|
150
|
+
|
151
|
+
method_option :webpack,
|
152
|
+
type: :string,
|
153
|
+
default: nil,
|
154
|
+
desc: "Preconfigure for app-like JavaScript with Webpack (options: #{WEBPACKS.join('/')})"
|
155
|
+
|
156
|
+
desc "new APP_PATH [options]", "generate a gnarly rails app"
|
157
|
+
long_desc <<-LONGDESC
|
158
|
+
`gnarails new NAME` will create a new rails application called NAME,
|
159
|
+
pre-built with the same helpful default configuration you can expect from
|
160
|
+
any rails project built by The Gnar Company.
|
161
|
+
|
162
|
+
By default, we pass arguments to `rails new` that skip test unit
|
163
|
+
generation and use postgres instead of sqlite as the default database.
|
164
|
+
|
165
|
+
You should also be able to pass any other arguments you would expect to
|
166
|
+
be able to when generating a new rails app.
|
167
|
+
LONGDESC
|
168
|
+
def new(name)
|
169
|
+
Kernel.system "rails new #{name} #{cli_options(options)}"
|
170
|
+
end
|
171
|
+
|
172
|
+
no_tasks do
|
173
|
+
def cli_options(options)
|
174
|
+
options_string = "-m #{Gnarails.template_file} --skip-test-unit --database=postgresql"
|
175
|
+
options.each_with_object(options_string) do |(k, v), str|
|
176
|
+
str << cli_option(k, v)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
def cli_option(key, value)
|
181
|
+
if value == false
|
182
|
+
""
|
183
|
+
elsif value == true
|
184
|
+
" --#{key}"
|
185
|
+
else
|
186
|
+
" --#{key}=#{value}"
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
data/lib/gnarails.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
version: 2.0
|
2
|
+
jobs:
|
3
|
+
build:
|
4
|
+
docker:
|
5
|
+
- image: circleci/ruby:__ruby_version__-stretch-node-browsers
|
6
|
+
environment:
|
7
|
+
RAILS_ENV: test
|
8
|
+
- image: circleci/postgres:9.6.5
|
9
|
+
steps:
|
10
|
+
- checkout
|
11
|
+
|
12
|
+
# Restore bundle cache
|
13
|
+
- restore_cache:
|
14
|
+
key: __application_name__-{{ checksum "Gemfile.lock" }}
|
15
|
+
|
16
|
+
# cmake is required by Rugged, a dependency of Pronto
|
17
|
+
- run:
|
18
|
+
name: Install cmake
|
19
|
+
command: sudo apt-get -y -qq update && sudo apt-get -y -qq install cmake
|
20
|
+
|
21
|
+
# Bundle install dependencies
|
22
|
+
- run:
|
23
|
+
name: Install dependencies
|
24
|
+
command: bundle install --path vendor/bundle
|
25
|
+
|
26
|
+
# Store bundle cache
|
27
|
+
- save_cache:
|
28
|
+
key: __application_name__-{{ checksum "Gemfile.lock" }}
|
29
|
+
paths:
|
30
|
+
- vendor/bundle
|
31
|
+
|
32
|
+
# Database setup
|
33
|
+
- run:
|
34
|
+
name: Create database
|
35
|
+
command: bundle exec rake db:create
|
36
|
+
- run:
|
37
|
+
name: Load database schema
|
38
|
+
command: bundle exec rake db:schema:load
|
39
|
+
|
40
|
+
# Tests
|
41
|
+
- run:
|
42
|
+
name: RSpec
|
43
|
+
command: bundle exec rspec
|
44
|
+
|
45
|
+
# Security analysis
|
46
|
+
- run:
|
47
|
+
name: Bundler Audit
|
48
|
+
command: bundle exec bundle-audit update && bundle exec bundle-audit check
|
49
|
+
- run:
|
50
|
+
name: Brakeman
|
51
|
+
command: ./script/brakeman
|
52
|
+
|
53
|
+
# Pronto
|
54
|
+
- run:
|
55
|
+
name: Pronto
|
56
|
+
command: ./script/ci_pronto
|
57
|
+
|
58
|
+
# Save Brakeman
|
59
|
+
- store_artifacts:
|
60
|
+
path: tmp/brakeman.html
|
61
|
+
destination: security/brakeman.html
|
62
|
+
|
63
|
+
# Save Coverage Analysis
|
64
|
+
- store_artifacts:
|
65
|
+
path: coverage
|
66
|
+
destination: coverage
|
@@ -0,0 +1 @@
|
|
1
|
+
DATABASE_HOST=db
|
@@ -0,0 +1 @@
|
|
1
|
+
WEBPACKER_DEV_SERVER_HOST=0.0.0.0
|
data/templates/.env.test
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore all logfiles and tempfiles.
|
11
|
+
/log/*
|
12
|
+
/tmp/*
|
13
|
+
!/log/.keep
|
14
|
+
!/tmp/.keep
|
15
|
+
|
16
|
+
# Ignore Byebug command history file.
|
17
|
+
.byebug_history
|
18
|
+
|
19
|
+
# Ignore output of simplecov
|
20
|
+
coverage
|
data/templates/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
__ruby_version__
|
@@ -0,0 +1,33 @@
|
|
1
|
+
scss_files: 'app/assets/stylesheets/**/*.scss'
|
2
|
+
exclude: 'app/assets/stylesheets/plugins/**'
|
3
|
+
|
4
|
+
linters:
|
5
|
+
StringQuotes:
|
6
|
+
enabled: false
|
7
|
+
|
8
|
+
LeadingZero:
|
9
|
+
enabled: false
|
10
|
+
|
11
|
+
BorderZero:
|
12
|
+
enabled: false
|
13
|
+
|
14
|
+
ColorVariable:
|
15
|
+
enabled: false
|
16
|
+
|
17
|
+
Comment:
|
18
|
+
enabled: false
|
19
|
+
|
20
|
+
FinalNewline:
|
21
|
+
enabled: false
|
22
|
+
|
23
|
+
IdSelector:
|
24
|
+
enabled: false
|
25
|
+
|
26
|
+
NestingDepth:
|
27
|
+
enabled: true
|
28
|
+
max_depth: 6
|
29
|
+
ignore_parent_selectors: false
|
30
|
+
|
31
|
+
SelectorDepth:
|
32
|
+
enabled: true
|
33
|
+
max_depth: 6
|
@@ -0,0 +1,20 @@
|
|
1
|
+
FROM ruby:__ruby_version__
|
2
|
+
|
3
|
+
# use a newer version of Node to use Yarn
|
4
|
+
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
|
5
|
+
|
6
|
+
# nodejs: Rails needs a JS runtime
|
7
|
+
# cmake: required by Rugged, dependency of Pronto
|
8
|
+
RUN apt-get update -qq \
|
9
|
+
&& apt-get install -y -qq nodejs cmake
|
10
|
+
|
11
|
+
RUN npm install -g yarn
|
12
|
+
|
13
|
+
RUN mkdir /app
|
14
|
+
WORKDIR /app
|
15
|
+
|
16
|
+
ADD Gemfile /app/Gemfile
|
17
|
+
ADD Gemfile.lock /app/Gemfile.lock
|
18
|
+
RUN bundle install
|
19
|
+
|
20
|
+
ADD . /app
|
@@ -0,0 +1,24 @@
|
|
1
|
+
FROM ruby:__ruby_version__
|
2
|
+
|
3
|
+
# use a newer version of Node to use Yarn
|
4
|
+
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
|
5
|
+
|
6
|
+
# nodejs: Rails needs a JS runtime
|
7
|
+
# cmake: required by Rugged, dependency of Pronto
|
8
|
+
RUN apt-get update -qq \
|
9
|
+
&& apt-get install -y -qq nodejs cmake
|
10
|
+
|
11
|
+
RUN npm install -g yarn
|
12
|
+
|
13
|
+
RUN mkdir /app
|
14
|
+
WORKDIR /app
|
15
|
+
|
16
|
+
ADD Gemfile /app/Gemfile
|
17
|
+
ADD Gemfile.lock /app/Gemfile.lock
|
18
|
+
RUN bundle install
|
19
|
+
|
20
|
+
ADD package.json /app/package.json
|
21
|
+
ADD yarn.lock /app/yarn.lock
|
22
|
+
RUN yarn install
|
23
|
+
|
24
|
+
ADD . /app
|
data/templates/README.md
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# __application_name__
|
2
|
+
|
3
|
+
## Setup
|
4
|
+
|
5
|
+
```sh
|
6
|
+
$ bundle install
|
7
|
+
$ bundle exec rake db:create
|
8
|
+
$ bundle exec rake db:migrate
|
9
|
+
$ bundle exec rake db:seed
|
10
|
+
$ bundle exec rails s
|
11
|
+
$ open http://localhost:3000
|
12
|
+
```
|
13
|
+
|
14
|
+
## Testing
|
15
|
+
|
16
|
+
### Testing Dependency:
|
17
|
+
|
18
|
+
To run acceptance tests chromedriver is required.
|
19
|
+
|
20
|
+
If using macOS and homebrew, you can install chromedriver with the following
|
21
|
+
command:
|
22
|
+
```sh
|
23
|
+
$ brew install chromedriver
|
24
|
+
```
|
25
|
+
|
26
|
+
To run the full test suite:
|
27
|
+
|
28
|
+
```sh
|
29
|
+
$ bundle exec rake
|
30
|
+
```
|
31
|
+
|
32
|
+
### Switching out Capybara Driver:
|
33
|
+
|
34
|
+
If you'd like to not run your tests headless, for example, to troubleshoot an issue and see what's on the screen, modify the `driven_by` driver in `spec/support/system_test_configuration.rb` to use `:selenium_chrome` instead of `:selenium_chrome_headless`. After the change, this block should look as follows:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
config.before(:each, type: :system, js: true) do
|
38
|
+
driven_by :selenium_chrome
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
## Dependencies
|
43
|
+
|
44
|
+
[Ruby Version](.ruby-version)
|
45
|
+
|
46
|
+
## Docker
|
47
|
+
|
48
|
+
The application may be run via [docker](https://docs.docker.com/) and [docker-compose](https://docs.docker.com/compose/). Once installed run:
|
49
|
+
|
50
|
+
```sh
|
51
|
+
$ docker-compose build
|
52
|
+
```
|
53
|
+
|
54
|
+
To run the application for the first time:
|
55
|
+
|
56
|
+
```sh
|
57
|
+
# Create the database
|
58
|
+
$ docker-compose run web rake db:setup
|
59
|
+
|
60
|
+
# Start the application
|
61
|
+
$ docker-compose up
|
62
|
+
```
|
63
|
+
|
64
|
+
To run rspec:
|
65
|
+
```sh
|
66
|
+
$ docker-compose run web bundle exec rspec
|
67
|
+
```
|
68
|
+
|
69
|
+
### Using pry with Docker
|
70
|
+
|
71
|
+
Once docker is running, type `docker ps` in the terminal and copy the ID of the `__application_name___web` image.
|
72
|
+
|
73
|
+
Then, in a new terminal window, use the container ID you copied to open an image specific terminal...
|
74
|
+
|
75
|
+
```sh
|
76
|
+
$ docker attach COPIED_CONTAINER_ID
|
77
|
+
```
|
78
|
+
|
79
|
+
Lastly, set `binding.pry` in the usual fashion, and use the new image specific terminal to interact with your breakpoint.
|
80
|
+
|
81
|
+
## Updating gnar-style
|
82
|
+
|
83
|
+
After updating the gnar-style gem, you must take care to ensure that your local rubocop file does not stray from the update made to the gem in an unintended manner. Any changes in the local rubocop file will take precedence over what is in the gnar-style gem. See the gnar-style [docs](https://github.com/TheGnarCo/gnar-style#overriding-styles) for more details.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
default: &default
|
2
|
+
adapter: postgresql
|
3
|
+
encoding: unicode
|
4
|
+
pool: <%= ENV.fetch("DATABASE_POOL_SIZE") { 5 } %>
|
5
|
+
database: <%= ENV['DATABASE_NAME'] %>
|
6
|
+
username: <%= ENV['DATABASE_USERNAME'] %>
|
7
|
+
password: <%= ENV['DATABASE_PASSWORD'] %>
|
8
|
+
host: <%= ENV['DATABASE_HOST'] %>
|
9
|
+
port: <%= ENV['DATABASE_PORT'] %>
|
10
|
+
|
11
|
+
development:
|
12
|
+
<<: *default
|
13
|
+
database: __application_name___development
|
14
|
+
|
15
|
+
test:
|
16
|
+
<<: *default
|
17
|
+
database: __application_name___test
|
18
|
+
|
19
|
+
production:
|
20
|
+
<<: *default
|
@@ -0,0 +1,15 @@
|
|
1
|
+
version: '3'
|
2
|
+
services:
|
3
|
+
db:
|
4
|
+
image: postgres
|
5
|
+
web:
|
6
|
+
build: .
|
7
|
+
command: bash -c 'rm -f tmp/pids/server.pid && bundle exec rails s --port 3000 --binding 0.0.0.0'
|
8
|
+
volumes:
|
9
|
+
- .:/app
|
10
|
+
ports:
|
11
|
+
- 3000:3000
|
12
|
+
depends_on:
|
13
|
+
- db
|
14
|
+
env_file:
|
15
|
+
- .env.docker
|
@@ -0,0 +1,26 @@
|
|
1
|
+
version: '3'
|
2
|
+
services:
|
3
|
+
db:
|
4
|
+
image: postgres
|
5
|
+
assets:
|
6
|
+
build:
|
7
|
+
context: .
|
8
|
+
dockerfile: Dockerfile-assets
|
9
|
+
command: yarn start
|
10
|
+
volumes:
|
11
|
+
- .:/app
|
12
|
+
- /app/node_modules
|
13
|
+
env_file:
|
14
|
+
- .env.docker-assets
|
15
|
+
web:
|
16
|
+
build: .
|
17
|
+
command: bash -c 'rm -f tmp/pids/server.pid && bundle exec rails s --port 3000 --binding 0.0.0.0'
|
18
|
+
volumes:
|
19
|
+
- .:/app
|
20
|
+
ports:
|
21
|
+
- 3000:3000
|
22
|
+
depends_on:
|
23
|
+
- db
|
24
|
+
- assets
|
25
|
+
env_file:
|
26
|
+
- .env.docker
|
@@ -0,0 +1,45 @@
|
|
1
|
+
var path = require('path');
|
2
|
+
|
3
|
+
module.exports = {
|
4
|
+
extends: 'airbnb',
|
5
|
+
parser: 'babel-eslint',
|
6
|
+
env: {
|
7
|
+
'node': true,
|
8
|
+
'mocha': true
|
9
|
+
},
|
10
|
+
globals: {
|
11
|
+
'expect': false,
|
12
|
+
'describe': false
|
13
|
+
},
|
14
|
+
rules: {
|
15
|
+
'consistent-return': 1,
|
16
|
+
'arrow-body-style': 0,
|
17
|
+
'max-len': 0,
|
18
|
+
'jsx-a11y/img-has-alt': 0,
|
19
|
+
'no-use-before-define': [2, 'nofunc'],
|
20
|
+
'no-unused-expressions': 0,
|
21
|
+
'no-console': 0,
|
22
|
+
'space-before-function-paren': 0,
|
23
|
+
'react/prefer-stateless-function': 0,
|
24
|
+
'react/no-multi-comp': 0,
|
25
|
+
'react/no-unused-prop-types': [1, { 'customValidators': [], skipShapeProps: true }],
|
26
|
+
'no-param-reassign': 0,
|
27
|
+
'new-cap': 0,
|
28
|
+
'import/no-unresolved': 'error',
|
29
|
+
'import/no-extraneous-dependencies': ['error', { 'devDependencies': true }],
|
30
|
+
'linebreak-style': 0,
|
31
|
+
'import/no-named-as-default': 'off',
|
32
|
+
'import/no-named-as-default-member': 'off',
|
33
|
+
'no-underscore-dangle': 0
|
34
|
+
},
|
35
|
+
settings: {
|
36
|
+
'import/resolver': {
|
37
|
+
webpack: {
|
38
|
+
config: path.join(__dirname, 'webpack.config.js')
|
39
|
+
},
|
40
|
+
node: {
|
41
|
+
paths: 'app/javascript'
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import React, { Component } from 'react';
|
2
|
+
import { Provider } from 'react-redux';
|
3
|
+
import { ConnectedRouter } from 'react-router-redux'
|
4
|
+
import { Route } from 'react-router';
|
5
|
+
|
6
|
+
import App from 'components/App';
|
7
|
+
import history from 'redux/history';
|
8
|
+
import store from 'redux/store';
|
9
|
+
|
10
|
+
export default class Router extends Component {
|
11
|
+
render () {
|
12
|
+
return (
|
13
|
+
<Provider store={store}>
|
14
|
+
<ConnectedRouter history={history}>
|
15
|
+
<App>
|
16
|
+
<h1>Welcome to Gnarails</h1>
|
17
|
+
</App>
|
18
|
+
</ConnectedRouter>
|
19
|
+
</Provider>
|
20
|
+
)
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import Schlepp from 'schlepp';
|
2
|
+
|
3
|
+
import appConstants from 'app_constants';
|
4
|
+
import sessionMethods from 'api/sessions';
|
5
|
+
|
6
|
+
class Api extends Schlepp {
|
7
|
+
constructor(options) {
|
8
|
+
super(options);
|
9
|
+
|
10
|
+
this.sessions = sessionMethods(this);
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
export default new Api({
|
15
|
+
host: appConstants.API_HOST,
|
16
|
+
bearerTokenKeyInLocalStorage: `${appConstants.APP_NAME}:auth_token`,
|
17
|
+
});
|