Skip to content

Commit

Permalink
Merge pull request #330 from AssetSync/fix/config-log-sliently
Browse files Browse the repository at this point in the history
Fix/config log sliently
  • Loading branch information
PikachuEXE authored Aug 18, 2016
2 parents 62ee3b3 + 236a6f9 commit eaacb4f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- Nothing
- Respect value of option `log_silently` even when `ENV['RAILS_GROUPS'] == 'assets'`


## [1.2.0] - 2016-08-17
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ AssetSync.configure do |config|
#
# Fail silently. Useful for environments such as Heroku
# config.fail_silently = true
#
# Log silently. Default is `true`. But you can set it to false if more logging message are preferred.
# Logging messages are sent to `STDOUT` when `log_silently` is falsy
# config.log_silently = true
end
```

Expand Down
2 changes: 1 addition & 1 deletion lib/asset_sync/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def fail_silently?
end

def log_silently?
ENV['RAILS_GROUPS'] == 'assets' || !!self.log_silently
!!self.log_silently
end

def enabled?
Expand Down
8 changes: 4 additions & 4 deletions spec/unit/asset_sync_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@
it "should default log_silently to true" do
expect(AssetSync.config.log_silently).to be_truthy
end

it "log_silently? should reflect the configuration" do
AssetSync.config.log_silently = false
expect(AssetSync.config.log_silently?).to eq(false)
end

it "log_silently? should always be true if ENV['RAILS_GROUPS'] == 'assets'" do
AssetSync.config.log_silently = false
# make sure ENV is actually being checked ...
expect(ENV).to receive(:[]).with('RAILS_GROUPS').and_return('assets')
expect(AssetSync.config.log_silently?).to eq(true)
allow(ENV).to receive(:[]).with('RAILS_GROUPS').and_return('assets')

expect(AssetSync.config.log_silently?).to eq(false)
end

it "should default cdn_distribution_id to nil" do
Expand Down

0 comments on commit eaacb4f

Please sign in to comment.