dracula 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e148c48f43d0c429b99185e871a93c814ad8cc4
4
- data.tar.gz: 0e5981929891a953d5e4cd223d0fa0a1365c1e34
3
+ metadata.gz: bf8af3fa8ce0d0773e44cf93b3fe96c801ab73c9
4
+ data.tar.gz: 748c0857159a8f4f554c47c659a4ce39f481c5ac
5
5
  SHA512:
6
- metadata.gz: 7654ff76f9bdc4853367517802769d970575c704c429c3a1652e133c409751607bc464b88242300b0844c2201db855bbfcf6586ae46db426ad28966d7689c870
7
- data.tar.gz: e3a49f08e84a54d89353b44dbf4895707d5550c49a45f5f0cc137e3d74c6aae781609b73c8358770d36222f705595ef3b86270b7da8aca3991e6b631b35e9490
6
+ metadata.gz: b419f1370ad664f0d74954ec949817a1523928f640db92917a74d196ec4eb7b47f4ccf25aded8f760623cff0442c4e6bc67cd45167572661eec7081b38087f0e
7
+ data.tar.gz: ee539053a23e58bf2de318da6418202e59135cb084c042a81711b623523813ba5b4f22337ed974e3bbcbef041aa98ae5f2a5640edee6b4213b1536f604cf5b0a
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Dracula
2
2
 
3
- [![Build Status](https://semaphoreci.com/api/v1/shiroyasha/dracula/branches/master/badge.svg)](https://semaphoreci.com/shiroyasha/dracula)
3
+ [![Build Status](https://semaphoreci.com/api/v1/renderedtext/dracula/branches/master/badge.svg)](https://semaphoreci.com/renderedtext/dracula)
4
4
 
5
5
  ## Usage
6
6
 
data/lib/dracula.rb CHANGED
@@ -6,69 +6,73 @@ class Dracula
6
6
  require "dracula/namespace"
7
7
  require "dracula/ui"
8
8
 
9
- def self.program_name(name = nil)
10
- if name.nil?
11
- @@program_name || "dracula" # getter
12
- else
13
- @@program_name = name # setter
9
+ class << self
10
+ def program_name(name = nil)
11
+ if name.nil?
12
+ @@program_name || "dracula" # getter
13
+ else
14
+ @@program_name = name # setter
15
+ end
14
16
  end
15
- end
16
17
 
17
- def self.start(args)
18
- if args.empty? || (args.size == 1 && args[0] == "help")
19
- namespace.help
20
- else
21
- action = args[0] == "help" ? :help : :run
18
+ def start(args)
19
+ if args.empty? || (args.size == 1 && args[0] == "help")
20
+ namespace.help
21
+ else
22
+ action = args[0] == "help" ? :help : :run
22
23
 
23
- if args[0] == "help"
24
- action = :help
24
+ if args[0] == "help"
25
+ action = :help
25
26
 
26
- args.shift # drop 'help'
27
+ args.shift # drop 'help'
27
28
 
28
- command = args.shift
29
- params = args
30
- else
31
- action = :run
32
- command = args.shift
33
- params = args
29
+ command = args.shift
30
+ params = args
31
+ else
32
+ action = :run
33
+ command = args.shift
34
+ params = args
35
+ end
36
+
37
+ namespace.dispatch(command.split(":"), params, action)
34
38
  end
39
+ end
35
40
 
36
- namespace.dispatch(command.split(":"), params, action)
41
+ def namespace
42
+ @namespace ||= Dracula::Namespace.new(self)
37
43
  end
38
- end
39
44
 
40
- def self.namespace
41
- @namespace ||= Dracula::Namespace.new(self)
42
- end
45
+ def option(name, params = {})
46
+ @options ||= []
47
+ @options << Command::Option.new(name, params)
48
+ end
43
49
 
44
- def self.option(name, params = {})
45
- @options ||= []
46
- @options << Command::Option.new(name, params)
47
- end
50
+ def long_desc(description)
51
+ @long_desc = description
52
+ end
48
53
 
49
- def self.long_desc(description)
50
- @long_desc = description
51
- end
54
+ def desc(name, description)
55
+ @desc = Command::Desc.new(name, description)
56
+ end
52
57
 
53
- def self.desc(name, description)
54
- @desc = Command::Desc.new(name, description)
55
- end
58
+ def register(name, description, klass)
59
+ klass.namespace.name = name
60
+ klass.namespace.description = description
56
61
 
57
- def self.register(name, description, klass)
58
- klass.namespace.name = name
59
- klass.namespace.description = description
62
+ namespace.add_subcommand(klass.namespace)
63
+ end
60
64
 
61
- namespace.add_subcommand(klass.namespace)
62
- end
65
+ private
63
66
 
64
- private_class_method def self.method_added(method_name)
65
- command = Command.new(self, method_name, @desc, @long_desc, @options)
67
+ def method_added(method_name)
68
+ command = Command.new(self, method_name, @desc, @long_desc, @options)
66
69
 
67
- @desc = nil
68
- @long_desc = nil
69
- @options = nil
70
+ @desc = nil
71
+ @long_desc = nil
72
+ @options = nil
70
73
 
71
- namespace.add_command(command)
74
+ namespace.add_command(command)
75
+ end
72
76
  end
73
77
 
74
78
  attr_reader :options
@@ -1,3 +1,3 @@
1
1
  class Dracula
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.1.1".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dracula
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Šarčević