Skip to content

Commit a50123d

Browse files
committed
init rails new app-name --api --webpack=react -d mysql
0 parents  commit a50123d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+8017
-0
lines changed

.babelrc

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"presets": [
3+
[
4+
"env",
5+
{
6+
"modules": false,
7+
"targets": {
8+
"browsers": "> 1%",
9+
"uglify": true
10+
},
11+
"useBuiltIns": true
12+
}
13+
],
14+
"react"
15+
],
16+
"plugins": [
17+
"syntax-dynamic-import",
18+
"transform-object-rest-spread",
19+
[
20+
"transform-class-properties",
21+
{
22+
"spec": true
23+
}
24+
]
25+
]
26+
}

.gitignore

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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 uploaded files in development
17+
/storage/*
18+
!/storage/.keep
19+
20+
.byebug_history
21+
22+
# Ignore master key for decrypting credentials and more.
23+
/config/master.key
24+
/public/packs
25+
/public/packs-test
26+
/node_modules
27+
yarn-debug.log*
28+
.yarn-integrity

.postcssrc.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
plugins:
2+
postcss-import: {}
3+
postcss-cssnext: {}

.ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.5.1

Gemfile

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
source 'https://rubygems.org'
2+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3+
4+
ruby '2.5.1'
5+
6+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
7+
gem 'rails', '~> 5.2.1'
8+
# Use mysql as the database for Active Record
9+
gem 'mysql2', '>= 0.4.4', '< 0.6.0'
10+
# Use Puma as the app server
11+
gem 'puma', '~> 3.11'
12+
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
13+
gem 'webpacker'
14+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
15+
# gem 'jbuilder', '~> 2.5'
16+
# Use Redis adapter to run Action Cable in production
17+
# gem 'redis', '~> 4.0'
18+
# Use ActiveModel has_secure_password
19+
# gem 'bcrypt', '~> 3.1.7'
20+
21+
# Use ActiveStorage variant
22+
# gem 'mini_magick', '~> 4.8'
23+
24+
# Use Capistrano for deployment
25+
# gem 'capistrano-rails', group: :development
26+
27+
# Reduces boot times through caching; required in config/boot.rb
28+
gem 'bootsnap', '>= 1.1.0', require: false
29+
30+
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
31+
# gem 'rack-cors'
32+
33+
group :development, :test do
34+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
35+
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
36+
end
37+
38+
group :development do
39+
gem 'listen', '>= 3.0.5', '< 3.2'
40+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
41+
gem 'spring'
42+
gem 'spring-watcher-listen', '~> 2.0.0'
43+
end
44+
45+
46+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
47+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Gemfile.lock

+157
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
actioncable (5.2.1)
5+
actionpack (= 5.2.1)
6+
nio4r (~> 2.0)
7+
websocket-driver (>= 0.6.1)
8+
actionmailer (5.2.1)
9+
actionpack (= 5.2.1)
10+
actionview (= 5.2.1)
11+
activejob (= 5.2.1)
12+
mail (~> 2.5, >= 2.5.4)
13+
rails-dom-testing (~> 2.0)
14+
actionpack (5.2.1)
15+
actionview (= 5.2.1)
16+
activesupport (= 5.2.1)
17+
rack (~> 2.0)
18+
rack-test (>= 0.6.3)
19+
rails-dom-testing (~> 2.0)
20+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
21+
actionview (5.2.1)
22+
activesupport (= 5.2.1)
23+
builder (~> 3.1)
24+
erubi (~> 1.4)
25+
rails-dom-testing (~> 2.0)
26+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
27+
activejob (5.2.1)
28+
activesupport (= 5.2.1)
29+
globalid (>= 0.3.6)
30+
activemodel (5.2.1)
31+
activesupport (= 5.2.1)
32+
activerecord (5.2.1)
33+
activemodel (= 5.2.1)
34+
activesupport (= 5.2.1)
35+
arel (>= 9.0)
36+
activestorage (5.2.1)
37+
actionpack (= 5.2.1)
38+
activerecord (= 5.2.1)
39+
marcel (~> 0.3.1)
40+
activesupport (5.2.1)
41+
concurrent-ruby (~> 1.0, >= 1.0.2)
42+
i18n (>= 0.7, < 2)
43+
minitest (~> 5.1)
44+
tzinfo (~> 1.1)
45+
arel (9.0.0)
46+
bootsnap (1.3.2)
47+
msgpack (~> 1.0)
48+
builder (3.2.3)
49+
byebug (10.0.2)
50+
concurrent-ruby (1.1.3)
51+
crass (1.0.4)
52+
erubi (1.7.1)
53+
ffi (1.9.25)
54+
globalid (0.4.1)
55+
activesupport (>= 4.2.0)
56+
i18n (1.1.1)
57+
concurrent-ruby (~> 1.0)
58+
listen (3.1.5)
59+
rb-fsevent (~> 0.9, >= 0.9.4)
60+
rb-inotify (~> 0.9, >= 0.9.7)
61+
ruby_dep (~> 1.2)
62+
loofah (2.2.3)
63+
crass (~> 1.0.2)
64+
nokogiri (>= 1.5.9)
65+
mail (2.7.1)
66+
mini_mime (>= 0.1.1)
67+
marcel (0.3.3)
68+
mimemagic (~> 0.3.2)
69+
method_source (0.9.2)
70+
mimemagic (0.3.2)
71+
mini_mime (1.0.1)
72+
mini_portile2 (2.3.0)
73+
minitest (5.11.3)
74+
msgpack (1.2.4)
75+
mysql2 (0.5.2)
76+
nio4r (2.3.1)
77+
nokogiri (1.8.5)
78+
mini_portile2 (~> 2.3.0)
79+
puma (3.12.0)
80+
rack (2.0.6)
81+
rack-proxy (0.6.5)
82+
rack
83+
rack-test (1.1.0)
84+
rack (>= 1.0, < 3)
85+
rails (5.2.1)
86+
actioncable (= 5.2.1)
87+
actionmailer (= 5.2.1)
88+
actionpack (= 5.2.1)
89+
actionview (= 5.2.1)
90+
activejob (= 5.2.1)
91+
activemodel (= 5.2.1)
92+
activerecord (= 5.2.1)
93+
activestorage (= 5.2.1)
94+
activesupport (= 5.2.1)
95+
bundler (>= 1.3.0)
96+
railties (= 5.2.1)
97+
sprockets-rails (>= 2.0.0)
98+
rails-dom-testing (2.0.3)
99+
activesupport (>= 4.2.0)
100+
nokogiri (>= 1.6)
101+
rails-html-sanitizer (1.0.4)
102+
loofah (~> 2.2, >= 2.2.2)
103+
railties (5.2.1)
104+
actionpack (= 5.2.1)
105+
activesupport (= 5.2.1)
106+
method_source
107+
rake (>= 0.8.7)
108+
thor (>= 0.19.0, < 2.0)
109+
rake (12.3.1)
110+
rb-fsevent (0.10.3)
111+
rb-inotify (0.9.10)
112+
ffi (>= 0.5.0, < 2)
113+
ruby_dep (1.5.0)
114+
spring (2.0.2)
115+
activesupport (>= 4.2)
116+
spring-watcher-listen (2.0.1)
117+
listen (>= 2.7, < 4.0)
118+
spring (>= 1.2, < 3.0)
119+
sprockets (3.7.2)
120+
concurrent-ruby (~> 1.0)
121+
rack (> 1, < 3)
122+
sprockets-rails (3.2.1)
123+
actionpack (>= 4.0)
124+
activesupport (>= 4.0)
125+
sprockets (>= 3.0.0)
126+
thor (0.20.3)
127+
thread_safe (0.3.6)
128+
tzinfo (1.2.5)
129+
thread_safe (~> 0.1)
130+
webpacker (3.5.5)
131+
activesupport (>= 4.2)
132+
rack-proxy (>= 0.6.1)
133+
railties (>= 4.2)
134+
websocket-driver (0.7.0)
135+
websocket-extensions (>= 0.1.0)
136+
websocket-extensions (0.1.3)
137+
138+
PLATFORMS
139+
ruby
140+
141+
DEPENDENCIES
142+
bootsnap (>= 1.1.0)
143+
byebug
144+
listen (>= 3.0.5, < 3.2)
145+
mysql2 (>= 0.4.4, < 0.6.0)
146+
puma (~> 3.11)
147+
rails (~> 5.2.1)
148+
spring
149+
spring-watcher-listen (~> 2.0.0)
150+
tzinfo-data
151+
webpacker
152+
153+
RUBY VERSION
154+
ruby 2.5.1p57
155+
156+
BUNDLED WITH
157+
1.16.4

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# README
2+
3+
This README would normally document whatever steps are necessary to get the
4+
application up and running.
5+
6+
Things you may want to cover:
7+
8+
* Ruby version
9+
10+
* System dependencies
11+
12+
* Configuration
13+
14+
* Database creation
15+
16+
* Database initialization
17+
18+
* How to run the test suite
19+
20+
* Services (job queues, cache servers, search engines, etc.)
21+
22+
* Deployment instructions
23+
24+
* ...

Rakefile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Add your own tasks in files placed in lib/tasks ending in .rake,
2+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3+
4+
require_relative 'config/application'
5+
6+
Rails.application.load_tasks
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ApplicationCable
2+
class Channel < ActionCable::Channel::Base
3+
end
4+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ApplicationCable
2+
class Connection < ActionCable::Connection::Base
3+
end
4+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ApplicationController < ActionController::API
2+
end

app/controllers/concerns/.keep

Whitespace-only changes.

app/javascript/packs/application.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* eslint no-console:0 */
2+
// This file is automatically compiled by Webpack, along with any other files
3+
// present in this directory. You're encouraged to place your actual application logic in
4+
// a relevant structure within app/javascript and only use these pack files to reference
5+
// that code so it'll be compiled.
6+
//
7+
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
8+
// layout file, like app/views/layouts/application.html.erb
9+
10+
console.log('Hello World from Webpacker')

