Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
curso-kubernetes
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jose Ernesto Suarez
curso-kubernetes
Commits
4492d7fa
Commit
4492d7fa
authored
Jun 02, 2019
by
Jose Ernesto Suarez Font
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Añadimos un programita en rails que utiliza secretos para mostrarlos en pantalla
parent
3ffc5d62
Changes
104
Hide whitespace changes
Inline
Side-by-side
Showing
104 changed files
with
1820 additions
and
0 deletions
+1820
-0
cool-app.yaml
app-secrets/cool-app.yaml
+42
-0
.dockerignore
app-secrets/cool-app/.dockerignore
+29
-0
.gitignore
app-secrets/cool-app/.gitignore
+31
-0
.ruby-version
app-secrets/cool-app/.ruby-version
+1
-0
Dockerfile
app-secrets/cool-app/Dockerfile
+27
-0
Gemfile
app-secrets/cool-app/Gemfile
+64
-0
Gemfile.lock
app-secrets/cool-app/Gemfile.lock
+231
-0
README.md
app-secrets/cool-app/README.md
+24
-0
Rakefile
app-secrets/cool-app/Rakefile
+6
-0
manifest.js
app-secrets/cool-app/app/assets/config/manifest.js
+3
-0
.keep
app-secrets/cool-app/app/assets/images/.keep
+0
-0
application.js
app-secrets/cool-app/app/assets/javascripts/application.js
+19
-0
cable.js
app-secrets/cool-app/app/assets/javascripts/cable.js
+13
-0
.keep
app-secrets/cool-app/app/assets/javascripts/channels/.keep
+0
-0
posts.coffee
app-secrets/cool-app/app/assets/javascripts/posts.coffee
+3
-0
application.scss
app-secrets/cool-app/app/assets/stylesheets/application.scss
+16
-0
posts.scss
app-secrets/cool-app/app/assets/stylesheets/posts.scss
+3
-0
scaffolds.scss
app-secrets/cool-app/app/assets/stylesheets/scaffolds.scss
+84
-0
channel.rb
...ecrets/cool-app/app/channels/application_cable/channel.rb
+4
-0
connection.rb
...ets/cool-app/app/channels/application_cable/connection.rb
+4
-0
application_controller.rb
...ecrets/cool-app/app/controllers/application_controller.rb
+2
-0
.keep
app-secrets/cool-app/app/controllers/concerns/.keep
+0
-0
posts_controller.rb
app-secrets/cool-app/app/controllers/posts_controller.rb
+80
-0
application_helper.rb
app-secrets/cool-app/app/helpers/application_helper.rb
+2
-0
posts_helper.rb
app-secrets/cool-app/app/helpers/posts_helper.rb
+2
-0
application_job.rb
app-secrets/cool-app/app/jobs/application_job.rb
+2
-0
application_mailer.rb
app-secrets/cool-app/app/mailers/application_mailer.rb
+4
-0
application_record.rb
app-secrets/cool-app/app/models/application_record.rb
+3
-0
.keep
app-secrets/cool-app/app/models/concerns/.keep
+0
-0
post.rb
app-secrets/cool-app/app/models/post.rb
+2
-0
application.html.erb
app-secrets/cool-app/app/views/layouts/application.html.erb
+17
-0
mailer.html.erb
app-secrets/cool-app/app/views/layouts/mailer.html.erb
+13
-0
mailer.text.erb
app-secrets/cool-app/app/views/layouts/mailer.text.erb
+1
-0
_form.html.erb
app-secrets/cool-app/app/views/posts/_form.html.erb
+33
-0
_post.json.jbuilder
app-secrets/cool-app/app/views/posts/_post.json.jbuilder
+2
-0
edit.html.erb
app-secrets/cool-app/app/views/posts/edit.html.erb
+6
-0
index.html.erb
app-secrets/cool-app/app/views/posts/index.html.erb
+39
-0
index.json.jbuilder
app-secrets/cool-app/app/views/posts/index.json.jbuilder
+1
-0
new.html.erb
app-secrets/cool-app/app/views/posts/new.html.erb
+5
-0
show.html.erb
app-secrets/cool-app/app/views/posts/show.html.erb
+21
-0
show.json.jbuilder
app-secrets/cool-app/app/views/posts/show.json.jbuilder
+1
-0
bundle
app-secrets/cool-app/bin/bundle
+3
-0
rails
app-secrets/cool-app/bin/rails
+9
-0
rake
app-secrets/cool-app/bin/rake
+9
-0
setup
app-secrets/cool-app/bin/setup
+36
-0
spring
app-secrets/cool-app/bin/spring
+17
-0
update
app-secrets/cool-app/bin/update
+31
-0
yarn
app-secrets/cool-app/bin/yarn
+11
-0
config.ru
app-secrets/cool-app/config.ru
+5
-0
application.rb
app-secrets/cool-app/config/application.rb
+25
-0
boot.rb
app-secrets/cool-app/config/boot.rb
+4
-0
cable.yml
app-secrets/cool-app/config/cable.yml
+10
-0
credentials.yml.enc
app-secrets/cool-app/config/credentials.yml.enc
+1
-0
database.yml
app-secrets/cool-app/config/database.yml
+25
-0
environment.rb
app-secrets/cool-app/config/environment.rb
+5
-0
development.rb
app-secrets/cool-app/config/environments/development.rb
+61
-0
production.rb
app-secrets/cool-app/config/environments/production.rb
+94
-0
test.rb
app-secrets/cool-app/config/environments/test.rb
+46
-0
application_controller_renderer.rb
...pp/config/initializers/application_controller_renderer.rb
+8
-0
assets.rb
app-secrets/cool-app/config/initializers/assets.rb
+14
-0
backtrace_silencers.rb
...crets/cool-app/config/initializers/backtrace_silencers.rb
+7
-0
content_security_policy.rb
...s/cool-app/config/initializers/content_security_policy.rb
+25
-0
cookies_serializer.rb
...ecrets/cool-app/config/initializers/cookies_serializer.rb
+5
-0
filter_parameter_logging.rb
.../cool-app/config/initializers/filter_parameter_logging.rb
+4
-0
inflections.rb
app-secrets/cool-app/config/initializers/inflections.rb
+16
-0
mime_types.rb
app-secrets/cool-app/config/initializers/mime_types.rb
+4
-0
wrap_parameters.rb
app-secrets/cool-app/config/initializers/wrap_parameters.rb
+14
-0
en.yml
app-secrets/cool-app/config/locales/en.yml
+33
-0
puma.rb
app-secrets/cool-app/config/puma.rb
+34
-0
routes.rb
app-secrets/cool-app/config/routes.rb
+5
-0
spring.rb
app-secrets/cool-app/config/spring.rb
+6
-0
storage.yml
app-secrets/cool-app/config/storage.yml
+34
-0
20190601154705_create_posts.rb
...ecrets/cool-app/db/migrate/20190601154705_create_posts.rb
+11
-0
schema.rb
app-secrets/cool-app/db/schema.rb
+23
-0
seeds.rb
app-secrets/cool-app/db/seeds.rb
+7
-0
.keep
app-secrets/cool-app/lib/assets/.keep
+0
-0
.keep
app-secrets/cool-app/lib/tasks/.keep
+0
-0
.keep
app-secrets/cool-app/log/.keep
+0
-0
package.json
app-secrets/cool-app/package.json
+5
-0
404.html
app-secrets/cool-app/public/404.html
+67
-0
422.html
app-secrets/cool-app/public/422.html
+67
-0
500.html
app-secrets/cool-app/public/500.html
+66
-0
apple-touch-icon-precomposed.png
app-secrets/cool-app/public/apple-touch-icon-precomposed.png
+0
-0
apple-touch-icon.png
app-secrets/cool-app/public/apple-touch-icon.png
+0
-0
favicon.ico
app-secrets/cool-app/public/favicon.ico
+0
-0
robots.txt
app-secrets/cool-app/public/robots.txt
+1
-0
.keep
app-secrets/cool-app/storage/.keep
+0
-0
application_system_test_case.rb
app-secrets/cool-app/test/application_system_test_case.rb
+5
-0
.keep
app-secrets/cool-app/test/controllers/.keep
+0
-0
posts_controller_test.rb
...ecrets/cool-app/test/controllers/posts_controller_test.rb
+48
-0
.keep
app-secrets/cool-app/test/fixtures/.keep
+0
-0
.keep
app-secrets/cool-app/test/fixtures/files/.keep
+0
-0
posts.yml
app-secrets/cool-app/test/fixtures/posts.yml
+11
-0
.keep
app-secrets/cool-app/test/helpers/.keep
+0
-0
.keep
app-secrets/cool-app/test/integration/.keep
+0
-0
.keep
app-secrets/cool-app/test/mailers/.keep
+0
-0
.keep
app-secrets/cool-app/test/models/.keep
+0
-0
post_test.rb
app-secrets/cool-app/test/models/post_test.rb
+7
-0
.keep
app-secrets/cool-app/test/system/.keep
+0
-0
posts_test.rb
app-secrets/cool-app/test/system/posts_test.rb
+47
-0
test_helper.rb
app-secrets/cool-app/test/test_helper.rb
+10
-0
.keep
app-secrets/cool-app/tmp/.keep
+0
-0
.keep
app-secrets/cool-app/vendor/.keep
+0
-0
yarn.lock
app-secrets/cool-app/yarn.lock
+4
-0
No files found.
app-secrets/cool-app.yaml
0 → 100644
View file @
4492d7fa
apiVersion
:
extensions/v1beta1
kind
:
Deployment
metadata
:
name
:
cool-app
spec
:
replicas
:
1
template
:
metadata
:
labels
:
app
:
rails
spec
:
containers
:
-
name
:
demo
image
:
eu.gcr.io/wdps-prj-terraform-e8b60c97/cool-app:v.1
ports
:
-
containerPort
:
3000
name
:
rails-port
env
:
-
name
:
USUARIO
valueFrom
:
secretKeyRef
:
name
:
user-pass
key
:
username
-
name
:
PASSWORD
valueFrom
:
secretKeyRef
:
name
:
user-pass
key
:
password
---
apiVersion
:
v1
kind
:
Service
metadata
:
name
:
cool-app
spec
:
type
:
LoadBalancer
selector
:
app
:
rails
ports
:
-
protocol
:
TCP
port
:
80
targetPort
:
rails-port
\ No newline at end of file
app-secrets/cool-app/.dockerignore
0 → 100644
View file @
4492d7fa
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
/public/packs/*
!/log/.keep
!/tmp/.keep
.DS_Store
.idea
.env.development
.env.staging
# Ignore node_modules
/node_modules/*
# Ignore bundler config.
/.bundle
# Ignore the tags file used by VIM
tags
# Ignore Byebug command history file.
.byebug_history
# Ignore .git as it's not needed with the docker built.
.git
.cache
# Ignore sqlite dabases
/db/*.sqlite3
\ No newline at end of file
app-secrets/cool-app/.gitignore
0 → 100644
View file @
4492d7fa
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
# Ignore uploaded files in development
/storage/*
!/storage/.keep
/node_modules
/yarn-error.log
/public/assets
.byebug_history
# Ignore master key for decrypting credentials and more.
/config/master.key
app-secrets/cool-app/.ruby-version
0 → 100644
View file @
4492d7fa
ruby-2.6.2
\ No newline at end of file
app-secrets/cool-app/Dockerfile
0 → 100644
View file @
4492d7fa
FROM
ruby:2.6.2
RUN
rm
/bin/sh
&&
ln
-s
/bin/bash /bin/sh
RUN
apt-get update
-qq
&&
apt-get
install
-y
build-essential libpq-dev nodejs ghostscript
RUN
mkdir
-p
/app
RUN
mkdir
-p
/usr/local/nvm
WORKDIR
/app
RUN
curl
-sL
https://deb.nodesource.com/setup_11.x | bash -
RUN
apt-get
install
-y
nodejs
RUN
node
-v
RUN
npm
-v
COPY
Gemfile Gemfile.lock package.json ./
RUN
gem
install
bundler
-v
1.17.2
RUN
bundle
install
--verbose
--jobs
20
--retry
5
RUN
npm
install
-g
yarn
COPY
. ./
RUN
rake db:migrate
EXPOSE
3000
CMD
["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
app-secrets/cool-app/Gemfile
0 → 100644
View file @
4492d7fa
source
'https://rubygems.org'
git_source
(
:github
)
{
|
repo
|
"https://github.com/
#{
repo
}
.git"
}
ruby
'2.6.2'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem
'rails'
,
'~> 5.2.3'
# Use sqlite3 as the database for Active Record
gem
'sqlite3'
# Use Puma as the app server
gem
'puma'
,
'~> 3.11'
# Use SCSS for stylesheets
gem
'sass-rails'
,
'~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem
'uglifier'
,
'>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby
# Use CoffeeScript for .coffee assets and views
gem
'coffee-rails'
,
'~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem
'turbolinks'
,
'~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem
'jbuilder'
,
'~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem
'bootstrap'
,
'~>4.0.0'
gem
'jquery-rails'
,
'~>4.3.3'
# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Reduces boot times through caching; required in config/boot.rb
gem
'bootsnap'
,
'>= 1.1.0'
,
require:
false
group
:development
,
:test
do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem
'byebug'
,
platforms:
[
:mri
,
:mingw
,
:x64_mingw
]
end
group
:development
do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem
'web-console'
,
'>= 3.3.0'
gem
'listen'
,
'>= 3.0.5'
,
'< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem
'spring'
gem
'spring-watcher-listen'
,
'~> 2.0.0'
end
group
:test
do
# Adds support for Capybara system testing and selenium driver
gem
'capybara'
,
'>= 2.15'
gem
'selenium-webdriver'
# Easy installation and use of chromedriver to run system tests with Chrome
gem
'chromedriver-helper'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem
'tzinfo-data'
,
platforms:
[
:mingw
,
:mswin
,
:x64_mingw
,
:jruby
]
app-secrets/cool-app/Gemfile.lock
0 → 100644
View file @
4492d7fa
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.3)
actionpack (= 5.2.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.3)
actionview (= 5.2.3)
activesupport (= 5.2.3)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.3)
activesupport (= 5.2.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.3)
activesupport (= 5.2.3)
globalid (>= 0.3.6)
activemodel (5.2.3)
activesupport (= 5.2.3)
activerecord (5.2.3)
activemodel (= 5.2.3)
activesupport (= 5.2.3)
arel (>= 9.0)
activestorage (5.2.3)
actionpack (= 5.2.3)
activerecord (= 5.2.3)
marcel (~> 0.3.1)
activesupport (5.2.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
archive-zip (0.12.0)
io-like (~> 0.3.0)
arel (9.0.0)
autoprefixer-rails (9.5.1.1)
execjs
bindex (0.7.0)
bootsnap (1.4.4)
msgpack (~> 1.0)
bootstrap (4.0.0)
autoprefixer-rails (>= 6.0.3)
popper_js (>= 1.12.9, < 2)
sass (>= 3.5.2)
builder (3.2.3)
byebug (11.0.1)
capybara (3.22.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.5)
xpath (~> 3.2)
childprocess (1.0.1)
rake (< 13.0)
chromedriver-helper (2.1.1)
archive-zip (~> 0.10)
nokogiri (~> 1.8)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.5)
crass (1.0.4)
erubi (1.8.0)
execjs (2.7.0)
ffi (1.11.1)
globalid (0.4.2)
activesupport (>= 4.2.0)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
io-like (0.3.0)
jbuilder (2.9.1)
activesupport (>= 4.2.0)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.2)
mimemagic (0.3.3)
mini_mime (1.0.1)
mini_portile2 (2.4.0)
minitest (5.11.3)
msgpack (1.2.10)
nio4r (2.3.1)
nokogiri (1.10.3)
mini_portile2 (~> 2.4.0)
popper_js (1.14.5)
public_suffix (3.1.0)
puma (3.12.1)
rack (2.0.7)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.3)
actioncable (= 5.2.3)
actionmailer (= 5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
activemodel (= 5.2.3)
activerecord (= 5.2.3)
activestorage (= 5.2.3)
activesupport (= 5.2.3)
bundler (>= 1.3.0)
railties (= 5.2.3)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.2.3)
actionpack (= 5.2.3)
activesupport (= 5.2.3)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rake (12.3.2)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
regexp_parser (1.5.1)
ruby_dep (1.5.0)
rubyzip (1.2.3)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selenium-webdriver (3.142.3)
childprocess (>= 0.5, < 2.0)
rubyzip (~> 1.2, >= 1.2.2)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.4.1)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.9)
turbolinks (5.2.0)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
xpath (3.2.0)
nokogiri (~> 1.8)
PLATFORMS
ruby
DEPENDENCIES
bootsnap (>= 1.1.0)
bootstrap (~> 4.0.0)
byebug
capybara (>= 2.15)
chromedriver-helper
coffee-rails (~> 4.2)
jbuilder (~> 2.5)
jquery-rails (~> 4.3.3)
listen (>= 3.0.5, < 3.2)
puma (~> 3.11)
rails (~> 5.2.3)
sass-rails (~> 5.0)
selenium-webdriver
spring
spring-watcher-listen (~> 2.0.0)
sqlite3
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
web-console (>= 3.3.0)
RUBY VERSION
ruby 2.6.2p47
BUNDLED WITH
1.17.2
app-secrets/cool-app/README.md
0 → 100644
View file @
4492d7fa
# README
This README would normally document whatever steps are necessary to get the
application up and running.
Things you may want to cover:
*
Ruby version
*
System dependencies
*
Configuration
*
Database creation
*
Database initialization
*
How to run the test suite
*
Services (job queues, cache servers, search engines, etc.)
*
Deployment instructions
*
...
app-secrets/cool-app/Rakefile
0 → 100644
View file @
4492d7fa
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require_relative
'config/application'
Rails
.
application
.
load_tasks
app-secrets/cool-app/app/assets/config/manifest.js
0 → 100644
View file @
4492d7fa
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
app-secrets/cool-app/app/assets/images/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/app/assets/javascripts/application.js
0 → 100644
View file @
4492d7fa
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
// vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require rails-ujs
//= require activestorage
//= require turbolinks
//= require_tree .
//= require jquery3
//= require popper
//= require bootstrap-sprockets
\ No newline at end of file
app-secrets/cool-app/app/assets/javascripts/cable.js
0 → 100644
View file @
4492d7fa
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
//
//= require action_cable
//= require_self
//= require_tree ./channels
(
function
()
{
this
.
App
||
(
this
.
App
=
{});
App
.
cable
=
ActionCable
.
createConsumer
();
}).
call
(
this
);
app-secrets/cool-app/app/assets/javascripts/channels/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/app/assets/javascripts/posts.coffee
0 → 100644
View file @
4492d7fa
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
app-secrets/cool-app/app/assets/stylesheets/application.scss
0 → 100644
View file @
4492d7fa
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
* vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*/
@import
"bootstrap"
;
\ No newline at end of file
app-secrets/cool-app/app/assets/stylesheets/posts.scss
0 → 100644
View file @
4492d7fa
// Place all the styles related to the posts controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
app-secrets/cool-app/app/assets/stylesheets/scaffolds.scss
0 → 100644
View file @
4492d7fa
body
{
background-color
:
#fff
;
color
:
#333
;
margin
:
33px
;
font-family
:
verdana
,
arial
,
helvetica
,
sans-serif
;
font-size
:
13px
;
line-height
:
18px
;
}
p
,
ol
,
ul
,
td
{
font-family
:
verdana
,
arial
,
helvetica
,
sans-serif
;
font-size
:
13px
;
line-height
:
18px
;
}
pre
{
background-color
:
#eee
;
padding
:
10px
;
font-size
:
11px
;
}
a
{
color
:
#000
;
&
:visited
{
color
:
#666
;
}
&
:hover
{
color
:
#fff
;
background-color
:
#000
;
}
}
th
{
padding-bottom
:
5px
;
}
td
{
padding
:
0
5px
7px
;
}
div
{
&
.field
,
&
.actions
{
margin-bottom
:
10px
;
}
}
#notice
{
color
:
green
;
}
.field_with_errors
{
padding
:
2px
;
background-color
:
red
;
display
:
table
;
}
#error_explanation
{
width
:
450px
;
border
:
2px
solid
red
;
padding
:
7px
7px
0
;
margin-bottom
:
20px
;
background-color
:
#f0f0f0
;
h2
{
text-align
:
left
;
font-weight
:
bold
;
padding
:
5px
5px
5px
15px
;
font-size
:
12px
;
margin
:
-7px
-7px
0
;
background-color
:
#c00
;
color
:
#fff
;
}
ul
li
{
font-size
:
12px
;
list-style
:
square
;
}
}
label
{
display
:
block
;
}
app-secrets/cool-app/app/channels/application_cable/channel.rb
0 → 100644
View file @
4492d7fa
module
ApplicationCable
class
Channel
<
ActionCable
::
Channel
::
Base
end
end
app-secrets/cool-app/app/channels/application_cable/connection.rb
0 → 100644
View file @
4492d7fa
module
ApplicationCable
class
Connection
<
ActionCable
::
Connection
::
Base
end
end
app-secrets/cool-app/app/controllers/application_controller.rb
0 → 100644
View file @
4492d7fa
class
ApplicationController
<
ActionController
::
Base
end
app-secrets/cool-app/app/controllers/concerns/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/app/controllers/posts_controller.rb
0 → 100644
View file @
4492d7fa
class
PostsController
<
ApplicationController
before_action
:set_post
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
# GET /posts
# GET /posts.json
def
index
@posts
=
Post
.
all
@username
=
CoolApp
::
Application
::
MY_USERNAME
@password
=
CoolApp
::
Application
::
MY_PASSWORD
@alert
=
"alert-danger"
@alert
=
"alert-success"
unless
@username
==
@password
end
# GET /posts/1
# GET /posts/1.json
def
show
end
# GET /posts/new
def
new
@post
=
Post
.
new
end
# GET /posts/1/edit
def
edit
end
# POST /posts
# POST /posts.json
def
create
@post
=
Post
.
new
(
post_params
)
respond_to
do
|
format
|
if
@post
.
save
format
.
html
{
redirect_to
@post
,
notice:
'Post was successfully created.'
}
format
.
json
{
render
:show
,
status: :created
,
location:
@post
}
else
format
.
html
{
render
:new
}
format
.
json
{
render
json:
@post
.
errors
,
status: :unprocessable_entity
}
end
end
end
# PATCH/PUT /posts/1
# PATCH/PUT /posts/1.json
def
update
respond_to
do
|
format
|
if
@post
.
update
(
post_params
)
format
.
html
{
redirect_to
@post
,
notice:
'Post was successfully updated.'
}
format
.
json
{
render
:show
,
status: :ok
,
location:
@post
}
else
format
.
html
{
render
:edit
}
format
.
json
{
render
json:
@post
.
errors
,
status: :unprocessable_entity
}
end
end
end
# DELETE /posts/1
# DELETE /posts/1.json
def
destroy
@post
.
destroy
respond_to
do
|
format
|
format
.
html
{
redirect_to
posts_url
,
notice:
'Post was successfully destroyed.'
}
format
.
json
{
head
:no_content
}
end
end
private
# Use callbacks to share common setup or constraints between actions.
def
set_post
@post
=
Post
.
find
(
params
[
:id
])
end
# Never trust parameters from the scary internet, only allow the white list through.
def
post_params
params
.
require
(
:post
).
permit
(
:title
,
:body
,
:published
)
end
end
app-secrets/cool-app/app/helpers/application_helper.rb
0 → 100644
View file @
4492d7fa
module
ApplicationHelper
end
app-secrets/cool-app/app/helpers/posts_helper.rb
0 → 100644
View file @
4492d7fa
module
PostsHelper
end
app-secrets/cool-app/app/jobs/application_job.rb
0 → 100644
View file @
4492d7fa
class
ApplicationJob
<
ActiveJob
::
Base
end
app-secrets/cool-app/app/mailers/application_mailer.rb
0 → 100644
View file @
4492d7fa
class
ApplicationMailer
<
ActionMailer
::
Base
default
from:
'from@example.com'
layout
'mailer'
end
app-secrets/cool-app/app/models/application_record.rb
0 → 100644
View file @
4492d7fa
class
ApplicationRecord
<
ActiveRecord
::
Base
self
.
abstract_class
=
true
end
app-secrets/cool-app/app/models/concerns/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/app/models/post.rb
0 → 100644
View file @
4492d7fa
class
Post
<
ApplicationRecord
end
app-secrets/cool-app/app/views/layouts/application.html.erb
0 → 100644
View file @
4492d7fa
<!DOCTYPE html>
<html>
<head>
<title>
CoolApp
</title>
<%=
csrf_meta_tags
%>
<%=
csp_meta_tag
%>
<%=
stylesheet_link_tag
'application'
,
media:
'all'
,
'data-turbolinks-track'
:
'reload'
%>
<%=
javascript_include_tag
'application'
,
'data-turbolinks-track'
:
'reload'
%>
</head>
<body>
<div
class=
"container-fluid"
>
<%=
yield
%>
</div>
</body>
</html>
app-secrets/cool-app/app/views/layouts/mailer.html.erb
0 → 100644
View file @
4492d7fa
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<style>
/* Email styles need to be inline */
</style>
</head>
<body>
<%=
yield
%>
</body>
</html>
app-secrets/cool-app/app/views/layouts/mailer.text.erb
0 → 100644
View file @
4492d7fa
<%=
yield
%>
app-secrets/cool-app/app/views/posts/_form.html.erb
0 → 100644
View file @
4492d7fa
<%=
form_with
(
model:
post
,
local:
true
)
do
|
form
|
%>
<%
if
post
.
errors
.
any?
%>
<div
id=
"error_explanation"
>
<h2>
<%=
pluralize
(
post
.
errors
.
count
,
"error"
)
%>
prohibited this post from being saved:
</h2>
<ul>
<%
post
.
errors
.
full_messages
.
each
do
|
message
|
%>
<li>
<%=
message
%>
</li>
<%
end
%>
</ul>
</div>
<%
end
%>
<div
class=
"form-group"
>
<div
class=
"field form-control"
>
<%=
form
.
label
:title
,
:class
=>
'col-form-label'
%>
<%=
form
.
text_field
:title
,
:class
=>
"form-control-plaintext"
%>
</div>
<div
class=
"field form-control"
>
<%=
form
.
label
:body
,
:class
=>
'col-form-label'
%>
<%=
form
.
text_area
:body
,
:class
=>
"form-control-plaintext"
%>
</div>
<div
class=
"field form-control"
>
<%=
form
.
label
:published
,
:class
=>
'col-form-label'
%>
<%=
form
.
check_box
:published
%>
</div>
<div
class=
"actions form-control"
>
<%=
form
.
submit
"Submit"
,
class:
'btn btn-success'
%>
</div>
</div>
<%
end
%>
app-secrets/cool-app/app/views/posts/_post.json.jbuilder
0 → 100644
View file @
4492d7fa
json.extract! post, :id, :title, :body, :published, :created_at, :updated_at
json.url post_url(post, format: :json)
app-secrets/cool-app/app/views/posts/edit.html.erb
0 → 100644
View file @
4492d7fa
<h1>
Editing Post
</h1>
<div
class=
"col-md-4"
>
<%=
render
'form'
,
post:
@post
%>
</div>
<%=
link_to
'Show'
,
@post
,
:class
=>
'btn btn-md btn-primary'
%>
<%=
link_to
'Back'
,
posts_path
,
:class
=>
'btn btn-md btn-secondary'
%>
app-secrets/cool-app/app/views/posts/index.html.erb
0 → 100644
View file @
4492d7fa
<p
id=
"notice"
>
<%=
notice
%>
</p>
<div
class=
"col col-lg-8"
>
<article
class=
"alert
<%=
@alert
%>
"
role=
"alert"
>
<h3>
Username:
<%=
@username
%>
</h3>
<h3>
Password:
<%=
@password
%>
</h3>
</article>
<h1>
Bienvenido
</h1>
<hr/>
<table
class=
"table table-striped table-borderless table-hover"
>
<thead
class=
"thead-dark"
>
<tr>
<th
scope=
"col"
>
Title
</th>
<th
scope=
"col"
>
Body
</th>
<th
scope=
"col"
>
Published
</th>
<th
scope=
"col"
>
Actions
</th>
</tr>
</thead>
<tbody>
<%
@posts
.
each
do
|
post
|
%>
<tr>
<td
scope=
"col"
>
<%=
post
.
title
%>
</td>
<td
scope=
"col"
>
<%=
post
.
body
%>
</td>
<td
scope=
"col"
>
<%=
post
.
published
%>
</td>
<td
scope=
"col"
>
<%=
link_to
'Show'
,
post
,
:class
=>
'btn btn-sm btn-primary'
%>
<%=
link_to
'Edit'
,
edit_post_path
(
post
),
:class
=>
'btn btn-sm btn-primary'
%>
<%=
link_to
'Destroy'
,
post
,
method: :delete
,
data:
{
confirm:
'Are you sure?'
}
,
:class
=>
'btn btn-sm btn-danger'
%>
</td>
</tr>
<%
end
%>
</tbody>
</table>
<br>
<%=
link_to
'New Post'
,
new_post_path
,
class:
'btn btn-dark'
%>
</div>
\ No newline at end of file
app-secrets/cool-app/app/views/posts/index.json.jbuilder
0 → 100644
View file @
4492d7fa
json.array! @posts, partial: "posts/post", as: :post
app-secrets/cool-app/app/views/posts/new.html.erb
0 → 100644
View file @
4492d7fa
<h1>
New Post
</h1>
<div
class=
"col-md-4"
>
<%=
render
'form'
,
post:
@post
%>
</div>
<%=
link_to
'Back'
,
posts_path
,
:class
=>
'btn btn-sm btn-secondary'
%>
app-secrets/cool-app/app/views/posts/show.html.erb
0 → 100644
View file @
4492d7fa
<div
class=
"col col-lg-4"
>
<p
id=
"notice"
>
<%=
notice
%>
</p>
<h1>
Post info
</h1>
<p
class=
"lead"
>
<strong>
Title:
</strong>
<%=
@post
.
title
%>
</p>
<p
class=
"lead"
>
<strong>
Body:
</strong>
<%=
@post
.
body
%>
</p>
<p
class=
"lead"
>
<strong>
Published:
</strong>
<%=
@post
.
published
%>
</p>
<hr/>
<%=
link_to
'Edit'
,
edit_post_path
(
@post
),
:class
=>
'btn btn-md btn-primary'
%>
<%=
link_to
'Back'
,
posts_path
,
:class
=>
'btn btn-md btn-secondary'
%>
</div>
\ No newline at end of file
app-secrets/cool-app/app/views/posts/show.json.jbuilder
0 → 100644
View file @
4492d7fa
json.partial! "posts/post", post: @post
app-secrets/cool-app/bin/bundle
0 → 100755
View file @
4492d7fa
#!/usr/bin/env ruby
ENV
[
'BUNDLE_GEMFILE'
]
||=
File
.
expand_path
(
'../Gemfile'
,
__dir__
)
load
Gem
.
bin_path
(
'bundler'
,
'bundle'
)
app-secrets/cool-app/bin/rails
0 → 100755
View file @
4492d7fa
#!/usr/bin/env ruby
begin
load
File
.
expand_path
(
'../spring'
,
__FILE__
)
rescue
LoadError
=>
e
raise
unless
e
.
message
.
include?
(
'spring'
)
end
APP_PATH
=
File
.
expand_path
(
'../config/application'
,
__dir__
)
require_relative
'../config/boot'
require
'rails/commands'
app-secrets/cool-app/bin/rake
0 → 100755
View file @
4492d7fa
#!/usr/bin/env ruby
begin
load
File
.
expand_path
(
'../spring'
,
__FILE__
)
rescue
LoadError
=>
e
raise
unless
e
.
message
.
include?
(
'spring'
)
end
require_relative
'../config/boot'
require
'rake'
Rake
.
application
.
run
app-secrets/cool-app/bin/setup
0 → 100755
View file @
4492d7fa
#!/usr/bin/env ruby
require
'fileutils'
include
FileUtils
# path to your application root.
APP_ROOT
=
File
.
expand_path
(
'..'
,
__dir__
)
def
system!
(
*
args
)
system
(
*
args
)
||
abort
(
"
\n
== Command
#{
args
}
failed =="
)
end
chdir
APP_ROOT
do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file.
puts
'== Installing dependencies =='
system
!
'gem install bundler --conservative'
system
(
'bundle check'
)
||
system
!
(
'bundle install'
)
# Install JavaScript dependencies if using Yarn
# system('bin/yarn')
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml'
# end
puts
"
\n
== Preparing database =="
system
!
'bin/rails db:setup'
puts
"
\n
== Removing old logs and tempfiles =="
system
!
'bin/rails log:clear tmp:clear'
puts
"
\n
== Restarting application server =="
system
!
'bin/rails restart'
end
app-secrets/cool-app/bin/spring
0 → 100755
View file @
4492d7fa
#!/usr/bin/env ruby
# This file loads spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.
unless
defined?
(
Spring
)
require
'rubygems'
require
'bundler'
lockfile
=
Bundler
::
LockfileParser
.
new
(
Bundler
.
default_lockfile
.
read
)
spring
=
lockfile
.
specs
.
detect
{
|
spec
|
spec
.
name
==
"spring"
}
if
spring
Gem
.
use_paths
Gem
.
dir
,
Bundler
.
bundle_path
.
to_s
,
*
Gem
.
path
gem
'spring'
,
spring
.
version
require
'spring/binstub'
end
end
app-secrets/cool-app/bin/update
0 → 100755
View file @
4492d7fa
#!/usr/bin/env ruby
require
'fileutils'
include
FileUtils
# path to your application root.
APP_ROOT
=
File
.
expand_path
(
'..'
,
__dir__
)
def
system!
(
*
args
)
system
(
*
args
)
||
abort
(
"
\n
== Command
#{
args
}
failed =="
)
end
chdir
APP_ROOT
do
# This script is a way to update your development environment automatically.
# Add necessary update steps to this file.
puts
'== Installing dependencies =='
system
!
'gem install bundler --conservative'
system
(
'bundle check'
)
||
system
!
(
'bundle install'
)
# Install JavaScript dependencies if using Yarn
# system('bin/yarn')
puts
"
\n
== Updating database =="
system
!
'bin/rails db:migrate'
puts
"
\n
== Removing old logs and tempfiles =="
system
!
'bin/rails log:clear tmp:clear'
puts
"
\n
== Restarting application server =="
system
!
'bin/rails restart'
end
app-secrets/cool-app/bin/yarn
0 → 100755
View file @
4492d7fa
#!/usr/bin/env ruby
APP_ROOT
=
File
.
expand_path
(
'..'
,
__dir__
)
Dir
.
chdir
(
APP_ROOT
)
do
begin
exec
"yarnpkg"
,
*
ARGV
rescue
Errno
::
ENOENT
$stderr
.
puts
"Yarn executable was not detected in the system."
$stderr
.
puts
"Download Yarn at https://yarnpkg.com/en/docs/install"
exit
1
end
end
app-secrets/cool-app/config.ru
0 → 100644
View file @
4492d7fa
# This file is used by Rack-based servers to start the application.
require_relative
'config/environment'
run
Rails
.
application
app-secrets/cool-app/config/application.rb
0 → 100644
View file @
4492d7fa
require_relative
'boot'
require
'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler
.
require
(
*
Rails
.
groups
)
module
CoolApp
class
Application
<
Rails
::
Application
# Initialize configuration defaults for originally generated Rails version.
config
.
load_defaults
5.2
logger
=
ActiveSupport
::
Logger
.
new
(
STDOUT
)
logger
.
formatter
=
config
.
log_formatter
config
.
log_tags
=
[
:subdomain
,
:uuid
]
config
.
logger
=
ActiveSupport
::
TaggedLogging
.
new
(
logger
)
MY_USERNAME
=
ENV
[
'USUARIO'
]
||
"Unknown"
MY_PASSWORD
=
ENV
[
'PASSWORD'
]
||
"Unknown"
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
end
end
app-secrets/cool-app/config/boot.rb
0 → 100644
View file @
4492d7fa
ENV
[
'BUNDLE_GEMFILE'
]
||=
File
.
expand_path
(
'../Gemfile'
,
__dir__
)
require
'bundler/setup'
# Set up gems listed in the Gemfile.
require
'bootsnap/setup'
# Speed up boot time by caching expensive operations.
app-secrets/cool-app/config/cable.yml
0 → 100644
View file @
4492d7fa
development
:
adapter
:
async
test
:
adapter
:
async
production
:
adapter
:
redis
url
:
<%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
channel_prefix
:
cool-app_production
app-secrets/cool-app/config/credentials.yml.enc
0 → 100644
View file @
4492d7fa
wLd5w5DNgSWpVmJFK1a+t+QCMNuQ9XqaEIhbgsFbms5ojRdqYOl9MCSGXOVqYR/gyfLYzeHu8XI7OUSKRV1wXmAd1eubtTDy9GYRbu0i1kkeGjdX2O4LNQ0HePy0XTWFTllRYvheQ4qelZ1mvviYbl83zl9NptwjR72Oc7+M+fMzI1rR6nbLfi6mGB5E4vR4OEZZIwj3K/VLLYGriaSJjgPuUzmR3zNSyFbQHe01pNBOAJ0c1dkn/5w+13o9d/KE7YJjmHUEgQr++8zDGIgMWYBdAZwE+xM/Hk3+uMfPD/NAg6l/JOg0tOoME6SVKWo6kY7s2YCkpSlRbG7w3gywpzNIaZXFj1wqpjYiENJNWNJnWfBr5hdX+f9BFGsDhywHHUs/oYUc+Jp0evRL3V9JgPIX0FRt8zo4KFT8--2FON4QWgp1S+Os+J--p6le2FoOgWHMRcmEqgR+SA==
\ No newline at end of file
app-secrets/cool-app/config/database.yml
0 → 100644
View file @
4492d7fa
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default
:
&default
adapter
:
sqlite3
pool
:
<%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout
:
5000
development
:
<<
:
*default
database
:
db/development.sqlite3
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test
:
<<
:
*default
database
:
db/test.sqlite3
production
:
<<
:
*default
database
:
db/production.sqlite3
app-secrets/cool-app/config/environment.rb
0 → 100644
View file @
4492d7fa
# Load the Rails application.
require_relative
'application'
# Initialize the Rails application.
Rails
.
application
.
initialize!
app-secrets/cool-app/config/environments/development.rb
0 → 100644
View file @
4492d7fa
Rails
.
application
.
configure
do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config
.
cache_classes
=
false
# Do not eager load code on boot.
config
.
eager_load
=
false
# Show full error reports.
config
.
consider_all_requests_local
=
true
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if
Rails
.
root
.
join
(
'tmp'
,
'caching-dev.txt'
).
exist?
config
.
action_controller
.
perform_caching
=
true
config
.
cache_store
=
:memory_store
config
.
public_file_server
.
headers
=
{
'Cache-Control'
=>
"public, max-age=
#{
2
.
days
.
to_i
}
"
}
else
config
.
action_controller
.
perform_caching
=
false
config
.
cache_store
=
:null_store
end
# Store uploaded files on the local file system (see config/storage.yml for options)
config
.
active_storage
.
service
=
:local
# Don't care if the mailer can't send.
config
.
action_mailer
.
raise_delivery_errors
=
false
config
.
action_mailer
.
perform_caching
=
false
# Print deprecation notices to the Rails logger.
config
.
active_support
.
deprecation
=
:log
# Raise an error on page load if there are pending migrations.
config
.
active_record
.
migration_error
=
:page_load
# Highlight code that triggered database queries in logs.
config
.
active_record
.
verbose_query_logs
=
true
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config
.
assets
.
debug
=
true
# Suppress logger output for asset requests.
config
.
assets
.
quiet
=
true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config
.
file_watcher
=
ActiveSupport
::
EventedFileUpdateChecker
end
app-secrets/cool-app/config/environments/production.rb
0 → 100644
View file @
4492d7fa
Rails
.
application
.
configure
do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config
.
cache_classes
=
true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config
.
eager_load
=
true
# Full error reports are disabled and caching is turned on.
config
.
consider_all_requests_local
=
false
config
.
action_controller
.
perform_caching
=
true
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config
.
public_file_server
.
enabled
=
ENV
[
'RAILS_SERVE_STATIC_FILES'
].
present?
# Compress JavaScripts and CSS.
config
.
assets
.
js_compressor
=
:uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config
.
assets
.
compile
=
false
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Store uploaded files on the local file system (see config/storage.yml for options)
config
.
active_storage
.
service
=
:local
# Mount Action Cable outside main process or domain
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config
.
log_level
=
:debug
# Prepend all log lines with the following tags.
config
.
log_tags
=
[
:request_id
]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment)
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "cool-app_#{Rails.env}"
config
.
action_mailer
.
perform_caching
=
false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config
.
i18n
.
fallbacks
=
true
# Send deprecation notices to registered listeners.
config
.
active_support
.
deprecation
=
:notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config
.
log_formatter
=
::
Logger
::
Formatter
.
new
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if
ENV
[
"RAILS_LOG_TO_STDOUT"
].
present?
logger
=
ActiveSupport
::
Logger
.
new
(
STDOUT
)
logger
.
formatter
=
config
.
log_formatter
config
.
logger
=
ActiveSupport
::
TaggedLogging
.
new
(
logger
)
end
# Do not dump schema after migrations.
config
.
active_record
.
dump_schema_after_migration
=
false
end
app-secrets/cool-app/config/environments/test.rb
0 → 100644
View file @
4492d7fa
Rails
.
application
.
configure
do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config
.
cache_classes
=
true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config
.
eager_load
=
false
# Configure public file server for tests with Cache-Control for performance.
config
.
public_file_server
.
enabled
=
true
config
.
public_file_server
.
headers
=
{
'Cache-Control'
=>
"public, max-age=
#{
1
.
hour
.
to_i
}
"
}
# Show full error reports and disable caching.
config
.
consider_all_requests_local
=
true
config
.
action_controller
.
perform_caching
=
false
# Raise exceptions instead of rendering exception templates.
config
.
action_dispatch
.
show_exceptions
=
false
# Disable request forgery protection in test environment.
config
.
action_controller
.
allow_forgery_protection
=
false
# Store uploaded files on the local file system in a temporary directory
config
.
active_storage
.
service
=
:test
config
.
action_mailer
.
perform_caching
=
false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config
.
action_mailer
.
delivery_method
=
:test
# Print deprecation notices to the stderr.
config
.
active_support
.
deprecation
=
:stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
app-secrets/cool-app/config/initializers/application_controller_renderer.rb
0 → 100644
View file @
4492d7fa
# Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
app-secrets/cool-app/config/initializers/assets.rb
0 → 100644
View file @
4492d7fa
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails
.
application
.
config
.
assets
.
version
=
'1.0'
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules folder to the asset load path.
Rails
.
application
.
config
.
assets
.
paths
<<
Rails
.
root
.
join
(
'node_modules'
)
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
app-secrets/cool-app/config/initializers/backtrace_silencers.rb
0 → 100644
View file @
4492d7fa
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
app-secrets/cool-app/config/initializers/content_security_policy.rb
0 → 100644
View file @
4492d7fa
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
# If you are using UJS then enable automatic nonce generation
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
# Report CSP violations to a specified URI
# For further information see the following documentation:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
# Rails.application.config.content_security_policy_report_only = true
app-secrets/cool-app/config/initializers/cookies_serializer.rb
0 → 100644
View file @
4492d7fa
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails
.
application
.
config
.
action_dispatch
.
cookies_serializer
=
:json
app-secrets/cool-app/config/initializers/filter_parameter_logging.rb
0 → 100644
View file @
4492d7fa
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails
.
application
.
config
.
filter_parameters
+=
[
:password
]
app-secrets/cool-app/config/initializers/inflections.rb
0 → 100644
View file @
4492d7fa
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
app-secrets/cool-app/config/initializers/mime_types.rb
0 → 100644
View file @
4492d7fa
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
app-secrets/cool-app/config/initializers/wrap_parameters.rb
0 → 100644
View file @
4492d7fa
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport
.
on_load
(
:action_controller
)
do
wrap_parameters
format:
[
:json
]
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# end
app-secrets/cool-app/config/locales/en.yml
0 → 100644
View file @
4492d7fa
# Files in the config/locales directory are used for internationalization
# and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t 'hello'
#
# In views, this is aliased to just `t`:
#
# <%= t('hello') %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# The following keys must be escaped otherwise they will not be retrieved by
# the default I18n backend:
#
# true, false, on, off, yes, no
#
# Instead, surround them with single quotes.
#
# en:
# 'true': 'foo'
#
# To learn more, please read the Rails Internationalization guide
# available at http://guides.rubyonrails.org/i18n.html.
en
:
hello
:
"
Hello
world"
app-secrets/cool-app/config/puma.rb
0 → 100644
View file @
4492d7fa
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
threads_count
=
ENV
.
fetch
(
"RAILS_MAX_THREADS"
)
{
5
}
threads
threads_count
,
threads_count
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port
ENV
.
fetch
(
"PORT"
)
{
3000
}
# Specifies the `environment` that Puma will run in.
#
environment
ENV
.
fetch
(
"RAILS_ENV"
)
{
"development"
}
# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory.
#
# preload_app!
# Allow puma to be restarted by `rails restart` command.
plugin
:tmp_restart
app-secrets/cool-app/config/routes.rb
0 → 100644
View file @
4492d7fa
Rails
.
application
.
routes
.
draw
do
resources
:posts
root
'posts#index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
app-secrets/cool-app/config/spring.rb
0 → 100644
View file @
4492d7fa
%w[
.ruby-version
.rbenv-vars
tmp/restart.txt
tmp/caching-dev.txt
]
.
each
{
|
path
|
Spring
.
watch
(
path
)
}
app-secrets/cool-app/config/storage.yml
0 → 100644
View file @
4492d7fa
test
:
service
:
Disk
root
:
<%= Rails.root.join("tmp/storage") %>
local
:
service
:
Disk
root
:
<%= Rails.root.join("storage") %>
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon:
# service: S3
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
# region: us-east-1
# bucket: your_own_bucket
# Remember not to checkin your GCS keyfile to a repository
# google:
# service: GCS
# project: your_project
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
# bucket: your_own_bucket
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
# microsoft:
# service: AzureStorage
# storage_account_name: your_account_name
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
# container: your_container_name
# mirror:
# service: Mirror
# primary: local
# mirrors: [ amazon, google, microsoft ]
app-secrets/cool-app/db/migrate/20190601154705_create_posts.rb
0 → 100644
View file @
4492d7fa
class
CreatePosts
<
ActiveRecord
::
Migration
[
5.2
]
def
change
create_table
:posts
do
|
t
|
t
.
string
:title
t
.
text
:body
t
.
boolean
:published
t
.
timestamps
end
end
end
app-secrets/cool-app/db/schema.rb
0 → 100644
View file @
4492d7fa
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2019_06_01_154705
)
do
create_table
"posts"
,
force: :cascade
do
|
t
|
t
.
string
"title"
t
.
text
"body"
t
.
boolean
"published"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
end
end
app-secrets/cool-app/db/seeds.rb
0 → 100644
View file @
4492d7fa
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
app-secrets/cool-app/lib/assets/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/lib/tasks/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/log/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/package.json
0 → 100644
View file @
4492d7fa
{
"name"
:
"cool-app"
,
"private"
:
true
,
"dependencies"
:
{}
}
app-secrets/cool-app/public/404.html
0 → 100644
View file @
4492d7fa
<!DOCTYPE html>
<html>
<head>
<title>
The page you were looking for doesn't exist (404)
</title>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1"
>
<style>
.rails-default-error-page
{
background-color
:
#EFEFEF
;
color
:
#2E2F30
;
text-align
:
center
;
font-family
:
arial
,
sans-serif
;
margin
:
0
;
}
.rails-default-error-page
div
.dialog
{
width
:
95%
;
max-width
:
33em
;
margin
:
4em
auto
0
;
}
.rails-default-error-page
div
.dialog
>
div
{
border
:
1px
solid
#CCC
;
border-right-color
:
#999
;
border-left-color
:
#999
;
border-bottom-color
:
#BBB
;
border-top
:
#B00100
solid
4px
;
border-top-left-radius
:
9px
;
border-top-right-radius
:
9px
;
background-color
:
white
;
padding
:
7px
12%
0
;
box-shadow
:
0
3px
8px
rgba
(
50
,
50
,
50
,
0.17
);
}
.rails-default-error-page
h1
{
font-size
:
100%
;
color
:
#730E15
;
line-height
:
1.5em
;
}
.rails-default-error-page
div
.dialog
>
p
{
margin
:
0
0
1em
;
padding
:
1em
;
background-color
:
#F7F7F7
;
border
:
1px
solid
#CCC
;
border-right-color
:
#999
;
border-left-color
:
#999
;
border-bottom-color
:
#999
;
border-bottom-left-radius
:
4px
;
border-bottom-right-radius
:
4px
;
border-top-color
:
#DADADA
;
color
:
#666
;
box-shadow
:
0
3px
8px
rgba
(
50
,
50
,
50
,
0.17
);
}
</style>
</head>
<body
class=
"rails-default-error-page"
>
<!-- This file lives in public/404.html -->
<div
class=
"dialog"
>
<div>
<h1>
The page you were looking for doesn't exist.
</h1>
<p>
You may have mistyped the address or the page may have moved.
</p>
</div>
<p>
If you are the application owner check the logs for more information.
</p>
</div>
</body>
</html>
app-secrets/cool-app/public/422.html
0 → 100644
View file @
4492d7fa
<!DOCTYPE html>
<html>
<head>
<title>
The change you wanted was rejected (422)
</title>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1"
>
<style>
.rails-default-error-page
{
background-color
:
#EFEFEF
;
color
:
#2E2F30
;
text-align
:
center
;
font-family
:
arial
,
sans-serif
;
margin
:
0
;
}
.rails-default-error-page
div
.dialog
{
width
:
95%
;
max-width
:
33em
;
margin
:
4em
auto
0
;
}
.rails-default-error-page
div
.dialog
>
div
{
border
:
1px
solid
#CCC
;
border-right-color
:
#999
;
border-left-color
:
#999
;
border-bottom-color
:
#BBB
;
border-top
:
#B00100
solid
4px
;
border-top-left-radius
:
9px
;
border-top-right-radius
:
9px
;
background-color
:
white
;
padding
:
7px
12%
0
;
box-shadow
:
0
3px
8px
rgba
(
50
,
50
,
50
,
0.17
);
}
.rails-default-error-page
h1
{
font-size
:
100%
;
color
:
#730E15
;
line-height
:
1.5em
;
}
.rails-default-error-page
div
.dialog
>
p
{
margin
:
0
0
1em
;
padding
:
1em
;
background-color
:
#F7F7F7
;
border
:
1px
solid
#CCC
;
border-right-color
:
#999
;
border-left-color
:
#999
;
border-bottom-color
:
#999
;
border-bottom-left-radius
:
4px
;
border-bottom-right-radius
:
4px
;
border-top-color
:
#DADADA
;
color
:
#666
;
box-shadow
:
0
3px
8px
rgba
(
50
,
50
,
50
,
0.17
);
}
</style>
</head>
<body
class=
"rails-default-error-page"
>
<!-- This file lives in public/422.html -->
<div
class=
"dialog"
>
<div>
<h1>
The change you wanted was rejected.
</h1>
<p>
Maybe you tried to change something you didn't have access to.
</p>
</div>
<p>
If you are the application owner check the logs for more information.
</p>
</div>
</body>
</html>
app-secrets/cool-app/public/500.html
0 → 100644
View file @
4492d7fa
<!DOCTYPE html>
<html>
<head>
<title>
We're sorry, but something went wrong (500)
</title>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1"
>
<style>
.rails-default-error-page
{
background-color
:
#EFEFEF
;
color
:
#2E2F30
;
text-align
:
center
;
font-family
:
arial
,
sans-serif
;
margin
:
0
;
}
.rails-default-error-page
div
.dialog
{
width
:
95%
;
max-width
:
33em
;
margin
:
4em
auto
0
;
}
.rails-default-error-page
div
.dialog
>
div
{
border
:
1px
solid
#CCC
;
border-right-color
:
#999
;
border-left-color
:
#999
;
border-bottom-color
:
#BBB
;
border-top
:
#B00100
solid
4px
;
border-top-left-radius
:
9px
;
border-top-right-radius
:
9px
;
background-color
:
white
;
padding
:
7px
12%
0
;
box-shadow
:
0
3px
8px
rgba
(
50
,
50
,
50
,
0.17
);
}
.rails-default-error-page
h1
{
font-size
:
100%
;
color
:
#730E15
;
line-height
:
1.5em
;
}
.rails-default-error-page
div
.dialog
>
p
{
margin
:
0
0
1em
;
padding
:
1em
;
background-color
:
#F7F7F7
;
border
:
1px
solid
#CCC
;
border-right-color
:
#999
;
border-left-color
:
#999
;
border-bottom-color
:
#999
;
border-bottom-left-radius
:
4px
;
border-bottom-right-radius
:
4px
;
border-top-color
:
#DADADA
;
color
:
#666
;
box-shadow
:
0
3px
8px
rgba
(
50
,
50
,
50
,
0.17
);
}
</style>
</head>
<body
class=
"rails-default-error-page"
>
<!-- This file lives in public/500.html -->
<div
class=
"dialog"
>
<div>
<h1>
We're sorry, but something went wrong.
</h1>
</div>
<p>
If you are the application owner check the logs for more information.
</p>
</div>
</body>
</html>
app-secrets/cool-app/public/apple-touch-icon-precomposed.png
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/public/apple-touch-icon.png
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/public/favicon.ico
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/public/robots.txt
0 → 100644
View file @
4492d7fa
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
app-secrets/cool-app/storage/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/test/application_system_test_case.rb
0 → 100644
View file @
4492d7fa
require
"test_helper"
class
ApplicationSystemTestCase
<
ActionDispatch
::
SystemTestCase
driven_by
:selenium
,
using: :chrome
,
screen_size:
[
1400
,
1400
]
end
app-secrets/cool-app/test/controllers/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/test/controllers/posts_controller_test.rb
0 → 100644
View file @
4492d7fa
require
'test_helper'
class
PostsControllerTest
<
ActionDispatch
::
IntegrationTest
setup
do
@post
=
posts
(
:one
)
end
test
"should get index"
do
get
posts_url
assert_response
:success
end
test
"should get new"
do
get
new_post_url
assert_response
:success
end
test
"should create post"
do
assert_difference
(
'Post.count'
)
do
post
posts_url
,
params:
{
post:
{
body:
@post
.
body
,
published:
@post
.
published
,
title:
@post
.
title
}
}
end
assert_redirected_to
post_url
(
Post
.
last
)
end
test
"should show post"
do
get
post_url
(
@post
)
assert_response
:success
end
test
"should get edit"
do
get
edit_post_url
(
@post
)
assert_response
:success
end
test
"should update post"
do
patch
post_url
(
@post
),
params:
{
post:
{
body:
@post
.
body
,
published:
@post
.
published
,
title:
@post
.
title
}
}
assert_redirected_to
post_url
(
@post
)
end
test
"should destroy post"
do
assert_difference
(
'Post.count'
,
-
1
)
do
delete
post_url
(
@post
)
end
assert_redirected_to
posts_url
end
end
app-secrets/cool-app/test/fixtures/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/test/fixtures/files/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/test/fixtures/posts.yml
0 → 100644
View file @
4492d7fa
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one
:
title
:
MyString
body
:
MyText
published
:
false
two
:
title
:
MyString
body
:
MyText
published
:
false
app-secrets/cool-app/test/helpers/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/test/integration/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/test/mailers/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/test/models/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/test/models/post_test.rb
0 → 100644
View file @
4492d7fa
require
'test_helper'
class
PostTest
<
ActiveSupport
::
TestCase
# test "the truth" do
# assert true
# end
end
app-secrets/cool-app/test/system/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/test/system/posts_test.rb
0 → 100644
View file @
4492d7fa
require
"application_system_test_case"
class
PostsTest
<
ApplicationSystemTestCase
setup
do
@post
=
posts
(
:one
)
end
test
"visiting the index"
do
visit
posts_url
assert_selector
"h1"
,
text:
"Posts"
end
test
"creating a Post"
do
visit
posts_url
click_on
"New Post"
fill_in
"Body"
,
with:
@post
.
body
check
"Published"
if
@post
.
published
fill_in
"Title"
,
with:
@post
.
title
click_on
"Create Post"
assert_text
"Post was successfully created"
click_on
"Back"
end
test
"updating a Post"
do
visit
posts_url
click_on
"Edit"
,
match: :first
fill_in
"Body"
,
with:
@post
.
body
check
"Published"
if
@post
.
published
fill_in
"Title"
,
with:
@post
.
title
click_on
"Update Post"
assert_text
"Post was successfully updated"
click_on
"Back"
end
test
"destroying a Post"
do
visit
posts_url
page
.
accept_confirm
do
click_on
"Destroy"
,
match: :first
end
assert_text
"Post was successfully destroyed"
end
end
app-secrets/cool-app/test/test_helper.rb
0 → 100644
View file @
4492d7fa
ENV
[
'RAILS_ENV'
]
||=
'test'
require_relative
'../config/environment'
require
'rails/test_help'
class
ActiveSupport
::
TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures
:all
# Add more helper methods to be used by all tests here...
end
app-secrets/cool-app/tmp/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/vendor/.keep
0 → 100644
View file @
4492d7fa
app-secrets/cool-app/yarn.lock
0 → 100644
View file @
4492d7fa
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment