yanapiri 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.grenrc +4 -1
- data/lib/yanapiri/bot.rb +19 -7
- data/lib/yanapiri/entrega.rb +7 -2
- data/lib/yanapiri/version.rb +1 -1
- data/lib/yanapiri.rb +10 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c3750b408bb03028e0efa632c8de502167385eda4ae602d103705fc2add1c1f
|
4
|
+
data.tar.gz: eca42b1ea12f2821e41827e99a06fdd3b488ce98d889f57c9e78c2ccfedc6fb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfe1c080a749dfefaf05c5b6f1fb1800279bf408b6dbae10032336cd3277cd0d8f14ae8d65c2ba4a730aa183517832a483120d14ce838915d54a0124086f7e86
|
7
|
+
data.tar.gz: 330443e3dfca79d3f63df3ca17d5b27e4c2482934b3bbf1caa3a1afed2f19244ef6e099dcd3a08f95032df25282c9c40041921e94449c0b6062b2aacab3ee8f7
|
data/.grenrc
CHANGED
data/lib/yanapiri/bot.rb
CHANGED
@@ -23,12 +23,16 @@ class Bot
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def preparar_correccion!(entrega
|
27
|
-
entrega.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
def preparar_correccion!(entrega)
|
27
|
+
if not entrega.hay_cambios?
|
28
|
+
crear_issue_advertencia! entrega
|
29
|
+
else
|
30
|
+
entrega.crear_branch! 'base', entrega.commit_base
|
31
|
+
entrega.crear_branch! 'entrega', 'master'
|
32
|
+
TransformacionWollok.transformar!(entrega, self) if TransformacionWollok.aplica?(entrega)
|
33
|
+
publicar_cambios! entrega
|
34
|
+
crear_pull_request! entrega
|
35
|
+
end
|
32
36
|
end
|
33
37
|
|
34
38
|
def preparar_entrega!(nombre, repo_base)
|
@@ -76,7 +80,15 @@ class Bot
|
|
76
80
|
end
|
77
81
|
|
78
82
|
def crear_pull_request!(entrega)
|
79
|
-
@gh_client.create_pull_request(
|
83
|
+
@gh_client.create_pull_request(gh_repo_para(entrega), "base", "entrega", "Corrección", entrega.mensaje_pull_request) rescue nil
|
84
|
+
end
|
85
|
+
|
86
|
+
def crear_issue_advertencia!(entrega)
|
87
|
+
@gh_client.create_issue(gh_repo_para(entrega), "Corrección", "¡Hola! Te estamos cargando esta _issue_ porque no subiste ningún cambio al repositorio y ya pasó la fecha de entrega. :pensive:\n\nPor favor, si tuviste algún problema acercate a hablar con tus docentes." )
|
88
|
+
end
|
89
|
+
|
90
|
+
def gh_repo_para(entrega)
|
91
|
+
"#{@organization}/#{entrega.id}"
|
80
92
|
end
|
81
93
|
|
82
94
|
def publicar_repo!(nombre, repo)
|
data/lib/yanapiri/entrega.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
class Entrega
|
2
|
-
attr_reader :id, :fecha_limite, :repo
|
2
|
+
attr_reader :id, :fecha_limite, :repo, :commit_base
|
3
3
|
|
4
|
-
def initialize(base_path, id, fecha_limite = Time.now)
|
4
|
+
def initialize(base_path, id, commit_base, fecha_limite = Time.now)
|
5
5
|
@base_path = base_path
|
6
6
|
@id = id
|
7
7
|
@fecha_limite = fecha_limite
|
8
|
+
@commit_base = commit_base || '--max-parents=0 HEAD'
|
8
9
|
@repo = Git.open "#{@base_path}/#{@id}"
|
9
10
|
end
|
10
11
|
|
@@ -43,6 +44,10 @@ class Entrega
|
|
43
44
|
@repo.chdir { File.exist? nombre }
|
44
45
|
end
|
45
46
|
|
47
|
+
def hay_cambios?
|
48
|
+
@repo.log.between(@commit_base, 'master').any?
|
49
|
+
end
|
50
|
+
|
46
51
|
private
|
47
52
|
|
48
53
|
def formato_humano(fecha)
|
data/lib/yanapiri/version.rb
CHANGED
data/lib/yanapiri.rb
CHANGED
@@ -17,7 +17,6 @@ module Yanapiri
|
|
17
17
|
include Thor::Actions
|
18
18
|
include ActionView::Helpers::DateHelper
|
19
19
|
|
20
|
-
class_option :verbose, {type: :boolean, aliases: :v}
|
21
20
|
class_option :orga, {aliases: :o}
|
22
21
|
class_option :github_token
|
23
22
|
|
@@ -98,12 +97,13 @@ module Yanapiri
|
|
98
97
|
option :fecha_limite, {default: Time.now.to_s, aliases: :l}
|
99
98
|
def corregir(nombre)
|
100
99
|
foreach_entrega(nombre) do |entrega|
|
101
|
-
@bot.preparar_correccion! entrega
|
100
|
+
@bot.preparar_correccion! entrega
|
102
101
|
end
|
103
102
|
end
|
104
103
|
|
105
104
|
desc 'ultimo_commit [ENTREGA]', 'Muestra la fecha del último commit de cada repositorio e indica si se pasó de la fecha límite'
|
106
105
|
option :fecha_limite, {default: Time.now.to_s, aliases: :l}
|
106
|
+
option :commit_base, {aliases: :b}
|
107
107
|
option :solo_excedidos, {type: :boolean}
|
108
108
|
def ultimo_commit(nombre)
|
109
109
|
print_table entregas(nombre)
|
@@ -115,7 +115,13 @@ module Yanapiri
|
|
115
115
|
|
116
116
|
no_commands do
|
117
117
|
def fila_ultimo_commit(entrega)
|
118
|
-
|
118
|
+
fecha = if entrega.hay_cambios?
|
119
|
+
"hace #{time_ago_in_words entrega.fecha} (#{entrega.fecha.strftime "%d/%m/%Y %H:%M"})"
|
120
|
+
else
|
121
|
+
'(no hay cambios)'
|
122
|
+
end
|
123
|
+
|
124
|
+
fila = [entrega.autor, fecha, if entrega.fuera_de_termino? then '---> Fuera de término' else '' end]
|
119
125
|
color = if entrega.fuera_de_termino? then :red else :white end
|
120
126
|
fila.map {|s| set_color s, color }
|
121
127
|
end
|
@@ -126,18 +132,16 @@ module Yanapiri
|
|
126
132
|
repos = Dir.glob('*').select {|f| File.directory? f}.sort
|
127
133
|
|
128
134
|
for repo in repos
|
129
|
-
log "Trabajando con #{repo}..."
|
130
135
|
Dir.chdir "#{working_dir}/#{repo}" do
|
131
136
|
yield repo, working_dir
|
132
137
|
end
|
133
|
-
log "==============================\n"
|
134
138
|
end
|
135
139
|
end
|
136
140
|
end
|
137
141
|
|
138
142
|
def foreach_entrega(nombre)
|
139
143
|
foreach_repo(nombre) do |repo, base_path|
|
140
|
-
yield Entrega.new base_path, repo, Time.parse(options.fecha_limite)
|
144
|
+
yield Entrega.new base_path, repo, options.commit_base, Time.parse(options.fecha_limite)
|
141
145
|
end
|
142
146
|
end
|
143
147
|
|
@@ -147,10 +151,6 @@ module Yanapiri
|
|
147
151
|
resultado
|
148
152
|
end
|
149
153
|
|
150
|
-
def log(mensaje)
|
151
|
-
puts mensaje if options[:verbose]
|
152
|
-
end
|
153
|
-
|
154
154
|
def global_config_file
|
155
155
|
File.expand_path "~/#{config_file_name}"
|
156
156
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yanapiri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Federico Aloi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|