Skip to content

Commit

Permalink
More renames
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyshields committed May 17, 2024
1 parent b2ce94d commit ce3ac7c
Show file tree
Hide file tree
Showing 53 changed files with 198 additions and 198 deletions.
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ RSpec::Core::RakeTask.new('spec:progress') do |spec|
end

namespace :generate do
desc 'Generates a activedocument.yml from the template'
desc 'Generates an active_document.yml from the template'
task config: :environment do
require 'active_document'
require 'erb'

template_path = 'lib/rails/generators/mongoid/config/templates/activedocument.yml'
template_path = 'lib/rails/generators/mongoid/config/templates/active_document.yml'
config = ERB.new(File.read(template_path), trim_mode: '-').result(binding)
File.write('activedocument.yml', config)
File.write('active_document.yml', config)
end
end

Expand Down
18 changes: 9 additions & 9 deletions docs/reference/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Configuration
:depth: 2
:class: singlecol

ActiveDocument is customarily configured through a ``activedocument.yml`` file that specifies
ActiveDocument is customarily configured through a ``active_document.yml`` file that specifies
options and clients. The simplest configuration is as follows, which configures
ActiveDocument to talk to a MongoDB server at "localhost:27017" and use the database
named "mongoid".
Expand Down Expand Up @@ -43,16 +43,16 @@ configuration file for you by running the following command:

rails g mongoid:config

The configuration file will be placed in ``config/activedocument.yml``. An
The configuration file will be placed in ``config/active_document.yml``. An
initializer will also be created and placed in
``config/initializers/mongoid.rb``. It is recommended that all configuration
be specified in ``config/activedocument.yml``, but if you prefer, the ``mongoid.rb``
be specified in ``config/active_document.yml``, but if you prefer, the ``mongoid.rb``
initializer may also be used to set configuration options. Note, though, that
settings in ``activedocument.yml`` always take precedence over settings in the
settings in ``active_document.yml`` always take precedence over settings in the
initializer.

If you are not using Ruby on Rails, you can copy the minimal configuration
given above and save it as ``config/activedocument.yml``.
given above and save it as ``config/active_document.yml``.


Loading ActiveDocument Configuration
Expand All @@ -78,10 +78,10 @@ the configuration file path as its argument, as follows:
.. code-block:: ruby

# Use automatically detected environment name
ActiveDocument.load!('path/to/your/activedocument.yml')
ActiveDocument.load!('path/to/your/active_document.yml')

# Specify environment name manually
ActiveDocument.load!('path/to/your/activedocument.yml', :production)
ActiveDocument.load!('path/to/your/active_document.yml', :production)

When ActiveDocument is asked to automatically detect the environment name,
it does so by examining the following sources, in order:
Expand Down Expand Up @@ -119,7 +119,7 @@ current environment - but it does support defining multiple clients.
ActiveDocument Configuration Options
=============================

The following annotated example ``activedocument.yml`` demonstrates how ActiveDocument
The following annotated example ``active_document.yml`` demonstrates how ActiveDocument
can be configured.

ActiveDocument delegates to the Ruby driver for client configuration. Please review
Expand Down Expand Up @@ -793,7 +793,7 @@ the Ruby driver, which implements the three algorithms that are supported by Mon
requires the `zstd-ruby <https://rubygems.org/gems/zstd-ruby>`_ library to
be installed.

To use wire protocol compression, configure the Ruby driver options within ``activedocument.yml``:
To use wire protocol compression, configure the Ruby driver options within ``active_document.yml``:

.. code-block:: yaml

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/persistence-configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ database, or a different client. The following example would store the Band clas
default into a collection named "artists" in the database named "music", with the client "analytics".

Note that the value supplied to the ``client`` option must be configured under ``clients``
in your activedocument.yml.
in your active_document.yml.

.. code-block:: ruby

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/rails-integration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ You can set ActiveDocument configuration options in your ``application.rb`` alon
other Rails environment specific options by accessing config.mongoid. The
``mongoid:config`` generator will create an initializer in
``config/initializers/mongoid.rb`` which can also be used for configuring
ActiveDocument. Note, though, that options set in your ``config/activedocument.yml`` will
ActiveDocument. Note, though, that options set in your ``config/active_document.yml`` will
take precedence over options set elsewhere; it is recommended that whenever
possible you use ``activedocument.yml`` as the default location for ActiveDocument
possible you use ``active_document.yml`` as the default location for ActiveDocument
configuration.

