geminstaller 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,5 +1,9 @@
1
1
  == 0.x.y / yyyy-mm-dd
2
2
 
3
+ == 0.2.5 / 2007-10-24
4
+ * Add 'include_config' directive to yaml config file, allowing other files to be included via ERB.
5
+ * Fix broken links in docs - patch from Maciej Kozak (macio)
6
+
3
7
  == 0.2.4 / 2007-10-21
4
8
  * Look for config file at config/geminstaller.yml as well as geminstaller.yml
5
9
  * Make startup message ('Installing Gems...') debug level instead of info
data/TODO.txt CHANGED
@@ -3,6 +3,8 @@
3
3
  * Figure out how to suppress webrick messages from embedded gem server
4
4
  * Allow array or eval'able string of gems to be passed as --gems arg or instead of args
5
5
  * Add @options[:gems], should be parsed from command line
6
+ * Add warning that environment is not passed via sudo
7
+ * document include_config in yaml
6
8
  =============== 0.2.6
7
9
  * Understand environment.rb vs boot.rb (bottom line: env is not processed before Initializer, so can't be used to load rails gems). Add doc references.
8
10
  * docs - clean up sudo section. Should be clearer about sudoers entry, and make sure that NOPASSWD is the last entry.
@@ -24,9 +24,14 @@ module GemInstaller
24
24
  file_contents = @file_reader.read(path)
25
25
  next unless file_contents
26
26
  next if file_contents.empty?
27
- @output_filter.geminstaller_output(:debug,"Found GemInstaller config file at: #{File.expand_path(path)}\n")
28
- file_contents_erb = ERB.new(%{#{file_contents}})
29
- yaml = @yaml_loader.load(file_contents_erb.result)
27
+ expanded_path = File.expand_path(path)
28
+ @output_filter.geminstaller_output(:debug,"Found GemInstaller config file at: #{expanded_path}\n")
29
+ erb = ERB.new(%{#{file_contents}})
30
+ erb_result = nil
31
+ Dir.chdir(File.dirname(expanded_path)) do |yaml_file_dir|
32
+ erb_result = erb.result(include_config_binding)
33
+ end
34
+ yaml = @yaml_loader.load(erb_result)
30
35
  merged_defaults.merge!(yaml['defaults']) unless yaml['defaults'].nil?
31
36
  next unless yaml['gems']
32
37
  yaml['gems'].each do |gem|
@@ -41,5 +46,15 @@ module GemInstaller
41
46
  config = GemInstaller::Config.new(merged_yaml)
42
47
  config
43
48
  end
49
+
50
+ def include_config_binding
51
+ def include_config(config_file)
52
+ Dir.chdir(File.dirname(config_file)) do |yaml_file_dir|
53
+ erb = File.open(config_file) { |io| ERB.new(io.read) }
54
+ erb.result(include_config_binding)
55
+ end
56
+ end
57
+ binding
58
+ end
44
59
  end
45
60
  end
data/lib/geminstaller.rb CHANGED
@@ -29,7 +29,7 @@ module GemInstaller
29
29
  end
30
30
 
31
31
  def self.version
32
- "0.2.4"
32
+ "0.2.5"
33
33
  end
34
34
 
35
35
  def self.create_application(args = [], registry = nil)
@@ -26,6 +26,7 @@ h2. Table of Contents
26
26
  ** "<code>fix_dependencies</code> config property":#fix_dependencies_config_property
27
27
  ** "<code>no_autogem</code> config property":#no_autogem_config_property
28
28
  ** "<code>prefer_binary_platform</code> config property":#prefer_binary_platform_config_property
29
+ ** "<code>include_config</code> directive":#include_config
29
30
  * "Using GemInstaller with Ruby on Rails or Other Ruby Apps":#using_geminstaller_with_ruby_on_rails_or_other_ruby_apps
30
31
  ** "Invoking <code>GemInstaller</code> from Rails":#invoking_geminstaller_from_rails
31
32
  ** "Bootstrapping Rails with GemInstaller":#bootstrapping_rails_with_geminstaller
@@ -153,6 +154,8 @@ h3(#sudo_option). <code>--sudo</code> option
153
154
 
154
155
  The <code>--sudo</code> option runs GemInstaller as root by using the <code>sudo</code> command. This command is neither valid nor necessary on Windows platforms. See the "Dealing with sudo and root-owned RubyGem installations":#dealing_with_sudo section for more details.
155
156
 
157
+ NOTE: As a security feature, the sudo command does NOT pass along the current environment. That means that if you use the <code>--sudo</code> option, environment variables that are currently set will NOT be available to GemInstaller config files. There are options to get around this - read the docs on sudoers for your unix distro.
158
+
156
159
  h3(#silent_option). <code>--silent</code> option
157
160
 
158
161
  The <code>--silent</code> option suppresses all RubyGems output except fatal errors/exceptions. It overrides the <code>--geminstaller-output</code> and <code>--rubygems-output</code> options.
@@ -237,6 +240,35 @@ Defaults to true. GemInstaller automatically guesses at the correct platform fo
237
240
 
238
241
  This option determines whether the 'ruby' platform, or a 'binary' platform will be chosen first. By default, binary platforms will be chosen if there is one available which seems to match the platform of the current machine. In practice, this usually only applies to windows, since (hopefully) most gems which need to be compiled distribute a windows-specific precompiled gem version. See "Automatic Platform Detection":#automatic_platform_detection for more info.
239
242
 
243
+ h3(#include_config). <code>include_config</code> directive
244
+
245
+ Inside a GemInstaller yaml config file, you can use the <code>include_config</code> directive to include another config file via ERB. This also works recursively - included files can include other files.
246
+
247
+ This is an alternative to specifying multiple files in the <code>--config</code> command line option - it allows you to abstract out common portions of config files across multiple files, while still only having to specify a single top-level config file.
248
+
249
+ GemInstaller also ensures that the working directory is set to the directory containing the current yaml file - NOT the directory that <code>geminstaller</code> was invoked from. This allows you to use <code>include_config</code> to reference yaml files relative to each other. Here's an example:
250
+
251
+ <pre>
252
+ \---
253
+ # .../geminstaller.yml
254
+ gems:
255
+ <%= include_config("#{File.expand_path(File.dirname(__FILE__))}/subdir1/included_gem_config1.yml") %>
256
+ </pre>
257
+
258
+ <pre>
259
+ \---
260
+ # .../subdir1/included_gem_config1.yml
261
+ - name: testgem1
262
+ <%= include_config("#{File.expand_path(File.dirname(__FILE__))}/../subdir2/included_gem_config2.yml") %>
263
+ </pre>
264
+
265
+ <pre>
266
+ \---
267
+ # .../subdir2/included_gem_config2.yml
268
+ - name: testgem2
269
+ </pre>
270
+
271
+
240
272
  h2(#using_geminstaller_with_ruby_on_rails_or_other_ruby_apps). Using GemInstaller with Ruby on Rails or Other Ruby Apps
241
273
 
242
274
  GemInstaller can also be embedded in another application, such as a Rails app. This is done by invoking the GemInstaller class or the geminstaller executable directly from Ruby. This section only contains a brief explanation, see the tutorial on "Integrating GemInstaller into Ruby on Rails":#integrating_geminstaller_into_ruby_on_rails for detailed explanation.
@@ -52,7 +52,7 @@ require "rubygems"
52
52
  require "geminstaller"
53
53
 
54
54
  # Path(s) to your GemInstaller config file(s)
55
- config_paths = "#{File.expand_path(RAILS_ROOT)}/config/geminstaller.yml"
55
+ config_paths = "#{File.expand_path(RAILS_ROOT)}/config/geminstaller.yml"
56
56
 
57
57
  # Arguments which will be passed to GemInstaller
58
58
  args = "--config #{config_paths}"
@@ -64,7 +64,7 @@ args += " --exceptions"
64
64
  # This will use sudo by default on all non-windows platforms, but requires an entry in your
65
65
  # sudoers file to avoid having to type a password. It can be omitted if you don't want to use sudo.
66
66
  # See http://geminstaller.rubyforge.org/documentation/documentation.html#dealing_with_sudo
67
- args += " --sudo" unless RUBY_PLATFORM =~ /mswin/
67
+ args += " --sudo" unless RUBY_PLATFORM =~ /mswin/
68
68
 
69
69
  # The 'install' method will auto-install gems as specified by the args and config
70
70
  GemInstaller.run(args)
@@ -83,4 +83,4 @@ unless defined?(Rails::Initializer)
83
83
 
84
84
  h2. Where to go next
85
85
 
86
- See the "Tutorials":documentation/tutorials.html or the "Detailed Documentation":documentation/documentation.html for examples of more GemInstaller features.
86
+ See the "Tutorials":tutorials.html or the "Detailed Documentation":documentation.html for examples of more GemInstaller features.
@@ -34,12 +34,15 @@ GemInstaller was created by "Chad Woolley":http://www.thewoolleyweb.com.
34
34
 
35
35
  h2(#known_bugs). Known Bugs
36
36
 
37
- Currently (as of version 0.2.4), the only _major_ known bug is related to auto-installing the Rails or Mongrel gems via boot.rb during startup of Mongrel or Webrick. The simple workaround is to run GemInstaller manually or just restart Rails anytime GemInstaller auto-installs a Rails/Mongrel gem upgrade during app startup. For Rails and other deployable apps, you can also "run GemInstaller from Capistrano":documentation/tutorials.html#running_geminstaller_from_capistrano to avoid this problem in demo/production environments. Researching and fixing this problem is a top priority. I bet there's another bug or twoo, so please "report them if you find them":http://rubyforge.org/tracker/?group_id=1902!
37
+ Currently, the only _major_ known bug is related to auto-installing the Rails or Mongrel gems via boot.rb during startup of Mongrel or Webrick. The simple workaround is to run GemInstaller manually or just restart Rails anytime GemInstaller auto-installs a Rails/Mongrel gem upgrade during app startup. For Rails and other deployable apps, you can also "run GemInstaller from Capistrano":documentation/tutorials.html#running_geminstaller_from_capistrano to avoid this problem in demo/production environments. I bet there's another bug or twoo, so please "report them if you find them":http://rubyforge.org/tracker/?group_id=1902!
38
38
 
39
39
  There's also some leakage of gem doc warning messages even if you turn down --rubygems-output, but these can be ignored (these same messages show up when installing gems manually). This should be fixed soon.
40
40
 
41
41
  h2(#history). History
42
42
 
43
+ * 0.2.5
44
+ ** Add 'include_config' directive to yaml config file, allowing other files to be included via ERB.
45
+ ** Fix broken links in docs - patch from Maciej Kozak (macio)
43
46
  * 0.2.4
44
47
  ** Look for config file at config/geminstaller.yml as well as geminstaller.yml
45
48
  ** make startup message ('Installing Gems...') debug level instead of info
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: geminstaller
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.4
7
- date: 2007-10-21 00:00:00 -07:00
6
+ version: 0.2.5
7
+ date: 2007-10-24 00:00:00 -07:00
8
8
  summary: GemInstaller provides automated management of RubyGems.
9
9
  require_paths:
10
10
  - lib