yorobot 0.3.0 → 1.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.
- checksums.yaml +4 -4
- data/Manifest.txt +0 -4
- data/Rakefile +4 -2
- data/lib/yorobot.rb +103 -19
- data/lib/yorobot/version.rb +3 -3
- metadata +35 -11
- data/lib/yorobot/echo.rb +0 -10
- data/lib/yorobot/github/git.rb +0 -109
- data/lib/yorobot/github/github.rb +0 -30
- data/lib/yorobot/list.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cf2d8d1b641b291bde126dfae38897f1bbb33a8
|
4
|
+
data.tar.gz: 53e74d9487c4a4154ce66cd970499b9f47cf0a57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88e1961c9404bbf634504a13c4f84165cadce1a3165d96f0cafbbfc7379165348d78aae2200bf71f554cd9529c33d847df67798eaf1c9bf523103314fe120a0d
|
7
|
+
data.tar.gz: b1e849042a9e4aa012eca071c336ae0b956ec9f93aa320131ba62c4f7595238ae9011c38855189da7303806529bc36418a47162a077cebd83708938d904509ed
|
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
@@ -18,9 +18,11 @@ Hoe.spec 'yorobot' do
|
|
18
18
|
self.history_file = 'CHANGELOG.md'
|
19
19
|
|
20
20
|
self.extra_deps = [
|
21
|
-
['
|
22
|
-
['gitti', '>= 0.
|
21
|
+
['flow-lite', '>= 1.0.1'],
|
22
|
+
['gitti', '>= 0.6.1'],
|
23
23
|
['hubba', '>= 1.0.0'],
|
24
|
+
['hubba-reports', '>= 1.0.1'],
|
25
|
+
['monos', '>= 1.0.2'],
|
24
26
|
]
|
25
27
|
|
26
28
|
self.licenses = ['Public Domain']
|
data/lib/yorobot.rb
CHANGED
@@ -1,38 +1,122 @@
|
|
1
|
+
require 'flow-lite'
|
2
|
+
|
3
|
+
|
1
4
|
####
|
2
|
-
# 3rd party gems / libs
|
5
|
+
# add more 3rd party gems / libs to flow "prologue / prelude"
|
3
6
|
#
|
4
7
|
# require 'computer' # add shell run/call etc. machinery
|
5
8
|
# add via gitti & hubba
|
6
|
-
require 'commands-lite'
|
7
9
|
require 'gitti'
|
8
10
|
require 'hubba'
|
11
|
+
require 'hubba/reports'
|
12
|
+
require 'mono'
|
9
13
|
|
10
14
|
|
11
15
|
# our own code
|
12
16
|
require 'yorobot/version' # note: let version always go first
|
13
|
-
require 'yorobot/echo'
|
14
|
-
require 'yorobot/list'
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
+
|
19
|
+
|
20
|
+
#### add predefined steps
|
21
|
+
module Flow
|
22
|
+
class Base
|
23
|
+
|
24
|
+
=begin
|
25
|
+
# check ssh
|
26
|
+
if [ ! -d ~/.ssh ]; then mkdir ~/.ssh; fi
|
27
|
+
echo "$SSH_KEY" > ~/.ssh/id_rsa
|
28
|
+
chmod 600 ~/.ssh/id_rsa
|
29
|
+
echo "ssh directory - ~/.ssh:"
|
30
|
+
ls -la ~/.ssh
|
31
|
+
# ssh -vT git@github.com
|
32
|
+
|
33
|
+
# check git
|
34
|
+
git --version
|
35
|
+
git config --global user.name "Yo Robot"
|
36
|
+
git config --global user.email "gerald.bauer+yorobot@gmail.com"
|
37
|
+
git config -l --show-origin
|
38
|
+
=end
|
39
|
+
def step_setup
|
40
|
+
##############
|
41
|
+
## setup ssh
|
42
|
+
|
43
|
+
ssh_key = ENV['SSH_KEY']
|
44
|
+
|
45
|
+
if ssh_key.nil?
|
46
|
+
STDERR.puts "!! ERROR - required SSH_KEY env(ironment) variable missing"
|
47
|
+
exit 1
|
48
|
+
end
|
49
|
+
|
50
|
+
ssh_path = File.expand_path( '~/.ssh' )
|
51
|
+
|
52
|
+
if File.exist?( "#{ssh_path}/id_rsa" )
|
53
|
+
STDERR.puts "!! ERROR - ssh key >#{ssh_path}/id_rsa< already exists"
|
54
|
+
exit 1
|
55
|
+
end
|
56
|
+
|
57
|
+
## make sure path exists
|
58
|
+
FileUtils.mkdir_p( ssh_path ) unless Dir.exist?( ssh_path )
|
59
|
+
puts "--> writing ssh key to >#{ssh_path}/id_rsa<..."
|
60
|
+
File.open( "#{ssh_path}/id_rsa", 'w:utf-8' ) do |f|
|
61
|
+
f.write( ssh_key )
|
62
|
+
end
|
63
|
+
## note: ssh key must be "private" only access by owner (otherwise) WILL NOT work
|
64
|
+
## res = File.chmod( 0600, "#{ssh_path}/id_rsa" )
|
65
|
+
## puts res ## returns number of files processed; should be 1 - assert - why? why not?
|
66
|
+
Computer::Shell.run( %Q{chmod 600 #{ssh_path}/id_rsa} )
|
67
|
+
|
68
|
+
Computer::Shell.run( %Q{ls -la #{ssh_path}} )
|
69
|
+
# ssh -vT git@github.com
|
70
|
+
|
71
|
+
|
72
|
+
#####
|
73
|
+
## setup git
|
74
|
+
## git --version
|
75
|
+
Git.version
|
76
|
+
|
77
|
+
user_name = ENV['YOROBOT_NAME'] || ENV['YO_NAME'] || 'Yo Robot'
|
78
|
+
user_email = ENV['YOROBOT_EMAIL'] || ENV['YO_EMAIL'] || 'gerald.bauer+yorobot@gmail.com'
|
79
|
+
|
80
|
+
Computer::Shell.run( %Q{git config --global user.name "#{user_name}"} )
|
81
|
+
Computer::Shell.run( %Q{git config --global user.email "#{user_email}"} )
|
82
|
+
|
83
|
+
Computer::Shell.run( %Q{git config -l --show-origin} )
|
84
|
+
end
|
85
|
+
|
86
|
+
end # class Base
|
87
|
+
end # module Flow
|
18
88
|
|
19
89
|
|
20
90
|
|
21
91
|
module Yorobot
|
22
|
-
def self.
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
92
|
+
def self.main( args=ARGV )
|
93
|
+
|
94
|
+
## setup/check mono root
|
95
|
+
puts "[flow] pwd: #{Dir.pwd}"
|
96
|
+
|
97
|
+
|
98
|
+
## quick hack:
|
99
|
+
## if /sites does not exists
|
100
|
+
## assume running with GitHub Actions or such
|
101
|
+
## and use working dir as root? or change to home dir ~/ or ~/mono - why? why not?
|
102
|
+
##
|
103
|
+
## in the future use some -e/-env(ironemt) settings and scripts - why? why not?
|
104
|
+
if Dir.exist?( 'C:/Sites' )
|
105
|
+
Mono.root = 'C:/Sites' ## use local (dev) setup for testing flow steps
|
106
|
+
|
107
|
+
puts "[flow] assume local (dev) setup for testing"
|
108
|
+
else
|
109
|
+
Mono.root = Dir.pwd
|
110
|
+
|
111
|
+
## for debugging print / walk mono (source) tree
|
112
|
+
Mono.walk
|
34
113
|
end
|
35
|
-
|
114
|
+
puts "[flow] Mono.root: #{Mono.root}"
|
115
|
+
|
116
|
+
|
117
|
+
## pass along to "standard" flow engine
|
118
|
+
::Flow::Tool.main( args )
|
119
|
+
end
|
36
120
|
end # module Yorobot
|
37
121
|
|
38
122
|
|
data/lib/yorobot/version.rb
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
module YorobotCore ## todo/check: rename GittiBase or GittiMeta or such - why? why not?
|
7
|
-
MAJOR =
|
8
|
-
MINOR =
|
9
|
-
PATCH =
|
7
|
+
MAJOR = 1 ## todo: namespace inside version or something - why? why not??
|
8
|
+
MINOR = 0
|
9
|
+
PATCH = 4
|
10
10
|
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
11
11
|
|
12
12
|
def self.version
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yorobot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.4
|
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-
|
11
|
+
date: 2020-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: flow-lite
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1
|
19
|
+
version: 1.0.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1
|
26
|
+
version: 1.0.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: gitti
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.6.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.6.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hubba
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: hubba-reports
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.1
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: monos
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.0.2
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.0.2
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: rdoc
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -105,10 +133,6 @@ files:
|
|
105
133
|
- bin/yo
|
106
134
|
- bin/yorobot
|
107
135
|
- lib/yorobot.rb
|
108
|
-
- lib/yorobot/echo.rb
|
109
|
-
- lib/yorobot/github/git.rb
|
110
|
-
- lib/yorobot/github/github.rb
|
111
|
-
- lib/yorobot/list.rb
|
112
136
|
- lib/yorobot/version.rb
|
113
137
|
homepage: https://github.com/rubycoco/git
|
114
138
|
licenses:
|
data/lib/yorobot/echo.rb
DELETED
data/lib/yorobot/github/git.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
module Yorobot
|
2
|
-
|
3
|
-
|
4
|
-
class Setup < Command
|
5
|
-
|
6
|
-
=begin
|
7
|
-
# check ssh
|
8
|
-
if [ ! -d ~/.ssh ]; then mkdir ~/.ssh; fi
|
9
|
-
echo "$SSH_KEY" > ~/.ssh/id_rsa
|
10
|
-
chmod 600 ~/.ssh/id_rsa
|
11
|
-
echo "ssh directory - ~/.ssh:"
|
12
|
-
ls -la ~/.ssh
|
13
|
-
# ssh -vT git@github.com
|
14
|
-
|
15
|
-
# check git
|
16
|
-
git --version
|
17
|
-
git config --global user.name "Yo Robot"
|
18
|
-
git config --global user.email "gerald.bauer+yorobot@gmail.com"
|
19
|
-
git config -l --show-origin
|
20
|
-
=end
|
21
|
-
|
22
|
-
def call
|
23
|
-
##############
|
24
|
-
## setup ssh
|
25
|
-
|
26
|
-
ssh_key = ENV['SSH_KEY']
|
27
|
-
|
28
|
-
if ssh_key.nil?
|
29
|
-
STDERR.puts "!! ERROR - required SSH_KEY env(ironment) variable missing"
|
30
|
-
exit 1
|
31
|
-
end
|
32
|
-
|
33
|
-
ssh_path = File.expand_path( '~/.ssh' )
|
34
|
-
|
35
|
-
if File.exist?( "#{ssh_path}/id_rsa" )
|
36
|
-
STDERR.puts "!! ERROR - ssh key >#{ssh_path}/id_rsa< already exists"
|
37
|
-
exit 1
|
38
|
-
end
|
39
|
-
|
40
|
-
## make sure path exists
|
41
|
-
FileUtils.mkdir_p( ssh_path ) unless Dir.exist?( ssh_path )
|
42
|
-
puts "--> writing ssh key to >#{ssh_path}/id_rsa<..."
|
43
|
-
File.open( "#{ssh_path}/id_rsa", 'w:utf-8' ) do |f|
|
44
|
-
f.write( ssh_key )
|
45
|
-
end
|
46
|
-
## note: ssh key must be "private" only access by owner (otherwise) WILL NOT work
|
47
|
-
## res = File.chmod( 0600, "#{ssh_path}/id_rsa" )
|
48
|
-
## puts res ## returns number of files processed; should be 1 - assert - why? why not?
|
49
|
-
Computer::Shell.run( %Q{chmod 600 #{ssh_path}/id_rsa} )
|
50
|
-
|
51
|
-
Computer::Shell.run( %Q{ls -la #{ssh_path}} )
|
52
|
-
# ssh -vT git@github.com
|
53
|
-
|
54
|
-
|
55
|
-
#####
|
56
|
-
## setup git
|
57
|
-
## git --version
|
58
|
-
Git.version
|
59
|
-
|
60
|
-
user_name = ENV['YOROBOT_NAME'] || ENV['YO_NAME']
|
61
|
-
user_email = ENV['YOROBOT_EMAIL'] || ENV['YO_EMAIL']
|
62
|
-
|
63
|
-
Computer::Shell.run( %Q{git config --global user.name "#{user_name}"} )
|
64
|
-
Computer::Shell.run( %Q{git config --global user.email "#{user_email}"} )
|
65
|
-
|
66
|
-
Computer::Shell.run( %Q{git config -l --show-origin} )
|
67
|
-
end
|
68
|
-
end # class Setup
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
class Clone < Command ## change to SshClone(r) or such - why? why not?
|
73
|
-
option :depth, "--depth DEPTH", Integer, "shallow clone depth"
|
74
|
-
|
75
|
-
def call( *repos )
|
76
|
-
repos.each do |repo|
|
77
|
-
if options[:depth]
|
78
|
-
### shallow "fast clone" - support libraries
|
79
|
-
### use https:// instead of ssh - why? why not?
|
80
|
-
Git.clone( "git@github.com:#{repo}.git", depth: options[:depth] )
|
81
|
-
else
|
82
|
-
### "deep" standard/ regular clone
|
83
|
-
Git.clone( "git@github.com:#{repo}.git" )
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end # class Clone
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
class Push < Command ## change to SshPush(r) or such - why? why not?
|
92
|
-
|
93
|
-
def call( *paths ) ## e.g. "./cache.github" etc.
|
94
|
-
msg = "auto-update week #{Date.today.cweek}"
|
95
|
-
|
96
|
-
paths.each do |path|
|
97
|
-
GitProject.open( path ) do |proj|
|
98
|
-
if proj.changes?
|
99
|
-
proj.add( "." )
|
100
|
-
proj.commit( msg )
|
101
|
-
proj.push
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end # class Push
|
107
|
-
|
108
|
-
|
109
|
-
end # module Yorobot
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Yorobot
|
2
|
-
|
3
|
-
class Github < Command ## change to GithubStats or such - why? why not?
|
4
|
-
|
5
|
-
## todo/check: use --data-dir/--datadir - why? why not?
|
6
|
-
option :data_dir, "-d DIR", "--dir DIR",
|
7
|
-
"data dir (defaults to #{Hubba.config.data_dir})"
|
8
|
-
|
9
|
-
## todo/check: add switch --[no]-traffic - why? why not?
|
10
|
-
|
11
|
-
|
12
|
-
def call( username )
|
13
|
-
## username e.g. geraldb
|
14
|
-
|
15
|
-
if options[:data_dir] ## e.g. "./cache.github"
|
16
|
-
puts " setting data_dir to >#{options[:data_dir]}<"
|
17
|
-
Hubba.config.data_dir = options[:data_dir]
|
18
|
-
end
|
19
|
-
|
20
|
-
h = Hubba.reposet( username ) ## note: do NOT include yorobot for now
|
21
|
-
pp h
|
22
|
-
|
23
|
-
Hubba.update_stats( h )
|
24
|
-
Hubba.update_traffic( h )
|
25
|
-
puts "Done."
|
26
|
-
end
|
27
|
-
|
28
|
-
end # class Github
|
29
|
-
end # module Yorobot
|
30
|
-
|
data/lib/yorobot/list.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
module Yorobot
|
2
|
-
|
3
|
-
class List < Command
|
4
|
-
def call
|
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
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
end # module Yorobot
|
17
|
-
|
18
|
-
|
19
|
-
|