fig 1.24.0 → 1.24.1.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changes +32 -0
- data/README.md +7 -1
- data/lib/fig.rb +1 -1
- data/lib/fig/command/action/list_dependencies/json.rb +46 -0
- data/lib/fig/command/action/list_dependencies/json_all_configs.rb +46 -0
- data/lib/fig/command/action/list_dependencies/yaml.rb +46 -0
- data/lib/fig/command/action/list_dependencies/yaml_all_configs.rb +46 -0
- data/lib/fig/command/action/list_variables/json.rb +26 -0
- data/lib/fig/command/action/list_variables/json_all_configs.rb +26 -0
- data/lib/fig/command/action/list_variables/yaml.rb +26 -0
- data/lib/fig/command/action/list_variables/yaml_all_configs.rb +26 -0
- data/lib/fig/command/action/role/list_as_json.rb +19 -0
- data/lib/fig/command/action/role/list_as_yaml.rb +19 -0
- data/lib/fig/command/action/role/list_dependencies_from_data_structure.rb +14 -0
- data/lib/fig/command/action/role/list_from_data_structure.rb +90 -0
- data/lib/fig/command/action/role/list_variables_from_data_structure.rb +60 -0
- data/lib/fig/command/options.rb +78 -9
- data/lib/fig/deparser/v0.rb +1 -1
- data/lib/fig/deparser/v1.rb +1 -1
- data/lib/fig/deparser/v2.rb +1 -1
- data/lib/fig/repository_package_publisher.rb +3 -2
- metadata +17 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ea33a3e608936d3bc7ba5dfa2e844cfa425f979
|
4
|
+
data.tar.gz: b062f1064cac523af1372d5197001b06ffd5c7e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0c03e39ab625727c7a1570ccecb581e16d0a188eda16d7e91cfbe5213975e7340fd8133fd5f4d453627f1f62d82251f1b7c802471ff40897d3bedf8e255c5bf
|
7
|
+
data.tar.gz: 2b8cc76a6b3d749978e72800a1dde63f03bdf2db741f77b2a4001aebe67cc67d1f34ad9d8b2824544d376685f806373c626197b104d5d3e868def67ee30b2822
|
data/Changes
CHANGED
@@ -1,3 +1,35 @@
|
|
1
|
+
v1.24.1.beta.1 - 2015/04/23
|
2
|
+
|
3
|
+
Announcement:
|
4
|
+
|
5
|
+
- This is the final version that will support Ruby 1.9.x. The next version
|
6
|
+
will require Ruby 2.0.0.
|
7
|
+
|
8
|
+
Bug fix:
|
9
|
+
|
10
|
+
- No longer crashes when using --graphviz, --list-tree, or --list-all-configs
|
11
|
+
without any other options. Thanks to Matt Godbolt for the report.
|
12
|
+
|
13
|
+
New features:
|
14
|
+
|
15
|
+
- New --list-yaml option to get --list-dependencies and --list-variables to
|
16
|
+
emit their data as YAML (http://yaml.org).
|
17
|
+
|
18
|
+
- New --list-json option to get --list-dependencies and --list-variables to
|
19
|
+
emit their data as JSON (http://json.org). Note that JSON isn't exactly
|
20
|
+
ideal for representing the directed acyclic graph that even a mildly
|
21
|
+
complicated set of dependencies can result in and you can end up with large
|
22
|
+
amounts of duplicate data in the output. If you can handle parsing YAML,
|
23
|
+
you are probably better off with that.
|
24
|
+
|
25
|
+
Miscellaneous:
|
26
|
+
|
27
|
+
- Small tweaks to --publish-comment and --publish-comment-file handling to
|
28
|
+
remove some trailing whitespace when there are blank lines in the input.
|
29
|
+
|
30
|
+
- A blank line is added after grammar statements in published packages in
|
31
|
+
order to seperate them from other statements.
|
32
|
+
|
1
33
|
v1.24.0 - 2015/01/13
|
2
34
|
|
3
35
|
New feature:
|
data/README.md
CHANGED
@@ -39,7 +39,13 @@ Community
|
|
39
39
|
|
40
40
|
[Fig Mailing List](http://groups.google.com/group/fig-user)
|
41
41
|
|
42
|
+
Extensions for other tools
|
43
|
+
==========================
|
44
|
+
|
45
|
+
These live in the `support` directory within the repository. For example,
|
46
|
+
there's a Vim plugin in `support/vim`.
|
47
|
+
|
42
48
|
Copyright
|
43
49
|
=========
|
44
50
|
|
45
|
-
Copyright (c) 2009-
|
51
|
+
Copyright (c) 2009-2015 Matthew Foemmel. See LICENSE for details.
|
data/lib/fig.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'fig/command/action'
|
4
|
+
require 'fig/command/action/role/list_as_json'
|
5
|
+
require 'fig/command/action/role/list_base_config'
|
6
|
+
require 'fig/command/action/role/list_dependencies_from_data_structure'
|
7
|
+
require 'fig/command/action/role/list_from_data_structure'
|
8
|
+
require 'fig/command/action/role/list_walking_dependency_tree'
|
9
|
+
|
10
|
+
module Fig; end
|
11
|
+
class Fig::Command; end
|
12
|
+
module Fig::Command::Action; end
|
13
|
+
class Fig::Command::Action::ListDependencies; end
|
14
|
+
|
15
|
+
class Fig::Command::Action::ListDependencies::JSON
|
16
|
+
include Fig::Command::Action
|
17
|
+
include Fig::Command::Action::Role::ListAsJSON
|
18
|
+
include Fig::Command::Action::Role::ListBaseConfig
|
19
|
+
include Fig::Command::Action::Role::ListDependenciesFromDataStructure
|
20
|
+
include Fig::Command::Action::Role::ListFromDataStructure
|
21
|
+
include Fig::Command::Action::Role::ListWalkingDependencyTree
|
22
|
+
|
23
|
+
def options()
|
24
|
+
return %w<--list-dependencies --list-json>
|
25
|
+
end
|
26
|
+
|
27
|
+
def descriptor_requirement()
|
28
|
+
return nil
|
29
|
+
end
|
30
|
+
|
31
|
+
def load_base_package?()
|
32
|
+
return true
|
33
|
+
end
|
34
|
+
|
35
|
+
def register_base_package?()
|
36
|
+
return nil # don't care
|
37
|
+
end
|
38
|
+
|
39
|
+
def apply_config?()
|
40
|
+
return nil # don't care
|
41
|
+
end
|
42
|
+
|
43
|
+
def apply_base_config?()
|
44
|
+
return nil # don't care
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'fig/command/action'
|
4
|
+
require 'fig/command/action/role/list_all_configs'
|
5
|
+
require 'fig/command/action/role/list_as_json'
|
6
|
+
require 'fig/command/action/role/list_dependencies_from_data_structure'
|
7
|
+
require 'fig/command/action/role/list_from_data_structure'
|
8
|
+
require 'fig/command/action/role/list_walking_dependency_tree'
|
9
|
+
|
10
|
+
module Fig; end
|
11
|
+
class Fig::Command; end
|
12
|
+
module Fig::Command::Action; end
|
13
|
+
class Fig::Command::Action::ListDependencies; end
|
14
|
+
|
15
|
+
class Fig::Command::Action::ListDependencies::JSONAllConfigs
|
16
|
+
include Fig::Command::Action
|
17
|
+
include Fig::Command::Action::Role::ListAllConfigs
|
18
|
+
include Fig::Command::Action::Role::ListAsJSON
|
19
|
+
include Fig::Command::Action::Role::ListDependenciesFromDataStructure
|
20
|
+
include Fig::Command::Action::Role::ListFromDataStructure
|
21
|
+
include Fig::Command::Action::Role::ListWalkingDependencyTree
|
22
|
+
|
23
|
+
def options()
|
24
|
+
return %w<--list-dependencies --list-json --list-all-configs>
|
25
|
+
end
|
26
|
+
|
27
|
+
def descriptor_requirement()
|
28
|
+
return nil
|
29
|
+
end
|
30
|
+
|
31
|
+
def load_base_package?()
|
32
|
+
return true
|
33
|
+
end
|
34
|
+
|
35
|
+
def register_base_package?()
|
36
|
+
return nil # don't care
|
37
|
+
end
|
38
|
+
|
39
|
+
def apply_config?()
|
40
|
+
return nil # don't care
|
41
|
+
end
|
42
|
+
|
43
|
+
def apply_base_config?()
|
44
|
+
return nil # don't care
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'fig/command/action'
|
4
|
+
require 'fig/command/action/role/list_as_yaml'
|
5
|
+
require 'fig/command/action/role/list_base_config'
|
6
|
+
require 'fig/command/action/role/list_dependencies_from_data_structure'
|
7
|
+
require 'fig/command/action/role/list_from_data_structure'
|
8
|
+
require 'fig/command/action/role/list_walking_dependency_tree'
|
9
|
+
|
10
|
+
module Fig; end
|
11
|
+
class Fig::Command; end
|
12
|
+
module Fig::Command::Action; end
|
13
|
+
class Fig::Command::Action::ListDependencies; end
|
14
|
+
|
15
|
+
class Fig::Command::Action::ListDependencies::YAML
|
16
|
+
include Fig::Command::Action
|
17
|
+
include Fig::Command::Action::Role::ListAsYAML
|
18
|
+
include Fig::Command::Action::Role::ListBaseConfig
|
19
|
+
include Fig::Command::Action::Role::ListDependenciesFromDataStructure
|
20
|
+
include Fig::Command::Action::Role::ListFromDataStructure
|
21
|
+
include Fig::Command::Action::Role::ListWalkingDependencyTree
|
22
|
+
|
23
|
+
def options()
|
24
|
+
return %w<--list-dependencies --list-yaml>
|
25
|
+
end
|
26
|
+
|
27
|
+
def descriptor_requirement()
|
28
|
+
return nil
|
29
|
+
end
|
30
|
+
|
31
|
+
def load_base_package?()
|
32
|
+
return true
|
33
|
+
end
|
34
|
+
|
35
|
+
def register_base_package?()
|
36
|
+
return nil # don't care
|
37
|
+
end
|
38
|
+
|
39
|
+
def apply_config?()
|
40
|
+
return nil # don't care
|
41
|
+
end
|
42
|
+
|
43
|
+
def apply_base_config?()
|
44
|
+
return nil # don't care
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'fig/command/action'
|
4
|
+
require 'fig/command/action/role/list_all_configs'
|
5
|
+
require 'fig/command/action/role/list_as_yaml'
|
6
|
+
require 'fig/command/action/role/list_dependencies_from_data_structure'
|
7
|
+
require 'fig/command/action/role/list_from_data_structure'
|
8
|
+
require 'fig/command/action/role/list_walking_dependency_tree'
|
9
|
+
|
10
|
+
module Fig; end
|
11
|
+
class Fig::Command; end
|
12
|
+
module Fig::Command::Action; end
|
13
|
+
class Fig::Command::Action::ListDependencies; end
|
14
|
+
|
15
|
+
class Fig::Command::Action::ListDependencies::YAMLAllConfigs
|
16
|
+
include Fig::Command::Action
|
17
|
+
include Fig::Command::Action::Role::ListAllConfigs
|
18
|
+
include Fig::Command::Action::Role::ListAsYAML
|
19
|
+
include Fig::Command::Action::Role::ListDependenciesFromDataStructure
|
20
|
+
include Fig::Command::Action::Role::ListFromDataStructure
|
21
|
+
include Fig::Command::Action::Role::ListWalkingDependencyTree
|
22
|
+
|
23
|
+
def options()
|
24
|
+
return %w<--list-dependencies --list-yaml --list-all-configs>
|
25
|
+
end
|
26
|
+
|
27
|
+
def descriptor_requirement()
|
28
|
+
return nil
|
29
|
+
end
|
30
|
+
|
31
|
+
def load_base_package?()
|
32
|
+
return true
|
33
|
+
end
|
34
|
+
|
35
|
+
def register_base_package?()
|
36
|
+
return nil # don't care
|
37
|
+
end
|
38
|
+
|
39
|
+
def apply_config?()
|
40
|
+
return nil # don't care
|
41
|
+
end
|
42
|
+
|
43
|
+
def apply_base_config?()
|
44
|
+
return nil # don't care
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'fig/command/action'
|
4
|
+
require 'fig/command/action/role/list_as_json'
|
5
|
+
require 'fig/command/action/role/list_base_config'
|
6
|
+
require 'fig/command/action/role/list_from_data_structure'
|
7
|
+
require 'fig/command/action/role/list_variables_from_data_structure'
|
8
|
+
require 'fig/command/action/role/list_walking_dependency_tree'
|
9
|
+
|
10
|
+
module Fig; end
|
11
|
+
class Fig::Command; end
|
12
|
+
module Fig::Command::Action; end
|
13
|
+
class Fig::Command::Action::ListVariables; end
|
14
|
+
|
15
|
+
class Fig::Command::Action::ListVariables::JSON
|
16
|
+
include Fig::Command::Action
|
17
|
+
include Fig::Command::Action::Role::ListAsJSON
|
18
|
+
include Fig::Command::Action::Role::ListBaseConfig
|
19
|
+
include Fig::Command::Action::Role::ListFromDataStructure
|
20
|
+
include Fig::Command::Action::Role::ListVariablesFromDataStructure
|
21
|
+
include Fig::Command::Action::Role::ListWalkingDependencyTree
|
22
|
+
|
23
|
+
def options()
|
24
|
+
return %w<--list-variables --list-json>
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'fig/command/action'
|
4
|
+
require 'fig/command/action/role/list_all_configs'
|
5
|
+
require 'fig/command/action/role/list_as_json'
|
6
|
+
require 'fig/command/action/role/list_from_data_structure'
|
7
|
+
require 'fig/command/action/role/list_variables_from_data_structure'
|
8
|
+
require 'fig/command/action/role/list_walking_dependency_tree'
|
9
|
+
|
10
|
+
module Fig; end
|
11
|
+
class Fig::Command; end
|
12
|
+
module Fig::Command::Action; end
|
13
|
+
class Fig::Command::Action::ListVariables; end
|
14
|
+
|
15
|
+
class Fig::Command::Action::ListVariables::JSONAllConfigs
|
16
|
+
include Fig::Command::Action
|
17
|
+
include Fig::Command::Action::Role::ListAllConfigs
|
18
|
+
include Fig::Command::Action::Role::ListAsJSON
|
19
|
+
include Fig::Command::Action::Role::ListFromDataStructure
|
20
|
+
include Fig::Command::Action::Role::ListVariablesFromDataStructure
|
21
|
+
include Fig::Command::Action::Role::ListWalkingDependencyTree
|
22
|
+
|
23
|
+
def options()
|
24
|
+
return %w<--list-variables --list-json --list-all-configs>
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'fig/command/action'
|
4
|
+
require 'fig/command/action/role/list_as_yaml'
|
5
|
+
require 'fig/command/action/role/list_base_config'
|
6
|
+
require 'fig/command/action/role/list_from_data_structure'
|
7
|
+
require 'fig/command/action/role/list_variables_from_data_structure'
|
8
|
+
require 'fig/command/action/role/list_walking_dependency_tree'
|
9
|
+
|
10
|
+
module Fig; end
|
11
|
+
class Fig::Command; end
|
12
|
+
module Fig::Command::Action; end
|
13
|
+
class Fig::Command::Action::ListVariables; end
|
14
|
+
|
15
|
+
class Fig::Command::Action::ListVariables::YAML
|
16
|
+
include Fig::Command::Action
|
17
|
+
include Fig::Command::Action::Role::ListAsYAML
|
18
|
+
include Fig::Command::Action::Role::ListBaseConfig
|
19
|
+
include Fig::Command::Action::Role::ListFromDataStructure
|
20
|
+
include Fig::Command::Action::Role::ListVariablesFromDataStructure
|
21
|
+
include Fig::Command::Action::Role::ListWalkingDependencyTree
|
22
|
+
|
23
|
+
def options()
|
24
|
+
return %w<--list-variables --list-yaml>
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'fig/command/action'
|
4
|
+
require 'fig/command/action/role/list_all_configs'
|
5
|
+
require 'fig/command/action/role/list_as_yaml'
|
6
|
+
require 'fig/command/action/role/list_from_data_structure'
|
7
|
+
require 'fig/command/action/role/list_variables_from_data_structure'
|
8
|
+
require 'fig/command/action/role/list_walking_dependency_tree'
|
9
|
+
|
10
|
+
module Fig; end
|
11
|
+
class Fig::Command; end
|
12
|
+
module Fig::Command::Action; end
|
13
|
+
class Fig::Command::Action::ListVariables; end
|
14
|
+
|
15
|
+
class Fig::Command::Action::ListVariables::YAMLAllConfigs
|
16
|
+
include Fig::Command::Action
|
17
|
+
include Fig::Command::Action::Role::ListAllConfigs
|
18
|
+
include Fig::Command::Action::Role::ListAsYAML
|
19
|
+
include Fig::Command::Action::Role::ListFromDataStructure
|
20
|
+
include Fig::Command::Action::Role::ListVariablesFromDataStructure
|
21
|
+
include Fig::Command::Action::Role::ListWalkingDependencyTree
|
22
|
+
|
23
|
+
def options()
|
24
|
+
return %w<--list-variables --list-yaml --list-all-configs>
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Fig; end
|
6
|
+
class Fig::Command; end
|
7
|
+
module Fig::Command::Action; end
|
8
|
+
module Fig::Command::Action::Role; end
|
9
|
+
|
10
|
+
# Requires a #set_up_object_to_be_serialized method.
|
11
|
+
module Fig::Command::Action::Role::ListAsJSON
|
12
|
+
def execute()
|
13
|
+
set_up_object_to_be_serialized
|
14
|
+
|
15
|
+
puts JSON.pretty_generate @object_to_be_serialized
|
16
|
+
|
17
|
+
return Fig::Command::Action::EXIT_SUCCESS
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module Fig; end
|
6
|
+
class Fig::Command; end
|
7
|
+
module Fig::Command::Action; end
|
8
|
+
module Fig::Command::Action::Role; end
|
9
|
+
|
10
|
+
# Requires a #set_up_object_to_be_serialized method.
|
11
|
+
module Fig::Command::Action::Role::ListAsYAML
|
12
|
+
def execute()
|
13
|
+
set_up_object_to_be_serialized
|
14
|
+
|
15
|
+
YAML.dump @object_to_be_serialized, $stdout
|
16
|
+
|
17
|
+
return Fig::Command::Action::EXIT_SUCCESS
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module Fig; end
|
4
|
+
class Fig::Command; end
|
5
|
+
module Fig::Command::Action; end
|
6
|
+
module Fig::Command::Action::Role; end
|
7
|
+
|
8
|
+
module Fig::Command::Action::Role::ListDependenciesFromDataStructure
|
9
|
+
private
|
10
|
+
|
11
|
+
def node_content(package, config_name)
|
12
|
+
return new_package_config_hash package, config_name
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'set'
|
4
|
+
|
5
|
+
module Fig; end
|
6
|
+
class Fig::Command; end
|
7
|
+
module Fig::Command::Action; end
|
8
|
+
module Fig::Command::Action::Role; end
|
9
|
+
|
10
|
+
# Requires #node_content(package, config_name) and #walk_dependency_tree()
|
11
|
+
# methods.
|
12
|
+
module Fig::Command::Action::Role::ListFromDataStructure
|
13
|
+
private
|
14
|
+
|
15
|
+
def set_up_object_to_be_serialized
|
16
|
+
@package_configs = {}
|
17
|
+
|
18
|
+
base_package = @execution_context.base_package
|
19
|
+
base_configs = base_display_config_names
|
20
|
+
walk_dependency_tree(
|
21
|
+
base_package, base_configs, include_gather, &package_gather
|
22
|
+
)
|
23
|
+
|
24
|
+
if base_configs.size > 1
|
25
|
+
@object_to_be_serialized = @package_configs[base_package].keys.collect do
|
26
|
+
|config_name|
|
27
|
+
|
28
|
+
@package_configs[base_package][config_name]
|
29
|
+
end
|
30
|
+
else
|
31
|
+
@object_to_be_serialized = @package_configs[base_package][base_configs[0]]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def include_gather
|
36
|
+
visited = Set.new
|
37
|
+
|
38
|
+
return lambda do
|
39
|
+
|including_package, including_config, included_package, included_config|
|
40
|
+
|
41
|
+
including_name = including_package.to_s_with_config including_config
|
42
|
+
included_name = included_package.to_s_with_config included_config
|
43
|
+
edge = [including_name, included_name]
|
44
|
+
|
45
|
+
if ! visited.include? edge
|
46
|
+
visited << edge
|
47
|
+
|
48
|
+
including_hash = @package_configs[including_package][including_config]
|
49
|
+
including_hash['dependencies'] ||= []
|
50
|
+
including_hash['dependencies'] <<
|
51
|
+
@package_configs[included_package][included_config]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def package_gather
|
57
|
+
visited = Set.new
|
58
|
+
|
59
|
+
return lambda do
|
60
|
+
|package, config_name, depth|
|
61
|
+
|
62
|
+
name = package.to_s_with_config config_name
|
63
|
+
|
64
|
+
if ! visited.include? name
|
65
|
+
visited << name
|
66
|
+
|
67
|
+
@package_configs[package] ||= {}
|
68
|
+
@package_configs[package][config_name] =
|
69
|
+
node_content package, config_name
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def new_package_config_hash(package, config_name)
|
75
|
+
hash = {}
|
76
|
+
|
77
|
+
if package.name
|
78
|
+
hash['name'] = package.name
|
79
|
+
end
|
80
|
+
if package.version
|
81
|
+
hash['version'] = package.version
|
82
|
+
end
|
83
|
+
if package.description
|
84
|
+
hash['description'] = package.description
|
85
|
+
end
|
86
|
+
hash['config'] = config_name
|
87
|
+
|
88
|
+
return hash
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'cgi'
|
4
|
+
|
5
|
+
module Fig; end
|
6
|
+
class Fig::Command; end
|
7
|
+
module Fig::Command::Action; end
|
8
|
+
module Fig::Command::Action::Role; end
|
9
|
+
|
10
|
+
module Fig::Command::Action::Role::ListVariablesFromDataStructure
|
11
|
+
def descriptor_requirement()
|
12
|
+
return nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def load_base_package?()
|
16
|
+
return true
|
17
|
+
end
|
18
|
+
|
19
|
+
def register_base_package?()
|
20
|
+
return nil # don't care
|
21
|
+
end
|
22
|
+
|
23
|
+
def apply_config?()
|
24
|
+
return nil # don't care
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def node_content(package, config_name)
|
30
|
+
hash = new_package_config_hash package, config_name
|
31
|
+
statements = variable_statements package, config_name
|
32
|
+
if not statements.empty?
|
33
|
+
hash['variables'] = statements
|
34
|
+
end
|
35
|
+
|
36
|
+
return hash
|
37
|
+
end
|
38
|
+
|
39
|
+
def variable_statements(package, config_name)
|
40
|
+
statements = []
|
41
|
+
|
42
|
+
package[config_name].walk_statements do
|
43
|
+
|statement|
|
44
|
+
|
45
|
+
if statement.is_environment_variable?
|
46
|
+
statements << hash_for_variable_statement(statement)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
return statements
|
51
|
+
end
|
52
|
+
|
53
|
+
def hash_for_variable_statement(statement)
|
54
|
+
return {
|
55
|
+
'type' => statement.statement_type,
|
56
|
+
'name' => statement.name,
|
57
|
+
'value' => statement.tokenized_value.to_escaped_string,
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
data/lib/fig/command/options.rb
CHANGED
@@ -13,8 +13,12 @@ require 'fig/command/action/list_dependencies/all_configs'
|
|
13
13
|
require 'fig/command/action/list_dependencies/default'
|
14
14
|
require 'fig/command/action/list_dependencies/graphviz'
|
15
15
|
require 'fig/command/action/list_dependencies/graphviz_all_configs'
|
16
|
+
require 'fig/command/action/list_dependencies/json'
|
17
|
+
require 'fig/command/action/list_dependencies/json_all_configs'
|
16
18
|
require 'fig/command/action/list_dependencies/tree'
|
17
19
|
require 'fig/command/action/list_dependencies/tree_all_configs'
|
20
|
+
require 'fig/command/action/list_dependencies/yaml'
|
21
|
+
require 'fig/command/action/list_dependencies/yaml_all_configs'
|
18
22
|
require 'fig/command/action/list_local'
|
19
23
|
require 'fig/command/action/list_remote'
|
20
24
|
require 'fig/command/action/list_variables'
|
@@ -22,8 +26,12 @@ require 'fig/command/action/list_variables/all_configs'
|
|
22
26
|
require 'fig/command/action/list_variables/default'
|
23
27
|
require 'fig/command/action/list_variables/graphviz'
|
24
28
|
require 'fig/command/action/list_variables/graphviz_all_configs'
|
29
|
+
require 'fig/command/action/list_variables/json'
|
30
|
+
require 'fig/command/action/list_variables/json_all_configs'
|
25
31
|
require 'fig/command/action/list_variables/tree'
|
26
32
|
require 'fig/command/action/list_variables/tree_all_configs'
|
33
|
+
require 'fig/command/action/list_variables/yaml'
|
34
|
+
require 'fig/command/action/list_variables/yaml_all_configs'
|
27
35
|
require 'fig/command/action/options'
|
28
36
|
require 'fig/command/action/publish'
|
29
37
|
require 'fig/command/action/publish_local'
|
@@ -189,6 +197,14 @@ Running commands:
|
|
189
197
|
return @list_tree
|
190
198
|
end
|
191
199
|
|
200
|
+
def list_json?()
|
201
|
+
return @list_json
|
202
|
+
end
|
203
|
+
|
204
|
+
def list_yaml?()
|
205
|
+
return @list_yaml
|
206
|
+
end
|
207
|
+
|
192
208
|
def graphviz?()
|
193
209
|
return @graphviz
|
194
210
|
end
|
@@ -633,6 +649,18 @@ Running commands:
|
|
633
649
|
@list_tree = true
|
634
650
|
end
|
635
651
|
|
652
|
+
@parser.on(
|
653
|
+
'--list-json', 'for listings, output JSON (http://json.org)'
|
654
|
+
) do
|
655
|
+
@list_json = true
|
656
|
+
end
|
657
|
+
|
658
|
+
@parser.on(
|
659
|
+
'--list-yaml', 'for listings, output YAML (http://yaml.org)'
|
660
|
+
) do
|
661
|
+
@list_yaml = true
|
662
|
+
end
|
663
|
+
|
636
664
|
@parser.on(
|
637
665
|
'--graphviz',
|
638
666
|
'for listings, output DOT (http://graphviz.org/content/dot-language)'
|
@@ -840,21 +868,25 @@ Running commands:
|
|
840
868
|
|
841
869
|
def validate()
|
842
870
|
if suppress_includes
|
871
|
+
# Not conceptually incompatible, just not implemented (would need to
|
872
|
+
# handle in command/action/role/list_*)
|
843
873
|
if list_tree?
|
844
|
-
# Not conceptually incompatible, just not implemented (would need to
|
845
|
-
# handle in command/action/role/list_*)
|
846
874
|
raise Fig::Command::OptionError.new(
|
847
875
|
'Cannot use --suppress-all-includes/--suppress-cross-package-includes with --list-tree.'
|
848
876
|
)
|
877
|
+
elsif list_json?
|
878
|
+
raise Fig::Command::OptionError.new(
|
879
|
+
'Cannot use --suppress-all-includes/--suppress-cross-package-includes with --list-json.'
|
880
|
+
)
|
881
|
+
elsif list_yaml?
|
882
|
+
raise Fig::Command::OptionError.new(
|
883
|
+
'Cannot use --suppress-all-includes/--suppress-cross-package-includes with --list-yaml.'
|
884
|
+
)
|
849
885
|
elsif graphviz?
|
850
|
-
# Not conceptually incompatible, just not implemented (would need to
|
851
|
-
# handle in command/action/role/list_*)
|
852
886
|
raise Fig::Command::OptionError.new(
|
853
887
|
'Cannot use --suppress-all-includes/--suppress-cross-package-includes with --graphviz.'
|
854
888
|
)
|
855
889
|
elsif list_all_configs?
|
856
|
-
# Not conceptually incompatible, just not implemented (would need to
|
857
|
-
# handle in command/action/role/list_*)
|
858
890
|
raise Fig::Command::OptionError.new(
|
859
891
|
'Cannot use --suppress-all-includes/--suppress-cross-package-includes with --list-all-configs.'
|
860
892
|
)
|
@@ -873,15 +905,45 @@ Running commands:
|
|
873
905
|
end
|
874
906
|
elsif list_tree?
|
875
907
|
validate_list_option '--list-tree'
|
908
|
+
elsif list_json?
|
909
|
+
validate_list_option '--list-json'
|
910
|
+
elsif list_yaml?
|
911
|
+
validate_list_option '--list-yaml'
|
876
912
|
elsif graphviz?
|
877
913
|
validate_list_option '--graphviz'
|
878
914
|
elsif list_all_configs?
|
879
915
|
validate_list_option '--list-all-configs'
|
880
916
|
end
|
881
917
|
|
882
|
-
if list_tree?
|
918
|
+
if list_tree?
|
919
|
+
if graphviz?
|
920
|
+
raise Fig::Command::OptionError.new(
|
921
|
+
'Cannot use --list-tree and --graphviz at the same time.'
|
922
|
+
)
|
923
|
+
elsif list_json?
|
924
|
+
raise Fig::Command::OptionError.new(
|
925
|
+
'Cannot use --list-tree and --list-json at the same time.'
|
926
|
+
)
|
927
|
+
elsif list_yaml?
|
928
|
+
raise Fig::Command::OptionError.new(
|
929
|
+
'Cannot use --list-tree and --list-json at the same time.'
|
930
|
+
)
|
931
|
+
end
|
932
|
+
end
|
933
|
+
if graphviz?
|
934
|
+
if list_json?
|
935
|
+
raise Fig::Command::OptionError.new(
|
936
|
+
'Cannot use --graphviz and --list-json at the same time.'
|
937
|
+
)
|
938
|
+
elsif list_yaml?
|
939
|
+
raise Fig::Command::OptionError.new(
|
940
|
+
'Cannot use --graphviz and --list-yaml at the same time.'
|
941
|
+
)
|
942
|
+
end
|
943
|
+
end
|
944
|
+
if list_json? and list_yaml?
|
883
945
|
raise Fig::Command::OptionError.new(
|
884
|
-
'Cannot use --list-
|
946
|
+
'Cannot use --list-json and --list-yaml at the same time.'
|
885
947
|
)
|
886
948
|
end
|
887
949
|
|
@@ -907,7 +969,10 @@ Running commands:
|
|
907
969
|
end
|
908
970
|
|
909
971
|
def validate_list_option(option)
|
910
|
-
if
|
972
|
+
if (
|
973
|
+
! @base_action \
|
974
|
+
|| ! @base_action.list_dependencies? && ! @base_action.list_variables?
|
975
|
+
)
|
911
976
|
raise Fig::Command::OptionError.new(
|
912
977
|
%Q<The #{option} option isn't useful without --list-dependencies/--list-variables.>
|
913
978
|
)
|
@@ -924,6 +989,10 @@ Running commands:
|
|
924
989
|
sub_action_name = :Default
|
925
990
|
if list_tree?
|
926
991
|
sub_action_name = list_all_configs? ? :TreeAllConfigs : :Tree
|
992
|
+
elsif list_json?
|
993
|
+
sub_action_name = list_all_configs? ? :JSONAllConfigs : :JSON
|
994
|
+
elsif list_yaml?
|
995
|
+
sub_action_name = list_all_configs? ? :YAMLAllConfigs : :YAML
|
927
996
|
elsif graphviz?
|
928
997
|
sub_action_name = list_all_configs? ? :GraphvizAllConfigs : :Graphviz
|
929
998
|
elsif list_all_configs?
|
data/lib/fig/deparser/v0.rb
CHANGED
data/lib/fig/deparser/v1.rb
CHANGED
data/lib/fig/deparser/v2.rb
CHANGED
@@ -170,7 +170,8 @@ class Fig::RepositoryPackagePublisher
|
|
170
170
|
return if not @options.publish_comment and not @options.publish_comment_path
|
171
171
|
|
172
172
|
if @options.publish_comment
|
173
|
-
comment = @options.publish_comment
|
173
|
+
comment = @options.publish_comment
|
174
|
+
comment = comment.strip.gsub(/[ \t]*\n/, "\n# ").gsub(/^#[ ]+\n/, "#\n")
|
174
175
|
@text_assembler.add_header %Q<# #{comment}>
|
175
176
|
@text_assembler.add_header %q<#>
|
176
177
|
end
|
@@ -180,7 +181,7 @@ class Fig::RepositoryPackagePublisher
|
|
180
181
|
comment = IO.read(
|
181
182
|
@options.publish_comment_path, :external_encoding => Encoding::UTF_8,
|
182
183
|
)
|
183
|
-
comment = comment.strip.gsub(/[ \t]*\n/, "\n# ")
|
184
|
+
comment = comment.strip.gsub(/[ \t]*\n/, "\n# ").gsub(/^#[ ]+\n/, "#\n")
|
184
185
|
rescue Errno::ENOENT
|
185
186
|
Fig::Logging.fatal(
|
186
187
|
%Q<Comment file "#{@options.publish_comment_path}" does not exist.>
|
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.
|
4
|
+
version: 1.24.1.beta.1
|
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-
|
11
|
+
date: 2015-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -255,8 +255,12 @@ files:
|
|
255
255
|
- lib/fig/command/action/list_dependencies/default.rb
|
256
256
|
- lib/fig/command/action/list_dependencies/graphviz.rb
|
257
257
|
- lib/fig/command/action/list_dependencies/graphviz_all_configs.rb
|
258
|
+
- lib/fig/command/action/list_dependencies/json.rb
|
259
|
+
- lib/fig/command/action/list_dependencies/json_all_configs.rb
|
258
260
|
- lib/fig/command/action/list_dependencies/tree.rb
|
259
261
|
- lib/fig/command/action/list_dependencies/tree_all_configs.rb
|
262
|
+
- lib/fig/command/action/list_dependencies/yaml.rb
|
263
|
+
- lib/fig/command/action/list_dependencies/yaml_all_configs.rb
|
260
264
|
- lib/fig/command/action/list_local.rb
|
261
265
|
- lib/fig/command/action/list_remote.rb
|
262
266
|
- lib/fig/command/action/list_variables.rb
|
@@ -264,8 +268,12 @@ files:
|
|
264
268
|
- lib/fig/command/action/list_variables/default.rb
|
265
269
|
- lib/fig/command/action/list_variables/graphviz.rb
|
266
270
|
- lib/fig/command/action/list_variables/graphviz_all_configs.rb
|
271
|
+
- lib/fig/command/action/list_variables/json.rb
|
272
|
+
- lib/fig/command/action/list_variables/json_all_configs.rb
|
267
273
|
- lib/fig/command/action/list_variables/tree.rb
|
268
274
|
- lib/fig/command/action/list_variables/tree_all_configs.rb
|
275
|
+
- lib/fig/command/action/list_variables/yaml.rb
|
276
|
+
- lib/fig/command/action/list_variables/yaml_all_configs.rb
|
269
277
|
- lib/fig/command/action/options.rb
|
270
278
|
- lib/fig/command/action/publish.rb
|
271
279
|
- lib/fig/command/action/publish_local.rb
|
@@ -273,11 +281,16 @@ files:
|
|
273
281
|
- lib/fig/command/action/role/has_sub_action.rb
|
274
282
|
- lib/fig/command/action/role/list_all_configs.rb
|
275
283
|
- lib/fig/command/action/role/list_as_graphviz.rb
|
284
|
+
- lib/fig/command/action/role/list_as_json.rb
|
285
|
+
- lib/fig/command/action/role/list_as_yaml.rb
|
276
286
|
- lib/fig/command/action/role/list_base_config.rb
|
277
287
|
- lib/fig/command/action/role/list_dependencies_as_graphviz.rb
|
278
288
|
- lib/fig/command/action/role/list_dependencies_flat.rb
|
289
|
+
- lib/fig/command/action/role/list_dependencies_from_data_structure.rb
|
279
290
|
- lib/fig/command/action/role/list_dependencies_in_a_tree.rb
|
291
|
+
- lib/fig/command/action/role/list_from_data_structure.rb
|
280
292
|
- lib/fig/command/action/role/list_variables_as_graphviz.rb
|
293
|
+
- lib/fig/command/action/role/list_variables_from_data_structure.rb
|
281
294
|
- lib/fig/command/action/role/list_variables_in_a_tree.rb
|
282
295
|
- lib/fig/command/action/role/list_walking_dependency_tree.rb
|
283
296
|
- lib/fig/command/action/role/publish.rb
|
@@ -391,9 +404,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
391
404
|
version: 1.9.2
|
392
405
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
393
406
|
requirements:
|
394
|
-
- - "
|
407
|
+
- - ">"
|
395
408
|
- !ruby/object:Gem::Version
|
396
|
-
version:
|
409
|
+
version: 1.3.1
|
397
410
|
requirements: []
|
398
411
|
rubyforge_project:
|
399
412
|
rubygems_version: 2.2.2
|