rvmbs 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/README.markdown CHANGED
@@ -25,6 +25,13 @@ Generates a my_project directory with a trusted .rvmrc file contains:
25
25
 
26
26
  Run `rvmbs --help` or `gem man rvmbs` for more options.
27
27
 
28
+ Config File
29
+ -----------
30
+
31
+ rvmbs use a config file (yaml) on your home dir: '.rvmbsrc'
32
+
33
+ implementation: 1.9.3
34
+
28
35
  To Do
29
36
  -----
30
37
 
data/lib/rvmbs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RVMBS
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/rvmbs.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "rvmbs/version"
2
2
  require "optparse"
3
3
  require "fileutils"
4
+ require "yaml"
4
5
 
5
6
  module RVMBS
6
7
 
@@ -11,19 +12,21 @@ module RVMBS
11
12
  options = {}
12
13
  optsp = nil
13
14
 
15
+ load_config
16
+
14
17
  optparse = OptionParser.new do |opts|
15
18
  optsp = opts
16
19
  opts.banner = "RVM Bootstrap - Command to create a project directory with a configured .rvmrc into.
17
20
 
18
- Usage: rvmbs -d PROJECT_NAME [options]"
21
+ Usage: rvmbs -d <PROJECT_NAME> [options]"
19
22
 
20
23
  # This define the directory name.
21
- opts.on('-d', '--directory NAME', "The name of the project's directory.") do |name|
24
+ opts.on('-d', '--directory NAME', "The project's directory name.") do |name|
22
25
  options[:directory] = name
23
26
  end
24
27
 
25
28
  # This define the ruby implementation.
26
- options[:implementation] = '1.9.2'
29
+ options[:implementation] = @implementation
27
30
  opts.on('-i', '--ruby-implementation NAME', "The name of the Ruby implementation.") do |name|
28
31
  options[:implementation] = name
29
32
  end
@@ -46,8 +49,15 @@ Usage: rvmbs -d PROJECT_NAME [options]"
46
49
  exit
47
50
  end
48
51
 
49
- end.parse!(args)
50
-
52
+ end
53
+
54
+ begin
55
+ optparse.parse!(args)
56
+ rescue OptionParser::MissingArgument
57
+ puts 'rvmbs: missing argument, -h for help'
58
+ exit
59
+ end
60
+
51
61
  # Directory must be set.
52
62
  if options[:directory] == nil
53
63
  puts optsp
@@ -59,6 +69,15 @@ Usage: rvmbs -d PROJECT_NAME [options]"
59
69
  end
60
70
  end
61
71
 
72
+ # Load config from user home dir.
73
+ def self.load_config
74
+ config_path = File.expand_path('~/.rvmbsrc')
75
+ config = YAML.load_file( config_path ) if File.exists? config_path
76
+
77
+ # config values
78
+ @implementation = config['implementation'] || '1.9.2'
79
+ end
80
+
62
81
  # Creates the directory.
63
82
  def self.create_directory(options)
64
83
  puts "Making new directory: #{options[:directory]}" if options[:verbose]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rvmbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-05 00:00:00.000000000Z
12
+ date: 2012-07-24 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gem-man
16
- requirement: &21910480 !ruby/object:Gem::Requirement
16
+ requirement: &21344540 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *21910480
24
+ version_requirements: *21344540
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: ronn
27
- requirement: &21910060 !ruby/object:Gem::Requirement
27
+ requirement: &21344120 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *21910060
35
+ version_requirements: *21344120
36
36
  description: RVM Bootstrap - Command to create a project directory with a configured
37
37
  .rvmrc into.
38
38
  email: