Module: LockOMotion

Extended by:
LockOMotion
Included in:
LockOMotion
Defined in:
lib/lock-o-motion/version.rb,
lib/lock-o-motion.rb,
lib/lock-o-motion/app.rb

Overview

:nodoc:

Defined Under Namespace

Classes: App, GemPath

Constant Summary collapse

USER_MOCKS =
File.expand_path("./mocks")
GEM_MOCKS =
File.expand_path("../lock-o-motion/mocks", __FILE__)
MAJOR =
0
MINOR =
1
TINY =
0
VERSION =
[MAJOR, MINOR, TINY].join(".")

Instance Method Summary collapse

Instance Method Details

#gem_pathsObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/lock-o-motion.rb', line 35

def gem_paths
  @gem_paths ||= Dir["{#{::Gem.paths.path.join(",")}}" + "/gems/*"].inject({}) do |gem_paths, path|
    gem_path = GemPath.new path
    gem_paths[gem_path.name] ||= gem_path
    gem_paths[gem_path.name] = gem_path if gem_paths[gem_path.name] < gem_path
    gem_paths
  end.values.collect do |gem_path|
    gem_path.path + "/lib"
  end.sort
end

#mock_path(path) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/lock-o-motion.rb', line 52

def mock_path(path)
  path = path.gsub(/\.rb$/, "")
  if File.exists?("#{USER_MOCKS}/#{path}.rb")
    File.expand_path "./mocks/#{path}.rb"
  elsif File.exists?("#{GEM_MOCKS}/#{path}.rb")
    "lock-o-motion/mocks/#{path}"
  end
end

#setup(&block) ⇒ Object



29
30
31
32
33
# File 'lib/lock-o-motion.rb', line 29

def setup(&block)
  Motion::Project::App.setup do |app|
    LockOMotion::App.setup app, &block
  end
end

#skip?(path) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
49
50
# File 'lib/lock-o-motion.rb', line 46

def skip?(path)
  !!%w(openssl pry).detect{|x| path.match %r{\b#{x}\b}}.tap do |file|
    puts "   Warning Skipped '#{file}' requirement".yellow if file
  end
end