rvm2 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 27b9958381eddc4f8428bb7737134e5870e1d073
4
+ data.tar.gz: 11ec44c2cf4f6729bd149bc9c28c02e256f129f8
5
+ SHA512:
6
+ metadata.gz: 4e926d57da26af8f9addef399b32c7415a9fe188c82cf73764e9c1d407128b1ae400698226d3726e2ed5656af9bd486af3a6b3a9258cc9baa7154b9efe1aa87b
7
+ data.tar.gz: 61a00fa1910eb771d5bce7589aaeb32323d55a661bc0410f676b804c5faa226b4eb4a636191969768ffeebaf9a09abf0e3b6c6768f646bb30f7d9459f6a168b4
@@ -0,0 +1,20 @@
1
+ class Rvm2::Cli::Help < Rvm2::Cli::Plugin
2
+ def self.description
3
+ "show help screen"
4
+ end
5
+
6
+ def run
7
+ plugins = @rvm2plugins["cli"]
8
+ max = plugins.map{|plugin| plugin.command.length }.max
9
+ if @args.empty? || @args[0] == self.class.command
10
+ puts "Welcome to RVM2, available commands:"
11
+ else
12
+ puts "Unknown arguments: #{@args.join(" ")}"
13
+ puts "Available commands:"
14
+ end
15
+ plugins.each do |plugin|
16
+ puts "%#{max}s | %s" % [plugin.command, plugin.description]
17
+ end
18
+ nil
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ class Rvm2::Cli::Welcome < Rvm2::Cli::Plugin
2
+ def self.handles?(*args)
3
+ return true if super
4
+ args.flatten!
5
+ args.length == 0 || args[0].nil? || args[0] == ""
6
+ end
7
+
8
+ def self.description
9
+ "show welcome message"
10
+ end
11
+
12
+ def run
13
+ puts <<-MESSAGE
14
+ Welcome to RVM2, to get some help run:
15
+
16
+ rvm2 help
17
+
18
+ MESSAGE
19
+ end
20
+ end
@@ -0,0 +1,28 @@
1
+ require "pluginator"
2
+
3
+ module Rvm2
4
+ class Cli
5
+ def self.run(args)
6
+ cli = new(args)
7
+ cli.run
8
+ end
9
+
10
+ def initialize(args)
11
+ @args = args
12
+ @rvm2plugins = Pluginator.find("rvm2", extends: %i{first_ask})
13
+ end
14
+
15
+ def run
16
+ plugin = @rvm2plugins.first_ask("cli", :handles?, @args)
17
+ if plugin
18
+ plugin.new(@rvm2plugins, @args).run
19
+ else
20
+ plugin = @rvm2plugins.first_ask("cli", :handles?, "help")
21
+ plugin.new(@rvm2plugins, @args).run
22
+ 1
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ require_relative "cli/plugin"
@@ -0,0 +1,17 @@
1
+ class Rvm2::Cli::Plugin
2
+ def self.handles?(*args)
3
+ args.flatten!
4
+ args.length > 0 && args[0] == command
5
+ end
6
+
7
+ def self.command
8
+ name = self.name.split(/::/)
9
+ name.shift(2)
10
+ name.join("/").downcase
11
+ end
12
+
13
+ def initialize(rvm2plugins, *args)
14
+ @args = args.flatten
15
+ @rvm2plugins = rvm2plugins
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Rvm2
2
+ VERSION = '0.0.1'
3
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rvm2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Michal Papis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pluginator
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: SM Framework aka RVM 2
28
+ email:
29
+ - mpapis@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - lib/rvm2/version.rb
35
+ - lib/rvm2/cli.rb
36
+ - lib/rvm2/cli/plugin.rb
37
+ - lib/plugins/rvm2/cli/help.rb
38
+ - lib/plugins/rvm2/cli/welcome.rb
39
+ homepage: https://github.com/rvm/rvm2
40
+ licenses:
41
+ - Apache2
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 2.1.2
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: SM Framework aka RVM 2
63
+ test_files: []