warder 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/bin/warder +3 -46
  4. data/features/checks_for_rails_related_security_issues.feature +25 -0
  5. data/features/step_definitions/checks_for_rails_security_issues_steps.rb +20 -0
  6. data/features/support/env.rb +16 -0
  7. data/lib/warder/bundle_audit_runner.rb +4 -1
  8. data/lib/warder/cli/arguments.rb +58 -0
  9. data/lib/warder/cli.rb +21 -54
  10. data/lib/warder/code_complexity_runner.rb +6 -2
  11. data/lib/warder/code_duplication_runner.rb +4 -1
  12. data/lib/warder/code_smells_runner.rb +3 -0
  13. data/lib/warder/magick_numbers_runner.rb +3 -0
  14. data/lib/warder/rails_security_runner.rb +22 -0
  15. data/lib/warder/runner.rb +5 -4
  16. data/lib/warder/style_guide_runner.rb +3 -0
  17. data/lib/warder/version.rb +1 -1
  18. data/lib/warder.rb +11 -0
  19. data/spec/fixtures/invalid_code_smells.rb +1 -1
  20. data/spec/fixtures/invalid_rails_app/Gemfile +3 -0
  21. data/spec/fixtures/invalid_rails_app/Rakefile +6 -0
  22. data/spec/fixtures/invalid_rails_app/app/controllers/application_controller.rb +5 -0
  23. data/spec/fixtures/invalid_rails_app/app/views/layouts/application.html.erb +14 -0
  24. data/spec/fixtures/invalid_rails_app/config/application.rb +23 -0
  25. data/spec/fixtures/invalid_rails_app/config/boot.rb +4 -0
  26. data/spec/fixtures/invalid_rails_app/config/database.yml +25 -0
  27. data/spec/fixtures/invalid_rails_app/config/environment.rb +5 -0
  28. data/spec/fixtures/invalid_rails_app/config/environments/development.rb +29 -0
  29. data/spec/fixtures/invalid_rails_app/config/environments/production.rb +80 -0
  30. data/spec/fixtures/invalid_rails_app/config/environments/test.rb +36 -0
  31. data/spec/fixtures/invalid_rails_app/config/initializers/backtrace_silencers.rb +7 -0
  32. data/spec/fixtures/invalid_rails_app/config/initializers/filter_parameter_logging.rb +4 -0
  33. data/spec/fixtures/invalid_rails_app/config/initializers/inflections.rb +16 -0
  34. data/spec/fixtures/invalid_rails_app/config/initializers/mime_types.rb +5 -0
  35. data/spec/fixtures/invalid_rails_app/config/initializers/secret_token.rb +12 -0
  36. data/spec/fixtures/invalid_rails_app/config/initializers/session_store.rb +3 -0
  37. data/spec/fixtures/invalid_rails_app/config/initializers/wrap_parameters.rb +14 -0
  38. data/spec/fixtures/invalid_rails_app/config/locales/en.yml +23 -0
  39. data/spec/fixtures/invalid_rails_app/config/routes.rb +56 -0
  40. data/spec/fixtures/invalid_rails_app/config.ru +4 -0
  41. data/spec/fixtures/valid_rails_app/Gemfile +3 -0
  42. data/spec/fixtures/valid_rails_app/Rakefile +6 -0
  43. data/spec/fixtures/valid_rails_app/app/controllers/application_controller.rb +5 -0
  44. data/spec/fixtures/valid_rails_app/app/views/layouts/application.html.erb +14 -0
  45. data/spec/fixtures/valid_rails_app/config/application.rb +23 -0
  46. data/spec/fixtures/valid_rails_app/config/boot.rb +4 -0
  47. data/spec/fixtures/valid_rails_app/config/database.yml +25 -0
  48. data/spec/fixtures/valid_rails_app/config/environment.rb +5 -0
  49. data/spec/fixtures/valid_rails_app/config/environments/development.rb +29 -0
  50. data/spec/fixtures/valid_rails_app/config/environments/production.rb +80 -0
  51. data/spec/fixtures/valid_rails_app/config/environments/test.rb +36 -0
  52. data/spec/fixtures/valid_rails_app/config/initializers/backtrace_silencers.rb +7 -0
  53. data/spec/fixtures/valid_rails_app/config/initializers/filter_parameter_logging.rb +4 -0
  54. data/spec/fixtures/valid_rails_app/config/initializers/inflections.rb +16 -0
  55. data/spec/fixtures/valid_rails_app/config/initializers/mime_types.rb +5 -0
  56. data/spec/fixtures/valid_rails_app/config/initializers/secret_token.rb +12 -0
  57. data/spec/fixtures/valid_rails_app/config/initializers/session_store.rb +3 -0
  58. data/spec/fixtures/valid_rails_app/config/initializers/wrap_parameters.rb +14 -0
  59. data/spec/fixtures/valid_rails_app/config/locales/en.yml +23 -0
  60. data/spec/fixtures/valid_rails_app/config/routes.rb +56 -0
  61. data/spec/fixtures/valid_rails_app/config.ru +4 -0
  62. data/warder.gemspec +2 -1
  63. metadata +120 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7afe9d3043a0b79203eae14a874da4b7e7476b7f
4
- data.tar.gz: 77b48c7afb507db85255b71e0e8630db14e45a4b
3
+ metadata.gz: 113fd7d19ada4fb760793d5c72fd0c3e739653e7
4
+ data.tar.gz: bdc5fb0e9de6c1bf0c5a5bbdef4f7427c29f798a
5
5
  SHA512:
6
- metadata.gz: b76bcd34640d62415548719b48c4d7ba13608cccf4382ec08992912ae53b904ac308ae9d2d208b9667918e50bd5fed0cd93356d201fdebdc5bd6f8296ec6324e
7
- data.tar.gz: c56a8c2cd0659cb171d6372f873ffedf6bac5cc7c68e4212c95ab936f4a6cbad7328cff1b41fc53a9251b810ac0ccecc6b35558c41f28e384dbcbb8cc4ae741d
6
+ metadata.gz: 199fb858d92abff4390d4691616134ab2818816eeeaa67a5739e32074e253c1a704e35dada071a84d084b6f1bd20a952a36289daf4795b7ca376937e5ecb8c14
7
+ data.tar.gz: f07d90d73cf49617f9d7bff699fe16e3307cddcdaabb86bf6606914553f8cb02dec510f2224ff039d00be7be81ba0076efc3406277b172a87dabc131cf8991e1
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # Warder
2
2
 
