-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Swap app and gem #144
Swap app and gem #144
Conversation
3e132d7
to
6841968
Compare
Looks like the build isn't running the appraisal builds anymore. I'm gonna start a checklist in the description. |
Yeah, I'm sure there's a boatload of stuff that I've missed/broken. |
but the specs are passing now - that's cool. Before the rebase, I was getting failures for missing translations. |
Ah no, that was fixed separately too. The |
config.before(js: true) do | ||
page.driver.block_unknown_urls | ||
end | ||
Capybara::Webkit.configure do |c| |
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.
Pass &:block_unknown_urls
as an argument to configure
instead of a block.
ed03968
to
8addc48
Compare
CircleCI is now running Appraisals. |
🎉 |
@danbee this looks great! Now, what color should we paint the bikeshed? I was initially thinking |
A lot of the docs/articles I read called it
|
This is probably completely up to the project but the convention I've seen is to house this in So ... ¯_(ツ)_/¯ |
FWIW, I believe that the generator for Rails engines creates |
@JoelQ Indeed it does! I created a test engine to compare to. |
yeah, I'm against |
I wondered about whether it should even live in the |
Should there be a separate demo app (possibly in it's own repo) that gets deployed to heroku and a |
@JoelQ yeah, we'll probably want to break that out eventually. Right now there's test coupling, so it would be a bit painful in the near term. |
desc "Deploy the example app to Heroku" | ||
namespace :deploy do | ||
task :example do | ||
exec 'git push heroku `git subtree split --prefix spec/example_app`:master --force' |
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.
Looks like this heroku
remote differs from what gets set up in bin/setup
? Can we change bin/setup
to add contributors to the correct heroku app, with a remote name that matches this?
Also, I've been preferring the $(shell_command)
format, because:
- It differentiates the start and end of a command
- It's copy-and-pastable into Slack code snippets 😄
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.
Ah, then I guess we need two deploy tasks?
@danbee one inline comment, but then this looks good to me! Were there any outstanding tasks I forgot about? |
I don't think so! |
Alright. I'm going to add a CHANGELOG entry (the only user-facing change is the ability to point bundler to the gem on github) and merge it. Thanks! 🎉 |
I just ran |
Problem: Because `administrate.gemspec` was not at the root of the repository, users could not install the gem by pointing their Gemfile at Github. Solution: Move the gem to the root directory and moves the example app to a directory within the `/spec` directory. This makes it possible to refer to the gem directly from git or Github. The example app is stored as a [git subtree], which means it can be deployed separately to Heroku or other hosting services. [git subtree]: https://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/ Change notes: - The `translate` method defined in the controller was causing i18n-tasks to get confused about the missing keys in the locale file. Renamed it to `translate_with_resource`. - Fix Capybara Webkit deprecation warning - Load schema before running specs - Update the example apps Gemfile to point at Github, so the example app can be deployed to Heroku. For local development, the local copy of `administrate` takes precedence over the example app's Gemfile, and tests still run as expected. - Add rake task to deploy example app. This uses more-complex-than-normal git subtree commands, so it's good to have a shortcut.
73b4dab
to
01e125c
Compare
I'm making a note here: Huge success! |
Problem: -------- With the git subtree strategy adopted in #144, there are several unconventional things surrounding the heroku deploy process: - Pushing to heroku requires a `git subtree` command - We need special logic in the Gemfile in order to run the demo app locally with our local version of Administrate. - `rake` and `rails` commands need to be run from the `spec/example_app` subdirectory. In addition, there is a dependency problem between the example app and the master branch of administrate on github. The example app needs to pull the master branch as a dependency on heroku, but the `Gemfile.lock` locks it in to a specific version. It is impossible to point the `Gemfile.lock` at the repo's current commit, because that would require a new commit before we could deploy to Heroku. The result would be that the branch on Heroku would always differ from the branch on GitHub by at least one commit, and we would need to develop special tooling around pushing to heroku. Solution: --------- Make the `rails`, `rake`, and `bundle exec` commands work from the root directory of the repository. This involved: - Move the `config.ru` script to the root of the repo - Update `rake` and `rails` binstubs to reference nested rails app - Move `unicorn.rb` (required by Procfile) to top-level `config` dir - Combine both Gemfiles into a single one, at the root of the repo - Remove spring for simplicity I tested the following tasks. All work from the root directory of the repo: - deploy to heroku: `git push heroku master` - run server locally: `rails server` or `foreman start` - seed demo database: `rake db:seed` - migrate demo database: `rake db:migrate` - reset demo database: `rake db:drop db:create` - run rails generators: - `rails generate administrate:field FooBar` - I was pleasantly surprised that this placed the files in the correct `spec/example_app` subdirectory - access demo app console:: `rails console` - view demo app routes: `rake routes` - appraisal test suite: `bundle exec appraisal rake` References: ----------- http://stackoverflow.com/questions/3081699/deploy-a-subdirectory-to-heroku
Problem: -------- With the git subtree strategy adopted in #144, there are several unconventional things surrounding the heroku deploy process: - Pushing to heroku requires a `git subtree` command - We need special logic in the Gemfile in order to run the demo app locally with our local version of Administrate. - `rake` and `rails` commands need to be run from the `spec/example_app` subdirectory. In addition, there is a dependency problem between the example app and the master branch of administrate on github. The example app needs to pull the master branch as a dependency on heroku, but the `Gemfile.lock` locks it in to a specific version. It is impossible to point the `Gemfile.lock` at the repo's current commit, because that would require a new commit before we could deploy to Heroku. The result would be that the branch on Heroku would always differ from the branch on GitHub by at least one commit, and we would need to develop special tooling around pushing to heroku. Solution: --------- Make the `rails`, `rake`, and `bundle exec` commands work from the root directory of the repository. This involved: - Move the `config.ru` script to the root of the repo - Update `rake` and `rails` binstubs to reference nested rails app - Move `unicorn.rb` (required by Procfile) to top-level `config` dir - Combine both Gemfiles into a single one, at the root of the repo - Remove spring for simplicity - Remove unused rake tasks I tested the following tasks. All work from the root directory of the repo: - deploy to heroku: `git push heroku master` - run server locally: `rails server` or `foreman start` - seed demo database: `rake db:seed` - migrate demo database: `rake db:migrate` - reset demo database: `rake db:drop db:create` - run rails generators: - `rails generate administrate:field FooBar` - I was pleasantly surprised that this placed the files in the correct `spec/example_app` subdirectory - access demo app console:: `rails console` - view demo app routes: `rake routes` - appraisal test suite: `bundle exec appraisal rake` References: ----------- http://stackoverflow.com/questions/3081699/deploy-a-subdirectory-to-heroku
- Update gem version - Update README with recommended optimistic versioning for bundler - Update README with warning about Administrate's pre-1.0 status - Update CHANGELOG to fill in missing PR references - sort CHANGELOG entries according to change type Changes: ``` * [#191] [CHANGE] Improve API for specifying how resources are displayed across the dashboard. * Models are now displayed with a sensible default - (e.g. "User #2") * Users can define `ModelDashboard#display_resource(resource)` for custom display behavior * Users who have generated views for the following field types may need to update them to take advantage of the new API: * HasOne * HasMany * Polymorphic * BelongsTo * [#223] [FEATURE] Translation: Vietnamese * [#161] [FEATURE] Translation: Mandarin Chinese * [#196] [FEATURE] Translation: Taiwanese Mandarin * [#142] [FEATURE] Translation: Brazilian Portuguese * [#171] [FEATURE] Translation: Polish * [#153] [FEATURE] Translation: Russian * [#148] [FEATURE] Translation: French * [#147] [FEATURE] Translation: German * [#154] [FEATURE] Translation: Spanish * [#126] [UI] Preserve whitespace when rendering text fields * [#194] [BUGFIX] Don't clear out datetime values in form fields * [#193] [BUGFIX] Don't assume that unrecognized db column types are searchable * [#124] [BUGFIX] Better detection of application models * [#156] [COMPAT] Include missing `sass-rails` dependency in gemspec * [#174] [COMPAT] Make several missing dependencies explicit. * [#144] [COMPAT] Update repository structure so Bundler can pull the gem from github. (e.g. `gem "administrate", github: "thoughtbot/administrate"`) * [#166] [COMPAT] Use ANSI SQL standards for case-insensitive search * [#120] [DOC] Add Rubygems version badge to README * [#165] [DOC] Add CircleCI badge to README * [#119] [DOC] Add CodeClimate badge to README ```
- Update gem version - Update README with recommended optimistic versioning for bundler - Update README with warning about Administrate's pre-1.0 status - Update CHANGELOG to fill in missing PR references - add `[I18n]` category to CHANGELOG - sort CHANGELOG entries according to change type Changes: * [#191] [CHANGE] Improve API for specifying how resources are displayed across the dashboard. * Models are now displayed with a sensible default - (e.g. "User #2") * Users can define `ModelDashboard#display_resource(resource)` for custom display behavior * Users who have generated views for the following field types may need to update them to take advantage of the new API: * HasOne * HasMany * Polymorphic * BelongsTo * [#223] [FEATURE] Translation: Vietnamese * [#161] [FEATURE] Translation: Mandarin Chinese * [#196] [FEATURE] Translation: Taiwanese Mandarin * [#142] [FEATURE] Translation: Brazilian Portuguese * [#171] [FEATURE] Translation: Polish * [#153] [FEATURE] Translation: Russian * [#148] [FEATURE] Translation: French * [#147] [FEATURE] Translation: German * [#154] [FEATURE] Translation: Spanish * [#126] [UI] Preserve whitespace when rendering text fields * [#194] [BUGFIX] Don't clear out datetime values in form fields * [#193] [BUGFIX] Don't assume that unrecognized db column types are searchable * [#124] [BUGFIX] Better detection of application models * [#156] [COMPAT] Include missing `sass-rails` dependency in gemspec * [#174] [COMPAT] Make several missing dependencies explicit. * [#144] [COMPAT] Update repository structure so Bundler can pull the gem from github. (e.g. `gem "administrate", github: "thoughtbot/administrate"`) * [#166] [COMPAT] Use ANSI SQL standards for case-insensitive search * [#120] [DOC] Add Rubygems version badge to README * [#165] [DOC] Add CircleCI badge to README * [#119] [DOC] Add CodeClimate badge to README
Moves the gem to the root directory and moves the example app to a
directory within the
/spec
directory. This makes it possible to referto the gem directly from git or Github.
TODO