app/javascript/packs/hello_react.jsx

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Run this example by adding <%= javascript_pack_tag 'hello_react' %> to the head of your layout file,
2+
// like app/views/layouts/application.html.erb. All it does is render <div>Hello React</div> at the bottom
3+
// of the page.
4+
5+
import React from 'react'
6+
import ReactDOM from 'react-dom'
7+
import PropTypes from 'prop-types'
8+
9+
const Hello = props => (
10+
<div>Hello {props.name}!</div>
11+
)
12+
13+
Hello.defaultProps = {
14+
name: 'David'
15+
}
16+
17+
Hello.propTypes = {
18+
name: PropTypes.string
19+
}
20+
21+
document.addEventListener('DOMContentLoaded', () => {
22+
ReactDOM.render(
23+
<Hello name="React" />,
24+
document.body.appendChild(document.createElement('div')),
25+
)
26+
})

app/jobs/application_job.rb

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ApplicationJob < ActiveJob::Base
2+
end

app/mailers/application_mailer.rb

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class ApplicationMailer < ActionMailer::Base
2+
default from: '[email protected]'
3+
layout 'mailer'
4+
end

app/models/application_record.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class ApplicationRecord < ActiveRecord::Base
2+
self.abstract_class = true
3+
end

app/models/concerns/.keep

Whitespace-only changes.

app/views/layouts/mailer.html.erb

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5+
<style>
6+
/* Email styles need to be inline */
7+
</style>
8+
</head>
9+
10+
<body>
11+
<%= yield %>
12+
</body>
13+
</html>

app/views/layouts/mailer.text.erb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%= yield %>

bin/bundle

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env ruby
2+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3+
load Gem.bin_path('bundler', 'bundle')

bin/rails

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env ruby
2+
begin
3+
load File.expand_path('../spring', __FILE__)
4+
rescue LoadError => e
5+
raise unless e.message.include?('spring')
6+
end
7+
APP_PATH = File.expand_path('../config/application', __dir__)
8+
require_relative '../config/boot'
9+
require 'rails/commands'

0 commit comments

Comments
 (0)