Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensuring rails_options are parsed #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Ensuring rails_options are parsed #102

wants to merge 1 commit into from

Conversation

jeremyf
Copy link
Contributor

@jeremyf jeremyf commented Feb 4, 2020

Prior to this commit, I had an .engine_cart.yml file with the
following YAML/ERB:

<%
  rails_options = []
  rails_options << "--skip-listen" if ENV.fetch('RAILS_VERSION', '') < '5.0'
  rails_options << "--database=postgresql" if ENV.fetch('CI', false)
%>
rails_options: "<%= rails_options.join(' ') %>"

The rendered YAML was: rails_options: "--skip-listen --database=postgresql"

When I ran the rake engine_cart:generate the parameters passed to
Rails::Generators::AppGenerator.start were;

[
  "internal",
  "--skip-git",
  "--skip-keeps",
  "--skip_spring",
  "--skip-bootsnap",
  "--skip-listen",
  "--skip-bundle",
  "--skip-test --database=postgresql"
]

Note, the last parameter, wihch cam from the .engine_cart.yaml are
not split. The end result is that the Rails generation did not build
the .internal_test_app with postgresql as the given database option.

In introducing this change, the above parameters were:

[
  "internal",
  "--skip-git",
  "--skip-keeps",
  "--skip_spring",
  "--skip-bootsnap",
  "--skip-listen",
  "--skip-bundle",
  "--skip-test",
  "--database=postgresql"
]

With those parameters, the .internal_test_app was built with
postgresql as the default Rails database.

Also, to help any debugging, I'm adding an output to the generation
process to debug what configuration options I'm doing.

In this debugging, I disocvered that the .engine_cart.yml config
completely obliterates ENGINE_CART_RAILS_OPTIONS ENV. That is
acceptable but means some downstream implementations may not be
configuring their engine cart behavior as they thought, in particular
looking at Hyrax's CircleCI Config as it interplays with it's
.engine_cart.yml configuration

Prior to this commit, I had an `.engine_cart.yml` file with the
following YAML/ERB:

```yaml
<%
  rails_options = []
  rails_options << "--skip-listen" if ENV.fetch('RAILS_VERSION', '') < '5.0'
  rails_options << "--database=postgresql" if ENV.fetch('CI', false)
%>
rails_options: "<%= rails_options.join(' ') %>"
```

The rendered YAML was: `rails_options: "--skip-listen --database=postgresql"`

When I ran the `rake engine_cart:generate` the parameters passed to
`Rails::Generators::AppGenerator.start` were;

```ruby
[
  "internal",
  "--skip-git",
  "--skip-keeps",
  "--skip_spring",
  "--skip-bootsnap",
  "--skip-listen",
  "--skip-bundle",
  "--skip-test --database=postgresql"
]
```

Note, the last parameter, wihch cam from the `.engine_cart.yaml` are
not split. The end result is that the Rails generation did not build
the `.internal_test_app` with postgresql as the given database option.

In introducing this change, the above parameters were:

```ruby
[
  "internal",
  "--skip-git",
  "--skip-keeps",
  "--skip_spring",
  "--skip-bootsnap",
  "--skip-listen",
  "--skip-bundle",
  "--skip-test",
  "--database=postgresql"
]
```

With those parameters, the `.internal_test_app` was built with
postgresql as the default Rails database.

Also, to help any debugging, I'm adding an output to the generation
process to debug what configuration options I'm doing.

