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

Add Support for Rails 3.1 #99

Merged
merged 1 commit into from
Mar 6, 2015
Merged

Add Support for Rails 3.1 #99

merged 1 commit into from
Mar 6, 2015

Conversation

seanpdoyle
Copy link
Contributor

Add Support for Rails 3.1

  • reduce Railties version
  • only inflect on CLI acronym if that API is available

delegate :configuration, to: EmberCLI
delegate :tee_path, :npm_path, :bundler_path, to: :configuration

def non_production?
!Rails.env.production?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relying on Rails.env.production? is an anti-pattern and totally not gonna work for any production-like environment with a different name. For instance lots of people actually create a separate environment called staging by copying production.rb into staging.rb and deploing it. This change ensures that none of this gonna work anymore. This is the main reason Helpers.non_production? exists in the first place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we expose these are configurations, with the default value set from the logic in Helpers?

The project that is driving these changes has config.consider_all_requests_local = false

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you mean?

config.consider_all_requests_local = false is usually a sign of a production-like environment. Which means that you probably want a production-like behavior from the gem (do nothing, let assets be precompiled).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.

The problem I'm facing is that I've manually set config.use_ember_middleware = true, overriding the value of non_production?. This works for browsing the app, the EmberCLI app's test/index.html is no longer included in the build, since non_production?? "development" : "production" is evaluating to "production".

This is breaking the work done in 0.1.7

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Errm... does it mean that you want ember tests in production?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this is a bigger issue that it seems.

The gem has essentially three modes of operation:

  • development

    Starts a build server on first request, runs it until the process dies.

  • test

    Builds assets once, does nothing after.

  • production

    Does nothing.

I guess instead of having this logic being spread out in lots of different places, we could make a single config option to let user set the operation mode manually.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this discussion doesn't have anything to do with 3.1 support, it's a separate issue, am I wrong?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rwz that's probably true.

cc: @rondale-sc

In the mean time, what part of this diff is a point of contention to be being merged?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I reduce the scope of this PR to just the gemspec and inflector changes?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that'd be cool. Let's remove the version changes, and precompile flag from it.

@seanpdoyle
Copy link
Contributor Author

@rwz I've responded in #99 (comment) but it's now hidden by an outdated diff

@@ -12,6 +12,6 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = ">= 1.9.3"

spec.add_dependency "railties", "~> 4.0"
spec.add_dependency "sprockets-rails", "~> 2.0"
spec.add_dependency "railties", ">= 3.1"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do "> 3.1", "< 5", since we can't use "~>"

@rwz
Copy link
Collaborator

rwz commented Mar 6, 2015

So, can you please undo all the changes that are not gemspec and inflection? And then we can merge it.

@rwz
Copy link
Collaborator

rwz commented Mar 6, 2015

Oh, and change version comparison to > "3.2".

* reduce Railties version
* only inflect on `CLI` acronym if that API is available
@seanpdoyle
Copy link
Contributor Author

@rwz good to go

@rwz
Copy link
Collaborator

rwz commented Mar 6, 2015

👍

rwz added a commit that referenced this pull request Mar 6, 2015
@rwz rwz merged commit 3fa6b9c into tricknotes:master Mar 6, 2015
@seanpdoyle seanpdoyle deleted the sd-rails-3.1 branch March 6, 2015 02:29
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.

2 participants