diff --git a/COPYING b/COPYING
new file mode 100755
index 0000000..29977a5
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,19 @@
+Copyright (c) 2017 CircleCI
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/Gemfile b/Gemfile
new file mode 100755
index 0000000..a8123da
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,58 @@
+source 'https://rubygems.org'
+
+git_source(:github) do |repo_name|
+ repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
+ "https://github.com/#{repo_name}.git"
+end
+
+ruby '2.4.2'
+
+# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
+gem 'rails', '~> 5.1.4'
+# Use postgresql as the database for Active Record
+gem 'pg', '~> 0.18'
+# Use Puma as the app server
+gem 'puma', '~> 3.7'
+# 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 'therubyracer', 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', '~> 3.0'
+# Use ActiveModel has_secure_password
+# gem 'bcrypt', '~> 3.1.7'
+
+# Use Capistrano for deployment
+# gem 'capistrano-rails', group: :development
+
+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]
+ # Adds support for Capybara system testing and selenium driver
+ gem 'capybara', '~> 2.13.0'
+ gem 'selenium-webdriver'
+
+ gem 'rspec-rails'
+ gem 'rspec_junit_formatter'
+end
+
+group :development do
+ # Access an IRB console on exception pages or by using <%= 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
+
+# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
+gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100755
index 0000000..91fd605
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,224 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actioncable (5.1.6)
+ actionpack (= 5.1.6)
+ nio4r (~> 2.0)
+ websocket-driver (~> 0.6.1)
+ actionmailer (5.1.6)
+ actionpack (= 5.1.6)
+ actionview (= 5.1.6)
+ activejob (= 5.1.6)
+ mail (~> 2.5, >= 2.5.4)
+ rails-dom-testing (~> 2.0)
+ actionpack (5.1.6)
+ actionview (= 5.1.6)
+ activesupport (= 5.1.6)
+ rack (~> 2.0)
+ rack-test (>= 0.6.3)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ actionview (5.1.6)
+ activesupport (= 5.1.6)
+ builder (~> 3.1)
+ erubi (~> 1.4)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
+ activejob (5.1.6)
+ activesupport (= 5.1.6)
+ globalid (>= 0.3.6)
+ activemodel (5.1.6)
+ activesupport (= 5.1.6)
+ activerecord (5.1.6)
+ activemodel (= 5.1.6)
+ activesupport (= 5.1.6)
+ arel (~> 8.0)
+ activesupport (5.1.6)
+ concurrent-ruby (~> 1.0, >= 1.0.2)
+ i18n (>= 0.7, < 2)
+ minitest (~> 5.1)
+ tzinfo (~> 1.1)
+ addressable (2.5.2)
+ public_suffix (>= 2.0.2, < 4.0)
+ arel (8.0.0)
+ bindex (0.5.0)
+ builder (3.2.3)
+ byebug (10.0.2)
+ capybara (2.13.0)
+ addressable
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ xpath (~> 2.0)
+ childprocess (0.9.0)
+ ffi (~> 1.0, >= 1.0.11)
+ 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.0.5)
+ crass (1.0.4)
+ diff-lcs (1.3)
+ erubi (1.7.1)
+ execjs (2.7.0)
+ ffi (1.9.25)
+ globalid (0.4.1)
+ activesupport (>= 4.2.0)
+ i18n (1.1.0)
+ concurrent-ruby (~> 1.0)
+ jbuilder (2.7.0)
+ activesupport (>= 4.2.0)
+ multi_json (>= 1.2)
+ 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.2)
+ crass (~> 1.0.2)
+ nokogiri (>= 1.5.9)
+ mail (2.7.0)
+ mini_mime (>= 0.1.1)
+ method_source (0.9.0)
+ mime-types (3.2.2)
+ mime-types-data (~> 3.2015)
+ mime-types-data (3.2018.0812)
+ mini_mime (1.0.1)
+ mini_portile2 (2.3.0)
+ minitest (5.11.3)
+ multi_json (1.13.1)
+ nio4r (2.3.1)
+ nokogiri (1.8.4)
+ mini_portile2 (~> 2.3.0)
+ pg (0.21.0)
+ public_suffix (3.0.3)
+ puma (3.12.0)
+ rack (2.0.5)
+ rack-test (1.1.0)
+ rack (>= 1.0, < 3)
+ rails (5.1.6)
+ actioncable (= 5.1.6)
+ actionmailer (= 5.1.6)
+ actionpack (= 5.1.6)
+ actionview (= 5.1.6)
+ activejob (= 5.1.6)
+ activemodel (= 5.1.6)
+ activerecord (= 5.1.6)
+ activesupport (= 5.1.6)
+ bundler (>= 1.3.0)
+ railties (= 5.1.6)
+ 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.1.6)
+ actionpack (= 5.1.6)
+ activesupport (= 5.1.6)
+ method_source
+ rake (>= 0.8.7)
+ thor (>= 0.18.1, < 2.0)
+ rake (12.3.1)
+ rb-fsevent (0.10.3)
+ rb-inotify (0.9.10)
+ ffi (>= 0.5.0, < 2)
+ rspec-core (3.8.0)
+ rspec-support (~> 3.8.0)
+ rspec-expectations (3.8.1)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.8.0)
+ rspec-mocks (3.8.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.8.0)
+ rspec-rails (3.8.0)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec-core (~> 3.8.0)
+ rspec-expectations (~> 3.8.0)
+ rspec-mocks (~> 3.8.0)
+ rspec-support (~> 3.8.0)
+ rspec-support (3.8.0)
+ rspec_junit_formatter (0.4.1)
+ rspec-core (>= 2, < 4, != 2.12.0)
+ ruby_dep (1.5.0)
+ rubyzip (1.2.2)
+ sass (3.6.0)
+ 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.14.0)
+ childprocess (~> 0.5)
+ rubyzip (~> 1.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)
+ thor (0.20.0)
+ thread_safe (0.3.6)
+ tilt (2.0.8)
+ turbolinks (5.2.0)
+ turbolinks-source (~> 5.2)
+ turbolinks-source (5.2.0)
+ tzinfo (1.2.5)
+ thread_safe (~> 0.1)
+ uglifier (4.1.19)
+ 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.6.5)
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.3)
+ xpath (2.1.0)
+ nokogiri (~> 1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ byebug
+ capybara (~> 2.13.0)
+ coffee-rails (~> 4.2)
+ jbuilder (~> 2.5)
+ listen (>= 3.0.5, < 3.2)
+ pg (~> 0.18)
+ puma (~> 3.7)
+ rails (~> 5.1.4)
+ rspec-rails
+ rspec_junit_formatter
+ sass-rails (~> 5.0)
+ selenium-webdriver
+ spring
+ spring-watcher-listen (~> 2.0.0)
+ turbolinks (~> 5)
+ tzinfo-data
+ uglifier (>= 1.3.0)
+ web-console (>= 3.3.0)
+
+RUBY VERSION
+ ruby 2.4.2p198
+
+BUNDLED WITH
+ 1.16.0
diff --git a/README.md b/README.md
new file mode 100755
index 0000000..50f530f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,13 @@
+# CircleCI Demo Application: Ruby on Rails [](https://circleci.com/gh/CircleCI-Public/circleci-demo-ruby-rails)
+
+This is an example application showcasing how to run a Ruby on Rails app on CircleCI 2.0.
+
+You can follow along with this project by reading the [documentation](https://circleci.com/docs/2.0/language-ruby/).
+
+## License
+
+Copyright (c) 2017 CircleCI
+
+Distributed under the MIT License. See the file COPYING.
+
+
diff --git a/Rakefile b/Rakefile
new file mode 100755
index 0000000..e85f913
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,6 @@
+# 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
diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js
new file mode 100755
index 0000000..b16e53d
--- /dev/null
+++ b/app/assets/config/manifest.js
@@ -0,0 +1,3 @@
+//= link_tree ../images
+//= link_directory ../javascripts .js
+//= link_directory ../stylesheets .css
diff --git a/app/assets/images/.keep b/app/assets/images/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
new file mode 100755
index 0000000..46b2035
--- /dev/null
+++ b/app/assets/javascripts/application.js
@@ -0,0 +1,15 @@
+// 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 turbolinks
+//= require_tree .
diff --git a/app/assets/javascripts/cable.js b/app/assets/javascripts/cable.js
new file mode 100755
index 0000000..739aa5f
--- /dev/null
+++ b/app/assets/javascripts/cable.js
@@ -0,0 +1,13 @@
+// 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);
diff --git a/app/assets/javascripts/channels/.keep b/app/assets/javascripts/channels/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/app/assets/javascripts/posts.coffee b/app/assets/javascripts/posts.coffee
new file mode 100755
index 0000000..24f83d1
--- /dev/null
+++ b/app/assets/javascripts/posts.coffee
@@ -0,0 +1,3 @@
+# 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/
diff --git a/app/assets/javascripts/welcome.coffee b/app/assets/javascripts/welcome.coffee
new file mode 100755
index 0000000..24f83d1
--- /dev/null
+++ b/app/assets/javascripts/welcome.coffee
@@ -0,0 +1,3 @@
+# 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/
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
new file mode 100755
index 0000000..d05ea0f
--- /dev/null
+++ b/app/assets/stylesheets/application.css
@@ -0,0 +1,15 @@
+/*
+ * 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.
+ *
+ *= require_tree .
+ *= require_self
+ */
diff --git a/app/assets/stylesheets/posts.scss b/app/assets/stylesheets/posts.scss
new file mode 100755
index 0000000..1a7e153
--- /dev/null
+++ b/app/assets/stylesheets/posts.scss
@@ -0,0 +1,3 @@
+// 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/
diff --git a/app/assets/stylesheets/scaffolds.scss b/app/assets/stylesheets/scaffolds.scss
new file mode 100755
index 0000000..6045188
--- /dev/null
+++ b/app/assets/stylesheets/scaffolds.scss
@@ -0,0 +1,84 @@
+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;
+}
diff --git a/app/assets/stylesheets/welcome.scss b/app/assets/stylesheets/welcome.scss
new file mode 100755
index 0000000..4e19aa4
--- /dev/null
+++ b/app/assets/stylesheets/welcome.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the Welcome controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb
new file mode 100755
index 0000000..d672697
--- /dev/null
+++ b/app/channels/application_cable/channel.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Channel < ActionCable::Channel::Base
+ end
+end
diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb
new file mode 100755
index 0000000..0ff5442
--- /dev/null
+++ b/app/channels/application_cable/connection.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Connection < ActionCable::Connection::Base
+ end
+end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
new file mode 100755
index 0000000..1c07694
--- /dev/null
+++ b/app/controllers/application_controller.rb
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery with: :exception
+end
diff --git a/app/controllers/concerns/.keep b/app/controllers/concerns/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb
new file mode 100755
index 0000000..cc46dee
--- /dev/null
+++ b/app/controllers/posts_controller.rb
@@ -0,0 +1,74 @@
+class PostsController < ApplicationController
+ before_action :set_post, only: [:show, :edit, :update, :destroy]
+
+ # GET /posts
+ # GET /posts.json
+ def index
+ @posts = Post.all
+ 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
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
new file mode 100755
index 0000000..f9b859b
--- /dev/null
+++ b/app/controllers/welcome_controller.rb
@@ -0,0 +1,4 @@
+class WelcomeController < ApplicationController
+ def index
+ end
+end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
new file mode 100755
index 0000000..de6be79
--- /dev/null
+++ b/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb
new file mode 100755
index 0000000..a7b8cec
--- /dev/null
+++ b/app/helpers/posts_helper.rb
@@ -0,0 +1,2 @@
+module PostsHelper
+end
diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb
new file mode 100755
index 0000000..eeead45
--- /dev/null
+++ b/app/helpers/welcome_helper.rb
@@ -0,0 +1,2 @@
+module WelcomeHelper
+end
diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb
new file mode 100755
index 0000000..a009ace
--- /dev/null
+++ b/app/jobs/application_job.rb
@@ -0,0 +1,2 @@
+class ApplicationJob < ActiveJob::Base
+end
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
new file mode 100755
index 0000000..286b223
--- /dev/null
+++ b/app/mailers/application_mailer.rb
@@ -0,0 +1,4 @@
+class ApplicationMailer < ActionMailer::Base
+ default from: 'from@example.com'
+ layout 'mailer'
+end
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
new file mode 100755
index 0000000..10a4cba
--- /dev/null
+++ b/app/models/application_record.rb
@@ -0,0 +1,3 @@
+class ApplicationRecord < ActiveRecord::Base
+ self.abstract_class = true
+end
diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/app/models/post.rb b/app/models/post.rb
new file mode 100755
index 0000000..428b052
--- /dev/null
+++ b/app/models/post.rb
@@ -0,0 +1,4 @@
+class Post < ApplicationRecord
+ validates_presence_of :title
+ validates_presence_of :body
+end
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
new file mode 100755
index 0000000..1dd80e4
--- /dev/null
+++ b/app/views/layouts/application.html.erb
@@ -0,0 +1,14 @@
+
+
+
+ Blog
+ <%= csrf_meta_tags %>
+
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
+
+
+
+ <%= yield %>
+
+
diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb
new file mode 100755
index 0000000..cbd34d2
--- /dev/null
+++ b/app/views/layouts/mailer.html.erb
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+ <%= yield %>
+
+
diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb
new file mode 100755
index 0000000..37f0bdd
--- /dev/null
+++ b/app/views/layouts/mailer.text.erb
@@ -0,0 +1 @@
+<%= yield %>
diff --git a/app/views/posts/_form.html.erb b/app/views/posts/_form.html.erb
new file mode 100755
index 0000000..2a9c59f
--- /dev/null
+++ b/app/views/posts/_form.html.erb
@@ -0,0 +1,32 @@
+<%= form_with(model: post, local: true) do |form| %>
+ <% if post.errors.any? %>
+
+
<%= pluralize(post.errors.count, "error") %> prohibited this post from being saved:
+
+
+ <% post.errors.full_messages.each do |message| %>
+ - <%= message %>
+ <% end %>
+
+
+ <% end %>
+
+
+ <%= form.label :title %>
+ <%= form.text_field :title, id: :post_title %>
+
+
+
+ <%= form.label :body %>
+ <%= form.text_area :body, id: :post_body %>
+
+
+
+ <%= form.label :published %>
+ <%= form.check_box :published, id: :post_published %>
+
+
+
+ <%= form.submit %>
+
+<% end %>
diff --git a/app/views/posts/_post.json.jbuilder b/app/views/posts/_post.json.jbuilder
new file mode 100755
index 0000000..fbfbb11
--- /dev/null
+++ b/app/views/posts/_post.json.jbuilder
@@ -0,0 +1,2 @@
+json.extract! post, :id, :title, :body, :published, :created_at, :updated_at
+json.url post_url(post, format: :json)
diff --git a/app/views/posts/edit.html.erb b/app/views/posts/edit.html.erb
new file mode 100755
index 0000000..ded33f7
--- /dev/null
+++ b/app/views/posts/edit.html.erb
@@ -0,0 +1,6 @@
+Editing Post
+
+<%= render 'form', post: @post %>
+
+<%= link_to 'Show', @post %> |
+<%= link_to 'Back', posts_path %>
diff --git a/app/views/posts/index.html.erb b/app/views/posts/index.html.erb
new file mode 100755
index 0000000..50cbc31
--- /dev/null
+++ b/app/views/posts/index.html.erb
@@ -0,0 +1,31 @@
+<%= notice %>
+
+Posts
+
+
+
+
+ Title |
+ Body |
+ Published |
+ |
+
+
+
+
+ <% @posts.each do |post| %>
+
+ <%= post.title %> |
+ <%= post.body %> |
+ <%= post.published %> |
+ <%= link_to 'Show', post %> |
+ <%= link_to 'Edit', edit_post_path(post) %> |
+ <%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %> |
+
+ <% end %>
+
+
+
+
+
+<%= link_to 'New Post', new_post_path %>
diff --git a/app/views/posts/index.json.jbuilder b/app/views/posts/index.json.jbuilder
new file mode 100755
index 0000000..d4d0249
--- /dev/null
+++ b/app/views/posts/index.json.jbuilder
@@ -0,0 +1 @@
+json.array! @posts, partial: 'posts/post', as: :post
diff --git a/app/views/posts/new.html.erb b/app/views/posts/new.html.erb
new file mode 100755
index 0000000..fb1e2a1
--- /dev/null
+++ b/app/views/posts/new.html.erb
@@ -0,0 +1,5 @@
+New Post
+
+<%= render 'form', post: @post %>
+
+<%= link_to 'Back', posts_path %>
diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb
new file mode 100755
index 0000000..85b8fe8
--- /dev/null
+++ b/app/views/posts/show.html.erb
@@ -0,0 +1,19 @@
+<%= notice %>
+
+
+ Title:
+ <%= @post.title %>
+
+
+
+ Body:
+ <%= @post.body %>
+
+
+
+ Published:
+ <%= @post.published %>
+
+
+<%= link_to 'Edit', edit_post_path(@post) %> |
+<%= link_to 'Back', posts_path %>
diff --git a/app/views/posts/show.json.jbuilder b/app/views/posts/show.json.jbuilder
new file mode 100755
index 0000000..5274482
--- /dev/null
+++ b/app/views/posts/show.json.jbuilder
@@ -0,0 +1 @@
+json.partial! "posts/post", post: @post
diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb
new file mode 100755
index 0000000..94ec8e1
--- /dev/null
+++ b/app/views/welcome/index.html.erb
@@ -0,0 +1 @@
+Hello, Rails!
diff --git a/bin/bundle b/bin/bundle
new file mode 100755
index 0000000..66e9889
--- /dev/null
+++ b/bin/bundle
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+load Gem.bin_path('bundler', 'bundle')
diff --git a/bin/rails b/bin/rails
new file mode 100755
index 0000000..5badb2f
--- /dev/null
+++ b/bin/rails
@@ -0,0 +1,9 @@
+#!/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'
diff --git a/bin/rake b/bin/rake
new file mode 100755
index 0000000..d87d5f5
--- /dev/null
+++ b/bin/rake
@@ -0,0 +1,9 @@
+#!/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
diff --git a/bin/setup b/bin/setup
new file mode 100755
index 0000000..78c4e86
--- /dev/null
+++ b/bin/setup
@@ -0,0 +1,38 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+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
diff --git a/bin/spring b/bin/spring
new file mode 100755
index 0000000..fb2ec2e
--- /dev/null
+++ b/bin/spring
@@ -0,0 +1,17 @@
+#!/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
diff --git a/bin/update b/bin/update
new file mode 100755
index 0000000..a8e4462
--- /dev/null
+++ b/bin/update
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+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')
+
+ 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
diff --git a/bin/yarn b/bin/yarn
new file mode 100755
index 0000000..c2bacef
--- /dev/null
+++ b/bin/yarn
@@ -0,0 +1,11 @@
+#!/usr/bin/env ruby
+VENDOR_PATH = File.expand_path('..', __dir__)
+Dir.chdir(VENDOR_PATH) do
+ begin
+ exec "yarnpkg #{ARGV.join(" ")}"
+ 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
diff --git a/config.ru b/config.ru
new file mode 100755
index 0000000..f7ba0b5
--- /dev/null
+++ b/config.ru
@@ -0,0 +1,5 @@
+# This file is used by Rack-based servers to start the application.
+
+require_relative 'config/environment'
+
+run Rails.application
diff --git a/config/application.rb b/config/application.rb
new file mode 100755
index 0000000..ffaaf0d
--- /dev/null
+++ b/config/application.rb
@@ -0,0 +1,18 @@
+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 Blog
+ class Application < Rails::Application
+ # Initialize configuration defaults for originally generated Rails version.
+ config.load_defaults 5.1
+
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+ end
+end
diff --git a/config/boot.rb b/config/boot.rb
new file mode 100755
index 0000000..30f5120
--- /dev/null
+++ b/config/boot.rb
@@ -0,0 +1,3 @@
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
+
+require 'bundler/setup' # Set up gems listed in the Gemfile.
diff --git a/config/cable.yml b/config/cable.yml
new file mode 100755
index 0000000..55e94a6
--- /dev/null
+++ b/config/cable.yml
@@ -0,0 +1,10 @@
+development:
+ adapter: async
+
+test:
+ adapter: async
+
+production:
+ adapter: redis
+ url: redis://localhost:6379/1
+ channel_prefix: blog_production
diff --git a/config/database.yml b/config/database.yml
new file mode 100755
index 0000000..50cd3ee
--- /dev/null
+++ b/config/database.yml
@@ -0,0 +1,88 @@
+# PostgreSQL. Versions 9.1 and up are supported.
+#
+# Install the pg driver:
+# gem install pg
+# On OS X with Homebrew:
+# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
+# On OS X with MacPorts:
+# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
+# On Windows:
+# gem install pg
+# Choose the win32 build.
+# Install PostgreSQL and put its /bin directory on your path.
+#
+# Configure Using Gemfile
+# gem 'pg'
+#
+default: &default
+ adapter: postgresql
+ encoding: unicode
+ host: localhost
+ user: postgres
+ # For details on connection pooling, see Rails configuration guide
+ # http://guides.rubyonrails.org/configuring.html#database-pooling
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
+
+development:
+ <<: *default
+ database: rails_blog
+
+ # The specified database role being used to connect to postgres.
+ # To create additional roles in postgres see `$ createuser --help`.
+ # When left blank, postgres will use the default role. This is
+ # the same name as the operating system user that initialized the database.
+ #username: zomg
+
+ # The password associated with the postgres role (username).
+ #password:
+
+ # Connect on a TCP socket. Omitted by default since the client uses a
+ # domain socket that doesn't need configuration. Windows does not have
+ # domain sockets, so uncomment these lines.
+ #host: localhost
+
+ # The TCP port the server listens on. Defaults to 5432.
+ # If your server runs on a different port number, change accordingly.
+ #port: 5432
+
+ # Schema search path. The server defaults to $user,public
+ #schema_search_path: myapp,sharedapp,public
+
+ # Minimum log levels, in increasing order:
+ # debug5, debug4, debug3, debug2, debug1,
+ # log, notice, warning, error, fatal, and panic
+ # Defaults to warning.
+ #min_messages: notice
+
+# 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
+ user: <%= ENV.fetch("PGUSER") %>
+ database: rails_blog
+
+# As with config/secrets.yml, you never want to store sensitive information,
+# like your database password, in your source code. If your source code is
+# ever seen by anyone, they now have access to your database.
+#
+# Instead, provide the password as a unix environment variable when you boot
+# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
+# for a full rundown on how to provide these environment variables in a
+# production deployment.
+#
+# On Heroku and other platform providers, you may have a full connection URL
+# available as an environment variable. For example:
+#
+# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
+#
+# You can use this database configuration with:
+#
+# production:
+# url: <%= ENV['DATABASE_URL'] %>
+#
+production:
+ <<: *default
+ database: zomg_production
+ username: zomg
+ password: <%= ENV['ZOMG_DATABASE_PASSWORD'] %>
diff --git a/config/environment.rb b/config/environment.rb
new file mode 100755
index 0000000..426333b
--- /dev/null
+++ b/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the Rails application.
+require_relative 'application'
+
+# Initialize the Rails application.
+Rails.application.initialize!
diff --git a/config/environments/development.rb b/config/environments/development.rb
new file mode 100755
index 0000000..5187e22
--- /dev/null
+++ b/config/environments/development.rb
@@ -0,0 +1,54 @@
+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.
+ 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.seconds.to_i}"
+ }
+ else
+ config.action_controller.perform_caching = false
+
+ config.cache_store = :null_store
+ end
+
+ # 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
+
+ # 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
diff --git a/config/environments/production.rb b/config/environments/production.rb
new file mode 100755
index 0000000..2f141da
--- /dev/null
+++ b/config/environments/production.rb
@@ -0,0 +1,91 @@
+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
+
+ # Attempt to read encrypted secrets from `config/secrets.yml.enc`.
+ # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
+ # `config/secrets.yml.key`.
+ config.read_encrypted_secrets = 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
+
+ # 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 = "blog_#{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
diff --git a/config/environments/test.rb b/config/environments/test.rb
new file mode 100755
index 0000000..8e5cbde
--- /dev/null
+++ b/config/environments/test.rb
@@ -0,0 +1,42 @@
+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.seconds.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
+ 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
diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb
new file mode 100755
index 0000000..51639b6
--- /dev/null
+++ b/config/initializers/application_controller_renderer.rb
@@ -0,0 +1,6 @@
+# Be sure to restart your server when you modify this file.
+
+# ApplicationController.renderer.defaults.merge!(
+# http_host: 'example.org',
+# https: false
+# )
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
new file mode 100755
index 0000000..4b828e8
--- /dev/null
+++ b/config/initializers/assets.rb
@@ -0,0 +1,14 @@
+# 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 )
diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb
new file mode 100755
index 0000000..59385cd
--- /dev/null
+++ b/config/initializers/backtrace_silencers.rb
@@ -0,0 +1,7 @@
+# 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!
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb
new file mode 100755
index 0000000..5a6a32d
--- /dev/null
+++ b/config/initializers/cookies_serializer.rb
@@ -0,0 +1,5 @@
+# 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
diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb
new file mode 100755
index 0000000..4a994e1
--- /dev/null
+++ b/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,4 @@
+# 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]
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
new file mode 100755
index 0000000..ac033bf
--- /dev/null
+++ b/config/initializers/inflections.rb
@@ -0,0 +1,16 @@
+# 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
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb
new file mode 100755
index 0000000..dc18996
--- /dev/null
+++ b/config/initializers/mime_types.rb
@@ -0,0 +1,4 @@
+# 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
diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb
new file mode 100755
index 0000000..bbfc396
--- /dev/null
+++ b/config/initializers/wrap_parameters.rb
@@ -0,0 +1,14 @@
+# 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
diff --git a/config/locales/en.yml b/config/locales/en.yml
new file mode 100755
index 0000000..decc5a8
--- /dev/null
+++ b/config/locales/en.yml
@@ -0,0 +1,33 @@
+# 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"
diff --git a/config/puma.rb b/config/puma.rb
new file mode 100755
index 0000000..1e19380
--- /dev/null
+++ b/config/puma.rb
@@ -0,0 +1,56 @@
+# 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. If you use this option
+# you need to make sure to reconnect any threads in the `on_worker_boot`
+# block.
+#
+# preload_app!
+
+# If you are preloading your application and using Active Record, it's
+# recommended that you close any connections to the database before workers
+# are forked to prevent connection leakage.
+#
+# before_fork do
+# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
+# end
+
+# The code in the `on_worker_boot` will be called if you are using
+# clustered mode by specifying a number of `workers`. After each worker
+# process is booted, this block will be run. If you are using the `preload_app!`
+# option, you will want to use this block to reconnect to any threads
+# or connections that may have been created at application boot, as Ruby
+# cannot share connections between processes.
+#
+# on_worker_boot do
+# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
+# end
+#
+
+# Allow puma to be restarted by `rails restart` command.
+plugin :tmp_restart
diff --git a/config/routes.rb b/config/routes.rb
new file mode 100755
index 0000000..bb156aa
--- /dev/null
+++ b/config/routes.rb
@@ -0,0 +1,6 @@
+Rails.application.routes.draw do
+ resources :posts
+ get 'welcome/index'
+
+ # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
+end
diff --git a/config/secrets.yml b/config/secrets.yml
new file mode 100755
index 0000000..2f2b546
--- /dev/null
+++ b/config/secrets.yml
@@ -0,0 +1,32 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key is used for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+# You can use `rails secret` to generate a secure secret key.
+
+# Make sure the secrets in this file are kept private
+# if you're sharing your code publicly.
+
+# Shared secrets are available across all environments.
+
+# shared:
+# api_key: a1B2c3D4e5F6
+
+# Environmental secrets are only available for that specific environment.
+
+development:
+ secret_key_base: 1772865d68179331209180bfb411ef9c9a982de29f41ebfc434b061cdbda03d4916c44fd4a8822e52bb6ae7b9f00996cbd5d2cd06c717b7197691df01318381c
+
+test:
+ secret_key_base: aed8f9bc41e732bd2f6d8f2656a075695d6b898caed71a2510987676c1cf30726f6ac943a47b6acde7cc4d1d66216c62f1725d707d4373849d252a4829d9d749
+
+# Do not keep production secrets in the unencrypted secrets file.
+# Instead, either read values from the environment.
+# Or, use `bin/rails secrets:setup` to configure encrypted secrets
+# and move the `production:` environment over there.
+
+production:
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
diff --git a/config/spring.rb b/config/spring.rb
new file mode 100755
index 0000000..c9119b4
--- /dev/null
+++ b/config/spring.rb
@@ -0,0 +1,6 @@
+%w(
+ .ruby-version
+ .rbenv-vars
+ tmp/restart.txt
+ tmp/caching-dev.txt
+).each { |path| Spring.watch(path) }
diff --git a/db/migrate/20170509232014_create_posts.rb b/db/migrate/20170509232014_create_posts.rb
new file mode 100755
index 0000000..59ece5f
--- /dev/null
+++ b/db/migrate/20170509232014_create_posts.rb
@@ -0,0 +1,11 @@
+class CreatePosts < ActiveRecord::Migration[5.1]
+ def change
+ create_table :posts do |t|
+ t.string :title
+ t.text :body
+ t.boolean :published
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
new file mode 100755
index 0000000..45bd77e
--- /dev/null
+++ b/db/schema.rb
@@ -0,0 +1,26 @@
+# 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: 20170509232014) do
+
+ # These are extensions that must be enabled in order to support this database
+ enable_extension "plpgsql"
+
+ 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
diff --git a/db/seeds.rb b/db/seeds.rb
new file mode 100755
index 0000000..1beea2a
--- /dev/null
+++ b/db/seeds.rb
@@ -0,0 +1,7 @@
+# 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)
diff --git a/lib/assets/.keep b/lib/assets/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/lib/tasks/.keep b/lib/tasks/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/log/.keep b/log/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/package.json b/package.json
new file mode 100755
index 0000000..0c136c6
--- /dev/null
+++ b/package.json
@@ -0,0 +1,11 @@
+{
+ "name": "circleci-demo-ruby-rails",
+ "private": true,
+ "dependencies": {
+ "bootstrap": "~>4.1.2"
+ },
+ "version": "1.0.0",
+ "repository": "git@github.com:CircleCI-Public/circleci-demo-ruby-rails.git",
+ "author": "Zachary Scott ",
+ "license": "MIT"
+}
diff --git a/public/404.html b/public/404.html
new file mode 100755
index 0000000..2be3af2
--- /dev/null
+++ b/public/404.html
@@ -0,0 +1,67 @@
+
+
+
+ The page you were looking for doesn't exist (404)
+
+
+
+
+
+
+
+
+
The page you were looking for doesn't exist.
+
You may have mistyped the address or the page may have moved.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/public/422.html b/public/422.html
new file mode 100755
index 0000000..c08eac0
--- /dev/null
+++ b/public/422.html
@@ -0,0 +1,67 @@
+
+
+
+ The change you wanted was rejected (422)
+
+
+
+
+
+
+
+
+
The change you wanted was rejected.
+
Maybe you tried to change something you didn't have access to.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/public/500.html b/public/500.html
new file mode 100755
index 0000000..78a030a
--- /dev/null
+++ b/public/500.html
@@ -0,0 +1,66 @@
+
+
+
+ We're sorry, but something went wrong (500)
+
+
+
+
+
+
+
+
+
We're sorry, but something went wrong.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/public/apple-touch-icon-precomposed.png b/public/apple-touch-icon-precomposed.png
new file mode 100755
index 0000000..e69de29
diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png
new file mode 100755
index 0000000..e69de29
diff --git a/public/favicon.ico b/public/favicon.ico
new file mode 100755
index 0000000..e69de29
diff --git a/public/robots.txt b/public/robots.txt
new file mode 100755
index 0000000..37b576a
--- /dev/null
+++ b/public/robots.txt
@@ -0,0 +1 @@
+# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
diff --git a/spec/controllers/posts_controller_spec.rb b/spec/controllers/posts_controller_spec.rb
new file mode 100755
index 0000000..a14e33b
--- /dev/null
+++ b/spec/controllers/posts_controller_spec.rb
@@ -0,0 +1,150 @@
+require 'rails_helper'
+
+# This spec was generated by rspec-rails when you ran the scaffold generator.
+# It demonstrates how one might use RSpec to specify the controller code that
+# was generated by Rails when you ran the scaffold generator.
+#
+# It assumes that the implementation code is generated by the rails scaffold
+# generator. If you are using any extension libraries to generate different
+# controller code, this generated spec may or may not pass.
+#
+# It only uses APIs available in rails and/or rspec-rails. There are a number
+# of tools you can use to make these specs even more expressive, but we're
+# sticking to rails and rspec-rails APIs to keep things simple and stable.
+#
+# Compared to earlier versions of this generator, there is very limited use of
+# stubs and message expectations in this spec. Stubs are only used when there
+# is no simpler way to get a handle on the object needed for the example.
+# Message expectations are only used when there is no simpler way to specify
+# that an instance is receiving a specific message.
+#
+# Also compared to earlier versions of this generator, there are no longer any
+# expectations of assigns and templates rendered. These features have been
+# removed from Rails core in Rails 5, but can be added back in via the
+# `rails-controller-testing` gem.
+
+RSpec.describe PostsController, type: :controller do
+
+ # This should return the minimal set of attributes required to create a valid
+ # Post. As you add validations to Post, be sure to
+ # adjust the attributes here as well.
+ let(:valid_attributes) {
+ {
+ title: "A new blog post",
+ body: "The body of the post"
+ }
+ }
+
+ let(:invalid_attributes) {
+ {
+ title: nil,
+ body: nil
+ }
+ }
+
+ # This should return the minimal set of values that should be in the session
+ # in order to pass any filters (e.g. authentication) defined in
+ # PostsController. Be sure to keep this updated too.
+ let(:valid_session) { {} }
+
+ describe "GET #index" do
+ it "returns a success response" do
+ post = Post.create! valid_attributes
+ get :index, params: {}, session: valid_session
+ expect(response).to be_success
+ end
+ end
+
+ describe "GET #show" do
+ it "returns a success response" do
+ post = Post.create! valid_attributes
+ get :show, params: {id: post.to_param}, session: valid_session
+ expect(response).to be_success
+ end
+ end
+
+ describe "GET #new" do
+ it "returns a success response" do
+ get :new, params: {}, session: valid_session
+ expect(response).to be_success
+ end
+ end
+
+ describe "GET #edit" do
+ it "returns a success response" do
+ post = Post.create! valid_attributes
+ get :edit, params: {id: post.to_param}, session: valid_session
+ expect(response).to be_success
+ end
+ end
+
+ describe "POST #create" do
+ context "with valid params" do
+ it "creates a new Post" do
+ expect {
+ post :create, params: {post: valid_attributes}, session: valid_session
+ }.to change(Post, :count).by(1)
+ end
+
+ it "redirects to the created post" do
+ post :create, params: {post: valid_attributes}, session: valid_session
+ expect(response).to redirect_to(Post.last)
+ end
+ end
+
+ context "with invalid params" do
+ it "returns a success response (i.e. to display the 'new' template)" do
+ post :create, params: {post: invalid_attributes}, session: valid_session
+ expect(response).to be_success
+ end
+ end
+ end
+
+ describe "PUT #update" do
+ context "with valid params" do
+ let(:new_attributes) {
+ {
+ title: "Zomg updated!",
+ body: "The updated blog post..."
+ }
+ }
+
+ it "updates the requested post" do
+ post = Post.create! valid_attributes
+ put :update, params: {id: post.to_param, post: new_attributes}, session: valid_session
+ post.reload
+ expect(post.title).to eq("Zomg updated!")
+ end
+
+ it "redirects to the post" do
+ post = Post.create! valid_attributes
+ put :update, params: {id: post.to_param, post: valid_attributes}, session: valid_session
+ expect(response).to redirect_to(post)
+ end
+ end
+
+ context "with invalid params" do
+ it "returns a success response (i.e. to display the 'edit' template)" do
+ post = Post.create! valid_attributes
+ put :update, params: {id: post.to_param, post: invalid_attributes}, session: valid_session
+ expect(response).to be_success
+ end
+ end
+ end
+
+ describe "DELETE #destroy" do
+ it "destroys the requested post" do
+ post = Post.create! valid_attributes
+ expect {
+ delete :destroy, params: {id: post.to_param}, session: valid_session
+ }.to change(Post, :count).by(-1)
+ end
+
+ it "redirects to the posts list" do
+ post = Post.create! valid_attributes
+ delete :destroy, params: {id: post.to_param}, session: valid_session
+ expect(response).to redirect_to(posts_url)
+ end
+ end
+
+end
diff --git a/spec/controllers/welcome_controller_spec.rb b/spec/controllers/welcome_controller_spec.rb
new file mode 100755
index 0000000..133f9e7
--- /dev/null
+++ b/spec/controllers/welcome_controller_spec.rb
@@ -0,0 +1,12 @@
+require 'rails_helper'
+
+RSpec.describe WelcomeController, type: :controller do
+
+ describe "GET #index" do
+ it "returns http success" do
+ get :index
+ expect(response).to have_http_status(:success)
+ end
+ end
+
+end
diff --git a/spec/helpers/posts_helper_spec.rb b/spec/helpers/posts_helper_spec.rb
new file mode 100755
index 0000000..f3d00cb
--- /dev/null
+++ b/spec/helpers/posts_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the PostsHelper. For example:
+#
+# describe PostsHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe PostsHelper, type: :helper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/helpers/welcome_helper_spec.rb b/spec/helpers/welcome_helper_spec.rb
new file mode 100755
index 0000000..a899852
--- /dev/null
+++ b/spec/helpers/welcome_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the WelcomeHelper. For example:
+#
+# describe WelcomeHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe WelcomeHelper, type: :helper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb
new file mode 100755
index 0000000..1f612d5
--- /dev/null
+++ b/spec/models/post_spec.rb
@@ -0,0 +1,35 @@
+require 'rails_helper'
+
+RSpec.describe Post, type: :model do
+ # This should return the minimal set of attributes required to create a valid
+ # Post. As you add validations to Post, be sure to
+ # adjust the attributes here as well.
+ let(:valid_attributes) {
+ {
+ title: "A new blog post",
+ body: "The body of the post"
+ }
+ }
+
+ let(:invalid_attributes) {
+ {
+ title: nil,
+ body: nil
+ }
+ }
+
+ describe "an valid post" do
+ it {
+ post = Post.new valid_attributes
+ expect(post.valid?).to be_truthy
+ expect { post.save }.to change { Post.count }.by(1)
+ }
+ end
+
+ describe "an invalid post" do
+ it {
+ post = Post.new invalid_attributes
+ expect(post.valid?).to be_falsey
+ }
+ end
+end
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
new file mode 100755
index 0000000..46ba8e0
--- /dev/null
+++ b/spec/rails_helper.rb
@@ -0,0 +1,57 @@
+# This file is copied to spec/ when you run 'rails generate rspec:install'
+require 'spec_helper'
+ENV['RAILS_ENV'] ||= 'test'
+require File.expand_path('../../config/environment', __FILE__)
+# Prevent database truncation if the environment is production
+abort("The Rails environment is running in production mode!") if Rails.env.production?
+require 'rspec/rails'
+# Add additional requires below this line. Rails is not loaded until this point!
+
+# Requires supporting ruby files with custom matchers and macros, etc, in
+# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
+# run as spec files by default. This means that files in spec/support that end
+# in _spec.rb will both be required and run as specs, causing the specs to be
+# run twice. It is recommended that you do not name files matching this glob to
+# end with _spec.rb. You can configure this pattern with the --pattern
+# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
+#
+# The following line is provided for convenience purposes. It has the downside
+# of increasing the boot-up time by auto-requiring all files in the support
+# directory. Alternatively, in the individual `*_spec.rb` files, manually
+# require only the support files necessary.
+#
+# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
+
+# Checks for pending migration and applies them before tests are run.
+# If you are not using ActiveRecord, you can remove this line.
+ActiveRecord::Migration.maintain_test_schema!
+
+RSpec.configure do |config|
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, remove the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = true
+
+ # RSpec Rails can automatically mix in different behaviours to your tests
+ # based on their file location, for example enabling you to call `get` and
+ # `post` in specs under `spec/controllers`.
+ #
+ # You can disable this behaviour by removing the line below, and instead
+ # explicitly tag your specs with their type, e.g.:
+ #
+ # RSpec.describe UsersController, :type => :controller do
+ # # ...
+ # end
+ #
+ # The different available types are documented in the features, such as in
+ # https://relishapp.com/rspec/rspec-rails/docs
+ config.infer_spec_type_from_file_location!
+
+ # Filter lines from Rails gems in backtraces.
+ config.filter_rails_from_backtrace!
+ # arbitrary gems may also be filtered via:
+ # config.filter_gems_from_backtrace("gem name")
+end
diff --git a/spec/requests/posts_spec.rb b/spec/requests/posts_spec.rb
new file mode 100755
index 0000000..7bbf3bc
--- /dev/null
+++ b/spec/requests/posts_spec.rb
@@ -0,0 +1,10 @@
+require 'rails_helper'
+
+RSpec.describe "Posts", type: :request do
+ describe "GET /posts" do
+ it "works! (now write some real specs)" do
+ get posts_path
+ expect(response).to have_http_status(200)
+ end
+ end
+end
diff --git a/spec/routing/posts_routing_spec.rb b/spec/routing/posts_routing_spec.rb
new file mode 100755
index 0000000..c691c1f
--- /dev/null
+++ b/spec/routing/posts_routing_spec.rb
@@ -0,0 +1,39 @@
+require "rails_helper"
+
+RSpec.describe PostsController, type: :routing do
+ describe "routing" do
+
+ it "routes to #index" do
+ expect(:get => "/posts").to route_to("posts#index")
+ end
+
+ it "routes to #new" do
+ expect(:get => "/posts/new").to route_to("posts#new")
+ end
+
+ it "routes to #show" do
+ expect(:get => "/posts/1").to route_to("posts#show", :id => "1")
+ end
+
+ it "routes to #edit" do
+ expect(:get => "/posts/1/edit").to route_to("posts#edit", :id => "1")
+ end
+
+ it "routes to #create" do
+ expect(:post => "/posts").to route_to("posts#create")
+ end
+
+ it "routes to #update via PUT" do
+ expect(:put => "/posts/1").to route_to("posts#update", :id => "1")
+ end
+
+ it "routes to #update via PATCH" do
+ expect(:patch => "/posts/1").to route_to("posts#update", :id => "1")
+ end
+
+ it "routes to #destroy" do
+ expect(:delete => "/posts/1").to route_to("posts#destroy", :id => "1")
+ end
+
+ end
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
new file mode 100755
index 0000000..ce33d66
--- /dev/null
+++ b/spec/spec_helper.rb
@@ -0,0 +1,96 @@
+# This file was generated by the `rails generate rspec:install` command. Conventionally, all
+# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
+# The generated `.rspec` file contains `--require spec_helper` which will cause
+# this file to always be loaded, without a need to explicitly require it in any
+# files.
+#
+# Given that it is always loaded, you are encouraged to keep this file as
+# light-weight as possible. Requiring heavyweight dependencies from this file
+# will add to the boot time of your test suite on EVERY test run, even for an
+# individual file that may not need all of that loaded. Instead, consider making
+# a separate helper file that requires the additional dependencies and performs
+# the additional setup, and require it from the spec files that actually need
+# it.
+#
+# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+RSpec.configure do |config|
+ # rspec-expectations config goes here. You can use an alternate
+ # assertion/expectation library such as wrong or the stdlib/minitest
+ # assertions if you prefer.
+ config.expect_with :rspec do |expectations|
+ # This option will default to `true` in RSpec 4. It makes the `description`
+ # and `failure_message` of custom matchers include text for helper methods
+ # defined using `chain`, e.g.:
+ # be_bigger_than(2).and_smaller_than(4).description
+ # # => "be bigger than 2 and smaller than 4"
+ # ...rather than:
+ # # => "be bigger than 2"
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
+ end
+
+ # rspec-mocks config goes here. You can use an alternate test double
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
+ config.mock_with :rspec do |mocks|
+ # Prevents you from mocking or stubbing a method that does not exist on
+ # a real object. This is generally recommended, and will default to
+ # `true` in RSpec 4.
+ mocks.verify_partial_doubles = true
+ end
+
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
+ # have no way to turn it off -- the option exists only for backwards
+ # compatibility in RSpec 3). It causes shared context metadata to be
+ # inherited by the metadata hash of host groups and examples, rather than
+ # triggering implicit auto-inclusion in groups with matching metadata.
+ config.shared_context_metadata_behavior = :apply_to_host_groups
+
+# The settings below are suggested to provide a good initial experience
+# with RSpec, but feel free to customize to your heart's content.
+=begin
+ # This allows you to limit a spec run to individual examples or groups
+ # you care about by tagging them with `:focus` metadata. When nothing
+ # is tagged with `:focus`, all examples get run. RSpec also provides
+ # aliases for `it`, `describe`, and `context` that include `:focus`
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
+ config.filter_run_when_matching :focus
+
+ # Allows RSpec to persist some state between runs in order to support
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
+ # you configure your source control system to ignore this file.
+ config.example_status_persistence_file_path = "spec/examples.txt"
+
+ # Limits the available syntax to the non-monkey patched syntax that is
+ # recommended. For more details, see:
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
+ config.disable_monkey_patching!
+
+ # Many RSpec users commonly either run the entire suite or an individual
+ # file, and it's useful to allow more verbose output when running an
+ # individual spec file.
+ if config.files_to_run.one?
+ # Use the documentation formatter for detailed output,
+ # unless a formatter has already been configured
+ # (e.g. via a command-line flag).
+ config.default_formatter = "doc"
+ end
+
+ # Print the 10 slowest examples and example groups at the
+ # end of the spec run, to help surface which specs are running
+ # particularly slow.
+ config.profile_examples = 10
+
+ # Run specs in random order to surface order dependencies. If you find an
+ # order dependency and want to debug it, you can fix the order by providing
+ # the seed, which is printed after each run.
+ # --seed 1234
+ config.order = :random
+
+ # Seed global randomization in this process using the `--seed` CLI option.
+ # Setting this allows you to use `--seed` to deterministically reproduce
+ # test failures related to randomization by passing the same `--seed` value
+ # as the one that triggered the failure.
+ Kernel.srand config.seed
+=end
+end
diff --git a/spec/views/posts/edit.html.erb_spec.rb b/spec/views/posts/edit.html.erb_spec.rb
new file mode 100755
index 0000000..8a29773
--- /dev/null
+++ b/spec/views/posts/edit.html.erb_spec.rb
@@ -0,0 +1,24 @@
+require 'rails_helper'
+
+RSpec.describe "posts/edit", type: :view do
+ before(:each) do
+ @post = assign(:post, Post.create!(
+ :title => "MyString",
+ :body => "MyText",
+ :published => false
+ ))
+ end
+
+ it "renders the edit post form" do
+ render
+
+ assert_select "form[action=?][method=?]", post_path(@post), "post" do
+
+ assert_select "input[name=?]", "post[title]"
+
+ assert_select "textarea[name=?]", "post[body]"
+
+ assert_select "input[name=?]", "post[published]"
+ end
+ end
+end
diff --git a/spec/views/posts/index.html.erb_spec.rb b/spec/views/posts/index.html.erb_spec.rb
new file mode 100755
index 0000000..54e6478
--- /dev/null
+++ b/spec/views/posts/index.html.erb_spec.rb
@@ -0,0 +1,25 @@
+require 'rails_helper'
+
+RSpec.describe "posts/index", type: :view do
+ before(:each) do
+ assign(:posts, [
+ Post.create!(
+ :title => "Title",
+ :body => "MyText",
+ :published => false
+ ),
+ Post.create!(
+ :title => "Title",
+ :body => "MyText",
+ :published => false
+ )
+ ])
+ end
+
+ it "renders a list of posts" do
+ render
+ assert_select "tr>td", :text => "Title".to_s, :count => 2
+ assert_select "tr>td", :text => "MyText".to_s, :count => 2
+ assert_select "tr>td", :text => false.to_s, :count => 2
+ end
+end
diff --git a/spec/views/posts/new.html.erb_spec.rb b/spec/views/posts/new.html.erb_spec.rb
new file mode 100755
index 0000000..35dc655
--- /dev/null
+++ b/spec/views/posts/new.html.erb_spec.rb
@@ -0,0 +1,24 @@
+require 'rails_helper'
+
+RSpec.describe "posts/new", type: :view do
+ before(:each) do
+ assign(:post, Post.new(
+ :title => "MyString",
+ :body => "MyText",
+ :published => false
+ ))
+ end
+
+ it "renders new post form" do
+ render
+
+ assert_select "form[action=?][method=?]", posts_path, "post" do
+
+ assert_select "input[name=?]", "post[title]"
+
+ assert_select "textarea[name=?]", "post[body]"
+
+ assert_select "input[name=?]", "post[published]"
+ end
+ end
+end
diff --git a/spec/views/posts/show.html.erb_spec.rb b/spec/views/posts/show.html.erb_spec.rb
new file mode 100755
index 0000000..08de291
--- /dev/null
+++ b/spec/views/posts/show.html.erb_spec.rb
@@ -0,0 +1,18 @@
+require 'rails_helper'
+
+RSpec.describe "posts/show", type: :view do
+ before(:each) do
+ @post = assign(:post, Post.create!(
+ :title => "Title",
+ :body => "MyText",
+ :published => false
+ ))
+ end
+
+ it "renders attributes in " do
+ render
+ expect(rendered).to match(/Title/)
+ expect(rendered).to match(/MyText/)
+ expect(rendered).to match(/false/)
+ end
+end
diff --git a/spec/views/welcome/index.html.erb_spec.rb b/spec/views/welcome/index.html.erb_spec.rb
new file mode 100755
index 0000000..226835c
--- /dev/null
+++ b/spec/views/welcome/index.html.erb_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe "welcome/index.html.erb", type: :view do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb
new file mode 100755
index 0000000..d19212a
--- /dev/null
+++ b/test/application_system_test_case.rb
@@ -0,0 +1,5 @@
+require "test_helper"
+
+class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
+ driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
+end
diff --git a/test/controllers/.keep b/test/controllers/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/test/fixtures/.keep b/test/fixtures/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/test/fixtures/files/.keep b/test/fixtures/files/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/test/helpers/.keep b/test/helpers/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/test/integration/.keep b/test/integration/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/test/mailers/.keep b/test/mailers/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/test/models/.keep b/test/models/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/test/system/.keep b/test/system/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/test/system/posts_test.rb b/test/system/posts_test.rb
new file mode 100755
index 0000000..d2d2fc3
--- /dev/null
+++ b/test/system/posts_test.rb
@@ -0,0 +1,9 @@
+require "application_system_test_case"
+
+class PostsTest < ApplicationSystemTestCase
+ # test "visiting the index" do
+ # visit posts_url
+ #
+ # assert_selector "h1", text: "Post"
+ # end
+end
diff --git a/test/test_helper.rb b/test/test_helper.rb
new file mode 100755
index 0000000..e3c4ff0
--- /dev/null
+++ b/test/test_helper.rb
@@ -0,0 +1,9 @@
+require File.expand_path('../../config/environment', __FILE__)
+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
diff --git a/tmp/.keep b/tmp/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/vendor/.keep b/vendor/.keep
new file mode 100755
index 0000000..e69de29
diff --git a/yarn.lock b/yarn.lock
new file mode 100755
index 0000000..4933806
--- /dev/null
+++ b/yarn.lock
@@ -0,0 +1,7 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
+bootstrap@^3.3.7:
+ version "3.3.7"
+ resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-3.3.7.tgz#5a389394549f23330875a3b150656574f8a9eb71"