commands 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'commands'
3
- s.version = '0.0.2'
3
+ s.version = '0.0.3'
4
4
  s.author = 'David Heinemeier Hansson'
5
5
  s.email = 'david@37signals.com'
6
6
  s.summary = 'Run Rake/Rails commands through the console'
@@ -18,15 +18,15 @@ class Commands
18
18
  end
19
19
 
20
20
  def rake(task, *args)
21
- silence_logger { Rake::Task[task].invoke(*args) }
22
-
21
+ silence_active_record_logger { Rake::Task[task].invoke(*args) }
22
+
23
23
  # Rake by default only allows tasks to be run once per session
24
24
  Rake.application.tasks.each(&:reenable)
25
25
 
26
- nil
26
+ "Completed"
27
27
  rescue SystemExit
28
28
  # Swallow exit/abort calls as we'll never want to exit the IRB session
29
- nil
29
+ "Failed"
30
30
  end
31
31
 
32
32
  # FIXME: Turn this into calls directly to the test classes, so we don't have to load environment again.
@@ -66,15 +66,16 @@ class Commands
66
66
  ARGV.replace [nil]
67
67
  end
68
68
 
69
- nil
69
+ "Completed"
70
70
  end
71
71
 
72
72
  # Only just ensured that this method is available in rails/master, so need a guard for a bit.
73
- def silence_logger
74
- if ActiveRecord::Base.logger.respond_to? :silence
75
- ActiveRecord::Base.logger.silence { yield }
76
- else
73
+ def silence_active_record_logger
74
+ begin
75
+ old_logger_level, ActiveRecord::Base.logger.level = ActiveRecord::Base.logger.level, Logger::ERROR
77
76
  yield
77
+ ensure
78
+ ActiveRecord::Base.logger.level = old_logger_level
78
79
  end
79
80
  end
80
81
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commands
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -33,6 +33,7 @@ executables: []
33
33
  extensions: []
34
34
  extra_rdoc_files: []
35
35
  files:
36
+ - ./commands-0.0.2.gem
36
37
  - ./commands.gemspec
37
38
  - ./Gemfile
38
39
  - ./Gemfile.lock