From 79cba187692c9964dd7a3b97c323768566347f40 Mon Sep 17 00:00:00 2001 From: mo khan Date: Sun, 15 Mar 2020 11:49:09 -0600 Subject: Add rails application --- .gitignore | 2 + rvh/Gemfile | 4 + rvh/Gemfile.lock | 137 +++++++++++++++++++++++++++++++++ rvh/Rakefile | 6 ++ rvh/app/models/application_record.rb | 3 + rvh/bin/rails | 4 + rvh/bin/setup | 13 ++++ rvh/config.ru | 5 ++ rvh/config/application.rb | 13 ++++ rvh/config/boot.rb | 3 + rvh/config/database.yml.sample | 8 ++ rvh/config/environment.rb | 3 + rvh/config/environments/development.rb | 8 ++ rvh/config/initializers/inflections.rb | 3 + rvh/db/schema.rb | 15 ++++ 15 files changed, 227 insertions(+) create mode 100644 rvh/Gemfile create mode 100644 rvh/Gemfile.lock create mode 100644 rvh/Rakefile create mode 100644 rvh/app/models/application_record.rb create mode 100755 rvh/bin/rails create mode 100755 rvh/bin/setup create mode 100644 rvh/config.ru create mode 100644 rvh/config/application.rb create mode 100644 rvh/config/boot.rb create mode 100644 rvh/config/database.yml.sample create mode 100644 rvh/config/environment.rb create mode 100644 rvh/config/environments/development.rb create mode 100644 rvh/config/initializers/inflections.rb create mode 100644 rvh/db/schema.rb diff --git a/.gitignore b/.gitignore index 981f145..100b7ac 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ assignments/**/*.pdf db/data/ tmp +*.sqlite* +database.yml diff --git a/rvh/Gemfile b/rvh/Gemfile new file mode 100644 index 0000000..6c4b309 --- /dev/null +++ b/rvh/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +gem 'rails', '~> 6.0.2', '>= 6.0.2.1' +gem 'sqlite3', '~> 1.4' diff --git a/rvh/Gemfile.lock b/rvh/Gemfile.lock new file mode 100644 index 0000000..39a153b --- /dev/null +++ b/rvh/Gemfile.lock @@ -0,0 +1,137 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.0.2.1) + actionpack (= 6.0.2.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.0.2.1) + actionpack (= 6.0.2.1) + activejob (= 6.0.2.1) + activerecord (= 6.0.2.1) + activestorage (= 6.0.2.1) + activesupport (= 6.0.2.1) + mail (>= 2.7.1) + actionmailer (6.0.2.1) + actionpack (= 6.0.2.1) + actionview (= 6.0.2.1) + activejob (= 6.0.2.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.0.2.1) + actionview (= 6.0.2.1) + activesupport (= 6.0.2.1) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.2.1) + actionpack (= 6.0.2.1) + activerecord (= 6.0.2.1) + activestorage (= 6.0.2.1) + activesupport (= 6.0.2.1) + nokogiri (>= 1.8.5) + actionview (6.0.2.1) + activesupport (= 6.0.2.1) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.0.2.1) + activesupport (= 6.0.2.1) + globalid (>= 0.3.6) + activemodel (6.0.2.1) + activesupport (= 6.0.2.1) + activerecord (6.0.2.1) + activemodel (= 6.0.2.1) + activesupport (= 6.0.2.1) + activestorage (6.0.2.1) + actionpack (= 6.0.2.1) + activejob (= 6.0.2.1) + activerecord (= 6.0.2.1) + marcel (~> 0.3.1) + activesupport (6.0.2.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + zeitwerk (~> 2.2) + builder (3.2.4) + concurrent-ruby (1.1.6) + crass (1.0.6) + erubi (1.9.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (1.8.2) + concurrent-ruby (~> 1.0) + loofah (2.4.0) + 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.4) + mini_mime (1.0.2) + mini_portile2 (2.4.0) + minitest (5.14.0) + nio4r (2.5.2) + nokogiri (1.10.9) + mini_portile2 (~> 2.4.0) + rack (2.2.2) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (6.0.2.1) + actioncable (= 6.0.2.1) + actionmailbox (= 6.0.2.1) + actionmailer (= 6.0.2.1) + actionpack (= 6.0.2.1) + actiontext (= 6.0.2.1) + actionview (= 6.0.2.1) + activejob (= 6.0.2.1) + activemodel (= 6.0.2.1) + activerecord (= 6.0.2.1) + activestorage (= 6.0.2.1) + activesupport (= 6.0.2.1) + bundler (>= 1.3.0) + railties (= 6.0.2.1) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (6.0.2.1) + actionpack (= 6.0.2.1) + activesupport (= 6.0.2.1) + method_source + rake (>= 0.8.7) + thor (>= 0.20.3, < 2.0) + rake (13.0.1) + sprockets (4.0.0) + 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.2) + thor (1.0.1) + thread_safe (0.3.6) + tzinfo (1.2.6) + thread_safe (~> 0.1) + websocket-driver (0.7.1) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.4) + zeitwerk (2.3.0) + +PLATFORMS + ruby + +DEPENDENCIES + rails (~> 6.0.2, >= 6.0.2.1) + sqlite3 (~> 1.4) + +BUNDLED WITH + 2.1.4 diff --git a/rvh/Rakefile b/rvh/Rakefile new file mode 100644 index 0000000..e85f913 --- /dev/null +++ b/rvh/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/rvh/app/models/application_record.rb b/rvh/app/models/application_record.rb new file mode 100644 index 0000000..10a4cba --- /dev/null +++ b/rvh/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/rvh/bin/rails b/rvh/bin/rails new file mode 100755 index 0000000..0739660 --- /dev/null +++ b/rvh/bin/rails @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +APP_PATH = File.expand_path('../config/application', __dir__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/rvh/bin/setup b/rvh/bin/setup new file mode 100755 index 0000000..7606fd6 --- /dev/null +++ b/rvh/bin/setup @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +Dir.chdir File.expand_path('..', __dir__) do + system! 'bundle install' + system! 'cp config/database.yml.sample config/database.yml' unless File.exist?('config/database.yml') + system! 'bin/rails db:prepare' + system! 'bin/rails log:clear tmp:clear' + system! 'bin/rails restart' +end diff --git a/rvh/config.ru b/rvh/config.ru new file mode 100644 index 0000000..f7ba0b5 --- /dev/null +++ b/rvh/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/rvh/config/application.rb b/rvh/config/application.rb new file mode 100644 index 0000000..14cc56a --- /dev/null +++ b/rvh/config/application.rb @@ -0,0 +1,13 @@ +require_relative 'boot' +require "rails" +require "active_model/railtie" +require "active_record/railtie" + +Bundler.require(*Rails.groups) + +module Rvh + class Application < Rails::Application + config.load_defaults 6.0 + config.api_only = true + end +end diff --git a/rvh/config/boot.rb b/rvh/config/boot.rb new file mode 100644 index 0000000..5cea2ab --- /dev/null +++ b/rvh/config/boot.rb @@ -0,0 +1,3 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) + +require 'bundler/setup' diff --git a/rvh/config/database.yml.sample b/rvh/config/database.yml.sample new file mode 100644 index 0000000..18e724b --- /dev/null +++ b/rvh/config/database.yml.sample @@ -0,0 +1,8 @@ +default: &default + adapter: sqlite3 + pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> + timeout: 5000 + +development: + <<: *default + database: db/development.sqlite3 diff --git a/rvh/config/environment.rb b/rvh/config/environment.rb new file mode 100644 index 0000000..875ab0f --- /dev/null +++ b/rvh/config/environment.rb @@ -0,0 +1,3 @@ +require_relative 'application' + +Rails.application.initialize! diff --git a/rvh/config/environments/development.rb b/rvh/config/environments/development.rb new file mode 100644 index 0000000..995d562 --- /dev/null +++ b/rvh/config/environments/development.rb @@ -0,0 +1,8 @@ +Rails.application.configure do + config.cache_classes = false + config.eager_load = false + config.consider_all_requests_local = true + config.active_support.deprecation = :log + config.active_record.migration_error = :page_load + config.active_record.verbose_query_logs = true +end diff --git a/rvh/config/initializers/inflections.rb b/rvh/config/initializers/inflections.rb new file mode 100644 index 0000000..220d228 --- /dev/null +++ b/rvh/config/initializers/inflections.rb @@ -0,0 +1,3 @@ +ActiveSupport::Inflector.inflections(:en) do |inflect| + inflect.irregular 'person', 'people' +end diff --git a/rvh/db/schema.rb b/rvh/db/schema.rb new file mode 100644 index 0000000..79b5c13 --- /dev/null +++ b/rvh/db/schema.rb @@ -0,0 +1,15 @@ +# 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. +# +# This file is the source Rails uses to define your schema when running `rails +# db:schema:load`. When creating a new database, `rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 0) do + +end -- cgit v1.2.3