.. code-block:: ruby
Expand Down
2 changes: 1 addition & 1 deletion docs/release-notes/mongoid-5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ from Moped to the official MongoDB Ruby driver. Please see the
:ref:`configuration section <configuration>` for a detailed description
of all the new options.

All references to session are now replaced with client. This includes the ``activedocument.yml``
All references to session are now replaced with client. This includes the ``active_document.yml``
configuration, ``store_in`` options, and all exceptions and modules with Session in the name.

``find_and_modify`` has been removed and replaced with 3 options: ``find_one_and_update``,
Expand Down
2 changes: 1 addition & 1 deletion docs/release-notes/mongoid-7.4.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ introduces feature flags which are further explained in the
sections below.

To enable all new behavior in ActiveDocument 7.4, please use the following
:ref:`configuration options <configuration-options>` in your activedocument.yml file.
:ref:`configuration options <configuration-options>` in your active_document.yml file.
We recommend newly created apps to do this as well.

.. code-block:: yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/release-notes/mongoid-7.5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ introduces feature flags which are further explained in the
sections below.

To enable all new behavior in ActiveDocument 7.5, please use the following
:ref:`configuration options <configuration-options>` in your activedocument.yml file.
:ref:`configuration options <configuration-options>` in your active_document.yml file.
We recommend newly created apps to do this as well.

.. code-block:: yaml
Expand Down
10 changes: 5 additions & 5 deletions docs/tutorials/automatic-encryption.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ The steps required are as follows:
5. Click Download.

Once extracted, ensure the full path to the library is configured within your
``activedocument.yml`` as follows:
``active_document.yml`` as follows:

.. code-block:: yaml

Expand Down Expand Up @@ -142,7 +142,7 @@ Configure Clients

Automatic CSFLE requires some additional configuration for the MongoDB client.
Assuming that your application has just one ``default`` client, you need to
add the following to your ``activedocument.yml``:
add the following to your ``active_document.yml``:

.. code-block:: yaml

Expand Down Expand Up @@ -248,7 +248,7 @@ Now we can tell ActiveDocument what should be encrypted:

.. note::
If you are developing a Rails application, it is recommended to set
``preload_models`` to ``true`` in ``activedocument.yml``. This will ensure that
``preload_models`` to ``true`` in ``active_document.yml``. This will ensure that
ActiveDocument loads all models before the application starts, and the encryption
schema is configured before any data is read or written.

Expand Down Expand Up @@ -340,7 +340,7 @@ Data Encryption Keys can be created using the
``db:mongoid:encryption:create_data_key`` ``Rake`` task. By default they are
stored on the same cluster as the database.
However, it might be a good idea to store the keys separately. This can be
done by specifying a key vault client in ``activedocument.yml``:
done by specifying a key vault client in ``active_document.yml``:

.. code-block:: yaml

Expand Down Expand Up @@ -376,7 +376,7 @@ Here is an example of rotating keys using AWS KMS:

# Create a key vault client
key_vault_client = Mongo::Client.new('mongodb+srv://user:[email protected]')
# Or, if you declared the key value client in activedocument.yml, use it
# Or, if you declared the key value client in active_document.yml, use it
key_vault_client = ActiveDocument.client(:key_vault)

# Create the encryption object
Expand Down
16 changes: 8 additions & 8 deletions docs/tutorials/getting-started-rails6.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Add ActiveDocument

bin/rails g mongoid:config

This generator will create the ``config/activedocument.yml`` configuration file
This generator will create the ``config/active_document.yml`` configuration file
(used to configure the connection to the MongoDB deployment) and the
``config/initializers/mongoid.rb`` initializer file (which may be used for
other ActiveDocument-related configuration). Note that as we are not using
Expand All @@ -142,9 +142,9 @@ a MongoDB server is running locally. If you do not already have a
local MongoDB server, `download and install MongoDB
<https://mongodb.com/docs/manual/installation/>`_.

While the generated ``activedocument.yml`` will work without modifications,
While the generated ``active_document.yml`` will work without modifications,
we recommend reducing the server selection timeout for development.
With this change, the uncommented lines of ``activedocument.yml`` should look
With this change, the uncommented lines of ``active_document.yml`` should look
like this:

.. code-block:: none
Expand All @@ -171,11 +171,11 @@ Once the cluster is created, follow the instructions in `connect to the cluster
page <https://docs.atlas.mongodb.com/connect-to-cluster/#connect-to-a-cluster>`_
to obtain the URI. Use the *Ruby driver 2.5 or later* format.

