fig 0.1.69 → 0.1.71

Sign up to get free protection for your applications and to get access to all the features.
data/Changes CHANGED
@@ -1,3 +1,48 @@
1
+ v0.1.71
2
+
3
+ Backwards incompatibilities:
4
+
5
+ - Packages, resources, archives, and configs cannot have names that are
6
+ keywords (other than "config") in order to have more clear parse error
7
+ messages and allow for future expandability. (You didn't really want a
8
+ package named "end" did you?)
9
+
10
+ New features:
11
+
12
+ - Default for --update-lock-response is now "wait" instead of "fail".
13
+ However, if a pre-existing lock is encountered and you haven't explicitly
14
+ specified "--update-lock-response wait", you'll get a warning about the
15
+ wait. Note that this warning is not influenced by --log-level.
16
+
17
+ - Can specify the location of the remote repository via ~/.figrc or the value
18
+ of the --figrc parameter by specifying a value for "default
19
+ FIG_REMOTE_URL", e.g.
20
+
21
+ { "default FIG_REMOTE_URL" : "file:///some/path" }
22
+
23
+ - New --dump-package-definition-text option, which gives you the text of the
24
+ base package. Useful for looking at published packages.
25
+
26
+ - New --dump-package-definition-parsed option, which, surprise, gives you the
27
+ the base package after Fig has digested it. Note that you won't see the
28
+ result of --set/--append/--archive/--resource options in this because those
29
+ get stored outside of the base package.
30
+
31
+ - Warns on ignored --archive/--resource options.
32
+
33
+ - The output "--help" was getting way too long. The text that it now emits
34
+ is non-comprehensive, but it should fit onto a single screen and includes
35
+ pointers to the new "--options" and "--help-long" options.
36
+
37
+ Bug fixes:
38
+
39
+ - Loading an overridden package version that had one config include another
40
+ config of the same package could cause problems in some circumstances.
41
+
42
+ v0.1.70.beta.1
43
+
44
+ - Test release
45
+
1
46
  v0.1.69
2
47
 
3
48
  Backwards incompatibilities:
