-
-
Notifications
You must be signed in to change notification settings - Fork 408
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
Bundle less generator failure #1938
Conversation
@deivid-rodriguez CircleCI got an error: https://circleci.com/gh/decidim/decidim/4663#queue-placeholder/containers/0
😕 |
Codecov Report
@@ Coverage Diff @@
## master #1938 +/- ##
==========================================
- Coverage 98.48% 98.47% -0.02%
==========================================
Files 1145 1145
Lines 25737 25734 -3
==========================================
- Hits 25347 25341 -6
- Misses 390 393 +3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CircleCI has errors but somehow the build is green 😕
@mrcasals It's expected, it's because of d3d76c5. I changed it so that new people cloning a fresh repo are allowed to get an error on DB dropping (because the DB won't exist previously). Previously we workarounded this in CI by skipping this step via What do you think? |
And rename it so that specs don't fail on a freshly cloned repo (where ./tmp does not exist).
We can't asume bundler is available inside our generators, since it will not when they are run through decidim executable. Fixes the following crash: ``` /code/to/decidim/lib/generators/decidim/install_generator.rb:25:in `bundle_install': uninitialized constant Decidim::Generators::InstallGenerator::Bundler (NameError) ```
ebd8586
to
08ddb8c
Compare
Ah, I understand now. I find it a little weird that we get errors on the build but still everything's normal. Is there a way to check if the database exists before dropping? Found this in a 2-second search on Google: https://stackoverflow.com/a/25592558/2110884 def database_exists?
ActiveRecord::Base.connection
rescue ActiveRecord::NoDatabaseError
false
else
true
end What do you think? |
I did try that but couldn't get it working. Let me try spend another five minutes! |
For example, on freshly cloned repos. As a result, we no longer need to check for CI here.
So we can give it the standard "test name" and it doesn't affect our "real" development application.
08ddb8c
to
a5cf40b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
* Fix crash when running decidim executable We can't asume bundler is available inside our generators, since it will not when they are run through decidim executable. Fixes the following crash: ``` /code/to/decidim/lib/generators/decidim/install_generator.rb:25:in `bundle_install': uninitialized constant Decidim::Generators::InstallGenerator::Bundler (NameError) ``` * Improve some test descriptions * Test generator without flags * Extract a shared example * Extract test app name to a variable And rename it so that specs don't fail on a freshly cloned repo (where ./tmp does not exist). * Allow DB dropping to fail For example, on freshly cloned repos. As a result, we no longer need to check for CI here. * Generate dev application in tests via bin/decidim So we can give it the standard "test name" and it doesn't affect our "real" development application.
* Fix crash when running decidim executable We can't asume bundler is available inside our generators, since it will not when they are run through decidim executable. Fixes the following crash: ``` /code/to/decidim/lib/generators/decidim/install_generator.rb:25:in `bundle_install': uninitialized constant Decidim::Generators::InstallGenerator::Bundler (NameError) ``` * Improve some test descriptions * Test generator without flags * Extract a shared example * Extract test app name to a variable And rename it so that specs don't fail on a freshly cloned repo (where ./tmp does not exist). * Allow DB dropping to fail For example, on freshly cloned repos. As a result, we no longer need to check for CI here. * Generate dev application in tests via bin/decidim So we can give it the standard "test name" and it doesn't affect our "real" development application.
* Don't use models in migrations (#1921) * Run seeds in the same process as migrations So we can detect bad model usage inside migrations. * Don't swallow errors in app generation The `rails_command` method shells out the target command, but swallows any errors that may happen. In my opinion, this is bad because we really want these commands to succeed, and since the output is usually long, you might not notice that they have failed. In addition, if errors are swallowed, it's really hard to unit test generators! * Remove hardcoded models from migrations And add a regression test for development app generation. To ensure that these errors can be properly caught in the future. * Prefer `abort` to `exit 1` * Remove unnecessary `ActiveRecord::Base.connection` In migrations, all that stuff in directly available. * Silence test output * Fix app generators (#1931) * Bundle less generator failure (#1938) * Fix crash when running decidim executable We can't asume bundler is available inside our generators, since it will not when they are run through decidim executable. Fixes the following crash: ``` /code/to/decidim/lib/generators/decidim/install_generator.rb:25:in `bundle_install': uninitialized constant Decidim::Generators::InstallGenerator::Bundler (NameError) ``` * Improve some test descriptions * Test generator without flags * Extract a shared example * Extract test app name to a variable And rename it so that specs don't fail on a freshly cloned repo (where ./tmp does not exist). * Allow DB dropping to fail For example, on freshly cloned repos. As a result, we no longer need to check for CI here. * Generate dev application in tests via bin/decidim So we can give it the standard "test name" and it doesn't affect our "real" development application. * Centralize dependencies (#1958) * Style fixes in template Gemfile * Centralize dependencies to a single Gemfile * Upgrade dependencies * Require survey TOS field on admin (#1980) * Require survey TOS field on admin * Add CHANGELOG entry * Fix puma dep * Fix input fields for single locale organizations (#1983) * Fix input fields for single locale organizations * Add CHANGELOG entry * Bump version to 0.6.6 * Downgrade graphiql-rails * Update CHANGELOG * Use latest docker image on CircleCI
🎩 What? Why?
Our generator was crashing when run directly via
decidim
's executable (gem install decidim; decidim my_awesome_app
). This is becausebundler
is not available in that case.This PR fixes that, changes our tests so they catch this thing, and improves some extra related stuff.
📌 Related Issues
bundle install
#1873 (where I introduced this while fixing other issues).📋 Subtasks
None.
📷 Screenshots (optional)
None.
👻 GIF