git_models 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/.dependabot/config.yml +10 -0
  3. data/.github/workflows/gem_release.yml +37 -0
  4. data/.gitignore +61 -0
  5. data/.jenkins/Jenkinsfile +80 -0
  6. data/.jenkins/ruby_build_pod.yml +18 -0
  7. data/.rspec +3 -0
  8. data/.rubocop.yml +51 -0
  9. data/Appraisals +14 -0
  10. data/CHANGELOG.md +25 -0
  11. data/Gemfile +25 -0
  12. data/Gemfile.lock +237 -0
  13. data/README.md +6 -0
  14. data/Rakefile +28 -0
  15. data/app/models/concerns/branch.rb +55 -0
  16. data/app/models/concerns/commit.rb +44 -0
  17. data/app/models/concerns/repository.rb +28 -0
  18. data/app/models/concerns/user.rb +33 -0
  19. data/gemfiles/.bundle/config +2 -0
  20. data/gemfiles/rails_4.gemfile +26 -0
  21. data/gemfiles/rails_5.gemfile +26 -0
  22. data/gemfiles/rails_6.gemfile +26 -0
  23. data/git_models.gemspec +27 -0
  24. data/lib/git_models.rb +6 -0
  25. data/lib/git_models/test_helpers.rb +60 -0
  26. data/lib/git_models/version.rb +5 -0
  27. data/spec/dummy/Rakefile +6 -0
  28. data/spec/dummy/app/assets/config/manifest.js +3 -0
  29. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  30. data/spec/dummy/app/assets/javascripts/cable.js +13 -0
  31. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  32. data/spec/dummy/app/controllers/application_controller.rb +4 -0
  33. data/spec/dummy/app/helpers/application_helper.rb +4 -0
  34. data/spec/dummy/app/models/application_record.rb +7 -0
  35. data/spec/dummy/app/models/branch.rb +8 -0
  36. data/spec/dummy/app/models/commit.rb +8 -0
  37. data/spec/dummy/app/models/repository.rb +8 -0
  38. data/spec/dummy/app/models/user.rb +8 -0
  39. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  40. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  41. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  42. data/spec/dummy/bin/bundle +3 -0
  43. data/spec/dummy/bin/rails +4 -0
  44. data/spec/dummy/bin/rake +4 -0
  45. data/spec/dummy/bin/setup +36 -0
  46. data/spec/dummy/bin/spring +16 -0
  47. data/spec/dummy/bin/update +31 -0
  48. data/spec/dummy/bin/yarn +11 -0
  49. data/spec/dummy/config.ru +7 -0
  50. data/spec/dummy/config/application.rb +25 -0
  51. data/spec/dummy/config/boot.rb +5 -0
  52. data/spec/dummy/config/credentials.yml.enc +1 -0
  53. data/spec/dummy/config/database.yml +27 -0
  54. data/spec/dummy/config/environment.rb +8 -0
  55. data/spec/dummy/config/environments/development.rb +63 -0
  56. data/spec/dummy/config/environments/production.rb +96 -0
  57. data/spec/dummy/config/environments/test.rb +55 -0
  58. data/spec/dummy/config/initializers/application_controller_renderer.rb +10 -0
  59. data/spec/dummy/config/initializers/assets.rb +16 -0
  60. data/spec/dummy/config/initializers/backtrace_silencers.rb +9 -0
  61. data/spec/dummy/config/initializers/content_security_policy.rb +27 -0
  62. data/spec/dummy/config/initializers/cookies_serializer.rb +7 -0
  63. data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  64. data/spec/dummy/config/initializers/inflections.rb +18 -0
  65. data/spec/dummy/config/initializers/mime_types.rb +6 -0
  66. data/spec/dummy/config/initializers/session_store.rb +5 -0
  67. data/spec/dummy/config/initializers/wrap_parameters.rb +16 -0
  68. data/spec/dummy/config/locales/en.yml +33 -0
  69. data/spec/dummy/config/puma.rb +39 -0
  70. data/spec/dummy/config/routes.rb +5 -0
  71. data/spec/dummy/config/spring.rb +8 -0
  72. data/spec/dummy/config/storage.yml +34 -0
  73. data/spec/dummy/db/migrate/20161123065534_create_users_table.rb +16 -0
  74. data/spec/dummy/db/migrate/20161123184217_create_commits_repositories_branches.rb +37 -0
  75. data/spec/dummy/db/schema.rb +53 -0
  76. data/spec/dummy/spec/models/branch_spec.rb +84 -0
  77. data/spec/dummy/spec/models/commit_spec.rb +60 -0
  78. data/spec/dummy/spec/models/user_spec.rb +64 -0
  79. data/spec/dummy/spec/spec_helper.rb +48 -0
  80. metadata +231 -0
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationController < ActionController::Base
4
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationHelper
4
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_record'
4
+
5
+ class ApplicationRecord < ActiveRecord::Base
6
+ self.abstract_class = true
7
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'application_record'
4
+ require_relative '../../../../app/models/concerns/branch'
5
+
6
+ class Branch < ApplicationRecord
7
+ include GitModels::Branch
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'application_record'
4
+ require_relative '../../../../app/models/concerns/commit'
5
+
6
+ class Commit < ApplicationRecord
7
+ include GitModels::Commit
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'application_record'
4
+ require_relative '../../../../app/models/concerns/repository'
5
+
6
+ class Repository < ApplicationRecord
7
+ include GitModels::Repository
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'application_record'
4
+ require_relative '../../../../app/models/concerns/user'
5
+
6
+ class User < ApplicationRecord
7
+ include GitModels::User
8
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
9
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
10
+ </head>
11
+
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ include FileUtils
4
+
5
+ # path to your application root.
6
+ APP_ROOT = File.expand_path('..', __dir__)
7
+
8
+ def system!(*args)
9
+ system(*args) || abort("\n== Command #{args} failed ==")
10
+ end
11
+
12
+ chdir APP_ROOT do
13
+ # This script is a starting point to setup your application.
14
+ # Add necessary setup steps to this file.
15
+
16
+ puts '== Installing dependencies =='
17
+ system! 'gem install bundler --conservative'
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # Install JavaScript dependencies if using Yarn
21
+ # system('bin/yarn')
22
+
23
+ # puts "\n== Copying sample files =="
24
+ # unless File.exist?('config/database.yml')
25
+ # cp 'config/database.yml.sample', 'config/database.yml'
26
+ # end
27
+
28
+ puts "\n== Preparing database =="
29
+ system! 'bin/rails db:setup'
30
+
31
+ puts "\n== Removing old logs and tempfiles =="
32
+ system! 'bin/rails log:clear tmp:clear'
33
+
34
+ puts "\n== Restarting application server =="
35
+ system! 'bin/rails restart'
36
+ end
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This file loads spring without using Bundler, in order to be fast.
4
+ # It gets overwritten when you run the `spring binstub` command.
5
+
6
+ unless defined?(Spring)
7
+ require 'rubygems'
8
+ require 'bundler'
9
+
10
+ lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
11
+ if spring = lockfile.specs.detect { |spec| spec.name == "spring" }
12
+ Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
13
+ gem 'spring', spring.version
14
+ require 'spring/binstub'
15
+ end
16
+ end
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ include FileUtils
4
+
5
+ # path to your application root.
6
+ APP_ROOT = File.expand_path('..', __dir__)
7
+
8
+ def system!(*args)
9
+ system(*args) || abort("\n== Command #{args} failed ==")
10
+ end
11
+
12
+ chdir APP_ROOT do
13
+ # This script is a way to update your development environment automatically.
14
+ # Add necessary update steps to this file.
15
+
16
+ puts '== Installing dependencies =='
17
+ system! 'gem install bundler --conservative'
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # Install JavaScript dependencies if using Yarn
21
+ # system('bin/yarn')
22
+
23
+ puts "\n== Updating database =="
24
+ system! 'bin/rails db:migrate'
25
+
26
+ puts "\n== Removing old logs and tempfiles =="
27
+ system! 'bin/rails log:clear tmp:clear'
28
+
29
+ puts "\n== Restarting application server =="
30
+ system! 'bin/rails restart'
31
+ end
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path('..', __dir__)
3
+ Dir.chdir(APP_ROOT) do
4
+ begin
5
+ exec "yarnpkg", *ARGV
6
+ rescue Errno::ENOENT
7
+ $stderr.puts "Yarn executable was not detected in the system."
8
+ $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9
+ exit 1
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is used by Rack-based servers to start the application.
4
+
5
+ require_relative 'config/environment'
6
+
7
+ run Rails.application
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'boot'
4
+
5
+ require 'rails/all'
6
+ require 'active_model/validations/presence'
7
+
8
+ # Require the gems listed in Gemfile, including any gems
9
+ # you've limited to :test, :development, or :production.
10
+ Bundler.require(*Rails.groups)
11
+ require 'git_models'
12
+
13
+ module Dummy
14
+ class Application < Rails::Application
15
+ if Rails::VERSION::MAJOR >= 5
16
+ # Initialize configuration defaults for originally generated Rails version.
17
+ config.load_defaults "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}"
18
+ end
19
+
20
+ # Settings in config/environments/* take precedence over those specified here.
21
+ # Application configuration can go into files in config/initializers
22
+ # -- all .rb files in that directory are automatically loaded after loading
23
+ # the framework and any gems in your application.
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
4
+
5
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -0,0 +1 @@
1
+ t8z4eFuU7T5YWiEsC9Bzk16tdVgcrBoRDkG9XzFOyApvhHAbLyQoE7yHfvPQ1E9492Z8fqDHhEQd5kfoPqkJytfllACFUQ5wlMxntGUSvDLp4+CTeRvwFUnN75tzW++Mje9DthDntFWfDe71YVAJ4RGDWIPt+c473RD4LLZ+yxKaKWoaOmESQYnDIS2SkbVsOrFp9MvzDM2Cteppri035Sgqoa6t7Z37kTgZUZQKi3bG3ZgSynp9sakeUq+NYz/2HBytSRAnwdCL+Wef6VziZMBObu66qmPMI7uyk5Lrmz6TJHfqF40TXdbogNIIWikKr6RYSpQ98uc+ouEEA23TlyD5N8j8eVGTQ/3d8PJXM4fpCTZvc56F77PJtRnnZv7RQO1oirk72UAdVQsgH8AfRn4docy16ABqj5rH--nth4fkWiYWvENdXl--c8sRRbICwGDQNoBfvMZpqg==
@@ -0,0 +1,27 @@
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
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+
20
+ # Note: Put DATABASE_SUFFIX value into the test database name so Appraisal can run those tests in parallel
21
+ test:
22
+ <<: *default
23
+ database: db/test-<%= ENV['DATABASE_SUFFIX'] %>.sqlite3
24
+
25
+ production:
26
+ <<: *default
27
+ database: db/production.sqlite3
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load the Rails application.
4
+ require_relative 'application'
5
+
6
+ # Initialize the Rails application.
7
+
8
+ Rails.application.initialize!
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # In the development environment your application's code is reloaded on
7
+ # every request. This slows down response time but is perfect for development
8
+ # since you don't have to restart the web server when you make code changes.
9
+ config.cache_classes = false
10
+
11
+ # Do not eager load code on boot.
12
+ config.eager_load = false
13
+
14
+ # Show full error reports.
15
+ config.consider_all_requests_local = true
16
+
17
+ # Enable/disable caching. By default caching is disabled.
18
+ # Run rails dev:cache to toggle caching.
19
+ if Rails.root.join('tmp', 'caching-dev.txt').exist?
20
+ config.action_controller.perform_caching = true
21
+
22
+ config.cache_store = :memory_store
23
+ config.public_file_server.headers = {
24
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
25
+ }
26
+ else
27
+ config.action_controller.perform_caching = false
28
+
29
+ config.cache_store = :null_store
30
+ end
31
+
32
+ # Store uploaded files on the local file system (see config/storage.yml for options)
33
+ # config.active_storage.service = :local
34
+
35
+ # Don't care if the mailer can't send.
36
+ config.action_mailer.raise_delivery_errors = false
37
+
38
+ # config.action_mailer.perform_caching = false
39
+
40
+ # Print deprecation notices to the Rails logger.
41
+ config.active_support.deprecation = :log
42
+
43
+ # Raise an error on page load if there are pending migrations.
44
+ config.active_record.migration_error = :page_load
45
+
46
+ # Highlight code that triggered database queries in logs.
47
+ # config.active_record.verbose_query_logs = true
48
+
49
+ # Debug mode disables concatenation and preprocessing of assets.
50
+ # This option may cause significant delays in view rendering with a large
51
+ # number of complex assets.
52
+ config.assets.debug = true
53
+
54
+ # Suppress logger output for asset requests.
55
+ config.assets.quiet = true
56
+
57
+ # Raises error for missing translations
58
+ # config.action_view.raise_on_missing_translations = true
59
+
60
+ # Use an evented file watcher to asynchronously detect changes in source code,
61
+ # routes, locales, etc. This feature depends on the listen gem.
62
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
63
+ end
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # Code is not reloaded between requests.
7
+ config.cache_classes = true
8
+
9
+ # Eager load code on boot. This eager loads most of Rails and
10
+ # your application in memory, allowing both threaded web servers
11
+ # and those relying on copy on write to perform better.
12
+ # Rake tasks automatically ignore this option for performance.
13
+ config.eager_load = true
14
+
15
+ # Full error reports are disabled and caching is turned on.
16
+ config.consider_all_requests_local = false
17
+ config.action_controller.perform_caching = true
18
+
19
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
20
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
21
+ # config.require_master_key = true
22
+
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
26
+
27
+ # Compress JavaScripts and CSS.
28
+ config.assets.js_compressor = :uglifier
29
+ # config.assets.css_compressor = :sass
30
+
31
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
32
+ config.assets.compile = false
33
+
34
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
35
+
36
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
37
+ # config.action_controller.asset_host = 'http://assets.example.com'
38
+
39
+ # Specifies the header that your server uses for sending files.
40
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
41
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
42
+
43
+ # Store uploaded files on the local file system (see config/storage.yml for options)
44
+ config.active_storage.service = :local
45
+
46
+ # Mount Action Cable outside main process or domain
47
+ # config.action_cable.mount_path = nil
48
+ # config.action_cable.url = 'wss://example.com/cable'
49
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
50
+
51
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
52
+ # config.force_ssl = true
53
+
54
+ # Use the lowest log level to ensure availability of diagnostic information
55
+ # when problems arise.
56
+ config.log_level = :debug
57
+
58
+ # Prepend all log lines with the following tags.
59
+ config.log_tags = [ :request_id ]
60
+
61
+ # Use a different cache store in production.
62
+ # config.cache_store = :mem_cache_store
63
+
64
+ # Use a real queuing backend for Active Job (and separate queues per environment)
65
+ # config.active_job.queue_adapter = :resque
66
+ # config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
67
+
68
+ config.action_mailer.perform_caching = false
69
+
70
+ # Ignore bad email addresses and do not raise email delivery errors.
71
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
72
+ # config.action_mailer.raise_delivery_errors = false
73
+
74
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
75
+ # the I18n.default_locale when a translation cannot be found).
76
+ config.i18n.fallbacks = true
77
+
78
+ # Send deprecation notices to registered listeners.
79
+ config.active_support.deprecation = :notify
80
+
81
+ # Use default logging formatter so that PID and timestamp are not suppressed.
82
+ config.log_formatter = ::Logger::Formatter.new
83
+
84
+ # Use a different logger for distributed setups.
85
+ # require 'syslog/logger'
86
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
87
+
88
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
89
+ logger = ActiveSupport::Logger.new(STDOUT)
90
+ logger.formatter = config.log_formatter
91
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
92
+ end
93
+
94
+ # Do not dump schema after migrations.
95
+ config.active_record.dump_schema_after_migration = false
96
+ end