Module: Devpack
- Defined in:
- lib/devpack.rb,
lib/devpack/gems.rb,
lib/devpack/config.rb,
lib/devpack/gem_ref.rb,
lib/devpack/railtie.rb,
lib/devpack/version.rb,
lib/devpack/gem_glob.rb,
lib/devpack/gem_spec.rb,
lib/devpack/messages.rb,
lib/devpack/initializers.rb
Overview
Provides helper method for writing warning messages.
Defined Under Namespace
Classes: Config, Error, GemGlob, GemIncompatibilityError, GemNotFoundError, GemRef, GemSpec, Gems, Initializers, Messages, Railtie
Constant Summary
collapse
- VERSION =
'0.4.2'
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
57
58
59
|
# File 'lib/devpack.rb', line 57
def config
@config ||= Devpack::Config.new(Dir.pwd)
end
|
.debug? ⇒ Boolean
41
42
43
|
# File 'lib/devpack.rb', line 41
def debug?
ENV.key?('DEVPACK_DEBUG')
end
|
.disabled? ⇒ Boolean
45
46
47
|
# File 'lib/devpack.rb', line 45
def disabled?
ENV.key?('DEVPACK_DISABLE')
end
|
.rails? ⇒ Boolean
53
54
55
|
# File 'lib/devpack.rb', line 53
def rails?
defined?(Rails::Railtie)
end
|
.silent? ⇒ Boolean
49
50
51
|
# File 'lib/devpack.rb', line 49
def silent?
ENV.key?('DEVPACK_SILENT')
end
|
.warn(level, message) ⇒ Object
34
35
36
37
38
39
|
# File 'lib/devpack.rb', line 34
def warn(level, message)
return if silent?
prefixed = message.split("\n").map { |line| "#{prefix(level)} #{line}" }.join("\n")
Kernel.warn(prefixed)
end
|