motion-require 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/motion-require.rb +4 -1
- data/lib/motion-require/version.rb +1 -1
- metadata +2 -3
- data/lib/motion-require/ext.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65d2009b53c5642252ae63eab604f55900d3bc46
|
4
|
+
data.tar.gz: 132b227bd9b8b57fc58bbb3937682205ea5db72a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b1d2ecdd20c39be8644dae728e50b441ad7d85e88c70ea7965e704f982cc88f87550f7b0933d1b5182a064d21f2e17958b0c298cbfff5b06be5bae728282a7f
|
7
|
+
data.tar.gz: aa95e01fe0bfb2b2e296ebcd973b933a0219e11360027b64572e505e7e2eafed4dcfdd5d9dc4d26bb14c78e313d39bdb5bffffd55bec49d9ed4668850083beb3
|
data/lib/motion-require.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'ripper'
|
2
2
|
require 'pathname'
|
3
|
-
require_relative 'motion-require/ext'
|
4
3
|
|
5
4
|
module Motion
|
6
5
|
module Require
|
@@ -89,13 +88,17 @@ module Motion
|
|
89
88
|
# Scan specified files. When nil, fallback to RubyMotion's default (app/**/*.rb).
|
90
89
|
def all(files=nil)
|
91
90
|
Motion::Project::App.setup do |app|
|
91
|
+
app.exclude_from_detect_dependencies << ext_file
|
92
|
+
|
92
93
|
if files.nil? || files.empty?
|
93
94
|
app.files.push ext_file
|
95
|
+
app.exclude_from_detect_dependencies += app.files
|
94
96
|
app.files_dependencies dependencies_for(app.files.flatten)
|
95
97
|
else
|
96
98
|
# Place files prior to those in ./app, otherwise at the end.
|
97
99
|
preceding_app = app.files.index { |f| f =~ %r(^(?:\./)?app/) } || -1
|
98
100
|
required = Array(files).map { |f| explicit_relative(f) }
|
101
|
+
app.exclude_from_detect_dependencies += required
|
99
102
|
app.files.insert(preceding_app, ext_file, *required)
|
100
103
|
app.files.uniq! # Prevent redundancy
|
101
104
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-require
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clay Allsopp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -37,7 +37,6 @@ files:
|
|
37
37
|
- README.md
|
38
38
|
- Rakefile
|
39
39
|
- lib/motion-require.rb
|
40
|
-
- lib/motion-require/ext.rb
|
41
40
|
- lib/motion-require/version.rb
|
42
41
|
- motion-require.gemspec
|
43
42
|
- motion/ext.rb
|
data/lib/motion-require/ext.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# Hack until HipByte accepts https://github.com/HipByte/RubyMotion/pull/82
|
2
|
-
# Stolen from BubbleWrap
|
3
|
-
module Motion
|
4
|
-
module Require
|
5
|
-
module Ext
|
6
|
-
module ConfigTask
|
7
|
-
|
8
|
-
def self.included(base)
|
9
|
-
base.class_eval do
|
10
|
-
alias_method :files_dependencies_without_require, :files_dependencies
|
11
|
-
alias_method :files_dependencies, :files_dependencies_with_require
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def files_dependencies_with_require(deps_hash)
|
16
|
-
res_path = lambda do |x|
|
17
|
-
path = /^\.?\//.match(x) ? x : File.join('.', x)
|
18
|
-
unless @files.flatten.include?(path)
|
19
|
-
Motion::Project::App.send(:fail, "Can't resolve dependency `#{x}'")
|
20
|
-
end
|
21
|
-
path
|
22
|
-
end
|
23
|
-
deps_hash.each do |path, deps|
|
24
|
-
deps = [deps] unless deps.is_a?(Array)
|
25
|
-
@dependencies[res_path.call(path)] = deps.map(&res_path)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
if Motion.const_defined?("Project")
|
34
|
-
Motion::Project::Config.send(:include, Motion::Require::Ext::ConfigTask)
|
35
|
-
end
|