fig 1.24.1.beta.2 → 1.24.1.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changes +18 -0
- data/lib/fig.rb +1 -1
- data/lib/fig/command.rb +11 -4
- data/lib/fig/command/action/role/list_from_data_structure.rb +12 -1
- data/lib/fig/command/action/role/list_walking_dependency_tree.rb +4 -1
- data/lib/fig/command/action/role/publish.rb +2 -2
- data/lib/fig/command/options.rb +22 -13
- data/lib/fig/command/package_applier.rb +2 -0
- data/lib/fig/command/package_loader.rb +15 -10
- data/lib/fig/non_repository_packages.rb +63 -0
- data/lib/fig/package.rb +35 -7
- data/lib/fig/package_descriptor.rb +28 -3
- data/lib/fig/parser_package_build_state.rb +1 -0
- data/lib/fig/runtime_environment.rb +21 -35
- data/lib/fig/statement/include_file.rb +4 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8cdbd459dfb515f0701d28fe062527a0d3ed627
|
4
|
+
data.tar.gz: 724829b9273df955565b304b37c4f333f5f8c27e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a7d05fa8c86fd0b7098b8dad60ee1d8a4aa5f55f6f5a909aa44f6c56d085cb98dd7083fffe67d408d0daeca92b591605c868b3ce306fdaf127652d154dd07bb
|
7
|
+
data.tar.gz: 690e99f51ed7ef89758c4650e762e6321fa2217ed6771400ae8c0b68e192a77c59948c761c0b3d2a9592fd57577044f659bcfa4ff9552d1ffdd9048933c747d5
|
data/Changes
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
v1.24.1.beta.3 - 2015/04/27
|
2
|
+
|
3
|
+
Bug fixes:
|
4
|
+
|
5
|
+
- Fixed potential package version data collapsing in --yaml and --json
|
6
|
+
output.
|
7
|
+
|
8
|
+
- The --list-dependencies and --list-variables options now work with packages
|
9
|
+
brought in via an include-file statement.
|
10
|
+
|
11
|
+
Miscellaneous:
|
12
|
+
|
13
|
+
- Fig now refuses to use the --list-all-configs option with --graphviz,
|
14
|
+
--yaml, and --json options. The results were non-sensical in the face of
|
15
|
+
overrides and other conflicts between peer base configs.
|
16
|
+
|
17
|
+
- Display file names instead of "<unpublished>" for unnamed packages.
|
18
|
+
|
1
19
|
v1.24.1.beta.2 - 2015/04/24
|
2
20
|
|
3
21
|
Bug fix:
|
data/lib/fig.rb
CHANGED
data/lib/fig/command.rb
CHANGED
@@ -11,6 +11,7 @@ require 'fig/command/package_applier'
|
|
11
11
|
require 'fig/command/package_loader'
|
12
12
|
require 'fig/figrc'
|
13
13
|
require 'fig/logging'
|
14
|
+
require 'fig/non_repository_packages'
|
14
15
|
require 'fig/operating_system'
|
15
16
|
require 'fig/package'
|
16
17
|
require 'fig/parser'
|
@@ -76,10 +77,11 @@ class Fig::Command
|
|
76
77
|
base_config(),
|
77
78
|
@environment,
|
78
79
|
@repository,
|
80
|
+
@non_repository_packages,
|
79
81
|
@working_directory_maintainer,
|
80
82
|
@operating_system,
|
81
83
|
@package_source_description,
|
82
|
-
@
|
84
|
+
@package_load_path_description
|
83
85
|
)
|
84
86
|
|
85
87
|
actions.each do
|
@@ -139,10 +141,11 @@ class Fig::Command
|
|
139
141
|
:base_config,
|
140
142
|
:environment,
|
141
143
|
:repository,
|
144
|
+
:non_repository_packages,
|
142
145
|
:working_directory_maintainer,
|
143
146
|
:operating_system,
|
144
147
|
:package_source_description,
|
145
|
-
:
|
148
|
+
:package_load_path_description
|
146
149
|
)
|
147
150
|
|
148
151
|
def handle_nothing_to_do()
|
@@ -202,6 +205,9 @@ class Fig::Command
|
|
202
205
|
)
|
203
206
|
|
204
207
|
prepare_repository()
|
208
|
+
|
209
|
+
@non_repository_packages = Fig::NonRepositoryPackages.new @parser
|
210
|
+
|
205
211
|
prepare_runtime_environment()
|
206
212
|
end
|
207
213
|
|
@@ -282,7 +288,7 @@ class Fig::Command
|
|
282
288
|
|
283
289
|
@environment = Fig::RuntimeEnvironment.new(
|
284
290
|
@repository,
|
285
|
-
@
|
291
|
+
@non_repository_packages,
|
286
292
|
@options.suppress_includes,
|
287
293
|
environment_variables,
|
288
294
|
@working_directory_maintainer,
|
@@ -337,7 +343,8 @@ class Fig::Command
|
|
337
343
|
@base_package = package_loader.load_package_object_from_file()
|
338
344
|
end
|
339
345
|
@package_source_description = package_loader.package_source_description()
|
340
|
-
@
|
346
|
+
@package_load_path_description =
|
347
|
+
package_loader.package_load_path_description()
|
341
348
|
|
342
349
|
return
|
343
350
|
end
|
@@ -84,6 +84,9 @@ module Fig::Command::Action::Role::ListFromDataStructure
|
|
84
84
|
if package.version
|
85
85
|
hash['version'] = package.version
|
86
86
|
end
|
87
|
+
if package.file_path
|
88
|
+
hash['file'] = package.file_path
|
89
|
+
end
|
87
90
|
if package.description
|
88
91
|
hash['description'] = package.description
|
89
92
|
end
|
@@ -93,6 +96,14 @@ module Fig::Command::Action::Role::ListFromDataStructure
|
|
93
96
|
end
|
94
97
|
|
95
98
|
def package_id(package)
|
96
|
-
|
99
|
+
if package.name
|
100
|
+
return package.to_s
|
101
|
+
end
|
102
|
+
|
103
|
+
if file = package.file_path
|
104
|
+
return "file: #{file}"
|
105
|
+
end
|
106
|
+
|
107
|
+
return "description: #{package.description}"
|
97
108
|
end
|
98
109
|
end
|
@@ -73,6 +73,7 @@ module Fig::Command::Action::Role::ListWalkingDependencyTree
|
|
73
73
|
|
74
74
|
if depth < 1
|
75
75
|
@execution_context.repository.reset_cached_data
|
76
|
+
@execution_context.non_repository_packages.reset_cached_data
|
76
77
|
end
|
77
78
|
|
78
79
|
package_block.call base_package, config_name, depth
|
@@ -86,7 +87,7 @@ module Fig::Command::Action::Role::ListWalkingDependencyTree
|
|
86
87
|
|
87
88
|
do_walk_dependency_tree(
|
88
89
|
package,
|
89
|
-
[descriptor.config],
|
90
|
+
[descriptor.config || Fig::Package::DEFAULT_CONFIG],
|
90
91
|
new_backtrace,
|
91
92
|
depth + 1,
|
92
93
|
include_block,
|
@@ -121,6 +122,8 @@ module Fig::Command::Action::Role::ListWalkingDependencyTree
|
|
121
122
|
return @execution_context.repository.get_package(
|
122
123
|
descriptor, :allow_any_version
|
123
124
|
)
|
125
|
+
elsif descriptor.file_path
|
126
|
+
return @execution_context.non_repository_packages[descriptor.file_path]
|
124
127
|
end
|
125
128
|
|
126
129
|
return base_package
|
@@ -93,9 +93,9 @@ module Fig::Command::Action::Role::Publish
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def derive_publish_statements_from_environment_statements
|
96
|
-
if @execution_context.
|
96
|
+
if @execution_context.package_load_path_description
|
97
97
|
message = 'Cannot publish based upon both a package definition file ('
|
98
|
-
message << @execution_context.
|
98
|
+
message << @execution_context.package_load_path_description
|
99
99
|
message << ') and --set/--append options.'
|
100
100
|
|
101
101
|
if @execution_context.package_source_description ==
|
data/lib/fig/command/options.rb
CHANGED
@@ -916,19 +916,10 @@ Running commands:
|
|
916
916
|
end
|
917
917
|
|
918
918
|
if list_tree?
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
elsif json?
|
924
|
-
raise Fig::Command::OptionError.new(
|
925
|
-
'Cannot use --list-tree and --json at the same time.'
|
926
|
-
)
|
927
|
-
elsif yaml?
|
928
|
-
raise Fig::Command::OptionError.new(
|
929
|
-
'Cannot use --list-tree and --json at the same time.'
|
930
|
-
)
|
931
|
-
end
|
919
|
+
validate_list_options_with_nodes('--list-tree')
|
920
|
+
end
|
921
|
+
if list_all_configs?
|
922
|
+
validate_list_options_with_nodes('--list-all-configs')
|
932
923
|
end
|
933
924
|
if graphviz?
|
934
925
|
if json?
|
@@ -981,6 +972,24 @@ Running commands:
|
|
981
972
|
return
|
982
973
|
end
|
983
974
|
|
975
|
+
def validate_list_options_with_nodes(conflicting_option)
|
976
|
+
if graphviz?
|
977
|
+
raise Fig::Command::OptionError.new(
|
978
|
+
"Cannot use #{conflicting_option} and --graphviz at the same time."
|
979
|
+
)
|
980
|
+
elsif json?
|
981
|
+
raise Fig::Command::OptionError.new(
|
982
|
+
"Cannot use #{conflicting_option} and --json at the same time."
|
983
|
+
)
|
984
|
+
elsif yaml?
|
985
|
+
raise Fig::Command::OptionError.new(
|
986
|
+
"Cannot use #{conflicting_option} and --json at the same time."
|
987
|
+
)
|
988
|
+
end
|
989
|
+
|
990
|
+
return
|
991
|
+
end
|
992
|
+
|
984
993
|
def set_up_sub_actions()
|
985
994
|
if @base_action and @base_action.sub_action?
|
986
995
|
# This is a cheat because the only things with sub-actions at present are
|
@@ -71,6 +71,7 @@ class Fig::Command::PackageApplier
|
|
71
71
|
@base_package.name(),
|
72
72
|
@base_package.version(),
|
73
73
|
@base_config,
|
74
|
+
:file_path => @base_package.file_path,
|
74
75
|
:description => @base_package.description
|
75
76
|
),
|
76
77
|
@base_package,
|
@@ -91,6 +92,7 @@ class Fig::Command::PackageApplier
|
|
91
92
|
return Fig::Package.new(
|
92
93
|
nil, # Name
|
93
94
|
nil, # Version
|
95
|
+
nil, # File path
|
94
96
|
'command-line',
|
95
97
|
'.', # Working
|
96
98
|
'.', # Base
|
@@ -9,7 +9,7 @@ class Fig::Command; end
|
|
9
9
|
|
10
10
|
# Loads the base package.
|
11
11
|
class Fig::Command::PackageLoader
|
12
|
-
attr_reader :
|
12
|
+
attr_reader :package_load_path_description
|
13
13
|
|
14
14
|
DEFAULT_PACKAGE_FILE = 'package.fig'
|
15
15
|
DEFAULT_APPLICATION_FILE = 'application.fig'
|
@@ -47,8 +47,8 @@ class Fig::Command::PackageLoader
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def package_source_description()
|
50
|
-
if @
|
51
|
-
return @
|
50
|
+
if @package_load_path_description
|
51
|
+
return @package_load_path_description
|
52
52
|
elsif @descriptor
|
53
53
|
return Fig::PackageDescriptor.format(
|
54
54
|
@descriptor.name, @descriptor.version, nil
|
@@ -64,18 +64,20 @@ class Fig::Command::PackageLoader
|
|
64
64
|
if @package_definition_file == :none
|
65
65
|
return nil
|
66
66
|
elsif @package_definition_file == '-'
|
67
|
-
@
|
67
|
+
@package_load_path_description = '<standard input>'
|
68
68
|
|
69
69
|
return $stdin.read
|
70
70
|
elsif @package_definition_file.nil?
|
71
71
|
if File.exist?(DEFAULT_PACKAGE_FILE)
|
72
|
-
@
|
72
|
+
@package_load_path_description = DEFAULT_PACKAGE_FILE
|
73
|
+
@package_load_path = DEFAULT_PACKAGE_FILE
|
73
74
|
elsif File.exist?(DEFAULT_APPLICATION_FILE)
|
74
|
-
@
|
75
|
+
@package_load_path_description = DEFAULT_APPLICATION_FILE
|
76
|
+
@package_load_path = DEFAULT_APPLICATION_FILE
|
75
77
|
end
|
76
78
|
|
77
|
-
if @
|
78
|
-
return File.read(@
|
79
|
+
if @package_load_path
|
80
|
+
return File.read(@package_load_path)
|
79
81
|
end
|
80
82
|
else
|
81
83
|
return read_in_package_definition_file(@package_definition_file)
|
@@ -86,7 +88,8 @@ class Fig::Command::PackageLoader
|
|
86
88
|
|
87
89
|
def read_in_package_definition_file(config_file)
|
88
90
|
if File.exist?(config_file)
|
89
|
-
@
|
91
|
+
@package_load_path_description = config_file
|
92
|
+
@package_load_path = config_file
|
90
93
|
@package_include_file_base_directory = File.dirname config_file
|
91
94
|
|
92
95
|
return File.read(config_file)
|
@@ -109,7 +112,8 @@ class Fig::Command::PackageLoader
|
|
109
112
|
nil,
|
110
113
|
nil,
|
111
114
|
nil,
|
112
|
-
:
|
115
|
+
:file_path => @package_load_path,
|
116
|
+
:description => @package_load_path ? nil : source_description,
|
113
117
|
:source_description => source_description
|
114
118
|
)
|
115
119
|
|
@@ -135,6 +139,7 @@ class Fig::Command::PackageLoader
|
|
135
139
|
Fig::Package.new(
|
136
140
|
nil, # Name
|
137
141
|
nil, # Version
|
142
|
+
nil, # File path
|
138
143
|
'synthetic',
|
139
144
|
'.', # Working
|
140
145
|
'.', # Base
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'fig/not_yet_parsed_package'
|
4
|
+
require 'fig/package_descriptor'
|
5
|
+
|
6
|
+
|
7
|
+
module Fig; end
|
8
|
+
|
9
|
+
|
10
|
+
class Fig::NonRepositoryPackages
|
11
|
+
def initialize(parser)
|
12
|
+
@parser = parser
|
13
|
+
|
14
|
+
reset_cached_data
|
15
|
+
|
16
|
+
return
|
17
|
+
end
|
18
|
+
|
19
|
+
def reset_cached_data
|
20
|
+
@packages_by_path = {}
|
21
|
+
|
22
|
+
return
|
23
|
+
end
|
24
|
+
|
25
|
+
def [](file_path)
|
26
|
+
file_path = File.expand_path file_path
|
27
|
+
if package = @packages_by_path[file_path]
|
28
|
+
return package
|
29
|
+
end
|
30
|
+
|
31
|
+
if ! File.exist? file_path
|
32
|
+
return
|
33
|
+
end
|
34
|
+
|
35
|
+
load_package file_path
|
36
|
+
|
37
|
+
return @packages_by_path[file_path]
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def load_package(file_path)
|
44
|
+
content = File.read file_path
|
45
|
+
|
46
|
+
descriptor =
|
47
|
+
Fig::PackageDescriptor.new(nil, nil, nil, :file_path => file_path)
|
48
|
+
|
49
|
+
unparsed_package = Fig::NotYetParsedPackage.new
|
50
|
+
unparsed_package.descriptor = descriptor
|
51
|
+
unparsed_package.working_directory =
|
52
|
+
unparsed_package.include_file_base_directory =
|
53
|
+
File.dirname(file_path)
|
54
|
+
unparsed_package.source_description = file_path
|
55
|
+
unparsed_package.unparsed_text = content
|
56
|
+
|
57
|
+
package = @parser.parse_package unparsed_package
|
58
|
+
|
59
|
+
@packages_by_path[file_path] = package
|
60
|
+
|
61
|
+
return
|
62
|
+
end
|
63
|
+
end
|
data/lib/fig/package.rb
CHANGED
@@ -5,6 +5,8 @@ require 'fig/no_such_package_config_error'
|
|
5
5
|
require 'fig/package_descriptor'
|
6
6
|
require 'fig/statement/archive'
|
7
7
|
require 'fig/statement/configuration'
|
8
|
+
require 'fig/statement/include'
|
9
|
+
require 'fig/statement/include_file'
|
8
10
|
require 'fig/statement/resource'
|
9
11
|
require 'fig/statement/retrieve'
|
10
12
|
|
@@ -22,6 +24,7 @@ class Fig::Package
|
|
22
24
|
|
23
25
|
attr_reader :name
|
24
26
|
attr_reader :version
|
27
|
+
attr_reader :file_path
|
25
28
|
attr_reader :description
|
26
29
|
attr_reader :runtime_directory
|
27
30
|
attr_reader :include_file_base_directory
|
@@ -32,6 +35,7 @@ class Fig::Package
|
|
32
35
|
def initialize(
|
33
36
|
name,
|
34
37
|
version,
|
38
|
+
file_path,
|
35
39
|
description,
|
36
40
|
runtime_directory,
|
37
41
|
include_file_base_directory,
|
@@ -40,6 +44,7 @@ class Fig::Package
|
|
40
44
|
)
|
41
45
|
@name = name
|
42
46
|
@version = version
|
47
|
+
@file_path = file_path
|
43
48
|
@description = description
|
44
49
|
@runtime_directory = runtime_directory
|
45
50
|
@include_file_base_directory = include_file_base_directory
|
@@ -68,12 +73,20 @@ class Fig::Package
|
|
68
73
|
end
|
69
74
|
|
70
75
|
def [](config_name)
|
71
|
-
@statements.each do
|
72
|
-
|
76
|
+
@statements.each do
|
77
|
+
|statement|
|
78
|
+
|
79
|
+
return statement if
|
80
|
+
statement.is_a?(Fig::Statement::Configuration) \
|
81
|
+
&& statement.name == config_name
|
73
82
|
end
|
74
83
|
|
75
84
|
descriptor = Fig::PackageDescriptor.new(
|
76
|
-
@name,
|
85
|
+
@name,
|
86
|
+
@version,
|
87
|
+
config_name,
|
88
|
+
:file_path => @file_path,
|
89
|
+
:description => @description
|
77
90
|
)
|
78
91
|
config_description = nil
|
79
92
|
if @name.nil? and @version.nil?
|
@@ -139,6 +152,12 @@ class Fig::Package
|
|
139
152
|
|
140
153
|
if statement.is_a?(Fig::Statement::Include)
|
141
154
|
descriptors << statement.resolved_dependency_descriptor(self, backtrace)
|
155
|
+
elsif statement.is_a?(Fig::Statement::IncludeFile)
|
156
|
+
full_path = statement.full_path_relative_to self
|
157
|
+
|
158
|
+
descriptors << Fig::PackageDescriptor.new(
|
159
|
+
nil, nil, nil, :file_path => full_path
|
160
|
+
)
|
142
161
|
elsif statement.is_a?(Fig::Statement::Override)
|
143
162
|
backtrace.add_override(statement)
|
144
163
|
end
|
@@ -157,8 +176,18 @@ class Fig::Package
|
|
157
176
|
return
|
158
177
|
end
|
159
178
|
|
179
|
+
def name_or_file_or_description
|
180
|
+
return @name if @name
|
181
|
+
|
182
|
+
if @file_path
|
183
|
+
return "[#{@file_path}]"
|
184
|
+
end
|
185
|
+
|
186
|
+
return @description
|
187
|
+
end
|
188
|
+
|
160
189
|
def to_s
|
161
|
-
name =
|
190
|
+
name = name_or_file_or_description
|
162
191
|
version = @version || '<empty>'
|
163
192
|
return Fig::PackageDescriptor.format(name, version, nil)
|
164
193
|
end
|
@@ -166,7 +195,7 @@ class Fig::Package
|
|
166
195
|
def to_s_with_config(config_name)
|
167
196
|
displayed_config = config_name == DEFAULT_CONFIG ? nil : config_name
|
168
197
|
return Fig::PackageDescriptor.format(
|
169
|
-
|
198
|
+
name_or_file_or_description, version, displayed_config
|
170
199
|
)
|
171
200
|
end
|
172
201
|
|
@@ -177,9 +206,8 @@ class Fig::Package
|
|
177
206
|
)
|
178
207
|
end
|
179
208
|
|
180
|
-
private
|
181
209
|
|
182
|
-
|
210
|
+
private
|
183
211
|
|
184
212
|
def compare_components(mine, others)
|
185
213
|
if mine.nil?
|
@@ -11,7 +11,12 @@ class Fig::PackageDescriptor
|
|
11
11
|
UNBRACKETED_COMPONENT_PATTERN = / (?! [.]{1,2} $) [a-zA-Z0-9_.-]+ /x
|
12
12
|
COMPONENT_PATTERN = / \A #{UNBRACKETED_COMPONENT_PATTERN} \z /x
|
13
13
|
|
14
|
-
attr_reader :name
|
14
|
+
attr_reader :name
|
15
|
+
attr_reader :version
|
16
|
+
attr_reader :config
|
17
|
+
attr_reader :original_string
|
18
|
+
attr_reader :file_path
|
19
|
+
attr_reader :description
|
15
20
|
|
16
21
|
def self.format(
|
17
22
|
name, version, config, use_default_config = false, description = nil
|
@@ -59,6 +64,9 @@ class Fig::PackageDescriptor
|
|
59
64
|
# :version => { :required | :forbidden }
|
60
65
|
# :config => { :required | :forbidden }
|
61
66
|
# :original_string => the unparsed form
|
67
|
+
# :file_path => if this is for a file outside of the
|
68
|
+
# repository and not synthetic, the
|
69
|
+
# source of the package
|
62
70
|
# :description => meta-information, if this is for a
|
63
71
|
# synthetic package
|
64
72
|
# :require_at_least_one_component => should we have at least one of
|
@@ -72,6 +80,7 @@ class Fig::PackageDescriptor
|
|
72
80
|
@version = translate_component(version)
|
73
81
|
@config = translate_component(config)
|
74
82
|
@original_string = options[:original_string]
|
83
|
+
@file_path = options[:file_path]
|
75
84
|
@description = options[:description]
|
76
85
|
|
77
86
|
validate_component name, 'name', :name, options
|
@@ -81,13 +90,13 @@ class Fig::PackageDescriptor
|
|
81
90
|
end
|
82
91
|
|
83
92
|
# Specifically not named :to_s because it doesn't act like that should.
|
84
|
-
def to_string(use_default_config = false,
|
93
|
+
def to_string(use_default_config = false, use_file_or_description = false)
|
85
94
|
return Fig::PackageDescriptor.format(
|
86
95
|
@name,
|
87
96
|
@version,
|
88
97
|
@config,
|
89
98
|
use_default_config,
|
90
|
-
|
99
|
+
use_file_or_description ? @file_path ? @file_path : @description : nil
|
91
100
|
)
|
92
101
|
end
|
93
102
|
|
@@ -95,6 +104,7 @@ class Fig::PackageDescriptor
|
|
95
104
|
return to_string() <=> other.to_string()
|
96
105
|
end
|
97
106
|
|
107
|
+
|
98
108
|
private
|
99
109
|
|
100
110
|
def translate_component(value)
|
@@ -159,6 +169,21 @@ class Fig::PackageDescriptor
|
|
159
169
|
)
|
160
170
|
end
|
161
171
|
|
172
|
+
name_alternate_count = 0
|
173
|
+
if @name
|
174
|
+
name_alternate_count += 1
|
175
|
+
end
|
176
|
+
if @file_path
|
177
|
+
name_alternate_count += 1
|
178
|
+
end
|
179
|
+
if @description
|
180
|
+
name_alternate_count += 1
|
181
|
+
end
|
182
|
+
|
183
|
+
if name_alternate_count > 1
|
184
|
+
raise "Bug! More than one of name, file, and description provided! Name: #{@name}, File: #{@file}, Description: #{@description}"
|
185
|
+
end
|
186
|
+
|
162
187
|
return
|
163
188
|
end
|
164
189
|
|
@@ -28,19 +28,18 @@ class Fig::RuntimeEnvironment
|
|
28
28
|
|
29
29
|
def initialize(
|
30
30
|
repository,
|
31
|
-
|
31
|
+
non_repository_packages,
|
32
32
|
suppress_includes,
|
33
33
|
variables_override,
|
34
34
|
working_directory_maintainer
|
35
35
|
)
|
36
36
|
@repository = repository
|
37
|
-
@
|
37
|
+
@non_repository_packages = non_repository_packages
|
38
38
|
@suppress_includes = suppress_includes
|
39
39
|
@variables =
|
40
40
|
variables_override || Fig::OperatingSystem.get_environment_variables()
|
41
41
|
@retrieves = {}
|
42
42
|
@named_packages = {}
|
43
|
-
@packages_from_files = {}
|
44
43
|
@working_directory_maintainer = working_directory_maintainer
|
45
44
|
end
|
46
45
|
|
@@ -106,6 +105,7 @@ class Fig::RuntimeEnvironment
|
|
106
105
|
package.name,
|
107
106
|
package.version,
|
108
107
|
config_name,
|
108
|
+
:file_path => package.file_path,
|
109
109
|
:description => package.description
|
110
110
|
)
|
111
111
|
)
|
@@ -170,9 +170,7 @@ class Fig::RuntimeEnvironment
|
|
170
170
|
when Fig::Statement::Include
|
171
171
|
include_config(package, statement, backtrace)
|
172
172
|
when Fig::Statement::IncludeFile
|
173
|
-
include_file_config(
|
174
|
-
package, statement.path, statement.config_name, backtrace
|
175
|
-
)
|
173
|
+
include_file_config(package, statement, backtrace)
|
176
174
|
when Fig::Statement::Override
|
177
175
|
backtrace.add_override(statement)
|
178
176
|
end
|
@@ -263,18 +261,17 @@ class Fig::RuntimeEnvironment
|
|
263
261
|
return package, resolved_descriptor, new_backtrace
|
264
262
|
end
|
265
263
|
|
266
|
-
def include_file_config(including_package,
|
264
|
+
def include_file_config(including_package, include_file_statement, backtrace)
|
267
265
|
return if @suppress_includes
|
268
266
|
|
269
|
-
full_path =
|
270
|
-
File.absolute_path(path, including_package.include_file_base_directory)
|
267
|
+
full_path = include_file_statement.full_path_relative_to including_package
|
271
268
|
|
272
269
|
descriptor =
|
273
|
-
Fig::PackageDescriptor.new(nil, nil, nil, :
|
270
|
+
Fig::PackageDescriptor.new(nil, nil, nil, :file_path => full_path)
|
274
271
|
|
275
272
|
new_backtrace = Fig::IncludeBacktrace.new(backtrace, descriptor)
|
276
|
-
package
|
277
|
-
|
273
|
+
package = package_for_file(including_package, full_path, backtrace)
|
274
|
+
config_name = include_file_statement.config_name
|
278
275
|
|
279
276
|
apply_config(
|
280
277
|
package, config_name || Fig::Package::DEFAULT_CONFIG, new_backtrace
|
@@ -354,31 +351,16 @@ class Fig::RuntimeEnvironment
|
|
354
351
|
return package
|
355
352
|
end
|
356
353
|
|
357
|
-
def package_for_file(including_package, full_path,
|
358
|
-
package = @
|
359
|
-
|
354
|
+
def package_for_file(including_package, full_path, backtrace)
|
355
|
+
if package = @non_repository_packages[full_path]
|
356
|
+
package.backtrace = backtrace
|
360
357
|
|
361
|
-
|
362
|
-
raise_repository_error(
|
363
|
-
%Q<"#{full_path}" does not exist.>, backtrace, including_package
|
364
|
-
)
|
358
|
+
return package
|
365
359
|
end
|
366
360
|
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
unparsed_package.descriptor = descriptor
|
371
|
-
unparsed_package.working_directory =
|
372
|
-
unparsed_package.include_file_base_directory =
|
373
|
-
File.dirname(full_path)
|
374
|
-
unparsed_package.source_description = full_path
|
375
|
-
unparsed_package.unparsed_text = content
|
376
|
-
|
377
|
-
package = @parser.parse_package unparsed_package
|
378
|
-
|
379
|
-
@packages_from_files[full_path] = package
|
380
|
-
|
381
|
-
return package
|
361
|
+
raise_repository_error(
|
362
|
+
%Q<"#{full_path}" does not exist.>, backtrace, including_package
|
363
|
+
)
|
382
364
|
end
|
383
365
|
|
384
366
|
def determine_package_for_execution(base_package, base_config, descriptor)
|
@@ -395,7 +377,11 @@ class Fig::RuntimeEnvironment
|
|
395
377
|
Fig::IncludeBacktrace.new(
|
396
378
|
nil,
|
397
379
|
Fig::PackageDescriptor.new(
|
398
|
-
package_name,
|
380
|
+
package_name,
|
381
|
+
descriptor.version,
|
382
|
+
config_name,
|
383
|
+
:file_path => descriptor.file_path,
|
384
|
+
:description => descriptor.description
|
399
385
|
)
|
400
386
|
)
|
401
387
|
)
|
@@ -70,6 +70,10 @@ class Fig::Statement::IncludeFile < Fig::Statement
|
|
70
70
|
return 'include-file'
|
71
71
|
end
|
72
72
|
|
73
|
+
def full_path_relative_to(including_package)
|
74
|
+
return File.expand_path(path, including_package.include_file_base_directory)
|
75
|
+
end
|
76
|
+
|
73
77
|
def deparse_as_version(deparser)
|
74
78
|
return deparser.include_file(self)
|
75
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.24.1.beta.
|
4
|
+
version: 1.24.1.beta.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Foemmel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -343,6 +343,7 @@ files:
|
|
343
343
|
- lib/fig/logging/colorizable.rb
|
344
344
|
- lib/fig/network_error.rb
|
345
345
|
- lib/fig/no_such_package_config_error.rb
|
346
|
+
- lib/fig/non_repository_packages.rb
|
346
347
|
- lib/fig/not_yet_parsed_package.rb
|
347
348
|
- lib/fig/operating_system.rb
|
348
349
|
- lib/fig/package.rb
|