fig 0.1.65 → 0.1.67

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/Changes +29 -0
  2. data/bin/fig +1 -1
  3. data/bin/fig-debug +1 -1
  4. data/lib/fig.rb +3 -0
  5. data/lib/fig/{applicationconfiguration.rb → application_configuration.rb} +0 -0
  6. data/lib/fig/{atexit.rb → at_exit.rb} +0 -0
  7. data/lib/fig/command.rb +190 -200
  8. data/lib/fig/command/action.rb +83 -0
  9. data/lib/fig/command/action/clean.rb +33 -0
  10. data/lib/fig/command/action/get.rb +48 -0
  11. data/lib/fig/command/action/help.rb +29 -0
  12. data/lib/fig/command/action/list_configs.rb +39 -0
  13. data/lib/fig/command/action/list_dependencies.rb +19 -0
  14. data/lib/fig/command/action/list_dependencies/all_configs.rb +44 -0
  15. data/lib/fig/command/action/list_dependencies/default.rb +40 -0
  16. data/lib/fig/command/action/list_dependencies/tree.rb +40 -0
  17. data/lib/fig/command/action/list_dependencies/tree_all_configs.rb +40 -0
  18. data/lib/fig/command/action/list_local.rb +29 -0
  19. data/lib/fig/command/action/list_remote.rb +33 -0
  20. data/lib/fig/command/action/list_variables.rb +23 -0
  21. data/lib/fig/command/action/list_variables/all_configs.rb +61 -0
  22. data/lib/fig/command/action/list_variables/default.rb +48 -0
  23. data/lib/fig/command/action/list_variables/tree.rb +20 -0
  24. data/lib/fig/command/action/list_variables/tree_all_configs.rb +20 -0
  25. data/lib/fig/command/action/publish.rb +52 -0
  26. data/lib/fig/command/action/publish_local.rb +29 -0
  27. data/lib/fig/command/action/role/has_no_sub_action.rb +10 -0
  28. data/lib/fig/command/action/role/has_sub_action.rb +58 -0
  29. data/lib/fig/command/action/role/list_all_configs.rb +14 -0
  30. data/lib/fig/command/action/role/list_base_config.rb +14 -0
  31. data/lib/fig/command/action/role/list_dependencies_flat.rb +22 -0
  32. data/lib/fig/command/action/role/list_dependencies_in_a_tree.rb +21 -0
  33. data/lib/fig/command/action/role/list_variables_in_a_tree.rb +150 -0
  34. data/lib/fig/command/action/role/list_walking_dependency_tree.rb +90 -0
  35. data/lib/fig/command/action/role/publish.rb +90 -0
  36. data/lib/fig/command/action/role/update.rb +46 -0
  37. data/lib/fig/command/action/run_command_line.rb +45 -0
  38. data/lib/fig/command/action/run_command_statement.rb +52 -0
  39. data/lib/fig/command/action/update.rb +17 -0
  40. data/lib/fig/command/action/update_if_missing.rb +17 -0
  41. data/lib/fig/command/action/version.rb +27 -0
  42. data/lib/fig/command/{coveragesupport.rb → coverage_support.rb} +0 -0
  43. data/lib/fig/command/{optionerror.rb → option_error.rb} +1 -1
  44. data/lib/fig/command/options.rb +185 -127
  45. data/lib/fig/command/package_applier.rb +140 -0
  46. data/lib/fig/command/package_loader.rb +124 -0
  47. data/lib/fig/{configfileerror.rb → config_file_error.rb} +1 -1
  48. data/lib/fig/{environmentvariables.rb → environment_variables.rb} +0 -0
  49. data/lib/fig/{environmentvariables/caseinsensitive.rb → environment_variables/case_insensitive.rb} +1 -1
  50. data/lib/fig/{environmentvariables/casesensitive.rb → environment_variables/case_sensitive.rb} +1 -1
  51. data/lib/fig/figrc.rb +3 -3
  52. data/lib/fig/grammar.treetop +1 -1
  53. data/lib/fig/{backtrace.rb → include_backtrace.rb} +7 -2
  54. data/lib/fig/log4r/outputter.rb +1 -1
  55. data/lib/fig/{log4rconfigerror.rb → log4r_config_error.rb} +1 -1
  56. data/lib/fig/logging.rb +2 -2
  57. data/lib/fig/{networkerror.rb → network_error.rb} +1 -1
  58. data/lib/fig/{nosuchpackageconfigerror.rb → no_such_package_config_error.rb} +2 -2
  59. data/lib/fig/{notfounderror.rb → not_found_error.rb} +0 -0
  60. data/lib/fig/{operatingsystem.rb → operating_system.rb} +5 -5
  61. data/lib/fig/package.rb +3 -3
  62. data/lib/fig/{packagecache.rb → package_cache.rb} +0 -0
  63. data/lib/fig/{packagedescriptor.rb → package_descriptor.rb} +1 -1
  64. data/lib/fig/{packagedescriptorparseerror.rb → package_descriptor_parse_error.rb} +1 -1
  65. data/lib/fig/{packageparseerror.rb → package_parse_error.rb} +1 -1
  66. data/lib/fig/parser.rb +4 -4
  67. data/lib/fig/{parserpackagebuildstate.rb → parser_package_build_state.rb} +1 -1
  68. data/lib/fig/repository.rb +17 -17
  69. data/lib/fig/{repositoryerror.rb → repository_error.rb} +1 -1
  70. data/lib/fig/{environment.rb → runtime_environment.rb} +15 -8
  71. data/lib/fig/statement/include.rb +1 -1
  72. data/lib/fig/statement/override.rb +1 -1
  73. data/lib/fig/{urlaccesserror.rb → url_access_error.rb} +1 -1
  74. data/lib/fig/{userinputerror.rb → user_input_error.rb} +0 -0
  75. data/lib/fig/{workingdirectorymaintainer.rb → working_directory_maintainer.rb} +4 -4
  76. data/lib/fig/{workingdirectorymetadata.rb → working_directory_metadata.rb} +0 -0
  77. metadata +88 -54
  78. data/VERSION +0 -1
  79. data/lib/fig/command/listing.rb +0 -363
  80. data/lib/fig/command/packageload.rb +0 -236
