yorobot 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +0 -4
- data/lib/yorobot.rb +79 -20
- data/lib/yorobot/version.rb +2 -2
- metadata +2 -6
- 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: 744bf1d16ec92d8d24fdface05eaa82468f0cd06
|
4
|
+
data.tar.gz: 955a0e8e8efdef32af7b704fe0fe68743f249155
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97eb73654cddeaecc7e967ba2e61ef71cdd476fe432696297e4aa9a36c918ae6ee3b14a37fb88d6016c25d407bfed99f89a8f04e95eb0a513b2faaeec0a8c0f4
|
7
|
+
data.tar.gz: df1022730ee3ab85a73ec362f91ecd8ef3d5ca7258807ebb96335946558d1dd7fb37d5efafc52191b7cf7e80162e19cc9f19276f1f694fcbb0a3ba1a0aa5af15
|
data/Manifest.txt
CHANGED
data/lib/yorobot.rb
CHANGED
@@ -1,38 +1,97 @@
|
|
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 'mono'
|
9
12
|
|
10
13
|
|
11
14
|
# our own code
|
12
15
|
require 'yorobot/version' # note: let version always go first
|
13
|
-
require 'yorobot/echo'
|
14
|
-
require 'yorobot/list'
|
15
16
|
|
16
|
-
require 'yorobot/github/git'
|
17
|
-
require 'yorobot/github/github'
|
18
17
|
|
19
18
|
|
19
|
+
#### add predefined steps
|
20
|
+
module Flow
|
21
|
+
class Base
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
23
|
+
=begin
|
24
|
+
# check ssh
|
25
|
+
if [ ! -d ~/.ssh ]; then mkdir ~/.ssh; fi
|
26
|
+
echo "$SSH_KEY" > ~/.ssh/id_rsa
|
27
|
+
chmod 600 ~/.ssh/id_rsa
|
28
|
+
echo "ssh directory - ~/.ssh:"
|
29
|
+
ls -la ~/.ssh
|
30
|
+
# ssh -vT git@github.com
|
31
|
+
|
32
|
+
# check git
|
33
|
+
git --version
|
34
|
+
git config --global user.name "Yo Robot"
|
35
|
+
git config --global user.email "gerald.bauer+yorobot@gmail.com"
|
36
|
+
git config -l --show-origin
|
37
|
+
=end
|
38
|
+
def setup
|
39
|
+
##############
|
40
|
+
## setup ssh
|
41
|
+
|
42
|
+
ssh_key = ENV['SSH_KEY']
|
43
|
+
|
44
|
+
if ssh_key.nil?
|
45
|
+
STDERR.puts "!! ERROR - required SSH_KEY env(ironment) variable missing"
|
46
|
+
exit 1
|
34
47
|
end
|
35
|
-
|
48
|
+
|
49
|
+
ssh_path = File.expand_path( '~/.ssh' )
|
50
|
+
|
51
|
+
if File.exist?( "#{ssh_path}/id_rsa" )
|
52
|
+
STDERR.puts "!! ERROR - ssh key >#{ssh_path}/id_rsa< already exists"
|
53
|
+
exit 1
|
54
|
+
end
|
55
|
+
|
56
|
+
## make sure path exists
|
57
|
+
FileUtils.mkdir_p( ssh_path ) unless Dir.exist?( ssh_path )
|
58
|
+
puts "--> writing ssh key to >#{ssh_path}/id_rsa<..."
|
59
|
+
File.open( "#{ssh_path}/id_rsa", 'w:utf-8' ) do |f|
|
60
|
+
f.write( ssh_key )
|
61
|
+
end
|
62
|
+
## note: ssh key must be "private" only access by owner (otherwise) WILL NOT work
|
63
|
+
## res = File.chmod( 0600, "#{ssh_path}/id_rsa" )
|
64
|
+
## puts res ## returns number of files processed; should be 1 - assert - why? why not?
|
65
|
+
Computer::Shell.run( %Q{chmod 600 #{ssh_path}/id_rsa} )
|
66
|
+
|
67
|
+
Computer::Shell.run( %Q{ls -la #{ssh_path}} )
|
68
|
+
# ssh -vT git@github.com
|
69
|
+
|
70
|
+
|
71
|
+
#####
|
72
|
+
## setup git
|
73
|
+
## git --version
|
74
|
+
Git.version
|
75
|
+
|
76
|
+
user_name = ENV['YOROBOT_NAME'] || ENV['YO_NAME'] || 'Yo Robot'
|
77
|
+
user_email = ENV['YOROBOT_EMAIL'] || ENV['YO_EMAIL'] || 'gerald.bauer+yorobot@gmail.com'
|
78
|
+
|
79
|
+
Computer::Shell.run( %Q{git config --global user.name "#{user_name}"} )
|
80
|
+
Computer::Shell.run( %Q{git config --global user.email "#{user_email}"} )
|
81
|
+
|
82
|
+
Computer::Shell.run( %Q{git config -l --show-origin} )
|
83
|
+
end
|
84
|
+
alias_method :step_setup, :setup
|
85
|
+
|
86
|
+
end # class Base
|
87
|
+
end # module Flow
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
module Yorobot
|
94
|
+
Tool = ::Flow::Tool
|
36
95
|
end # module Yorobot
|
37
96
|
|
38
97
|
|
data/lib/yorobot/version.rb
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
module YorobotCore ## todo/check: rename GittiBase or GittiMeta or such - why? why not?
|
7
|
-
MAJOR =
|
8
|
-
MINOR =
|
7
|
+
MAJOR = 1 ## todo: namespace inside version or something - why? why not??
|
8
|
+
MINOR = 0
|
9
9
|
PATCH = 0
|
10
10
|
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
11
11
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yorobot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.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-
|
11
|
+
date: 2020-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commands-lite
|
@@ -105,10 +105,6 @@ files:
|
|
105
105
|
- bin/yo
|
106
106
|
- bin/yorobot
|
107
107
|
- 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
108
|
- lib/yorobot/version.rb
|
113
109
|
homepage: https://github.com/rubycoco/git
|
114
110
|
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
|
-
|