Module: Guard::Deprecated::Guard::ClassMethods
- Defined in:
- lib/guard/deprecated/guard.rb
Constant Summary collapse
- MORE_INFO_ON_UPGRADING_TO_GUARD_2 =
<<-EOS.gsub(/^\s*/, "") For more information on how to upgrade for Guard 2.0, please head over to: https://github.com/guard/guard/wiki/Upgrading-to-Guard-2.0%s EOS
- GUARDS =
Deprecated.
Use ‘Guard.plugins(filter)` instead.
<<-EOS.gsub(/^\s*/, "") Starting with Guard 2.0 'Guard.guards(filter)' is deprecated. Please use 'Guard.plugins(filter)' instead. #{MORE_INFO_ON_UPGRADING_TO_GUARD_2 % '#deprecated-methods'} EOS
- ADD_GUARD =
Deprecated.
Use ‘Guard.add_plugin(name, options = {})` instead.
<<-EOS.gsub(/^\s*/, "") Starting with Guard 2.0 'Guard.add_guard(name, options = {})' is deprecated. Please use 'Guard.add_plugin(name, options = {})' instead. #{MORE_INFO_ON_UPGRADING_TO_GUARD_2 % '#deprecated-methods'} EOS
- GET_GUARD_CLASS =
Deprecated.
Use ‘Guard::PluginUtil.new(name).plugin_class(fail_gracefully: fail_gracefully)` instead.
<<-EOS.gsub(/^\s*/, "") Starting with Guard 2.0 'Guard.get_guard_class(name, fail_gracefully = false)' is deprecated and is now always on. Please use 'Guard::PluginUtil.new(name).plugin_class(fail_gracefully: fail_gracefully)' instead. #{MORE_INFO_ON_UPGRADING_TO_GUARD_2 % '#deprecated-methods'} EOS
- LOCATE_GUARD =
Deprecated.
Use ‘Guard::PluginUtil.new(name).plugin_location` instead.
<<-EOS.gsub(/^\s*/, "") Starting with Guard 2.0 'Guard.locate_guard(name)' is deprecated. Please use 'Guard::PluginUtil.new(name).plugin_location' instead. #{MORE_INFO_ON_UPGRADING_TO_GUARD_2 % '#deprecated-methods'} EOS
- GUARD_GEM_NAMES =
Deprecated.
Use ‘Guard::PluginUtil.plugin_names` instead.
Deprecator message for the ‘Guard.guard_gem_names` method
<<-EOS.gsub(/^\s*/, "") Starting with Guard 2.0 'Guard.guard_gem_names' is deprecated. Please use 'Guard::PluginUtil.plugin_names' instead. #{MORE_INFO_ON_UPGRADING_TO_GUARD_2 % '#deprecated-methods'} EOS
- RUNNING =
<<-EOS.gsub(/^\s*/, "") Starting with Guard 2.7.1 it was discovered that Guard.running was never initialized or used internally. EOS
- LOCK =
<<-EOS.gsub(/^\s*/, "") Starting with Guard 2.7.1 it was discovered that this accessor was never initialized or used internally. EOS
- LISTENER_ASSIGN =
<<-EOS.gsub(/^\s*/, "") listener= should not be used EOS
- EVALUATOR =
<<-EOS.gsub(/^\s*/, "") Starting with Guard 2.8.2 this method shouldn't be used EOS
- RESET_EVALUATOR =
<<-EOS.gsub(/^\s*/, "") Starting with Guard 2.8.2 this method shouldn't be used EOS
- RUNNER =
<<-EOS.gsub(/^\s*/, "") Starting with Guard 2.8.2 this method shouldn't be used EOS
- EVALUATE_GUARDFILE =
<<-EOS.gsub(/^\s*/, "") Starting with Guard 2.8.2 this method shouldn't be used EOS
- OPTIONS =
<<-EOS.gsub(/^\s*/, "") Starting with Guard 2.9.0 Guard.options is deprecated and ideally you should be able to set specific options through an API or a DSL method. Feel free to add feature requests if there's something missing. EOS
- ADD_GROUP =
<<-EOS.gsub(/^\s*/, "") add_group is deprecated since 2.10.0 in favor of Guard.state.session.groups.add EOS
- ADD_PLUGIN =
<<-EOS.gsub(/^\s*/, "") add_plugin is deprecated since 2.10.0 in favor of Guard.state.session.plugins.add EOS
- GROUP =
<<-EOS.gsub(/^\s*/, "") group is deprecated since 2.10.0 in favor of Guard.state.session.group.add(filter).first EOS
- PLUGIN =
<<-EOS.gsub(/^\s*/, "") plugin is deprecated since 2.10.0 in favor of Guard.state.session.group.add(filter).first EOS
- GROUPS =
<<-EOS.gsub(/^\s*/, "") group is deprecated since 2.10.0 in favor of Guard.state.session.groups.all(filter) EOS
- PLUGINS =
<<-EOS.gsub(/^\s*/, "") plugins is deprecated since 2.10.0 in favor of Guard.state.session.plugins.all(filter) EOS
- SCOPE =
<<-EOS.gsub(/^\s*/, "") scope is deprecated since 2.10.0 in favor of Guard.state.scope.to_hash EOS
- SCOPE_ASSIGN =
<<-EOS.gsub(/^\s*/, "") scope= is deprecated since 2.10.0 in favor of Guard.state.scope.to_hash EOS
Instance Method Summary collapse
- #add_group(name, options = {}) ⇒ Object
- #add_guard(*args) ⇒ Object
- #add_plugin(name, options = {}) ⇒ Object
- #evaluate_guardfile ⇒ Object
- #evaluator ⇒ Object
- #get_guard_class(name, fail_gracefully = false) ⇒ Object
- #group(filter) ⇒ Object
- #groups(filter) ⇒ Object
- #guard_gem_names ⇒ Object
- #guards(filter = nil) ⇒ Object
- #listener=(_) ⇒ Object
- #locate_guard(name) ⇒ Object
- #lock ⇒ Object
- #options ⇒ Object
- #plugin(filter) ⇒ Object
- #plugins(filter) ⇒ Object
- #reset_evaluator(_options) ⇒ Object
- #runner ⇒ Object
- #running ⇒ Object
- #scope ⇒ Object
- #scope=(scope) ⇒ Object
Instance Method Details
#add_group(name, options = {}) ⇒ Object
251 252 253 254 |
# File 'lib/guard/deprecated/guard.rb', line 251 def add_group(name, = {}) UI.deprecation(ADD_GROUP) ::Guard.state.session.groups.add(name, ) end |
#add_guard(*args) ⇒ Object
57 58 59 60 |
# File 'lib/guard/deprecated/guard.rb', line 57 def add_guard(*args) ::Guard::UI.deprecation(ADD_GUARD) add_plugin(*args) end |
#add_plugin(name, options = {}) ⇒ Object
261 262 263 264 |
# File 'lib/guard/deprecated/guard.rb', line 261 def add_plugin(name, = {}) UI.deprecation(ADD_PLUGIN) ::Guard.state.session.plugins.add(name, ) end |
#evaluate_guardfile ⇒ Object
179 180 181 182 183 184 185 186 |
# File 'lib/guard/deprecated/guard.rb', line 179 def evaluate_guardfile UI.deprecation(EVALUATE_GUARDFILE) = ::Guard.state.session. evaluator = ::Guard::Guardfile::Evaluator.new() evaluator.evaluate msg = "No plugins found in Guardfile, please add at least one." ::Guard::UI.error msg if _pluginless_guardfile? end |
#evaluator ⇒ Object
152 153 154 155 156 |
# File 'lib/guard/deprecated/guard.rb', line 152 def evaluator UI.deprecation(EVALUATOR) = ::Guard.state.session. ::Guard::Guardfile::Evaluator.new() end |
#get_guard_class(name, fail_gracefully = false) ⇒ Object
79 80 81 82 |
# File 'lib/guard/deprecated/guard.rb', line 79 def get_guard_class(name, fail_gracefully = false) UI.deprecation(GET_GUARD_CLASS) PluginUtil.new(name).plugin_class(fail_gracefully: fail_gracefully) end |
#group(filter) ⇒ Object
271 272 273 274 |
# File 'lib/guard/deprecated/guard.rb', line 271 def group(filter) UI.deprecation(GROUP) ::Guard.state.session.groups.all(filter).first end |
#groups(filter) ⇒ Object
291 292 293 294 |
# File 'lib/guard/deprecated/guard.rb', line 291 def groups(filter) UI.deprecation(GROUPS) ::Guard.state.session.groups.all(filter) end |
#guard_gem_names ⇒ Object
116 117 118 119 |
# File 'lib/guard/deprecated/guard.rb', line 116 def guard_gem_names UI.deprecation(GUARD_GEM_NAMES) PluginUtil.plugin_names end |
#guards(filter = nil) ⇒ Object
38 39 40 41 |
# File 'lib/guard/deprecated/guard.rb', line 38 def guards(filter = nil) ::Guard::UI.deprecation(GUARDS) ::Guard.state.session.plugins.all(filter) end |
#listener=(_) ⇒ Object
143 144 145 146 |
# File 'lib/guard/deprecated/guard.rb', line 143 def listener=(_) UI.deprecation(LISTENER_ASSIGN) ::Guard.listener end |
#locate_guard(name) ⇒ Object
97 98 99 100 |
# File 'lib/guard/deprecated/guard.rb', line 97 def locate_guard(name) UI.deprecation(LOCATE_GUARD) PluginUtil.new(name).plugin_location end |
#lock ⇒ Object
135 136 137 |
# File 'lib/guard/deprecated/guard.rb', line 135 def lock UI.deprecation(LOCK) end |
#options ⇒ Object
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/guard/deprecated/guard.rb', line 195 def UI.deprecation(OPTIONS) Class.new(Hash) do def initialize super(to_hash) end def to_hash session = ::Guard.state.session { clear: session.clearing?, debug: session.debug?, watchdir: Array(session.watchdirs).map(&:to_s), notify: session.[:notify], no_interactions: (session.interactor_name == :sleep) } end extend Forwardable delegate [:to_a, :keys] => :to_hash delegate [:include?] => :keys def fetch(key, *args) hash = to_hash verify_key!(hash, key) hash.fetch(key, *args) end def []=(key, value) case key when :clear ::Guard.state.session.clearing(value) else msg = "Oops! Guard.option[%s]= is unhandled or unsupported." \ "Please file an issue if you rely on this option working." fail NotImplementedError, format(msg, key) end end private def verify_key!(hash, key) return if hash.key?(key) msg = "Oops! Guard.option[%s] is unhandled or unsupported." \ "Please file an issue if you rely on this option working." fail NotImplementedError, format(msg, key) end end.new end |
#plugin(filter) ⇒ Object
281 282 283 284 |
# File 'lib/guard/deprecated/guard.rb', line 281 def plugin(filter) UI.deprecation(PLUGIN) ::Guard.state.session.plugins.all(filter).first end |
#plugins(filter) ⇒ Object
301 302 303 304 |
# File 'lib/guard/deprecated/guard.rb', line 301 def plugins(filter) UI.deprecation(PLUGINS) ::Guard.state.session.plugins.all(filter) end |
#reset_evaluator(_options) ⇒ Object
162 163 164 |
# File 'lib/guard/deprecated/guard.rb', line 162 def reset_evaluator() UI.deprecation(RESET_EVALUATOR) end |
#runner ⇒ Object
170 171 172 173 |
# File 'lib/guard/deprecated/guard.rb', line 170 def runner UI.deprecation(RUNNER) ::Guard::Runner.new end |
#running ⇒ Object
126 127 128 129 |
# File 'lib/guard/deprecated/guard.rb', line 126 def running UI.deprecation(RUNNING) nil end |
#scope ⇒ Object
311 312 313 314 |
# File 'lib/guard/deprecated/guard.rb', line 311 def scope UI.deprecation(SCOPE) ::Guard.state.scope.to_hash end |
#scope=(scope) ⇒ Object
321 322 323 324 |
# File 'lib/guard/deprecated/guard.rb', line 321 def scope=(scope) UI.deprecation(SCOPE_ASSIGN) ::Guard.state.scope.from_interactor(scope) end |