Skip to content

Commit

Permalink
install mongoid via gemfile and generator; haml too
Browse files Browse the repository at this point in the history
  • Loading branch information
awesome committed Jan 22, 2021
1 parent 6bd68f2 commit d8a4b8e
Show file tree
Hide file tree
Showing 3 changed files with 249 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'mongoid', github: 'mongodb/mongoid', branch: '7.2-stable'
gem 'kaminari'
gem 'kaminari-mongoid'
gem 'mongoid-history'
gem 'haml-rails'
66 changes: 64 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
GIT
remote: https://github.com/mongodb/mongoid.git
revision: e49b9af6bfd826a488bbea836100c731cf786080
branch: 7.2-stable
specs:
mongoid (7.2.0)
activemodel (>= 5.1, < 6.2)
mongo (>= 2.10.5, < 3.0.0)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -63,19 +72,51 @@ GEM
bindex (0.8.1)
bootsnap (1.5.1)
msgpack (~> 1.0)
bson (4.11.1)
builder (3.2.4)
byebug (11.1.3)
concurrent-ruby (1.1.8)
crass (1.0.6)
easy_diff (1.0.0)
erubi (1.10.0)
erubis (2.7.0)
ffi (1.14.2)
globalid (0.4.2)
activesupport (>= 4.2.0)
haml (5.2.1)
temple (>= 0.8.0)
tilt
haml-rails (2.0.1)
actionpack (>= 5.1)
activesupport (>= 5.1)
haml (>= 4.0.6, < 6.0)
html2haml (>= 1.0.1)
railties (>= 5.1)
html2haml (2.2.0)
erubis (~> 2.7.0)
haml (>= 4.0, < 6)
nokogiri (>= 1.6.0)
ruby_parser (~> 3.5)
i18n (1.8.7)
concurrent-ruby (~> 1.0)
jbuilder (2.10.1)
activesupport (>= 5.0.0)
listen (3.4.0)
kaminari (1.2.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.1)
kaminari-activerecord (= 1.2.1)
kaminari-core (= 1.2.1)
kaminari-actionview (1.2.1)
actionview
kaminari-core (= 1.2.1)
kaminari-activerecord (1.2.1)
activerecord
kaminari-core (= 1.2.1)
kaminari-core (1.2.1)
kaminari-mongoid (1.0.1)
kaminari-core (~> 1.0)
mongoid
listen (3.4.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.9.0)
Expand All @@ -89,6 +130,16 @@ GEM
mimemagic (0.3.5)
mini_mime (1.0.2)
minitest (5.14.3)
mongo (2.14.0)
bson (>= 4.8.2, < 5.0.0)
mongoid-compatibility (0.5.1)
activesupport
mongoid (>= 2.0)
mongoid-history (0.8.3)
activesupport
easy_diff
mongoid (>= 3.0)
mongoid-compatibility (>= 0.5.1)
msgpack (1.3.3)
nio4r (2.5.4)
nokogiri (1.11.1-x86_64-darwin)
Expand Down Expand Up @@ -133,15 +184,20 @@ GEM
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
ruby_parser (3.15.1)
sexp_processor (~> 4.9)
semantic_range (2.3.1)
sexp_processor (4.15.2)
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.2)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
temple (0.8.2)
thor (1.1.0)
tilt (2.0.10)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
Expand All @@ -164,12 +220,18 @@ GEM

PLATFORMS
ruby
x86_64-darwin-20

DEPENDENCIES
bootsnap (>= 1.4.4)
byebug
haml-rails
jbuilder (~> 2.7)
kaminari
kaminari-mongoid
listen (~> 3.3)
mongoid!
mongoid-history
puma (~> 5.0)
rack-mini-profiler (~> 2.0)
rails (~> 6.1.1)
Expand All @@ -182,4 +244,4 @@ RUBY VERSION
ruby 2.7.1p83

BUNDLED WITH
2.1.4
2.2.4
179 changes: 179 additions & 0 deletions config/mongoid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
development:
# Configure available database clients. (required)
clients:
# Defines the default client. (required)
default:
# Mongoid can connect to a URI accepted by the driver:
# uri: mongodb://user:password@mongodb.domain.com:27017/rails6_mongoid_stimulus_development

# Otherwise define the parameters separately.
# This defines the name of the default database that Mongoid can connect to.
# (required).
database: rails6_mongoid_stimulus_development
# Provides the hosts the default client can connect to. Must be an array
# of host:port pairs. (required)
hosts:
- localhost:27017
options:
# Note that all options listed below are Ruby driver client options (the mongo gem).
# Please refer to the driver documentation of the version of the mongo gem you are using
# for the most up-to-date list of options.
#
# Change the default write concern. (default = { w: 1 })
# write:
# w: 1