Paste the URI into the ``config/activedocument.yml`` file, and comment out the
Paste the URI into the ``config/active_document.yml`` file, and comment out the
hosts that are defined. We recommend setting the server selection timeout to 5
seconds for development environment when using Atlas.

The uncommented contents of ``config/activedocument.yml`` should look like this:
The uncommented contents of ``config/active_document.yml`` should look like this:

.. code-block:: yaml

Expand Down Expand Up @@ -466,15 +466,15 @@ Generate the default ActiveDocument configuration:

bin/rails g mongoid:config

This generator will create the ``config/activedocument.yml`` configuration file
This generator will create the ``config/active_document.yml`` configuration file
(used to configure the connection to the MongoDB deployment) and the
``config/initializers/mongoid.rb`` initializer file (which may be used for
other ActiveDocument-related configuration). In general, it is recommended to use
``activedocument.yml`` for all ActiveDocument configuration.
``active_document.yml`` for all ActiveDocument configuration.

Review the sections :ref:`Run MongoDB Locally <run-locally>` and
:ref:`Use MongoDB Atlas <use-atlas>` to decide how you would like to deploy
MongoDB, and adjust ActiveDocument configuration (``config/activedocument.yml``) to match.
MongoDB, and adjust ActiveDocument configuration (``config/active_document.yml``) to match.

Adjust Models
-------------
Expand Down
16 changes: 8 additions & 8 deletions docs/tutorials/getting-started-rails7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Setup ActiveDocument

bin/rails g mongoid:config

This generator will create the ``config/activedocument.yml`` configuration file
This generator will create the ``config/active_document.yml`` configuration file
(used to configure the connection to the MongoDB deployment) and the
``config/initializers/mongoid.rb`` initializer file (which may be used for
other ActiveDocument-related configuration). Note that as we are not using
Expand All @@ -112,9 +112,9 @@ a MongoDB server is running locally. If you do not already have a
local MongoDB server, `download and install MongoDB
<https://mongodb.com/docs/manual/installation/>`_.

While the generated ``activedocument.yml`` will work without modifications,
While the generated ``active_document.yml`` will work without modifications,
we recommend reducing the server selection timeout for development.
With this change, the uncommented lines of ``activedocument.yml`` should look
With this change, the uncommented lines of ``active_document.yml`` should look
like this:

.. code-block:: yaml
Expand All @@ -141,11 +141,11 @@ Once the cluster is created, follow the instructions in `connect to the cluster
page <https://docs.atlas.mongodb.com/connect-to-cluster/#connect-to-a-cluster>`_
to obtain the URI. Use the *Ruby driver 2.5 or later* format.

Paste the URI into the ``config/activedocument.yml`` file, and comment out the
Paste the URI into the ``config/active_document.yml`` file, and comment out the
hosts that are defined. We recommend setting the server selection timeout to 5
seconds for development environment when using Atlas.

The uncommented contents of ``config/activedocument.yml`` should look like this:
The uncommented contents of ``config/active_document.yml`` should look like this:

.. code-block:: yaml

Expand Down Expand Up @@ -334,16 +334,16 @@ Generate the default ActiveDocument configuration:

bin/rails g mongoid:config

This generator will create the ``config/activedocument.yml`` configuration file
This generator will create the ``config/active_document.yml`` configuration file
(used to configure the connection to the MongoDB deployment) and the
``config/initializers/mongoid.rb`` initializer file (which may be used for
other ActiveDocument-related configuration). In general, it is recommended to use
``activedocument.yml`` for all ActiveDocument configuration.
``active_document.yml`` for all ActiveDocument configuration.

Review the sections :ref:`Configure for Self Managed MongoDB <configure-self-managed>`
and :ref:`Configure for MongoDB Atlas <configure-atlas>` to decide how you
would like to deploy MongoDB, and adjust the ActiveDocument configuration
(``config/activedocument.yml``) to match.
(``config/active_document.yml``) to match.

Loaded Frameworks
-----------------
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorials/getting-started-sinatra.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Run MongoDB Locally
To develop locally with MongoDB, `download and install MongoDB
<https://mongodb.com/docs/manual/installation/>`_.

Once MongoDB is installed and running, create a file named ``config/activedocument.yml``
Once MongoDB is installed and running, create a file named ``config/active_document.yml``
pointing to your deployment. For example, if you launched a standalone
``mongod`` on the default port, the following contents would be appropriate:

