gem_tools 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.0.3 2008-09-02
2
+ * Add a setup command to drop a gems.yml template in place
3
+
1
4
  == 0.0.3 2008-09-02
2
5
  * Fix the borked binary, not sure why this didn't show up previously
3
6
 
data/README.txt CHANGED
@@ -13,12 +13,17 @@ Doesn't yet work in Windows
13
13
 
14
14
  == SYNOPSIS:
15
15
 
16
- I use this to manage gem versions in my apps, it has a rake task to install gems
16
+ I use this to manage gem versions in my apps, it has a script to install gems
17
17
  and a load utility to load them on startup.
18
18
 
19
+ create a gems.yml in a new project
20
+ <pre><code>
21
+ gemtools setup path/to/app
22
+ </pre></code>
23
+
19
24
  Install or update required gems
20
25
  <pre><code>
21
- gem_tools install
26
+ gemtools install
22
27
  </pre></code>
23
28
 
24
29
  Make sure they are loaded with the right versions during startup, by adding the
data/bin/gemtools CHANGED
@@ -3,6 +3,7 @@
3
3
  # Created on 2008-8-2.
4
4
  # Copyright (c) 2008. All rights reserved.
5
5
 
6
+ require 'optparse'
6
7
  require File.dirname(__FILE__) + '/../lib/gem_tools'
7
8
 
8
9
  begin
@@ -13,12 +14,9 @@ rescue LoadError => e
13
14
  exit 1
14
15
  end
15
16
 
16
- require 'optparse'
17
-
18
17
  command = ARGV.first
19
-
20
- OPTIONS = { }
21
- MANDATORY_OPTIONS = %w( )
18
+ options = {}
19
+ MANDATORY_OPTIONS = %w()
22
20
 
23
21
  parser = OptionParser.new do |opts|
24
22
  opts.banner = <<BANNER
@@ -37,22 +35,23 @@ Commands are:
37
35
 
38
36
  Options are:
39
37
  BANNER
38
+
40
39
  opts.separator ""
41
40
  opts.on("-d", "--docs", String,
42
41
  "Install the rdocs and ri during install",
43
- "Default: off") { |opts| OPTIONS[:docs] }
42
+ "Default: off") { |opt| options[:docs] = opt }
44
43
  opts.on("-f", "--force", String,
45
44
  "Force the install of the gems",
46
- "Default: off") { |opts| OPTIONS[:force] }
45
+ "Default: off") { |opt| options[:force] = opt }
47
46
  opts.on("-h", "--help",
48
47
  "Show this help message") { puts opts; exit }
49
48
  opts.parse!(ARGV)
50
49
 
51
- if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
50
+ if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| options[option.to_sym].nil? }
52
51
  puts opts; exit
53
52
  end
54
- OPTS = opts
55
- end
53
+ end.parse!
54
+
55
+ OPTIONS = options
56
56
 
57
- # do stuff
58
57
  GemTools.run command
@@ -2,7 +2,7 @@ module GemTools
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/lib/gem_tools.rb CHANGED
@@ -8,6 +8,18 @@ module GemTools
8
8
  send(cmd.to_sym) rescue help
9
9
  end
10
10
 
11
+ def setup
12
+ require 'fileutils'
13
+ dest_file = File.join(ARGV[1], '/config/gems.yml')
14
+ if File.exist?(dest_file) && ! OPTIONS.has_key?(:force)
15
+ puts "#{dest_file} already exists.\n\ngemtools install #{ARGV[1]} --force\n\nto overwrite"
16
+ exit 1
17
+ else
18
+ FileUtils.copy(File.join(File.dirname(__FILE__), '../config/gems.template.yml'), dest_file)
19
+ puts "#{dest_file} created"
20
+ end
21
+ end
22
+
11
23
  def load_gems
12
24
  config = load_config
13
25
  unless config['gems'].nil?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Moen
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-02 00:00:00 -05:00
12
+ date: 2008-09-03 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency