yanapiri 0.1.0 → 0.2.0
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/Gemfile.lock +1 -1
- data/lib/yanapiri/bot.rb +35 -2
- data/lib/yanapiri/version.rb +1 -1
- data/lib/yanapiri.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eeaeba7a366a0b292357f53c1927b922921d53ac
|
4
|
+
data.tar.gz: 03161dbd5f7c27f1fda3cbbf9dbf69c9ad4723cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 214237b162c0b874a90e0d3858d3639d10e0337c9a3d2e638941ec631e5ca794de437bf25bcdbb64200e041a6ebdf044636f1ea5a1bfc3516246fabffddfd8d5
|
7
|
+
data.tar.gz: 25d1812c9576b1f5eff20ecb92ba5869e513390738006177864827773e13a7550450c94bbec4f178cf01546976cc118e9ec179afe88d010fa7559e0661791992
|
data/Gemfile.lock
CHANGED
data/lib/yanapiri/bot.rb
CHANGED
@@ -13,7 +13,7 @@ class Bot
|
|
13
13
|
Dir.chdir(nombre) do
|
14
14
|
result.items.each do |repo|
|
15
15
|
puts "Clonando #{repo.name}..."
|
16
|
-
|
16
|
+
clonar! repo.full_name
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -26,6 +26,12 @@ class Bot
|
|
26
26
|
crear_pull_request! entrega
|
27
27
|
end
|
28
28
|
|
29
|
+
def preparar_entrega!(nombre, repo_base)
|
30
|
+
repo = clonar! repo_base
|
31
|
+
aplanar_commits! repo
|
32
|
+
publicar_repo! nombre, repo
|
33
|
+
end
|
34
|
+
|
29
35
|
def nombre
|
30
36
|
'Yanapiri Bot'
|
31
37
|
end
|
@@ -44,6 +50,22 @@ class Bot
|
|
44
50
|
|
45
51
|
private
|
46
52
|
|
53
|
+
def aplanar_commits!(repo)
|
54
|
+
repo.chdir do
|
55
|
+
`git checkout --orphan new-master master`
|
56
|
+
commit! repo, 'Enunciado preparado por Yanapiri'
|
57
|
+
`git branch -M new-master master`
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def clonar!(repo_slug)
|
62
|
+
Git.clone "git@github.com:#{repo_slug}.git", repo_slug.split('/').last
|
63
|
+
end
|
64
|
+
|
65
|
+
def commit!(repo, mensaje)
|
66
|
+
repo.commit_all mensaje, author: git_author
|
67
|
+
end
|
68
|
+
|
47
69
|
def crear_pull_request!(entrega)
|
48
70
|
@gh_client.create_pull_request("#{@organization}/#{entrega.id}", "base", "entrega", "Corrección", entrega.mensaje_pull_request) rescue nil
|
49
71
|
end
|
@@ -54,7 +76,18 @@ class Bot
|
|
54
76
|
File.open(proyecto_wollok, "w") {|file| file.puts xml.sub(/<name>.*<\/name>/, "<name>#{entrega.id}</name>") }
|
55
77
|
end
|
56
78
|
|
57
|
-
entrega.repo
|
79
|
+
commit! entrega.repo, 'Renombrado proyecto Wollok'
|
80
|
+
end
|
81
|
+
|
82
|
+
def publicar_repo!(nombre, repo)
|
83
|
+
repo_nuevo = crear_repo!(nombre)
|
84
|
+
repo.remote('origin').remove
|
85
|
+
repo.add_remote 'origin', repo_nuevo.ssh_url
|
86
|
+
repo.push
|
87
|
+
end
|
88
|
+
|
89
|
+
def crear_repo!(nombre)
|
90
|
+
@gh_client.create_repository nombre, organization: @organization
|
58
91
|
end
|
59
92
|
|
60
93
|
def publicar_cambios!(entrega)
|
data/lib/yanapiri/version.rb
CHANGED
data/lib/yanapiri.rb
CHANGED
@@ -25,6 +25,12 @@ module Yanapiri
|
|
25
25
|
true
|
26
26
|
end
|
27
27
|
|
28
|
+
map %w(--version -v) => :version
|
29
|
+
desc "--version, -v", "Muestra la versión actual de Yanapiri"
|
30
|
+
def version
|
31
|
+
say "yanapiri version #{VERSION}"
|
32
|
+
end
|
33
|
+
|
28
34
|
desc 'setup', 'Configura a Yanapiri para el primer uso'
|
29
35
|
def setup
|
30
36
|
say '¡Kamisaraki! Yo soy Yanapiri, tu ayudante, y necesito algunos datos antes de empezar:', :bold
|
@@ -76,6 +82,12 @@ module Yanapiri
|
|
76
82
|
`rm -rf #{path_repo_base}`
|
77
83
|
end
|
78
84
|
|
85
|
+
option :repo_base, {required: true, aliases: :b}
|
86
|
+
desc 'preparar [ENTREGA]', 'Crea el repositorio que va a servir de base para la entrega, con un solo commit en la rama master'
|
87
|
+
def preparar(nombre)
|
88
|
+
@bot.preparar_entrega! nombre, options.repo_base
|
89
|
+
end
|
90
|
+
|
79
91
|
desc 'corregir [ENTREGA]', 'Prepara la entrega para la corrección, creando los archivos y el pull request'
|
80
92
|
option :commit_base, {required: true, aliases: :b}
|
81
93
|
option :fecha_limite, {default: Time.now.to_s, aliases: :l}
|