codependency 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/codependency/graph.rb +6 -5
- data/lib/codependency/version.rb +1 -1
- data/spec/codependency/graph_spec/codependency_graph/files/assets/application_js.txt +4 -4
- data/spec/codependency/graph_spec/codependency_graph/files/assets/templates_account_js.txt +1 -1
- data/spec/codependency/graph_spec/codependency_graph/files/assets/templates_history_js.txt +1 -1
- data/spec/codependency/graph_spec/codependency_graph/files/assets/templates_user_js.txt +3 -3
- data/spec/codependency/graph_spec/codependency_graph/files/breakfast/butter_js.txt +1 -1
- data/spec/codependency/graph_spec/codependency_graph/files/breakfast/egg_js.txt +2 -2
- data/spec/codependency/graph_spec/codependency_graph/files/breakfast/sandwich_js.txt +4 -4
- data/spec/codependency/graph_spec/codependency_graph/files/breakfast/toast_js.txt +2 -2
- data/spec/codependency/graph_spec/codependency_graph/files/solar_system/body_rb.txt +1 -1
- data/spec/codependency/graph_spec/codependency_graph/files/solar_system/earth_rb.txt +3 -3
- data/spec/codependency/graph_spec/codependency_graph/files/solar_system/mars_rb.txt +3 -3
- data/spec/codependency/graph_spec/codependency_graph/files/solar_system/phobos_rb.txt +4 -4
- data/spec/codependency/graph_spec/codependency_graph/files/solar_system/planet_rb.txt +2 -2
- data/spec/codependency/graph_spec/codependency_graph/require/assets/application_js.txt +7 -7
- data/spec/codependency/graph_spec/codependency_graph/require/assets/templates_account_js.txt +1 -1
- data/spec/codependency/graph_spec/codependency_graph/require/assets/templates_history_js.txt +1 -1
- data/spec/codependency/graph_spec/codependency_graph/require/assets/templates_user_js.txt +5 -5
- data/spec/codependency/graph_spec/codependency_graph/require/breakfast/butter_js.txt +1 -1
- data/spec/codependency/graph_spec/codependency_graph/require/breakfast/egg_js.txt +3 -3
- data/spec/codependency/graph_spec/codependency_graph/require/breakfast/sandwich_js.txt +8 -8
- data/spec/codependency/graph_spec/codependency_graph/require/breakfast/toast_js.txt +3 -3
- data/spec/codependency/graph_spec/codependency_graph/require/lox/money_rb.txt +6 -6
- data/spec/codependency/graph_spec/codependency_graph/require/lox/power_rb.txt +6 -6
- data/spec/codependency/graph_spec/codependency_graph/require/lox/respect_rb.txt +6 -6
- data/spec/codependency/graph_spec/codependency_graph/require/solar_system/body_rb.txt +1 -1
- data/spec/codependency/graph_spec/codependency_graph/require/solar_system/earth_rb.txt +5 -5
- data/spec/codependency/graph_spec/codependency_graph/require/solar_system/mars_rb.txt +5 -5
- data/spec/codependency/graph_spec/codependency_graph/require/solar_system/phobos_rb.txt +8 -8
- data/spec/codependency/graph_spec/codependency_graph/require/solar_system/planet_rb.txt +3 -3
- data/spec/codependency/graph_spec/codependency_graph/tsort/assets/application_js.txt +4 -4
- data/spec/codependency/graph_spec/codependency_graph/tsort/assets/templates_account_js.txt +1 -1
- data/spec/codependency/graph_spec/codependency_graph/tsort/assets/templates_history_js.txt +1 -1
- data/spec/codependency/graph_spec/codependency_graph/tsort/assets/templates_user_js.txt +3 -3
- data/spec/codependency/graph_spec/codependency_graph/tsort/breakfast/butter_js.txt +1 -1
- data/spec/codependency/graph_spec/codependency_graph/tsort/breakfast/egg_js.txt +2 -2
- data/spec/codependency/graph_spec/codependency_graph/tsort/breakfast/sandwich_js.txt +4 -4
- data/spec/codependency/graph_spec/codependency_graph/tsort/breakfast/toast_js.txt +2 -2
- data/spec/codependency/graph_spec/codependency_graph/tsort/solar_system/body_rb.txt +1 -1
- data/spec/codependency/graph_spec/codependency_graph/tsort/solar_system/earth_rb.txt +3 -3
- data/spec/codependency/graph_spec/codependency_graph/tsort/solar_system/mars_rb.txt +3 -3
- data/spec/codependency/graph_spec/codependency_graph/tsort/solar_system/phobos_rb.txt +4 -4
- data/spec/codependency/graph_spec/codependency_graph/tsort/solar_system/planet_rb.txt +2 -2
- metadata +1 -1
data/lib/codependency/graph.rb
CHANGED
@@ -5,15 +5,16 @@ module Codependency
|
|
5
5
|
|
6
6
|
##
|
7
7
|
# Add the given file to this graph. Creates a new entry in the
|
8
|
-
# graph, the key of which is the
|
9
|
-
# the value is the array of
|
8
|
+
# graph, the key of which is the relative path to this file and
|
9
|
+
# the value is the array of relative paths to its dependencies.
|
10
10
|
# Any dependent files will also be recursively added to this
|
11
11
|
# graph.
|
12
12
|
def require( string )
|
13
|
-
|
13
|
+
root = Pathname.getwd
|
14
|
+
file = Pathname( string ).expand_path.relative_path_from( root ).to_path
|
14
15
|
|
15
16
|
self[ file ] ||= parser.parse( file ).map do |short|
|
16
|
-
path[ short ].to_path
|
17
|
+
path[ short ].relative_path_from( root ).to_path
|
17
18
|
end
|
18
19
|
self[ file ].each { |f| self.require( f ) unless key?( f ) }
|
19
20
|
end
|
@@ -23,7 +24,7 @@ module Codependency
|
|
23
24
|
# Returns the sorted list of files as determined by this graph,
|
24
25
|
# relative to the calling file.
|
25
26
|
def files
|
26
|
-
tsort
|
27
|
+
tsort
|
27
28
|
end
|
28
29
|
|
29
30
|
##
|
data/lib/codependency/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[
|
2
|
-
[0]
|
3
|
-
[1]
|
4
|
-
[2]
|
5
|
-
[3]
|
2
|
+
[0] "spec/fixtures/assets/templates/history.js",
|
3
|
+
[1] "spec/fixtures/assets/templates/account.js",
|
4
|
+
[2] "spec/fixtures/assets/templates/user.js",
|
5
|
+
[3] "spec/fixtures/assets/application.js"
|
6
6
|
]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
[
|
2
|
-
[0]
|
3
|
-
[1]
|
4
|
-
[2]
|
2
|
+
[0] "spec/fixtures/assets/templates/history.js",
|
3
|
+
[1] "spec/fixtures/assets/templates/account.js",
|
4
|
+
[2] "spec/fixtures/assets/templates/user.js"
|
5
5
|
]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[
|
2
|
-
[0]
|
3
|
-
[1]
|
4
|
-
[2]
|
5
|
-
[3]
|
2
|
+
[0] "spec/fixtures/breakfast/butter.js",
|
3
|
+
[1] "spec/fixtures/breakfast/egg.js",
|
4
|
+
[2] "spec/fixtures/breakfast/toast.js",
|
5
|
+
[3] "spec/fixtures/breakfast/sandwich.js"
|
6
6
|
]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
[
|
2
|
-
[0]
|
3
|
-
[1]
|
4
|
-
[2]
|
2
|
+
[0] "spec/fixtures/solar_system/body.rb",
|
3
|
+
[1] "spec/fixtures/solar_system/planet.rb",
|
4
|
+
[2] "spec/fixtures/solar_system/earth.rb"
|
5
5
|
]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
[
|
2
|
-
[0]
|
3
|
-
[1]
|
4
|
-
[2]
|
2
|
+
[0] "spec/fixtures/solar_system/body.rb",
|
3
|
+
[1] "spec/fixtures/solar_system/planet.rb",
|
4
|
+
[2] "spec/fixtures/solar_system/mars.rb"
|
5
5
|
]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[
|
2
|
-
[0]
|
3
|
-
[1]
|
4
|
-
[2]
|
5
|
-
[3]
|
2
|
+
[0] "spec/fixtures/solar_system/body.rb",
|
3
|
+
[1] "spec/fixtures/solar_system/planet.rb",
|
4
|
+
[2] "spec/fixtures/solar_system/mars.rb",
|
5
|
+
[3] "spec/fixtures/solar_system/phobos.rb"
|
6
6
|
]
|
@@ -1,4 +1,4 @@
|
|
1
1
|
[
|
2
|
-
[0]
|
3
|
-
[1]
|
2
|
+
[0] "spec/fixtures/solar_system/body.rb",
|
3
|
+
[1] "spec/fixtures/solar_system/planet.rb"
|
4
4
|
]
|
@@ -1,11 +1,11 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
[0] "
|
2
|
+
"spec/fixtures/assets/application.js" => [
|
3
|
+
[0] "spec/fixtures/assets/templates/user.js"
|
4
4
|
],
|
5
|
-
"
|
6
|
-
[0] "
|
7
|
-
[1] "
|
5
|
+
"spec/fixtures/assets/templates/user.js" => [
|
6
|
+
[0] "spec/fixtures/assets/templates/history.js",
|
7
|
+
[1] "spec/fixtures/assets/templates/account.js"
|
8
8
|
],
|
9
|
-
"
|
10
|
-
"
|
9
|
+
"spec/fixtures/assets/templates/history.js" => [],
|
10
|
+
"spec/fixtures/assets/templates/account.js" => []
|
11
11
|
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
[0] "
|
4
|
-
[1] "
|
2
|
+
"spec/fixtures/assets/templates/user.js" => [
|
3
|
+
[0] "spec/fixtures/assets/templates/history.js",
|
4
|
+
[1] "spec/fixtures/assets/templates/account.js"
|
5
5
|
],
|
6
|
-
"
|
7
|
-
"
|
6
|
+
"spec/fixtures/assets/templates/history.js" => [],
|
7
|
+
"spec/fixtures/assets/templates/account.js" => []
|
8
8
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
[0] "
|
2
|
+
"spec/fixtures/breakfast/egg.js" => [
|
3
|
+
[0] "spec/fixtures/breakfast/butter.js"
|
4
4
|
],
|
5
|
-
"
|
5
|
+
"spec/fixtures/breakfast/butter.js" => []
|
6
6
|
}
|
@@ -1,13 +1,13 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
[0] "
|
4
|
-
[1] "
|
2
|
+
"spec/fixtures/breakfast/sandwich.js" => [
|
3
|
+
[0] "spec/fixtures/breakfast/egg.js",
|
4
|
+
[1] "spec/fixtures/breakfast/toast.js"
|
5
5
|
],
|
6
|
-
"
|
7
|
-
[0] "
|
6
|
+
"spec/fixtures/breakfast/egg.js" => [
|
7
|
+
[0] "spec/fixtures/breakfast/butter.js"
|
8
8
|
],
|
9
|
-
"
|
10
|
-
"
|
11
|
-
[0] "
|
9
|
+
"spec/fixtures/breakfast/butter.js" => [],
|
10
|
+
"spec/fixtures/breakfast/toast.js" => [
|
11
|
+
[0] "spec/fixtures/breakfast/butter.js"
|
12
12
|
]
|
13
13
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
[0] "
|
2
|
+
"spec/fixtures/breakfast/toast.js" => [
|
3
|
+
[0] "spec/fixtures/breakfast/butter.js"
|
4
4
|
],
|
5
|
-
"
|
5
|
+
"spec/fixtures/breakfast/butter.js" => []
|
6
6
|
}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
[0] "
|
2
|
+
"spec/fixtures/lox/money.rb" => [
|
3
|
+
[0] "spec/fixtures/lox/power.rb"
|
4
4
|
],
|
5
|
-
"
|
6
|
-
[0] "
|
5
|
+
"spec/fixtures/lox/power.rb" => [
|
6
|
+
[0] "spec/fixtures/lox/respect.rb"
|
7
7
|
],
|
8
|
-
"
|
9
|
-
[0] "
|
8
|
+
"spec/fixtures/lox/respect.rb" => [
|
9
|
+
[0] "spec/fixtures/lox/money.rb"
|
10
10
|
]
|
11
11
|
}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
[0] "
|
2
|
+
"spec/fixtures/lox/power.rb" => [
|
3
|
+
[0] "spec/fixtures/lox/respect.rb"
|
4
4
|
],
|
5
|
-
"
|
6
|
-
[0] "
|
5
|
+
"spec/fixtures/lox/respect.rb" => [
|
6
|
+
[0] "spec/fixtures/lox/money.rb"
|
7
7
|
],
|
8
|
-
"
|
9
|
-
[0] "
|
8
|
+
"spec/fixtures/lox/money.rb" => [
|
9
|
+
[0] "spec/fixtures/lox/power.rb"
|
10
10
|
]
|
11
11
|
}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
[0] "
|
2
|
+
"spec/fixtures/lox/respect.rb" => [
|
3
|
+
[0] "spec/fixtures/lox/money.rb"
|
4
4
|
],
|
5
|
-
"
|
6
|
-
[0] "
|
5
|
+
"spec/fixtures/lox/money.rb" => [
|
6
|
+
[0] "spec/fixtures/lox/power.rb"
|
7
7
|
],
|
8
|
-
"
|
9
|
-
[0] "
|
8
|
+
"spec/fixtures/lox/power.rb" => [
|
9
|
+
[0] "spec/fixtures/lox/respect.rb"
|
10
10
|
]
|
11
11
|
}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
[0] "
|
2
|
+
"spec/fixtures/solar_system/earth.rb" => [
|
3
|
+
[0] "spec/fixtures/solar_system/planet.rb"
|
4
4
|
],
|
5
|
-
"
|
6
|
-
[0] "
|
5
|
+
"spec/fixtures/solar_system/planet.rb" => [
|
6
|
+
[0] "spec/fixtures/solar_system/body.rb"
|
7
7
|
],
|
8
|
-
"
|
8
|
+
"spec/fixtures/solar_system/body.rb" => []
|
9
9
|
}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
[0] "
|
2
|
+
"spec/fixtures/solar_system/mars.rb" => [
|
3
|
+
[0] "spec/fixtures/solar_system/planet.rb"
|
4
4
|
],
|
5
|
-
"
|
6
|
-
[0] "
|
5
|
+
"spec/fixtures/solar_system/planet.rb" => [
|
6
|
+
[0] "spec/fixtures/solar_system/body.rb"
|
7
7
|
],
|
8
|
-
"
|
8
|
+
"spec/fixtures/solar_system/body.rb" => []
|
9
9
|
}
|
@@ -1,13 +1,13 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
[0] "
|
4
|
-
[1] "
|
2
|
+
"spec/fixtures/solar_system/phobos.rb" => [
|
3
|
+
[0] "spec/fixtures/solar_system/body.rb",
|
4
|
+
[1] "spec/fixtures/solar_system/mars.rb"
|
5
5
|
],
|
6
|
-
"
|
7
|
-
"
|
8
|
-
[0] "
|
6
|
+
"spec/fixtures/solar_system/body.rb" => [],
|
7
|
+
"spec/fixtures/solar_system/mars.rb" => [
|
8
|
+
[0] "spec/fixtures/solar_system/planet.rb"
|
9
9
|
],
|
10
|
-
"
|
11
|
-
[0] "
|
10
|
+
"spec/fixtures/solar_system/planet.rb" => [
|
11
|
+
[0] "spec/fixtures/solar_system/body.rb"
|
12
12
|
]
|
13
13
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
[0] "
|
2
|
+
"spec/fixtures/solar_system/planet.rb" => [
|
3
|
+
[0] "spec/fixtures/solar_system/body.rb"
|
4
4
|
],
|
5
|
-
"
|
5
|
+
"spec/fixtures/solar_system/body.rb" => []
|
6
6
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[
|
2
|
-
[0] "
|
3
|
-
[1] "
|
4
|
-
[2] "
|
5
|
-
[3] "
|
2
|
+
[0] "spec/fixtures/assets/templates/history.js",
|
3
|
+
[1] "spec/fixtures/assets/templates/account.js",
|
4
|
+
[2] "spec/fixtures/assets/templates/user.js",
|
5
|
+
[3] "spec/fixtures/assets/application.js"
|
6
6
|
]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
[
|
2
|
-
[0] "
|
3
|
-
[1] "
|
4
|
-
[2] "
|
2
|
+
[0] "spec/fixtures/assets/templates/history.js",
|
3
|
+
[1] "spec/fixtures/assets/templates/account.js",
|
4
|
+
[2] "spec/fixtures/assets/templates/user.js"
|
5
5
|
]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[
|
2
|
-
[0] "
|
3
|
-
[1] "
|
4
|
-
[2] "
|
5
|
-
[3] "
|
2
|
+
[0] "spec/fixtures/breakfast/butter.js",
|
3
|
+
[1] "spec/fixtures/breakfast/egg.js",
|
4
|
+
[2] "spec/fixtures/breakfast/toast.js",
|
5
|
+
[3] "spec/fixtures/breakfast/sandwich.js"
|
6
6
|
]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
[
|
2
|
-
[0] "
|
3
|
-
[1] "
|
4
|
-
[2] "
|
2
|
+
[0] "spec/fixtures/solar_system/body.rb",
|
3
|
+
[1] "spec/fixtures/solar_system/planet.rb",
|
4
|
+
[2] "spec/fixtures/solar_system/earth.rb"
|
5
5
|
]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
[
|
2
|
-
[0] "
|
3
|
-
[1] "
|
4
|
-
[2] "
|
2
|
+
[0] "spec/fixtures/solar_system/body.rb",
|
3
|
+
[1] "spec/fixtures/solar_system/planet.rb",
|
4
|
+
[2] "spec/fixtures/solar_system/mars.rb"
|
5
5
|
]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[
|
2
|
-
[0] "
|
3
|
-
[1] "
|
4
|
-
[2] "
|
5
|
-
[3] "
|
2
|
+
[0] "spec/fixtures/solar_system/body.rb",
|
3
|
+
[1] "spec/fixtures/solar_system/planet.rb",
|
4
|
+
[2] "spec/fixtures/solar_system/mars.rb",
|
5
|
+
[3] "spec/fixtures/solar_system/phobos.rb"
|
6
6
|
]
|