# Change the default read preference. Valid options for mode are: :secondary,
# :secondary_preferred, :primary, :primary_preferred, :nearest
# (default: primary)
# read:
# mode: :secondary_preferred
# tag_sets:
# - use: web

# The name of the user for authentication.
# user: 'user'

# The password of the user for authentication.
# password: 'password'

# The user's database roles.
# roles:
# - 'dbOwner'

# Change the default authentication mechanism. Valid options are: :scram,
# :mongodb_cr, :mongodb_x509, and :plain. Note that all authentication
# mechanisms require username and password, with the exception of :mongodb_x509.
# Default on mongoDB 3.0 is :scram, default on 2.4 and 2.6 is :plain.
# auth_mech: :scram

# The database or source to authenticate the user against.
# (default: the database specified above or admin)
# auth_source: admin

# Force a the driver cluster to behave in a certain manner instead of auto-
# discovering. Can be one of: :direct, :replica_set, :sharded. Set to :direct
# when connecting to hidden members of a replica set.
# connect: :direct

# Changes the default time in seconds the server monitors refresh their status
# via ismaster commands. (default: 10)
# heartbeat_frequency: 10

# The time in seconds for selecting servers for a near read preference. (default: 0.015)
# local_threshold: 0.015

# The timeout in seconds for selecting a server for an operation. (default: 30)
# server_selection_timeout: 30

# The maximum number of connections in the connection pool. (default: 5)
# max_pool_size: 5

# The minimum number of connections in the connection pool. (default: 1)
# min_pool_size: 1

# The time to wait, in seconds, in the connection pool for a connection
# to be checked in before timing out. (default: 5)
# wait_queue_timeout: 5

# The time to wait to establish a connection before timing out, in seconds.
# (default: 10)
# connect_timeout: 10

# The timeout to wait to execute operations on a socket before raising an error.
# (default: 5)
# socket_timeout: 5

# The name of the replica set to connect to. Servers provided as seeds that do
# not belong to this replica set will be ignored.
# replica_set: name

# Whether to connect to the servers via ssl. (default: false)
# ssl: true

# The certificate file used to identify the connection against MongoDB.
# ssl_cert: /path/to/my.cert

# The private keyfile used to identify the connection against MongoDB.
# Note that even if the key is stored in the same file as the certificate,
# both need to be explicitly specified.
# ssl_key: /path/to/my.key

# A passphrase for the private key.
# ssl_key_pass_phrase: password

# Whether to do peer certification validation. (default: true)
# ssl_verify: true

# The file containing concatenated certificate authority certificates
# used to validate certs passed from the other end of the connection.
# ssl_ca_cert: /path/to/ca.cert

# Whether to truncate long log lines. (default: true)
# truncate_logs: true

# Configure Mongoid specific options. (optional)
options:
# Application name that is printed to the mongodb logs upon establishing
# a connection in server versions >= 3.4. Note that the name cannot
# exceed 128 bytes. It is also used as the database name if the
# database name is not explicitly defined. (default: nil)
# app_name: MyApplicationName

# Create indexes in background by default. (default: false)
# background_indexing: false

# Mark belongs_to associations as required by default, so that saving a
# model with a missing belongs_to association will trigger a validation
# error. (default: true)
# belongs_to_required_by_default: true

# Raise an exception when a field is redefined. (default: false)
# duplicate_fields_exception: false

# Include the root model name in json serialization. (default: false)
# include_root_in_json: false

# Include the _type field in serialization. (default: false)
# include_type_for_serialization: false

# Whether to join nested persistence contexts for atomic operations
# to parent contexts by default. (default: false)
# join_contexts: false

# Set the Mongoid and Ruby driver log levels when Mongoid is not using
# Ruby on Rails logger instance. (default: :info)
# log_level: :info

# Preload all models in development, needed when models use
# inheritance. (default: false)
# preload_models: false

# Raise an error when performing a #find and the document is not found.
# (default: true)
# raise_not_found_error: true

# Raise an error when defining a scope with the same name as an
# existing method. (default: false)
# scope_overwrite_exception: false

# Use ActiveSupport's time zone in time operations instead of
# the Ruby default time zone. See the time zone section below for
# further information. (default: true)
# use_activesupport_time_zone: true

# Return stored times as UTC. See the time zone section below for
# further information. Most applications should not use this option.
# (default: false)
# use_utc: false

test:
clients:
default:
database: rails6_mongoid_stimulus_test
hosts:
- localhost:27017
options:
read:
mode: :primary
max_pool_size: 1

0 comments on commit d8a4b8e

Please sign in to comment.