mordaroso / guard-motion

Guard::Motion automatically run your RubyMotion specs (much like autotest)
MIT License
45 stars 12 forks source link

Error - Could not load 'guard/motion... #12

Open dsgn1graphics opened 9 years ago

dsgn1graphics commented 9 years ago

Hi, I'm receiving the following error when I run guard init or guard init motion. ERROR - Could not load 'guard/motion' or '~/.guard/templates/motion' or find class Guard::Motion

My setup - OS X Yosemite 10.10.1 Running Ruby 2.1.2 with RVM

Gemfile

source 'https://rubygems.org'

gem 'rake'
# Add your dependencies here:
gem 'cocoapods'
gem 'motion-cocoapods'
gem 'motion_model'
gem 'formotion'
gem 'json', '~> 1.8.1'
gem 'guard-motion'
gem 'rb-fsevent', :require => false

Rakefile

# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios'
require 'motion-cocoapods'
require 'motion_model'
require 'guard/motion'
require 'formotion'

begin
  require 'bundler'
  Bundler.require
rescue LoadError
end

Motion::Project::App.setup do |app|
  # Use `rake config' to see complete project settings.
  app.name = 'SafeDate'

  # iOS Specific config
  app.icons = []
  app.fonts = []
  app.prerendered_icon = true
  app.interface_orientations = [:portrait]

  app.pods do
    pod 'AFNetworking'
  end
end
dsgn1graphics commented 9 years ago

When I manually create the Guardfile I get a little bit more feed back form the error stack.

Guardfile

guard 'motion' do
  watch(%r{^spec/.+_spec\.rb$})
  watch(%r{^app/(.+)\.rb$})     { |m| "spec/#{m[1]}_spec.rb" }
  watch(%r{^app/controllers/(.+)\.rb$})     { |m| "spec/controllers/#{m[1]}_spec.rb" }
  watch(%r{^app/models/(.+)\.rb$})     { |m| "spec/models/#{m[1]}_spec.rb" }
  watch('spec/helpers/spec_helper.rb')
end

Error Trace

Myrons-Mac-mini:SafeDate myron$ guard
08:16:01 - ERROR - Could not load 'guard/motion' or'    ' find class Guard::Motion
08:16:01 - ERROR - Error is: cannot load such file -- guard/guard
08:16:01 - ERROR - /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-motion-0.1.2/lib/guard/motion.rb:2:in `require'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-motion-0.1.2/lib/guard/motion.rb:2:in `<top (required)>'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/plugin_util.rb:105:in `require'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/plugin_util.rb:105:in `rescue in plugin_class'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/plugin_util.rb:97:in `plugin_class'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/plugin_util.rb:56:in `initialize_plugin'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/internals/plugins.rb:24:in `add'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/dsl.rb:186:in `block in guard'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/dsl.rb:183:in `each'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/dsl.rb:183:in `guard'
> [#] /Users/myron/motion_dev/SafeDate/Guardfile:10:in `evaluate'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/dsl.rb:378:in `instance_eval'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/dsl.rb:378:in `evaluate'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/guardfile/evaluator.rb:91:in `evaluate'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard.rb:155:in `_evaluate'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard.rb:60:in `setup'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/commander.rb:32:in `start'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/cli.rb:243:in `_start'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/cli.rb:108:in `start'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/aruba_adapter.rb:32:in `execute'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/lib/guard/aruba_adapter.rb:19:in `execute!'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/gems/guard-2.10.2/bin/guard:11:in `<top (required)>'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/bin/guard:23:in `load'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/bin/guard:23:in `<main>'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/bin/ruby_executable_hooks:15:in `eval'
> [#] /Users/myron/.rvm/gems/ruby-2.1.2@safedate_gems/bin/ruby_executable_hooks:15:in `<main>'
08:16:01 - ERROR - Invalid Guardfile, original error is: 
> [#] 
> [#] Could not load class: "Motion", 
> [#] backtrace: 
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/lib/guard/plugin_util.rb:57:in `initialize_plugin'
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/lib/guard/internals/plugins.rb:24:in `add'
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/lib/guard/dsl.rb:186:in `block in guard'
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/lib/guard/dsl.rb:183:in `each'
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/lib/guard/dsl.rb:183:in `guard'
> [#]   (dsl)> ./Guardfile:10:in `evaluate'
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/lib/guard/dsl.rb:378:in `instance_eval'
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/lib/guard/dsl.rb:378:in `evaluate'
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/lib/guard/guardfile/evaluator.rb:91:in `evaluate'
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/lib/guard.rb:155:in `_evaluate'
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/lib/guard.rb:60:in `setup'
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/lib/guard/commander.rb:32:in `start'
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/lib/guard/cli.rb:243:in `_start'
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/lib/guard/cli.rb:108:in `start'
> [#]   (dsl)> $GEM_PATH[0]/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
> [#]   (dsl)> $GEM_PATH[0]/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
> [#]   (dsl)> $GEM_PATH[0]/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
> [#]   (dsl)> $GEM_PATH[0]/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/lib/guard/aruba_adapter.rb:32:in `execute'
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/lib/guard/aruba_adapter.rb:19:in `execute!'
> [#]   (dsl)> $GEM_PATH[0]/gems/guard-2.10.2/bin/guard:11:in `<top (required)>'
> [#]   (dsl)> $GEM_PATH[0]/bin/guard:23:in `load'
> [#]   (dsl)> $GEM_PATH[0]/bin/guard:23:in `<main>'
> [#]   (dsl)> $GEM_PATH[0]/bin/ruby_executable_hooks:15:in `eval'
> [#]   (dsl)> $GEM_PATH[0]/bin/ruby_executable_hooks:15:in `<main>'
davidbella commented 9 years ago

Hi @dsgn1graphics - The pull request here https://github.com/mordaroso/guard-motion/pull/11 by @satoyos should alleviate this problem.

However, it will likely cause the test suite to fail for this project because the new Guard plugin system seems to have some trouble with external testing (which is being worked on now - https://github.com/guard/guard/issues/693).

I suggest giving this route a go, it seems to also be working for me.

otzy007 commented 9 years ago

11 Works fine for me too.