Skip to content

Commit

Permalink
Generate Rails API application
Browse files Browse the repository at this point in the history
  • Loading branch information
pavolzbell committed Oct 17, 2018
1 parent a9766cc commit 38e7970
Show file tree
Hide file tree
Showing 39 changed files with 576 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitignore
@@ -0,0 +1,17 @@
# 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 all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore master key for decrypting credentials and more.
/config/master.key
16 changes: 16 additions & 0 deletions Gemfile
@@ -0,0 +1,16 @@
source 'https://rubygems.org'

ruby '2.5.0', engine: 'jruby', engine_version: '9.2.0.0'

gem 'rails', '~> 5.2.1'
gem 'activerecord-jdbcpostgresql-adapter'
gem 'puma', '~> 3.11'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.5'

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
132 changes: 132 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,132 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.1)
actionpack (= 5.2.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.1)
actionpack (= 5.2.1)
actionview (= 5.2.1)
activejob (= 5.2.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.1)
actionview (= 5.2.1)
activesupport (= 5.2.1)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.1)
activesupport (= 5.2.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.1)
activesupport (= 5.2.1)
globalid (>= 0.3.6)
activemodel (5.2.1)
activesupport (= 5.2.1)
activerecord (5.2.1)
activemodel (= 5.2.1)
activesupport (= 5.2.1)
arel (>= 9.0)
activerecord-jdbc-adapter (52.1-java)
activerecord (~> 5.2.0)
activerecord-jdbcpostgresql-adapter (52.1-java)
activerecord-jdbc-adapter (= 52.1)
jdbc-postgres (>= 9.4, < 43)
activestorage (5.2.1)
actionpack (= 5.2.1)
activerecord (= 5.2.1)
marcel (~> 0.3.1)
activesupport (5.2.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (9.0.0)
builder (3.2.3)
concurrent-ruby (1.0.5-java)
crass (1.0.4)
erubi (1.7.1)
globalid (0.4.1)
activesupport (>= 4.2.0)
i18n (1.1.1)
concurrent-ruby (~> 1.0)
jdbc-postgres (42.1.4)
loofah (2.2.2)
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.0)
mimemagic (0.3.2)
mini_mime (1.0.1)
minitest (5.11.3)
nio4r (2.3.1-java)
nokogiri (1.8.5-java)
puma (3.12.0-java)
rack (2.0.5)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.1)
actioncable (= 5.2.1)
actionmailer (= 5.2.1)
actionpack (= 5.2.1)
actionview (= 5.2.1)
activejob (= 5.2.1)
activemodel (= 5.2.1)
activerecord (= 5.2.1)
activestorage (= 5.2.1)
activesupport (= 5.2.1)
bundler (>= 1.3.0)
railties (= 5.2.1)
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.1)
actionpack (= 5.2.1)
activesupport (= 5.2.1)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rake (12.3.1)
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-java)
tzinfo (1.2.5)
thread_safe (~> 0.1)
tzinfo-data (1.2018.5)
tzinfo (>= 1.0.0)
websocket-driver (0.7.0-java)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)

PLATFORMS
java

DEPENDENCIES
activerecord-jdbcpostgresql-adapter
puma (~> 3.11)
rails (~> 5.2.1)
tzinfo-data

RUBY VERSION
ruby 2.5.0p0 (jruby 9.2.0.0)

BUNDLED WITH
1.16.6
1 change: 1 addition & 0 deletions README.md
@@ -0,0 +1 @@
# PODAAS
6 changes: 6 additions & 0 deletions 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
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
@@ -0,0 +1,2 @@
class ApplicationController < ActionController::API
end
Empty file added app/controllers/concerns/.keep
Empty file.
2 changes: 2 additions & 0 deletions app/jobs/application_job.rb
@@ -0,0 +1,2 @@
class ApplicationJob < ActiveJob::Base
end
3 changes: 3 additions & 0 deletions app/models/application_record.rb
@@ -0,0 +1,3 @@
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
Empty file added app/models/concerns/.keep
Empty file.
3 changes: 3 additions & 0 deletions bin/bundle
@@ -0,0 +1,3 @@
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
load Gem.bin_path('bundler', 'bundle')
4 changes: 4 additions & 0 deletions 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'
4 changes: 4 additions & 0 deletions bin/rake
@@ -0,0 +1,4 @@
#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
Rake.application.run
33 changes: 33 additions & 0 deletions bin/setup
@@ -0,0 +1,33 @@
#!/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')

# 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
28 changes: 28 additions & 0 deletions bin/update
@@ -0,0 +1,28 @@
#!/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')

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
5 changes: 5 additions & 0 deletions 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
35 changes: 35 additions & 0 deletions config/application.rb
@@ -0,0 +1,35 @@
require_relative 'boot'

require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
# require "active_storage/engine"
require "action_controller/railtie"
# require "action_mailer/railtie"
require "action_view/railtie"
# require "action_cable/engine"
# require "sprockets/railtie"
# require "rails/test_unit/railtie"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module Podaas
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2

# 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.

# Only loads a smaller set of middleware suitable for API only apps.
# Middleware like session, flash, cookies can be added back manually.
# Skip views, helpers and assets when generating a new resource.
config.api_only = true
end
end
3 changes: 3 additions & 0 deletions 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.
1 change: 1 addition & 0 deletions config/credentials.yml.enc
@@ -0,0 +1 @@
C9YAddgQzGvIv+HWQ58KP4k4/Ul1y0X6Bc1ngwyR8CyszuEIz80bodvXBYr+VsTnEg9A9349fYORoy3+lUENFLrCfTAulXqiniKJ9eeVEkiR4EIR8sn0jBKoNf+bGsbpsv//h9l3PMfZOet86MUa3I51ntZ7eHEpLor+CIBfLj/ai3leihLB2w0/HmoH1Q6ZOE5PrT62ALUckUwLx9MVvPbVqau3uJc4BHY6Jg56YuE+oqLchT3POf9q2A8breKXHNTEDDDwS1rxQYojh44QBi6f0swnquzSi46w6aDen2RhIADbkS7f5qNAvCpukcN0JQNGgEV3GaIWVyQ8fGYOVkAniiSknZiqfei0PhRbFoVIJ9bl1cg1nJqYKNuTGcxNdJrrX4/GZo/gSK4TYWmbm1Zdvt5Qdfy3QLMb--nEaF652XcskP2cz4--G32I8xgQ7mR7VeRxKbRMrw==
26 changes: 26 additions & 0 deletions config/database.yml
@@ -0,0 +1,26 @@
default: &default
adapter: postgresql
encoding: unicode
pool: 50

development:
<<: *default
host: localhost
database: podaas_ecosystem_development
username: podaas_ecosystem
password: podaas_ecosystem

test:
<<: *default
host: localhost
database: podaas_ecosystem_test
username: podaas_ecosystem
password: podaas_ecosystem

staging:
url: <%= ENV['DATABASE_URL'] %>
pool: 30

production:
url: <%= ENV['DATABASE_URL'] %>
pool: 50
5 changes: 5 additions & 0 deletions config/environment.rb
@@ -0,0 +1,5 @@
# Load the Rails application.
require_relative 'application'

# Initialize the Rails application.
Rails.application.initialize!
46 changes: 46 additions & 0 deletions config/environments/development.rb
@@ -0,0 +1,46 @@
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

# 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


# 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

0 comments on commit 38e7970

Please sign in to comment.