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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e9d56ead6d7473f8ad0d0677bf7008343b8b240
4
- data.tar.gz: edfb052a9634b6644439118e7866e259276ba4ec
3
+ metadata.gz: 744bf1d16ec92d8d24fdface05eaa82468f0cd06
4
+ data.tar.gz: 955a0e8e8efdef32af7b704fe0fe68743f249155
5
5
  SHA512:
6
- metadata.gz: f2db7acdf2aa0c7630e02514fe407f952c946b155e48342774a76138a19c90617a2e9425a193da40f357388eb5929d62a4eaaf5c2765308d75b069ef3b8991eb
7
- data.tar.gz: b3964edb4092a54e3e4391fdc4c4e3a4e27a737681ada66bd214d6005d3968cee2cf8fb42978cc28b7f6abc40c4caa5c11706ac142b0716bb0457e1a9feb03b6
6
+ metadata.gz: 97eb73654cddeaecc7e967ba2e61ef71cdd476fe432696297e4aa9a36c918ae6ee3b14a37fb88d6016c25d407bfed99f89a8f04e95eb0a513b2faaeec0a8c0f4
7
+ data.tar.gz: df1022730ee3ab85a73ec362f91ecd8ef3d5ca7258807ebb96335946558d1dd7fb37d5efafc52191b7cf7e80162e19cc9f19276f1f694fcbb0a3ba1a0aa5af15
@@ -5,8 +5,4 @@ Rakefile
5
5
  bin/yo
6
6
  bin/yorobot
7
7
  lib/yorobot.rb
8
- lib/yorobot/echo.rb
9
- lib/yorobot/github/git.rb
10
- lib/yorobot/github/github.rb
11
- lib/yorobot/list.rb
12
8
  lib/yorobot/version.rb
@@ -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
- module Yorobot
22
- def self.run( args ) Commands.run( args ); end
23
- def self.list() List.run; end
24
-
25
-
26
- class Tool
27
- def self.main( args=ARGV )
28
- if args.size > 0
29
- Yorobot.run( args )
30
- else
31
- # list all known commands
32
- Yorobot.list
33
- end
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
- end # class Tool
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
 
@@ -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 = 0 ## todo: namespace inside version or something - why? why not??
8
- MINOR = 3
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.3.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-22 00:00:00.000000000 Z
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:
@@ -1,10 +0,0 @@
1
- module Yorobot
2
-
3
- class Echo < Command
4
- def call( *args )
5
- puts args.join( ' ' )
6
- end
7
- end # class Echo
8
-
9
- end # module Yorobot
10
-
@@ -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
-
@@ -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
-