data/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2009-2012, Matthew Foemmel
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+
14
+ * The names of the contributors may not be used to endorse or promote
15
+ products derived from this software without specific prior written
16
+ permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
22
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ Description
2
+ ===========
3
+
4
+ Fig is a utility for configuring environments and managing dependencies across
5
+ a team of developers.
6
+
7
+ An "environment" in fig is a set of environment variables. A "package" is a
8
+ collection of files, along with some metadata describing which environment
9
+ variables should be modified when the package is included. For instance, each
10
+ dependency may prepend its corresponding jar to CLASSPATH. The metadata may
11
+ also list that package's lower-level Fig package dependencies.
12
+
13
+ Fig recursively builds an environment consisting of package dependencies
14
+ (typically specified via command-line options or a package.fig file), each of
15
+ which as noted above may have its own dependencies, and optionally executes a
16
+ shell command in that environment. The caller's environment is not affected.
17
+
18
+ Developers can use package.fig files to specify the list of dependencies to use
19
+ for different tasks. This file will typically be versioned along with the rest
20
+ of the source files, ensuring that all developers on a team are using the same
21
+ environments.
22
+
23
+ Packages exist in two places: a "local" repository cache in the user's home
24
+ directory-- also called the fig-home --and a "remote" repository on a shared
25
+ server. Fig will automatically download packages from the remote repository and
26
+ install them in the fig-home as needed. Fig does not contact the remote
27
+ repository unless it needs to. The default fig-home is `$HOME/.fighome`, but
28
+ may be changed by setting the `$FIG_HOME` environment variable.
29
+
30
+ Full documentation
31
+ ==================
32
+
33
+ https://github.com/mfoemmel/fig/wiki
34
+
35
+ Community
36
+ =========
37
+
38
+ \#fig on irc.freenode.net
39
+
40
+ [Fig Mailing List](http://groups.google.com/group/fig-user)
41
+
42
+ Copyright
43
+ =========
44
+
45
+ Copyright (c) 2009-2012 Matthew Foemmel. See LICENSE for details.
data/lib/fig.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Fig
2
- VERSION = '0.1.69'
2
+ VERSION = '0.1.71'
3
3
  end
@@ -2,11 +2,11 @@ module Fig; end
2
2
 
3
3
  # Configuration for the Fig program, as opposed to a config in a package.
4
4
  class Fig::ApplicationConfiguration
5
- attr_reader :remote_repository_url
5
+ attr_accessor :base_whitelisted_url
6
+ attr_accessor :remote_repository_url
6
7
 
7
- def initialize(remote_repository_url)
8
+ def initialize()
8
9
  @data = []
9
- @remote_repository_url = remote_repository_url
10
10
  clear_cached_data
11
11
  end
12
12
 
@@ -15,8 +15,12 @@ class Fig::ApplicationConfiguration
15
15
  whitelist = self['url whitelist']
16
16
  if whitelist.nil?
17
17
  @whitelist = []
18
+ elsif @base_whitelisted_url
19
+ @whitelist = [@base_whitelisted_url, whitelist].flatten
20
+ elsif whitelist.is_a? Array
21
+ @whitelist = whitelist
18
22
  else
19
- @whitelist = [@remote_repository_url, whitelist].flatten
23
+ @whitelist = [whitelist]
20
24
  end
21
25
  end
22
26
 
@@ -33,12 +37,8 @@ class Fig::ApplicationConfiguration
33
37
  @data.push(dataset)
34
38
  end
35
39
 
36
- def unshift_dataset(dataset)
37
- @data.unshift(dataset)
38
- end
39
-
40
- # after push_dataset or unshift_dataset, call clear_cached, and lazy
41
- # initialize as far as the list of things to exclude
40
+ # After push_dataset, call clear_cached, and lazy initialize as far as the
41
+ # list of things to exclude
42
42
  def clear_cached_data()
43
43
  @whitelist = nil
44
44
  end
data/lib/fig/command.rb CHANGED
@@ -60,9 +60,11 @@ class Fig::Command
60
60
  if actions.any? {|action| not action.allow_both_descriptor_and_file? }
61
61
  ensure_descriptor_and_file_were_not_both_specified()
62
62
  end
63
+ check_package_content_options()
63
64
 
64
65
  configure()
65
66
  set_up_base_package()
67
+ invoke_post_set_up_actions()
66
68
 
67
69
  context = ExecutionContext.new(
68
70
  @base_package,
@@ -101,6 +103,13 @@ class Fig::Command
101
103
  return Fig::Command::Action::EXIT_FAILURE
102
104
  end
103
105
 
106
+ # Extension mechanism for customizing Fig.
107
+ def add_post_set_up_action(action)
108
+ @post_set_up_actions << action
109
+
110
+ return
111
+ end
112
+
104
113
  def add_publish_listener(listener)
105
114
  @publish_listeners << listener
106
115
 
@@ -108,6 +117,7 @@ class Fig::Command
108
117
  end
109
118
 
110
119
  def initialize()
120
+ @post_set_up_actions = []
111
121
  @publish_listeners = []
112
122
  end
113
123
 
@@ -123,17 +133,6 @@ class Fig::Command
123
133
  :package_source_description
124
134
  )
125
135
 
126
- def derive_remote_url()
127
- if remote_operation_necessary?()
128
- if ENV['FIG_REMOTE_URL'].nil?
129
- raise Fig::UserInputError.new('Please define the FIG_REMOTE_URL environment variable.')
130
- end
131
- return ENV['FIG_REMOTE_URL']
132
- end
133
-
134
- return nil
135
- end
136
-
137
136
  def check_include_statements_versions?()
138
137
  return false if @options.suppress_warning_include_statement_missing_version?
139
138
 
@@ -176,12 +175,21 @@ class Fig::Command
176
175
  def set_up_application_configuration()
177
176
  @application_configuration = Fig::FigRC.find(
178
177
  @options.figrc(),
179
- derive_remote_url(),
178
+ ENV['FIG_REMOTE_URL'],
180
179
  @options.login?,
181
180
  @options.home(),
182
181
  @options.no_figrc?
183
182
  )
184
183
 
184
+ if \
185
+ remote_operation_necessary? \
186
+ && @application_configuration.remote_repository_url.nil?
187
+
188
+ raise Fig::UserInputError.new(
189
+ 'Please define the FIG_REMOTE_URL environment variable.'
190
+ )
191
+ end
192
+
185
193
  return
186
194
  end
187
195
 
@@ -260,6 +268,16 @@ class Fig::Command
260
268
  return
261
269
  end
262
270
 
271
+ def invoke_post_set_up_actions()
272
+ @post_set_up_actions.each do
273
+ |action|
274
+
275
+ action.set_up_finished(@application_configuration)
276
+ end
277
+
278
+ return
279
+ end
280
+
263
281
  def base_config()
264
282
  return @options.config() ||
265
283
  @descriptor && @descriptor.config ||
@@ -330,6 +348,24 @@ class Fig::Command
330
348
  return
331
349
  end
332
350
 
351
+ def check_package_content_options()
352
+ statements = @options.package_contents_statements
353
+ return if statements.empty?
354
+
355
+ return if @options.actions.any? \
356
+ {|action| action.cares_about_package_content_options?}
357
+
358
+ statements.each do
359
+ |statement|
360
+
361
+ Fig::Logging.warn(
362
+ "Ignored #{statement.source_description} for #{statement.url}."
363
+ )
364
+ end
365
+
366
+ return
367
+ end
368
+
333
369
  def remote_operation_necessary?()
334
370
  return @options.actions.any? {|action| action.remote_operation_necessary?}
335
371
  end
@@ -37,6 +37,10 @@ module Fig::Command::Action
37
37
  return false
38
38
  end
39
39
 
40
+ def cares_about_package_content_options?()
41
+ return false
42
+ end
43
+
40
44
  def load_base_package?()
41
45
  raise NotImplementedError
42
46
  end
@@ -0,0 +1,43 @@
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::DumpPackageDefinitionParsed
9
+ include Fig::Command::Action
10
+ include Fig::Command::Action::Role::HasNoSubAction
11
+
12
+ def options()
13
+ return %w<--dump-package-definition-parsed>
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 false
26
+ end
27
+
28
+ def apply_config?()
29
+ return false
30
+ end
31
+
32
+ def execute()
33
+ lines = @execution_context.base_package.statements.map do
34
+ |statement|
35
+
36
+ statement.unparse('')
37
+ end
38
+
39
+ print lines.join("\n").strip
40
+
41
+ return EXIT_SUCCESS
42
+ end
43
+ end
@@ -0,0 +1,44 @@
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::DumpPackageDefinitionText
9
+ include Fig::Command::Action
10
+ include Fig::Command::Action::Role::HasNoSubAction
11
+
12
+ def options()
13
+ return %w<--dump-package-definition-text>
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 false
26
+ end
27
+
28
+ def apply_config?()
29
+ return false
30
+ end
31
+
32
+ def execute()
33
+ text = @execution_context.base_package.unparsed_text
34
+ if text
35
+ puts text.strip # Ensure one and only one ending newline.
36
+
37
+ return EXIT_SUCCESS
38
+ end
39
+
40
+ $stderr.puts %q<There's no text for the package.>
41
+
42
+ return EXIT_FAILURE
43
+ end
44
+ end
@@ -18,7 +18,7 @@ class Fig::Command::Action::Help
18
18
  end
19
19
 
20
20
  def configure(options)
21
- @help_message = options.help_message
21
+ @help_message = options.short_help_message
22
22
  end
23
23
 
24
24
  def execute()
@@ -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::HelpLong
9
+ include Fig::Command::Action
10
+ include Fig::Command::Action::Role::HasNoSubAction
11
+
12
+ def options()
13
+ return %w<--help-long>
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.full_help_message
22
+ end
23
+
24
+ def execute()
25
+ puts @help_message
26
+
27
+ return EXIT_SUCCESS
28
+ end
29
+ end
@@ -0,0 +1,30 @@
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::Options
9
+ include Fig::Command::Action
10
+ include Fig::Command::Action::Role::HasNoSubAction
11
+
12
+ def options()
13
+ return %w<--options>
14
+ end
15
+
16
+ def execute_immediately_after_command_line_parse?
17
+ return true
18
+ end
19
+
20
+ def configure(options)
21
+ @options_message = options.options_message
22
+ end
23
+
24
+ def execute()
25
+ puts "Fig options:\n\n"
26
+ puts @options_message
27
+
28
+ return EXIT_SUCCESS
29
+ end
30
+ end