yorobot 0.2.2 → 0.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 847505c5153a9538c83b411771c985f37af24244
4
- data.tar.gz: 65de3568ced94876da73ec17b76399604437efb6
3
+ metadata.gz: 2e9d56ead6d7473f8ad0d0677bf7008343b8b240
4
+ data.tar.gz: edfb052a9634b6644439118e7866e259276ba4ec
5
5
  SHA512:
6
- metadata.gz: 4a9345178932c3ac2d4901a240f88b95d75992d7e024efcf608fa5e535a598df40f42b83ade976bc760b0a1c2ed6c19e7931c92c67474ef3c6f0d7cc40538249
7
- data.tar.gz: f92929a759988a35020c5ae225c74186f9b29bc3f7c04a9f4c3e01a403bf76f4475375a58341fd3264c6b5f4271ad4f60bbdae9ec026fe039642ff43c8445967
6
+ metadata.gz: f2db7acdf2aa0c7630e02514fe407f952c946b155e48342774a76138a19c90617a2e9425a193da40f357388eb5929d62a4eaaf5c2765308d75b069ef3b8991eb
7
+ data.tar.gz: b3964edb4092a54e3e4391fdc4c4e3a4e27a737681ada66bd214d6005d3968cee2cf8fb42978cc28b7f6abc40c4caa5c11706ac142b0716bb0457e1a9feb03b6
@@ -5,7 +5,6 @@ Rakefile
5
5
  bin/yo
6
6
  bin/yorobot
7
7
  lib/yorobot.rb
8
- lib/yorobot/base.rb
9
8
  lib/yorobot/echo.rb
10
9
  lib/yorobot/github/git.rb
11
10
  lib/yorobot/github/github.rb
data/Rakefile CHANGED
@@ -18,8 +18,9 @@ Hoe.spec 'yorobot' do
18
18
  self.history_file = 'CHANGELOG.md'
19
19
 
20
20
  self.extra_deps = [
21
- ['gitti', '>= 0.5.0' ],
22
- ['hubba', '>= 1.0.0' ],
21
+ ['commands-lite', '>= 0.1.0'],
22
+ ['gitti', '>= 0.5.0'],
23
+ ['hubba', '>= 1.0.0'],
23
24
  ]
24
25
 
25
26
  self.licenses = ['Public Domain']
@@ -3,13 +3,13 @@
3
3
  #
4
4
  # require 'computer' # add shell run/call etc. machinery
5
5
  # add via gitti & hubba
6
+ require 'commands-lite'
6
7
  require 'gitti'
7
8
  require 'hubba'
8
9
 
9
10
 
10
11
  # our own code
11
12
  require 'yorobot/version' # note: let version always go first
12
- require 'yorobot/base'
13
13
  require 'yorobot/echo'
14
14
  require 'yorobot/list'
15
15
 
@@ -19,13 +19,17 @@ require 'yorobot/github/github'
19
19
 
20
20
 
21
21
  module Yorobot
22
+ def self.run( args ) Commands.run( args ); end
23
+ def self.list() List.run; end
24
+
25
+
22
26
  class Tool
23
27
  def self.main( args=ARGV )
24
28
  if args.size > 0
25
29
  Yorobot.run( args )
26
30
  else
27
- # list all known steps
28
- List.run
31
+ # list all known commands
32
+ Yorobot.list
29
33
  end
30
34
  end
31
35
  end # class Tool
@@ -1,12 +1,9 @@
1
1
  module Yorobot
2
2
 
3
-
4
- class Echo < Step
5
-
3
+ class Echo < Command
6
4
  def call( *args )
7
5
  puts args.join( ' ' )
8
6
  end
9
-
10
7
  end # class Echo
11
8
 
12
9
  end # module Yorobot
@@ -1,7 +1,7 @@
1
1
  module Yorobot
2
2
 
3
3
 
4
- class Setup < Step
4
+ class Setup < Command
5
5
 
6
6
  =begin
7
7
  # check ssh
@@ -69,7 +69,7 @@ end # class Setup
69
69
 
70
70
 
71
71
 
72
- class Clone < Step ## change to SshClone(r) or such - why? why not?
72
+ class Clone < Command ## change to SshClone(r) or such - why? why not?
73
73
  option :depth, "--depth DEPTH", Integer, "shallow clone depth"
74
74
 
75
75
  def call( *repos )
@@ -88,7 +88,7 @@ end # class Clone
88
88
 
89
89
 
90
90
 
91
- class Push < Step ## change to SshPush(r) or such - why? why not?
91
+ class Push < Command ## change to SshPush(r) or such - why? why not?
92
92
 
93
93
  def call( *paths ) ## e.g. "./cache.github" etc.
94
94
  msg = "auto-update week #{Date.today.cweek}"
@@ -1,6 +1,6 @@
1
1
  module Yorobot
2
2
 
3
- class Github < Step ## change to GithubStats or such - why? why not?
3
+ class Github < Command ## change to GithubStats or such - why? why not?
4
4
 
5
5
  ## todo/check: use --data-dir/--datadir - why? why not?
6
6
  option :data_dir, "-d DIR", "--dir DIR",
@@ -1,14 +1,14 @@
1
1
  module Yorobot
2
2
 
3
-
4
- class List < Step
5
-
3
+ class List < Command
6
4
  def call
7
- ## list all know steps
8
- steps = Yorobot.steps
9
- puts "#{steps.size} step(s):"
10
- steps.each do |name, step|
11
- puts " #{name} | #{step.class.name}"
5
+ ## list all known commands
6
+ commands = Commands.commands
7
+ puts "#{commands.size} command(s):"
8
+ commands.each do |name, command|
9
+ print " %-10s" % name
10
+ print " | #{command.class.name} (#{command.name})"
11
+ print "\n"
12
12
  end
13
13
  end
14
14
  end
@@ -16,10 +16,4 @@ end
16
16
  end # module Yorobot
17
17
 
18
18
 
19
- #####
20
- #
21
- #
22
- # -- add "shortcut why? why not?"
23
- # step [:list, :ls] do |args|
24
- # ....
25
- # end
19
+
@@ -5,8 +5,8 @@
5
5
 
6
6
  module YorobotCore ## todo/check: rename GittiBase or GittiMeta or such - why? why not?
7
7
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
8
- MINOR = 2
9
- PATCH = 2
8
+ MINOR = 3
9
+ PATCH = 0
10
10
  VERSION = [MAJOR,MINOR,PATCH].join('.')
11
11
 
12
12
  def self.version
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yorobot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-21 00:00:00.000000000 Z
11
+ date: 2020-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: commands-lite
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.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.1.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: gitti
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -91,7 +105,6 @@ files:
91
105
  - bin/yo
92
106
  - bin/yorobot
93
107
  - lib/yorobot.rb
94
- - lib/yorobot/base.rb
95
108
  - lib/yorobot/echo.rb
96
109
  - lib/yorobot/github/git.rb
97
110
  - lib/yorobot/github/github.rb
@@ -1,124 +0,0 @@
1
- module Yorobot
2
-
3
-
4
- class Step
5
-
6
- def self.option_defs
7
- @option_defs ||= {}
8
- end
9
-
10
- def self.option( key, *args )
11
- option_defs[ key ] = args
12
- end
13
-
14
-
15
-
16
- def options
17
- @options ||= {}
18
- end
19
-
20
- def parse!( args )
21
- ### todo/check - cache option parser!!!! - why? why not?
22
- OptionParser.new do |parser|
23
- ## add default banner - overwrite if needed/to customize
24
- parser.banner = <<TXT
25
-
26
- Usage: #{name} [OPTIONS] ARGUMENTS
27
-
28
- TXT
29
-
30
- self.class.option_defs.each do | key, on_args|
31
- parser.on( *on_args ) do |value|
32
- options[ key ] = value
33
- end
34
- end
35
- end.parse!( args )
36
- end
37
-
38
-
39
-
40
- def self.run( args=[] )
41
- step = new
42
-
43
- puts "--> (#{step.name}) #{args.join('·')}"
44
-
45
- ## check for options
46
- step.parse!( args )
47
-
48
- puts " #{step.options.size} opt(s): #{step.options.pretty_inspect}"
49
- puts " #{args.size} arg(s):"
50
- args.each_with_index do |arg,i|
51
- puts " #{[i]} >#{arg}<"
52
- end
53
-
54
-
55
- if args.size > 0
56
- ## todo/check: check/verify arity of run - why? why not?
57
- step.call( *args ) ## use run - why? why not?
58
- else
59
- step. call
60
- end
61
- end
62
-
63
-
64
- def self.step_name
65
- ## note: cut-off leading Yorobot:: for now in class name!!!
66
- ## note: always remove _ for now too!!!
67
- ## note: do NOT use @@name!!! - one instance variable per class needed!!
68
- @name ||= self.name.downcase
69
- .sub( /^yorobot::/, '' )
70
- .gsub( /[_-]/, '' )
71
- @name
72
- end
73
-
74
- def name() self.class.step_name; end
75
-
76
-
77
-
78
-
79
-
80
- def self.inherited( klass )
81
- # puts klass.class.name #=> Class
82
- ## auto-register steps for now - why? why not?
83
- Yorobot.register( klass )
84
- end
85
-
86
- end # class Step
87
-
88
-
89
-
90
- def self.steps ## todo/check: change to registry or such - why? why not?
91
- @@register ||= {}
92
- end
93
-
94
- def self.register( klass )
95
- raise ArgumentError, "class MUST be a Yorobot::Step" unless klass.ancestors.include?( Step )
96
-
97
- h = steps
98
- h[ klass.step_name] = klass
99
- h
100
- end
101
-
102
-
103
- def self.run( args=[] )
104
- step_name = args.shift
105
-
106
- ## 1) downcase e.g. GithubStats
107
- ## 2) remove - to _ ## treat them the same e.g. github-stats => github_stats
108
- step_name = step_name
109
- .gsub( /[_-]/, '' )
110
- .downcase
111
-
112
- step = steps[ step_name ]
113
- if step.nil?
114
- puts "!! ERROR: no step definition found for >#{step_name}<; known steps include:"
115
- List.run
116
- exit 1
117
- end
118
-
119
- step.run( args )
120
- end
121
-
122
-
123
-
124
- end # module Yorobot