3
- [![Travis CI](https://travis-ci.org/yltsrc/warder.png)](https://travis-ci.org/yltsrc/warder)
3
+ [![Build Status](https://travis-ci.org/yltsrc/warder.png?branch=master)](https://travis-ci.org/yltsrc/warder)
4
4
  [![Code Climate](https://codeclimate.com/github/yltsrc/warder.png)](https://codeclimate.com/github/yltsrc/warder)
5
+ [![Dependency Status](https://gemnasium.com/yltsrc/warder.png)](https://gemnasium.com/yltsrc/warder)
5
6
 
6
7
  TODO: Write a gem description
7
8
 
data/bin/warder CHANGED
@@ -1,50 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
3
+ lib = File.expand_path('../../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
 
5
- require 'optparse'
6
6
  require 'warder'
7
-
8
- options = {}
9
- OptionParser.new do |opts|
10
- opts.banner = 'Usage: warder [options] [dir1 file1 file2 ...]'
11
-
12
- desc = 'Run style guide validation'
13
- opts.on('-g', '--[no-]style-guide', desc) do |value|
14
- options[:style_guide] = value
15
- end
16
-
17
- desc = 'Run magick numbers validation'
18
- opts.on('-m', '--[no-]magick-numbers', desc) do |value|
19
- options[:magick_numbers] = value
20
- end
21
-
22
- desc = 'Run code duplication validation'
23
- opts.on('-d', '--[no-]code-duplication', desc) do |value|
24
- options[:code_duplication] = value
25
- end
26
-
27
- desc = 'Run code smells validation'
28
- opts.on('-s', '--[no-]code-smells', desc) do |value|
29
- options[:code_smells] = value
30
- end
31
-
32
- desc = 'Run code complexity validation'
33
- opts.on('-c', '--[no-]code-complexity', desc) do |value|
34
- options[:code_complexity] = value
35
- end
36
-
37
- desc = 'Run bundle freshness validation'
38
- opts.on('-b', '--[no-]bundle-audit', desc) do |value|
39
- options[:bundle_audit] = value
40
- end
41
-
42
- opts.on('-v', '--version', 'Show version') do |value|
43
- puts Warder::VERSION
44
- exit 0
45
- end
46
- end.parse!
47
-
48
- options[:files] = ARGV.empty? ? '.' : ARGV.join(' ')
49
-
50
- Warder::CLI.new(options).perform
7
+ Warder::CLI.new(ARGV).execute!
@@ -0,0 +1,25 @@
1
+ Feature: checks for rails related security issues
2
+ In order to find security issues
3
+ As a ruby developer
4
+ I want to run warder with --rails-security option
5
+
6
+ Scenario: run warder with enabled rails security option
7
+ Given I have valid_rails_app project in directory
8
+ And I am on project directory
9
+ When I run `warder --rails-security`
10
+ Then warder detects rails security issues
11
+ Then the exit status should be 0
12
+
13
+ Scenario: run warder with enabled rails security option on invalid project
14
+ Given I have invalid_rails_app project in directory
15
+ And I am on project directory
16
+ When I run `warder --rails-security`
17
+ Then warder detects rails security issues
18
+ Then the exit status should be 1
19
+
20
+ Scenario: run warder with disabled rails security option on invalid project
21
+ Given I have invalid_rails_app project in directory
22
+ And I am on project directory
23
+ When I run `warder --no-rails-security`
24
+ Then warder does nothing
25
+ Then the exit status should be 0
@@ -0,0 +1,20 @@
1
+ def executing_rails_security
2
+ "executing 'brakeman -q -p .'"
3
+ end
4
+
5
+ def rails_security_output
6
+ `cd tmp/aruba/#{@projectname}/ && brakeman -q -p .`
7
+ .split("\n")
8
+ .reject { |line| !line.match(/^\+|\|/) }
9
+ .join("\n")
10
+ end
11
+
12
+ Given(/^I have ((in)?valid_rails_app) project in directory$/) do |name, _|
13
+ @projectname = name
14
+ FileUtils.ln_s "../../spec/fixtures/#{@projectname}", 'tmp/aruba/'
15
+ expect(`ls tmp/aruba`).to match(@projectname)
16
+ end
17
+
18
+ Given(/^I am on project directory$/) do
19
+ @dirs = ["tmp/aruba/#{@projectname}"]
20
+ end
@@ -1,4 +1,20 @@
1
1
  require 'aruba/cucumber'
2
+ require 'aruba/in_process'
3
+
4
+ require 'simplecov'
5
+ SimpleCov.start do
6
+ add_filter '/features/'
7
+ add_filter '/spec/'
8
+ add_filter '/vendor/'
9
+ add_group 'Libraries', 'lib'
10
+ end
11
+ SimpleCov::MINIMUM_COVERAGE = 100
12
+ SimpleCov.minimum_coverage SimpleCov::MINIMUM_COVERAGE
2
13
 
3
14
  bin_path = "#{File.expand_path('../../../bin', __FILE__)}"
4
15
  ENV['PATH'] = "#{bin_path}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
16
+
17
+ require 'warder'
18
+
19
+ Aruba::InProcess.main_class = Warder::CLI
20
+ Aruba.process = Aruba::InProcess
@@ -1,13 +1,16 @@
1
1
  module Warder
2
2
  # responsible for run bundle freshness validation
3
3
  class BundleAuditRunner < Runner
4
+ CLI_OPTION = 'b'
5
+ CLI_FULL_OPTION = 'bundle-audit'
6
+ DESCRIPTION = 'Run bundle freshness validation'
4
7
  COMMAND_NAME = 'bundle-audit'
5
8
  FAILURE_REGEXP = /Unpatched versions found!/
6
9
 
7
10
  private
8
11
 
9
12
  def command_with_options
10
- path = @options.files[0]
13
+ path = @options.files.split(' ').first
11
14
  "#{COMMAND_NAME} update; (cd #{path} && #{COMMAND_NAME} check)"
12
15
  end
13
16
 
@@ -0,0 +1,58 @@
1
+ require 'optparse'
2
+
3
+ module Warder
4
+ class CLI
5
+ # responsible for parsing cli arguments
6
+ class Arguments
7
+ def initialize(argv, stdout, kernel)
8
+ @argv = argv
9
+ @stdout = stdout
10
+ @kernel = kernel
11
+ @options = {}
12
+ end
13
+
14
+ def parse
15
+ parse_options
16
+ assign_files
17
+ OpenStruct.new(@options)
18
+ end
19
+
20
+ private
21
+
22
+ def parse_options
23
+ OptionParser.new do |opts|
24
+ opts.banner = 'Usage: warder [options] [dir1 file1 file2 ...]'
25
+ validators(opts)
26
+ version(opts)
27
+ end.parse!(@argv)
28
+ end
29
+
30
+ def assign_files
31
+ @options['files'] = @argv.empty? ? '.' : @argv.join(' ')
32
+ end
33
+
34
+ def validators(opts)
35
+ Warder.validators.each do |validator|
36
+ validator(opts, validator)
37
+ end
38
+ end
39
+
40
+ def validator(opts, validator)
41
+ option = validator::CLI_OPTION
42
+ full_option = validator::CLI_FULL_OPTION
43
+ desc = validator::DESCRIPTION
44
+
45
+ opts.on("-#{option}", "--[no-]#{full_option}", desc) do |value|
46
+ @options[option] = value
47
+ end
48
+ end
49
+
50
+ def version(opts)
51
+ opts.on('-v', '--version', 'Show version') do |value|
52
+ @stdout.puts Warder::VERSION
53
+ @kernel.exit 0
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
data/lib/warder/cli.rb CHANGED
@@ -1,72 +1,39 @@
1
1
  module Warder
2
2
  # responsible for executing warder tools
3
3
  class CLI
4
- def initialize(options)
5
- @options = OpenStruct.new(options)
4
+ def initialize(argv, stdin = STDIN, stdout = STDOUT,
5
+ stderr = STDERR, kernel = Kernel)
6
+ @argv = argv
7
+ @stdin = stdin
8
+ @stdout = stdout
9
+ @stderr = stderr
10
+ @kernel = kernel
6
11
  end
7
12
 
8
- def perform
9
- exit perform_style_guide_validation +
10
- perform_magick_numbers_validation +
11
- perform_code_duplication_validation +
12
- perform_code_smells_validation +
13
- perform_code_complexity_validation +
14
- perform_bundle_freshness_validation
13
+ def execute!
14
+ @kernel.exit execute
15
15
  end
16
16
 
17
17
  private
18
18
 
19
- def perform_style_guide_validation
20
- if @options.style_guide
21
- runner = StyleGuideRunner.new(@options)
22
- runner.perform
23
- else
24
- 0
25
- end
26
- end
27
-
28
- def perform_magick_numbers_validation
29
- if @options.magick_numbers
30
- runner = MagickNumbersRunner.new(@options)
31
- runner.perform
32
- else
33
- 0
19
+ def execute
20
+ parse_arguments
21
+ exit_codes = Warder.validators.map do |validator|
22
+ perform_validation(validator)
34
23
  end
24
+ exit_codes.compact.inject(0, :+)
35
25
  end
36
26
 
37
- def perform_code_duplication_validation
38
- if @options.code_duplication
39
- runner = CodeDuplicationRunner.new(@options)
40
- runner.perform
41
- else
42
- 0
43
- end
44
- end
45
-
46
- def perform_code_smells_validation
47
- if @options.code_smells
48
- runner = CodeSmellsRunner.new(@options)
49
- runner.perform
50
- else
51
- 0
52
- end
53
- end
54
-
55
- def perform_code_complexity_validation
56
- if @options.code_complexity
57
- runner = CodeComplexityRunner.new(@options)
58
- runner.perform
59
- else
60
- 0
61
- end
27
+ def parse_arguments
28
+ args = Arguments.new(@argv, @stdout, @kernel)
29
+ @options = args.parse
62
30
  end
63
31
 
64
- def perform_bundle_freshness_validation
65
- if @options.bundle_audit
66
- runner = BundleAuditRunner.new(@options)
32
+ def perform_validation(validator)
33
+ key = validator::CLI_OPTION
34
+ if @options.send(key)
35
+ runner = validator.new(@stdout, @options)
67
36
  runner.perform
68
- else
69
- 0
70
37
  end
71
38
  end
72
39
  end
@@ -1,8 +1,12 @@
1
1
  module Warder
2
2
  # responsible for run code complexity validation
3
3
  class CodeComplexityRunner < Runner
4
- FLOG_SCORE = SCORE
4
+ CLI_OPTION = 'c'
5
+ CLI_FULL_OPTION = 'code-complexity'
6
+ DESCRIPTION = 'Run code complexity validation'
5
7
  COMMAND_NAME = 'flog'
8
+ FLOG_SCORE = SCORE
9
+ FAILURE_REGEXP = /^\s+(\d+.\d+)\:\s.*$/
6
10
  TOTAL_REGEXP = /^\s+\d+.\d+\:.*(total|average)$/
7
11
 
8
12
  private
@@ -12,7 +16,7 @@ module Warder
12
16
  end
13
17
 
14
18
  def failed?(line)
15
- match = line.match(/^\s+(\d+.\d+)\:\s.*$/)
19
+ match = FAILURE_REGEXP.match(line)
16
20
  return false if total?(line)
17
21
  match && match[1].to_f > FLOG_SCORE
18
22
  end
@@ -1,8 +1,11 @@
1
1
  module Warder
2
2
  # responsible for run code duplication validation
3
3
  class CodeDuplicationRunner < Runner
4
- FLAY_SCORE = SCORE / 2
4
+ CLI_OPTION = 'd'
5
+ CLI_FULL_OPTION = 'code-duplication'
6
+ DESCRIPTION = 'Run code duplication validation'
5
7
  COMMAND_NAME = 'flay'
8
+ FLAY_SCORE = SCORE / 2
6
9
  FAILURE_REGEXP = /Total score \(lower is better\) = (\d+)/
7
10
 
8
11
  private
@@ -1,6 +1,9 @@
1
1
  module Warder
2
2
  # responsible for run code smells validation
3
3
  class CodeSmellsRunner < Runner
4
+ CLI_OPTION = 's'
5
+ CLI_FULL_OPTION = 'code-smells'
6
+ DESCRIPTION = 'Run code smells validation'
4
7
  COMMAND_NAME = 'reek'
5
8
  FAILURE_REGEXP = / -- (\d+) warnings?:/
6
9
  end
@@ -1,6 +1,9 @@
1
1
  module Warder
2
2
  # responsible for run magick numbers validation
3
3
  class MagickNumbersRunner < Runner
4
+ CLI_OPTION = 'm'
5
+ CLI_FULL_OPTION = 'magick-numbers'
6
+ DESCRIPTION = 'Run magick numbers validation'
4
7
  COMMAND_NAME = 'mago'
5
8
 
6
9
  private
@@ -0,0 +1,22 @@
1
+ module Warder
2
+ # responsible for run rails security validation
3
+ class RailsSecurityRunner < Runner
4
+ CLI_OPTION = 'i'
5
+ CLI_FULL_OPTION = 'rails-security'
6
+ DESCRIPTION = 'Run magick numbers validation'
7
+ COMMAND_NAME = 'brakeman'
8
+ FAILURE_REGEXP = /^\| Security Warnings \| (\d)+/
9
+ PRINTABLE_REGEXP = /^(\+|\||View Warnings:)/
10
+
11
+ private
12
+
13
+ def command_with_options
14
+ path = @options.files.split(' ').first
15
+ "#{COMMAND_NAME} -q -p #{path}"
16
+ end
17
+
18
+ def printable?(line)
19
+ PRINTABLE_REGEXP.match(line)
20
+ end
21
+ end
22
+ end
data/lib/warder/runner.rb CHANGED
@@ -3,14 +3,15 @@ module Warder
3
3
  class Runner
4
4
  SCORE = 30
5
5
 
6
- def initialize(options = {})
6
+ def initialize(stdout, options = {})
7
+ @stdout = stdout
7
8
  @options = options
8
9
  @exit_code = 0
9
10
  end
10
11
 
11
12
  def perform
12
13
  run_command do |line|
13
- print line if printable?(line)
14
+ @stdout.puts(line) if printable?(line)
14
15
  @exit_code = 1 if failed?(line)
15
16
  end
16
17
  @exit_code
@@ -19,7 +20,7 @@ module Warder
19
20
  private
20
21
 
21
22
  def run_command
22
- puts "executing '#{command_with_options}'\n"
23
+ @stdout.puts "executing '#{command_with_options}'\n"
23
24
  IO.popen(command_with_options).each do |line|
24
25
  yield(line)
25
26
  end
@@ -30,7 +31,7 @@ module Warder
30
31
  end
31
32
 
32
33
  def failed?(line)
33
- match = line.match(self.class::FAILURE_REGEXP)
34
+ match = self.class::FAILURE_REGEXP.match(line)
34
35
  match && match[1].to_i != 0
35
36
  end
36
37
 
@@ -1,6 +1,9 @@
1
1
  module Warder
2
2
  # responsible for run style guide validation
3
3
  class StyleGuideRunner < Runner
4
+ CLI_OPTION = 'g'
5
+ CLI_FULL_OPTION = 'style-guide'
6
+ DESCRIPTION = 'Run style guide validation'
4
7
  COMMAND_NAME = 'rubocop'
5
8
  FAILURE_REGEXP = /(\d+|no) offence/
6
9
  end
@@ -1,4 +1,4 @@
1
1
  # define warder version
2
2
  module Warder
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
  end
data/lib/warder.rb CHANGED
@@ -6,5 +6,16 @@ require 'warder/magick_numbers_runner'
6
6
  require 'warder/code_duplication_runner'
7
7
  require 'warder/code_smells_runner'
8
8
  require 'warder/code_complexity_runner'
9
+ require 'warder/rails_security_runner'
9
10
  require 'warder/bundle_audit_runner'
11
+ require 'warder/cli/arguments'
10
12
  require 'warder/cli'
13
+
14
+ # scope for validators
15
+ module Warder
16
+ def self.validators
17
+ Warder.constants.grep(/\w+Runner/).map do |validator|
18
+ Warder.const_get(validator)
19
+ end
20
+ end
21
+ end
@@ -1,4 +1,4 @@
1
- def faild?(str)
1
+ def failed?(str)
2
2
  match = str.match(/\d+/)
3
3
  match && match[1].to_i != 0
4
4
  end
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '4.0.0'
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Invalid::Application.load_tasks
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Invalid</title>
5
+ <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6
+ <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,23 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env)
8
+
9
+ module Invalid
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17
+ # config.time_zone = 'Central Time (US & Canada)'
18
+
19
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21
+ # config.i18n.default_locale = :de
22
+ end
23
+ end
@@ -0,0 +1,4 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Invalid::Application.initialize!
@@ -0,0 +1,29 @@
1
+ Invalid::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+ end