Expand All @@ -95,7 +95,7 @@ Once the cluster is created, follow the instructions in `connect to the cluster
page <https://docs.atlas.mongodb.com/connect-to-cluster/#connect-to-a-cluster>`_
to obtain the URI. Use the *Ruby driver 2.5 or later* format.

Create a file named ``config/activedocument.yml`` with the following
Create a file named ``config/active_document.yml`` with the following
contents, replacing the URI with the actual URI for your cluster:

.. code-block:: yaml
Expand Down Expand Up @@ -126,7 +126,7 @@ with Sinatra, we need to do this ourselves:

.. code-block:: ruby

ActiveDocument.load!(File.join(File.dirname(__FILE__), 'config', 'activedocument.yml'))
ActiveDocument.load!(File.join(File.dirname(__FILE__), 'config', 'active_document.yml'))

Now we can define some models:

Expand Down Expand Up @@ -213,6 +213,6 @@ To start using ActiveDocument in an existing Sinatra applications, the steps are
essentially the same as the one given above for a new application:

1. Add the ``mongoid`` dependency to the ``Gemfile``.
2. Create a ``activedocument.yml`` configuration file.
2. Create a ``active_document.yml`` configuration file.
3. Load the configuration file and configure ActiveDocument in the application.
4. Define ActiveDocument models.
8 changes: 4 additions & 4 deletions lib/active_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module ActiveDocument
extend Clients::Sessions::ClassMethods

# A string added to the platform details of Ruby driver client handshake documents.
PLATFORM_DETAILS = "mongoid-#{VERSION}".freeze # rubocop:disable Style/RedundantFreeze
PLATFORM_DETAILS = "active_document-#{VERSION}".freeze # rubocop:disable Style/RedundantFreeze

# The minimum MongoDB version supported.
MONGODB_VERSION = '2.6.0'
Expand All @@ -55,19 +55,19 @@ module ActiveDocument
#
# @example Set up configuration options.
# ActiveDocument.configure do |config|
# config.connect_to("mongoid_test")
# config.connect_to("active_document_test")
#
# config.clients.default = {
# hosts: ["localhost:27017"],
# database: "mongoid_test",
# database: "active_document_test",
# }
# end
#
# @example Using a block without an argument. Use `config` inside
# the block to perform variable assignment.
#
# ActiveDocument.configure do
# connect_to("mongoid_test")
# connect_to("active_document_test")
#
# config.preload_models = true
#
Expand Down
4 changes: 2 additions & 2 deletions lib/active_document/association/accessors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def get_relation(name, association, object, reload = false) # rubocop:disable St
if object && needs_no_database_query?(object, association)
__build__(name, object, association)
else
selected_fields = _mongoid_filter_selected_fields(association.key)
selected_fields = _active_document_filter_selected_fields(association.key)
__build__(name, attributes[association.key], association, selected_fields)
end
end
Expand All @@ -317,7 +317,7 @@ def get_relation(name, association, object, reload = false) # rubocop:disable St
# @return [ Hash | nil ]
#
# @api private
def _mongoid_filter_selected_fields(assoc_key)
def _active_document_filter_selected_fields(assoc_key)
return nil unless __selected_fields

# If the list of fields was specified using #without instead of #only
Expand Down
6 changes: 3 additions & 3 deletions lib/active_document/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def configured?
# @note Use only in development or test environments for convenience.
#
# @example Set the database to connect to.
# config.connect_to("mongoid_test")
# config.connect_to("active_document_test")
#
# @param [ String ] name The database name.
def connect_to(name, options = { read: { mode: :primary } })
Expand All @@ -209,11 +209,11 @@ def destructive_fields
Composable.prohibited_methods
end

# Load the settings from a compliant activedocument.yml file. This can be used for
# Load the settings from a compliant active_document.yml file. This can be used for
# easy setup with frameworks other than Rails.
#
# @example Configure ActiveDocument.
# ActiveDocument.load!("/path/to/activedocument.yml")
# ActiveDocument.load!("/path/to/active_document.yml")
#
# @param [ String ] path The path to the file.
# @param [ String | Symbol ] environment The environment to load.
Expand Down
2 changes: 1 addition & 1 deletion lib/active_document/config/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def env_name
# specified environment, or for the current ActiveDocument environment.
#
# @example Load the yaml.
# Environment.load_yaml("/work/activedocument.yml")
# Environment.load_yaml("/work/active_document.yml")
#
# @param [ String ] path The location of the file.
# @param [ String | Symbol ] environment Optional environment name to
Expand Down
Loading

0 comments on commit ce3ac7c

Please sign in to comment.