@@ -0,0 +1,83 @@
1
+ module Fig; end
2
+ class Fig::Command; end
3
+
4
+ module Fig::Command::Action
5
+ EXIT_SUCCESS = 0
6
+ EXIT_FAILURE = 1
7
+
8
+ attr_writer :execution_context
9
+
10
+ def primary_option()
11
+ return options()[0]
12
+ end
13
+
14
+ def options()
15
+ raise NotImplementedError
16
+ end
17
+
18
+ # Is this a special Action that should just be run on its own without looking
19
+ # at other Actions? Note that anything that returns true won't get an
20
+ # execution context.
21
+ def execute_immediately_after_command_line_parse?
22
+ return false
23
+ end
24
+
25
+ def descriptor_requirement()
26
+ raise NotImplementedError
27
+ end
28
+
29
+ def allow_both_descriptor_and_file?()
30
+ return false
31
+ end
32
+
33
+ def load_base_package?()
34
+ raise NotImplementedError
35
+ end
36
+
37
+ def base_package_can_come_from_descriptor?()
38
+ return true
39
+ end
40
+
41
+ # true, false, or nil if don't care.
42
+ def register_base_package?()
43
+ raise NotImplementedError
44
+ end
45
+
46
+ # true, false, or nil if don't care.
47
+ def apply_config?()
48
+ raise NotImplementedError
49
+ end
50
+
51
+ # true, false, or nil if don't care.
52
+ def apply_base_config?()
53
+ raise NotImplementedError
54
+ end
55
+
56
+ def remote_operation_necessary?()
57
+ return false
58
+ end
59
+
60
+ def retrieves_should_happen?()
61
+ return false
62
+ end
63
+
64
+ # Answers whether we should reset the environment to nothing, sort of like
65
+ # the standardized environment that cron(1) creates. At present, we're only
66
+ # setting this when we're listing variables. One could imagine allowing this
67
+ # to be set by a command-line option in general; if we do this, the
68
+ # RuntimeEnvironment class will need to be changed to support deletion of
69
+ # values from ENV.
70
+ def reset_environment?()
71
+ return false
72
+ end
73
+
74
+ # Slurp data out of command-line options.
75
+ def configure(options)
76
+ # Do nothing by default.
77
+ return
78
+ end
79
+
80
+ def execute()
81
+ raise NotImplementedError
82
+ end
83
+ end
@@ -0,0 +1,33 @@
1
+ require 'fig/command/action'
2
+ require 'fig/command/action/role/has_no_sub_action'
3
+
4
+ module Fig; end
5
+ class Fig::Command; end
6
+ module Fig::Command::Action; end
7
+
8
+ class Fig::Command::Action::Clean
9
+ include Fig::Command::Action
10
+ include Fig::Command::Action::Role::HasNoSubAction
11
+
12
+ def options()
13
+ return %w<--clean>
14
+ end
15
+
16
+ def descriptor_requirement()
17
+ return :required
18
+ end
19
+
20
+ def load_base_package?()
21
+ return false
22
+ end
23
+
24
+ def configure(options)
25
+ @descriptor = options.descriptor
26
+ end
27
+
28
+ def execute()
29
+ @execution_context.repository.clean(@descriptor)
30
+
31
+ return EXIT_SUCCESS
32
+ end
33
+ end
@@ -0,0 +1,48 @@
1
+ require 'fig/command/action'
2
+ require 'fig/command/action/role/has_no_sub_action'
3
+
4
+ module Fig; end
5
+ class Fig::Command; end
6
+ module Fig::Command::Action; end
7
+
8
+ class Fig::Command::Action::Get
9
+ include Fig::Command::Action
10
+ include Fig::Command::Action::Role::HasNoSubAction
11
+
12
+ def options()
13
+ return %w<--get>
14
+ end
15
+
16
+ def descriptor_requirement()
17
+ return nil
18
+ end
19
+
20
+ def load_base_package?()
21
+ return true
22
+ end
23
+
24
+ def register_base_package?()
25
+ return true
26
+ end
27
+
28
+ def apply_config?()
29
+ return true
30
+ end
31
+
32
+ def apply_base_config?()
33
+ return true
34
+ end
35
+
36
+ def configure(options)
37
+ @variable = options.variable_to_get
38
+ end
39
+
40
+ def execute()
41
+ # Ruby v1.8 emits "nil" for nil, whereas ruby v1.9 emits the empty
42
+ # string, so, for consistency, we need to ensure that we always emit the
43
+ # empty string.
44
+ puts @execution_context.environment[@variable] || ''
45
+
46
+ return EXIT_SUCCESS
47
+ end
48
+ end
@@ -0,0 +1,29 @@
1
+ require 'fig/command/action'
2
+ require 'fig/command/action/role/has_no_sub_action'
3
+
4
+ module Fig; end
5
+ class Fig::Command; end
6
+ module Fig::Command::Action; end
7
+
8
+ class Fig::Command::Action::Help
9
+ include Fig::Command::Action
10
+ include Fig::Command::Action::Role::HasNoSubAction
11
+
12
+ def options()
13
+ return %w<--help>
14
+ end
15
+
16
+ def execute_immediately_after_command_line_parse?
17
+ return true
18
+ end
19
+
20
+ def configure(options)
21
+ @help_message = options.help_message
22
+ end
23
+
24
+ def execute()
25
+ puts @help_message
26
+
27
+ return EXIT_SUCCESS
28
+ end
29
+ end
@@ -0,0 +1,39 @@
1
+ require 'fig/command/action'
2
+ require 'fig/command/action/role/has_no_sub_action'
3
+
4
+ module Fig; end
5
+ class Fig::Command; end
6
+ module Fig::Command::Action; end
7
+
8
+ class Fig::Command::Action::ListConfigs
9
+ include Fig::Command::Action
10
+ include Fig::Command::Action::Role::HasNoSubAction
11
+
12
+ def options()
13
+ return %w<--list-configs>
14
+ end
15
+
16
+ def descriptor_requirement()
17
+ return nil
18
+ end
19
+
20
+ def load_base_package?()
21
+ return true
22
+ end
23
+
24
+ def register_base_package?()
25
+ return nil # don't care
26
+ end
27
+
28
+ def apply_config?()
29
+ return nil # don't care
30
+ end
31
+
32
+ def execute()
33
+ @execution_context.base_package.configs.each do |config|
34
+ puts config.name
35
+ end
36
+
37
+ return EXIT_SUCCESS
38
+ end
39
+ end
@@ -0,0 +1,19 @@
1
+ require 'fig/command/action'
2
+ require 'fig/command/action/role/has_sub_action'
3
+
4
+ module Fig; end
5
+ class Fig::Command; end
6
+ module Fig::Command::Action; end
7
+
8
+ class Fig::Command::Action::ListDependencies
9
+ include Fig::Command::Action
10
+ include Fig::Command::Action::Role::HasSubAction
11
+
12
+ def options()
13
+ if sub_action
14
+ return sub_action.options
15
+ end
16
+
17
+ return %w<--list-dependencies>
18
+ end
19
+ end
@@ -0,0 +1,44 @@
1
+ require 'fig/command/action'
2
+ require 'fig/command/action/role/list_all_configs'
3
+ require 'fig/command/action/role/list_dependencies_flat'
4
+ require 'fig/command/action/role/list_walking_dependency_tree'
5
+
6
+ module Fig; end
7
+ class Fig::Command; end
8
+ module Fig::Command::Action; end
9
+ class Fig::Command::Action::ListDependencies; end
10
+
11
+ class Fig::Command::Action::ListDependencies::AllConfigs
12
+ include Fig::Command::Action
13
+ include Fig::Command::Action::Role::ListAllConfigs
14
+ include Fig::Command::Action::Role::ListDependenciesFlat
15
+ include Fig::Command::Action::Role::ListWalkingDependencyTree
16
+
17
+ def options()
18
+ return %w<--list-dependencies --list-all-configs>
19
+ end
20
+
21
+ def descriptor_requirement()
22
+ return nil
23
+ end
24
+
25
+ def load_base_package?()
26
+ return true
27
+ end
28
+
29
+ def register_base_package?()
30
+ return nil # don't care
31
+ end
32
+
33
+ def apply_config?
34
+ return nil # don't care
35
+ end
36
+
37
+ def derive_package_strings(packages)
38
+ return packages.keys.collect do
39
+ |package|
40
+
41
+ packages[package].collect {|config| package.to_s_with_config(config)}
42
+ end.flatten
43
+ end
44
+ end
@@ -0,0 +1,40 @@
1
+ require 'fig/command/action'
2
+ require 'fig/command/action/role/list_base_config'
3
+ require 'fig/command/action/role/list_dependencies_flat'
4
+ require 'fig/command/action/role/list_walking_dependency_tree'
5
+
6
+ module Fig; end
7
+ class Fig::Command; end
8
+ module Fig::Command::Action; end
9
+ class Fig::Command::Action::ListDependencies; end
10
+
11
+ class Fig::Command::Action::ListDependencies::Default
12
+ include Fig::Command::Action
13
+ include Fig::Command::Action::Role::ListBaseConfig
14
+ include Fig::Command::Action::Role::ListDependenciesFlat
15
+ include Fig::Command::Action::Role::ListWalkingDependencyTree
16
+
17
+ def options()
18
+ return %w<--list-dependencies>
19
+ end
20
+
21
+ def descriptor_requirement()
22
+ return nil
23
+ end
24
+
25
+ def load_base_package?()
26
+ return true
27
+ end
28
+
29
+ def register_base_package?()
30
+ return nil # don't care
31
+ end
32
+
33
+ def apply_config?
34
+ return nil # don't care
35
+ end
36
+
37
+ def derive_package_strings(packages)
38
+ return packages.keys
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ require 'fig/command/action'
2
+ require 'fig/command/action/role/list_base_config'
3
+ require 'fig/command/action/role/list_dependencies_in_a_tree'
4
+ require 'fig/command/action/role/list_walking_dependency_tree'
5
+
6
+ module Fig; end
7
+ class Fig::Command; end
8
+ module Fig::Command::Action; end
9
+ class Fig::Command::Action::ListDependencies; end
10
+
11
+ class Fig::Command::Action::ListDependencies::Tree
12
+ include Fig::Command::Action
13
+ include Fig::Command::Action::Role::ListBaseConfig
14
+ include Fig::Command::Action::Role::ListDependenciesInATree
15
+ include Fig::Command::Action::Role::ListWalkingDependencyTree
16
+
17
+ def options()
18
+ return %w<--list-dependencies --list-tree>
19
+ end
20
+
21
+ def descriptor_requirement()
22
+ return nil
23
+ end
24
+
25
+ def load_base_package?()
26
+ return true
27
+ end
28
+
29
+ def register_base_package?()
30
+ return nil # don't care
31
+ end
32
+
33
+ def apply_config?()
34
+ return nil # don't care
35
+ end
36
+
37
+ def apply_base_config?()
38
+ return nil # don't care
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ require 'fig/command/action'
2
+ require 'fig/command/action/role/list_all_configs'
3
+ require 'fig/command/action/role/list_dependencies_in_a_tree'
4
+ require 'fig/command/action/role/list_walking_dependency_tree'
5
+
6
+ module Fig; end
7
+ class Fig::Command; end
8
+ module Fig::Command::Action; end
9
+ class Fig::Command::Action::ListDependencies; end
10
+
11
+ class Fig::Command::Action::ListDependencies::TreeAllConfigs
12
+ include Fig::Command::Action
13
+ include Fig::Command::Action::Role::ListAllConfigs
14
+ include Fig::Command::Action::Role::ListDependenciesInATree
15
+ include Fig::Command::Action::Role::ListWalkingDependencyTree
16
+
17
+ def options()
18
+ return %w<--list-dependencies --list-tree --list-all-configs>
19
+ end
20
+
21
+ def descriptor_requirement()
22
+ return nil
23
+ end
24
+
25
+ def load_base_package?()
26
+ return true
27
+ end
28
+
29
+ def register_base_package?()
30
+ return nil # don't care
31
+ end
32
+
33
+ def apply_config?()
34
+ return nil # don't care
35
+ end
36
+
37
+ def apply_base_config?()
38
+ return nil # don't care
39
+ end
40
+ end
@@ -0,0 +1,29 @@
1
+ require 'fig/command/action'
2
+ require 'fig/command/action/role/has_no_sub_action'
3
+
4
+ module Fig; end
5
+ class Fig::Command; end
6
+ module Fig::Command::Action; end
7
+
8
+ class Fig::Command::Action::ListLocal
9
+ include Fig::Command::Action
10
+ include Fig::Command::Action::Role::HasNoSubAction
11
+
12
+ def options()
13
+ return %w<--list-local>
14
+ end
15
+
16
+ def descriptor_requirement()
17
+ return :warn
18
+ end
19
+
20
+ def load_base_package?()
21
+ return nil # Don't care.
22
+ end
23
+
24
+ def execute()
25
+ @execution_context.repository.list_packages.sort.each {|item| puts item}
26
+
27
+ return EXIT_SUCCESS
28
+ end
29
+ end