Module: MotionBlender
- Defined in:
- lib/motion_blender.rb,
lib/motion_blender/version.rb,
lib/motion_blender/analyzer.rb,
lib/motion_blender/analyzer/hooker.rb,
lib/motion_blender/analyzer/parser.rb,
lib/motion_blender/analyzer/require.rb,
lib/motion_blender/analyzer/evaluator.rb
Defined Under Namespace
Classes: Analyzer
Constant Summary collapse
- VERSION =
'0.1.4'
Class Method Summary collapse
- .add(file = nil) ⇒ Object
- .analyze ⇒ Object
- .builtin_features ⇒ Object
- .ext_file ⇒ Object
- .motion? ⇒ Boolean
- .raketime(&proc) ⇒ Object
- .runtime(&_) ⇒ Object
- .use_motion_dir(dir = nil) ⇒ Object
Class Method Details
.add(file = nil) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/motion_blender.rb', line 25 def add file = nil return unless motion? file ||= caller.first.split(':', 2).first Motion::Project::App.setup do |app| app.files.unshift file end end |
.analyze ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/motion_blender.rb', line 8 def analyze Motion::Project::App.setup do |app| analyzer = Analyzer.new analyzer.exclude_files += Dir[File.('../**/*.rb', __FILE__)] analyzer.exclude_files += builtin_features app.files.flatten.each do |file| analyzer.analyze file end if analyzer.files.any? app.exclude_from_detect_dependencies += [ext_file, *analyzer.files] app.files = [ext_file, *(analyzer.files - app.files), *app.files] app.files_dependencies analyzer.dependencies end end end |
.builtin_features ⇒ Object
65 66 67 |
# File 'lib/motion_blender.rb', line 65 def builtin_features %w(bigdecimal rational date thread) end |
.ext_file ⇒ Object
61 62 63 |
# File 'lib/motion_blender.rb', line 61 def ext_file File.('../../motion/ext.rb', __FILE__) end |
.motion? ⇒ Boolean
50 51 52 |
# File 'lib/motion_blender.rb', line 50 def motion? defined?(Motion::Project::Config) end |
.raketime(&proc) ⇒ Object
54 55 56 |
# File 'lib/motion_blender.rb', line 54 def raketime &proc proc.call end |
.runtime(&_) ⇒ Object
58 59 |
# File 'lib/motion_blender.rb', line 58 def runtime &_ end |
.use_motion_dir(dir = nil) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/motion_blender.rb', line 34 def use_motion_dir dir = nil return unless motion? unless dir file = caller.first.split(':', 2).first Pathname.new(file).dirname.ascend do |path| if $LOAD_PATH.include?(path.to_s) dir = path.dirname.join('motion').to_s break end end end $LOAD_PATH.delete dir $LOAD_PATH.unshift dir end |