In this debugging, I disocvered that the `.engine_cart.yml` config
completely obliterates `ENGINE_CART_RAILS_OPTIONS` ENV. That is
acceptable but means some downstream implementations may not be
configuring their engine cart behavior as they thought, in particular
looking at [Hyrax's CircleCI Config][1] as it interplays with it's
[`.engine_cart.yml` configuration][2]

[1]:https://github.com/samvera/hyrax/blob/977e2d0719ba0d5163fc8719f86d0a094a8fb27e/.circleci/config.yml#L67
[2]:https://github.com/samvera/hyrax/blob/977e2d0719ba0d5163fc8719f86d0a094a8fb27e/.engine_cart.yml
jeremyf added a commit to samvera/hyrax that referenced this pull request Feb 4, 2020
At present, EngineCart's parsing of `.engine_cart.yml` will overwrite
the `ENGINE_CART_RAILS_OPTIONS` set in CircleCI (see
[cbeer/engine_cart/102][1] for some details). The present overwrite
behavior is reasonable. As the removed `.engine_cart.yml` targeted
pre-Rails 5 behavior, I opted to remove it.

In doing so, this would now "activate" the `.circleci/config.yml`
declaration of `ENGINE_CART_RAILS_OPTIONS`. As we have coffee script in
Hyrax (for better or worse) and we have ActionCable usage, I needed to
revisit the now activated parameters.

Note: This is in preparation for allowing PostgreSQL as the database
for CircleCI.

As this impacts the `.internal_test_app` generation, I also needed to
bump the Regen number.

TL;DR: A 4 year old file that we no longer need is silently trampling
on a CI variable. That CI variable has likely not been used. It now will
be used, but needed modifications to reflect that usage.

_I hope this works, as iterating on the CI process is always time
consuming as it requires coordination of remote resources._

[1]:cbeer/engine_cart#102
jeremyf added a commit to samvera/hyrax that referenced this pull request Feb 4, 2020
At present, EngineCart's parsing of `.engine_cart.yml` will overwrite
the `ENGINE_CART_RAILS_OPTIONS` set in CircleCI (see
[cbeer/engine_cart/102][1] for some details). The present overwrite
behavior is reasonable. As the removed `.engine_cart.yml` targeted
pre-Rails 5 behavior, I opted to remove it.

In doing so, this would now "activate" the `.circleci/config.yml`
declaration of `ENGINE_CART_RAILS_OPTIONS`. As we have coffee script in
Hyrax (for better or worse) and we have ActionCable usage, I needed to
revisit the now activated parameters.

Note: This is in preparation for allowing PostgreSQL as the database
for CircleCI.

As this impacts the `.internal_test_app` generation, I also needed to
bump the Regen number.

TL;DR: A 4 year old file that we no longer need is silently trampling
on a CI variable. That CI variable has likely not been used. It now will
be used, but needed modifications to reflect that usage.

_I hope this works, as iterating on the CI process is always time
consuming as it requires coordination of remote resources._

[1]:cbeer/engine_cart#102
jeremyf added a commit to samvera/hyrax that referenced this pull request Feb 4, 2020
At present, EngineCart's parsing of `.engine_cart.yml` will overwrite
the `ENGINE_CART_RAILS_OPTIONS` set in CircleCI (see
[cbeer/engine_cart/102][1] for some details). The present overwrite
behavior is reasonable. As the removed `.engine_cart.yml` targeted
pre-Rails 5 behavior, I opted to remove it.

In doing so, this would now "activate" the `.circleci/config.yml`
declaration of `ENGINE_CART_RAILS_OPTIONS`. As we have coffee script in
Hyrax (for better or worse) and we have ActionCable usage, I needed to
revisit the now activated parameters.

Note: This is in preparation for allowing PostgreSQL as the database
for CircleCI.

As this impacts the `.internal_test_app` generation, I also needed to
bump the Regen number.

TL;DR: A 4 year old file that we no longer need is silently trampling
on a CI variable. That CI variable has likely not been used. It now will
be used, but needed modifications to reflect that usage.

_I hope this works, as iterating on the CI process is always time
consuming as it requires coordination of remote resources._

[1]:cbeer/engine_cart#102
jeremyf added a commit to samvera/hyrax that referenced this pull request Feb 4, 2020
At present, EngineCart's parsing of `.engine_cart.yml` will overwrite
the `ENGINE_CART_RAILS_OPTIONS` set in CircleCI (see
[cbeer/engine_cart/102][1] for some details). The present overwrite
behavior is reasonable. As the removed `.engine_cart.yml` targeted
pre-Rails 5 behavior, I opted to remove it.

In doing so, this would now "activate" the `.circleci/config.yml`
declaration of `ENGINE_CART_RAILS_OPTIONS`. As we have coffee script in
Hyrax (for better or worse) and we have ActionCable usage, I needed to
revisit the now activated parameters.

Note: This is in preparation for allowing PostgreSQL as the database
for CircleCI.

As this impacts the `.internal_test_app` generation, I also needed to
bump the Regen number.

TL;DR: A 4 year old file that we no longer need is silently trampling
on a CI variable. That CI variable has likely not been used. It now will
be used, but needed modifications to reflect that usage.

_I hope this works, as iterating on the CI process is always time
consuming as it requires coordination of remote resources._

[1]:cbeer/engine_cart#102
jeremyf added a commit to samvera/hyrax that referenced this pull request Feb 4, 2020
At present, EngineCart's parsing of `.engine_cart.yml` will overwrite
the `ENGINE_CART_RAILS_OPTIONS` set in CircleCI (see
[cbeer/engine_cart/102][1] for some details). The present overwrite
behavior is reasonable. As the removed `.engine_cart.yml` targeted
pre-Rails 5 behavior, I opted to remove it.

In doing so, this would now "activate" the `.circleci/config.yml`
declaration of `ENGINE_CART_RAILS_OPTIONS`. As we have coffee script in
Hyrax (for better or worse) and we have ActionCable usage, I needed to
revisit the now activated parameters.

Note: This is in preparation for allowing PostgreSQL as the database
for CircleCI.

As this impacts the `.internal_test_app` generation, I also needed to
bump the Regen number.

TL;DR: A 4 year old file that we no longer need is silently trampling
on a CI variable. That CI variable has likely not been used. It now will
be used, but needed modifications to reflect that usage.

_I hope this works, as iterating on the CI process is always time
consuming as it requires coordination of remote resources._

[1]:cbeer/engine_cart#102
jeremyf added a commit to samvera/hyrax that referenced this pull request Feb 4, 2020
At present, EngineCart's parsing of `.engine_cart.yml` will overwrite
the `ENGINE_CART_RAILS_OPTIONS` set in CircleCI (see
[cbeer/engine_cart/102][1] for some details). The present overwrite
behavior is reasonable. As the removed `.engine_cart.yml` targeted
pre-Rails 5 behavior, I opted to remove it.

In doing so, this would now "activate" the `.circleci/config.yml`
declaration of `ENGINE_CART_RAILS_OPTIONS`. As we have coffee script in
Hyrax (for better or worse) and we have ActionCable usage, I needed to
revisit the now activated parameters.

Note: This is in preparation for allowing PostgreSQL as the database
for CircleCI.

As this impacts the `.internal_test_app` generation, I also needed to
bump the Regen number.

TL;DR: A 4 year old file that we no longer need is silently trampling
on a CI variable. That CI variable has likely not been used. It now will
be used, but needed modifications to reflect that usage.

_I hope this works, as iterating on the CI process is always time
consuming as it requires coordination of remote resources._

[1]:cbeer/engine_cart#102
jeremyf added a commit to samvera/hyrax that referenced this pull request Feb 4, 2020
At present, EngineCart's parsing of `.engine_cart.yml` will overwrite
the `ENGINE_CART_RAILS_OPTIONS` set in CircleCI (see
[cbeer/engine_cart/102][1] for some details). The present overwrite
behavior is reasonable. As the removed `.engine_cart.yml` targeted
pre-Rails 5 behavior, I opted to remove it.

In doing so, this would now "activate" the `.circleci/config.yml`
declaration of `ENGINE_CART_RAILS_OPTIONS`. As we have coffee script in
Hyrax (for better or worse) and we have ActionCable usage, I needed to
revisit the now activated parameters. The parameters to which I changed
are the defaults of EngineCart (as of this PR).

Note: This is in preparation for allowing PostgreSQL as the database
for CircleCI.

As this impacts the `.internal_test_app` generation, I also needed to
bump the Regen number.

TL;DR: A 4 year old file that we no longer need is silently trampling
on a CI variable. That CI variable has likely not been used. It now will
be used, but needed modifications to reflect that usage.

_I hope this works, as iterating on the CI process is always time
consuming as it requires coordination of remote resources._

[1]:cbeer/engine_cart#102
@jeremyf jeremyf requested a review from cbeer February 4, 2020 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant