yorobot 0.0.1 → 0.1.0

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: e4a01dffcd31d94c4d24d33805291506d63ff460
4
- data.tar.gz: f164e3bfc9bffb8d71aaf0712351cfc28bc9fc5b
3
+ metadata.gz: 2252541ead5305b3472d0f371e1040461290ad82
4
+ data.tar.gz: f13e3073fdbcdae51a68c294d3edb3ee5b64e518
5
5
  SHA512:
6
- metadata.gz: 118457eafb752db1011ee2b17af09433a1e7b40f2f92eb25af5f186889f104978a48a990b04df7f4352fac27da2e4269d842aa98bb5ee89fa983a8637992c8f8
7
- data.tar.gz: 4464d6db62229b4cfe77a32e4ed3f2b59cdedcadfd6fcd83574c1e957e4ccfe4edf218fa5af315cb843a389955d380b622a3b9810dc0d8be316a925ba9f11d57
6
+ metadata.gz: 6310b01adc581ad48a71b93e86c5b76525417a4cc1392787f310db7ba52ee1c92f0e85a5fba176c8285def710fe2d9c42a25cafec59b7d89d429de4c2c8126ba
7
+ data.tar.gz: 43866b4d8e30d64dfa9c232569c46a44dcb0466cfcb32bd70b7898754111f9fd3c3f4217d753d17e4ed64395b0eaeaa8eb92fd8394a0d20c9da36481d6836229
@@ -2,5 +2,10 @@ CHANGELOG.md
2
2
  Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
+ bin/yo
6
+ bin/yorobot
5
7
  lib/yorobot.rb
8
+ lib/yorobot/base.rb
9
+ lib/yorobot/echo.rb
10
+ lib/yorobot/list.rb
6
11
  lib/yorobot/version.rb
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # yorobot
2
2
 
3
- yorobot gem - yorobot - automate, automate, automate - ready to use scripts
3
+ yorobot gem - yo, robot - automate, automate, automate - ready to use scripts and command line tool
4
4
 
5
5
 
6
6
  * home :: [github.com/rubycoco/git](https://github.com/rubycoco/git)
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ Hoe.spec 'yorobot' do
5
5
 
6
6
  self.version = YorobotCore::VERSION
7
7
 
8
- self.summary = "yorobot - automate, automate, automate - ready to use scripts"
8
+ self.summary = "yorbot gem - yo, robot - automate, automate, automate - ready to use scripts and command line tool"
9
9
  self.description = summary
10
10
 
11
11
  self.urls = { home: 'https://github.com/rubycoco/git' }
@@ -17,7 +17,9 @@ Hoe.spec 'yorobot' do
17
17
  self.readme_file = 'README.md'
18
18
  self.history_file = 'CHANGELOG.md'
19
19
 
20
- self.extra_deps = []
20
+ self.extra_deps = [
21
+ ['gitti', '>= 0.5.0' ],
22
+ ]
21
23
 
22
24
  self.licenses = ['Public Domain']
23
25
 
data/bin/yo ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ###################
4
+ # DEV TIPS:
5
+ #
6
+ # For local testing run like:
7
+ #
8
+ # ruby -Ilib bin/yo
9
+ #
10
+ # Set the executable bit in Linux. Example:
11
+ #
12
+ # % chmod a+x bin/yo
13
+ #
14
+
15
+ require 'yorobot'
16
+
17
+ Yorobot::Tool.main
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ###################
4
+ # DEV TIPS:
5
+ #
6
+ # For local testing run like:
7
+ #
8
+ # ruby -Ilib bin/yorobot
9
+ #
10
+ # Set the executable bit in Linux. Example:
11
+ #
12
+ # % chmod a+x bin/yorobot
13
+ #
14
+
15
+ require 'yorobot'
16
+
17
+ Yorobot::Tool.main
@@ -1,7 +1,34 @@
1
- # our own code
1
+ #####
2
+ # say hello
2
3
  require 'yorobot/version' # note: let version always go first
4
+ puts YorobotCore.banner
3
5
 
4
6
 
5
7
 
6
- # say hello
7
- puts YorobotCore.banner
8
+ ####
9
+ # 3rd party gems / libs
10
+ #
11
+ # require 'yorobot/shell' # add shell run/call etc. machinery
12
+ # add via gitti
13
+ require 'gitti'
14
+
15
+
16
+ # our own code
17
+ require 'yorobot/base'
18
+ require 'yorobot/echo'
19
+ require 'yorobot/list'
20
+
21
+
22
+ module Yorobot
23
+ class Tool
24
+ def self.main( args=ARGV )
25
+ if args.size > 0
26
+ Yorobot.run( args )
27
+ else
28
+ # list all known steps
29
+ List.run
30
+ end
31
+ end
32
+ end # class Tool
33
+ end # module Yorobot
34
+
@@ -0,0 +1,63 @@
1
+ module Yorobot
2
+
3
+
4
+ class Step
5
+
6
+ def self.run( args=[] )
7
+ step = new
8
+ puts "--> (#{step.name}) #{args.join('·')}"
9
+
10
+ step.call( args ) ## use run - why? why not?
11
+ end
12
+
13
+ def self.step_name
14
+ ## note: cut-off leading Yorobot:: for now in class name!!!
15
+ ## note: do NOT use @@name!!! - one instance variable per class needed!!
16
+ @name ||= self.name.downcase.sub( /^yorobot::/, '' )
17
+ @name
18
+ end
19
+
20
+ def name() self.class.step_name; end
21
+
22
+
23
+
24
+
25
+
26
+ def self.inherited( klass )
27
+ # puts klass.class.name #=> Class
28
+ ## auto-register steps for now - why? why not?
29
+ Yorobot.register( klass )
30
+ end
31
+
32
+ end # class Step
33
+
34
+
35
+
36
+ def self.steps ## todo/check: change to registry or such - why? why not?
37
+ @@register ||= {}
38
+ end
39
+
40
+ def self.register( klass )
41
+ raise ArgumentError, "class MUST be a Yorobot::Step" unless klass.ancestors.include?( Step )
42
+
43
+ h = steps
44
+ h[ klass.step_name] = klass
45
+ h
46
+ end
47
+
48
+
49
+ def self.run( args=[] )
50
+ step_name = args.shift
51
+
52
+ step = steps[ step_name ]
53
+ if step.nil?
54
+ puts "!! ERROR: no step definition found for >#{step_name}<; known steps include:"
55
+ List.run
56
+ exit 1
57
+ end
58
+ step.run( args )
59
+ end
60
+
61
+
62
+
63
+ end # module Yorobot
@@ -0,0 +1,13 @@
1
+ module Yorobot
2
+
3
+
4
+ class Echo < Step
5
+
6
+ def call( args )
7
+ puts args.join( ' ' )
8
+ end
9
+
10
+ end # class Echo
11
+
12
+ end # module Yorobot
13
+
@@ -0,0 +1,25 @@
1
+ module Yorobot
2
+
3
+
4
+ class List < Step
5
+
6
+ def call( args )
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}"
12
+ end
13
+ end
14
+ end
15
+
16
+ end # module Yorobot
17
+
18
+
19
+ #####
20
+ #
21
+ #
22
+ # -- add "shortcut why? why not?"
23
+ # step [:list, :ls] do |args|
24
+ # ....
25
+ # end
@@ -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 = 0
9
- PATCH = 1
8
+ MINOR = 1
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.0.1
4
+ version: 0.1.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-19 00:00:00.000000000 Z
11
+ date: 2020-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gitti
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.5.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.5.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rdoc
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,9 +58,12 @@ dependencies:
44
58
  - - "~>"
45
59
  - !ruby/object:Gem::Version
46
60
  version: '3.22'
47
- description: yorobot - automate, automate, automate - ready to use scripts
61
+ description: yorbot gem - yo, robot - automate, automate, automate - ready to use
62
+ scripts and command line tool
48
63
  email: ruby-talk@ruby-lang.org
49
- executables: []
64
+ executables:
65
+ - yo
66
+ - yorobot
50
67
  extensions: []
51
68
  extra_rdoc_files:
52
69
  - CHANGELOG.md
@@ -57,7 +74,12 @@ files:
57
74
  - Manifest.txt
58
75
  - README.md
59
76
  - Rakefile
77
+ - bin/yo
78
+ - bin/yorobot
60
79
  - lib/yorobot.rb
80
+ - lib/yorobot/base.rb
81
+ - lib/yorobot/echo.rb
82
+ - lib/yorobot/list.rb
61
83
  - lib/yorobot/version.rb
62
84
  homepage: https://github.com/rubycoco/git
63
85
  licenses:
@@ -84,5 +106,6 @@ rubyforge_project:
84
106
  rubygems_version: 2.5.2
85
107
  signing_key:
86
108
  specification_version: 4
87
- summary: yorobot - automate, automate, automate - ready to use scripts
109
+ summary: yorbot gem - yo, robot - automate, automate, automate - ready to use scripts
110
+ and command line tool
88
111
  test_files: []