yanapiri 0.2.2 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a50f96efb71cfbc154cac1b88548361523998c6ccd242567c789f184c6f613a
4
- data.tar.gz: 11f009d684025a57cb9db8fbc80e9e01895072d7d6a8cdfc1bd58e9069aabf75
3
+ metadata.gz: 1fe130d3d1f138c56f6f44ae8c802099d6e026fcae21792bc3c0b321dba2e8c5
4
+ data.tar.gz: a568ee5e8394e412368635c7b1f06ae5ed18dddc5a3e3ee38d167168b24dea32
5
5
  SHA512:
6
- metadata.gz: 154dd40edaa2cfde3f5e3ac298e71bf466cda973442a0d6bc5ce419d4c3ebc8ebf40679a198b0a74942df59cbd11b6f8534f9f84b24ae1fdf7afa1af0ee5d129
7
- data.tar.gz: 7e8221e46fd33abc09765a3b7060499ea458663297281470f838ca3cd76684cdf126cfa73b8a52ec16598defc9999d02a136462344e4602edb21bfb251b43787
6
+ metadata.gz: 915ef5bf4fbd9ed4e28e45ee5edf8251cc606338a333bb6d54c6253e8ea3a450617879f5f8d35143511f92094ad24b0010de0425eb4ed3011b9eb95233026e2f
7
+ data.tar.gz: dc2bd1e9e076d9483fe23f8f91959ac371c28aec7644bb90c4cb50b0ac910fc0282b3373c7d4b84666f807043b904adf030f24acf462a67d12b2cad02d405361
data/.grenrc ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "dataSource": "prs",
3
+ "onlyMilestones": false,
4
+ "groupBy": false,
5
+ "changelogFilename": "CHANGELOG.md"
6
+ }
data/README.md CHANGED
@@ -3,6 +3,9 @@
3
3
 
4
4
  # Yanapiri
5
5
 
6
+ ![logo](https://user-images.githubusercontent.com/1585835/57146278-53838f00-6d9b-11e9-9875-56dc509e4943.png)
7
+
8
+
6
9
  Yanapiri es un vocablo aymara que significa "ayudante" o "el que ayuda".
7
10
 
8
11
  A partir de este humilde aporte, es también una aplicación de línea de comandos (CLI) para asistir a docentes en ciertas tareas relacionadas al manejo de entregas a través de [GitHub Classroom](https://classroom.github.com/).
@@ -17,11 +20,15 @@ Una vez que tu entorno Ruby esté funcionando, ejecutá lo siguiente:
17
20
  gem install yanapiri
18
21
  ```
19
22
 
20
- ## Uso
23
+ Luego, por única vez, deberás darle a `yanapiri` un access token de GitHub y una organización por defecto sobre la cual trabajar. Para ello, ejecutá el siguiente comando:
24
+
25
+ ```
26
+ yanapiri setup
27
+ ```
21
28
 
22
- Lo primero que tenés que hacer es ejecutar `yanapiri setup`, lo cual te va a preguntar con qué organización querés trabajar por defecto y te va a pedir un access token de un usuario que pueda pushear a esa organización.
29
+ ## Uso
23
30
 
24
- Luego podrás ejecutar cualquiera de los demás comandos. Podés ver una lista ejecutando `yanapiri help`.
31
+ Podés ver una lista de los comandos existentes ejecutando `yanapiri help`.
25
32
  Un flujo de trabajo típico sería el siguiente:
26
33
 
27
34
  ```
@@ -48,12 +55,6 @@ entregas
48
55
 
49
56
  Para escribir la configuración local, habría que ejecutar `yanapiri init` en cada uno de los subdirectorios.
50
57
 
51
- ## Development
52
-
53
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
54
-
55
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
56
-
57
- ## Contributing
58
+ ## Agradecimientos
58
59
 
59
- Bug reports and pull requests are welcome on GitHub at https://github.com/faloi/yanapiri.
60
+ Gracias a [Elizabeth Arostegui](http://www.coloripop.com/), autora de la cholita que usamos como logo de Yanapiri. Podés ver otros íconos de esa gran colección entrando a su sitio [Cosmocollita](http://cosmocollita.com/).
@@ -0,0 +1,219 @@
1
+ ---
2
+ es-AR:
3
+ activerecord:
4
+ errors:
5
+ messages:
6
+ record_invalid: 'La validación falló: %{errors}'
7
+ restrict_dependent_destroy:
8
+ has_one: No se puede eliminar el registro porque existe un %{record} dependiente
9
+ has_many: No se puede eliminar el registro porque existen %{record} dependientes
10
+ date:
11
+ abbr_day_names:
12
+ - dom
13
+ - lun
14
+ - mar
15
+ - mié
16
+ - jue
17
+ - vie
18
+ - sáb
19
+ abbr_month_names:
20
+ -
21
+ - ene
22
+ - feb
23
+ - mar
24
+ - abr
25
+ - may
26
+ - jun
27
+ - jul
28
+ - ago
29
+ - sep
30
+ - oct
31
+ - nov
32
+ - dic
33
+ day_names:
34
+ - domingo
35
+ - lunes
36
+ - martes
37
+ - miércoles
38
+ - jueves
39
+ - viernes
40
+ - sábado
41
+ formats:
42
+ default: "%d/%m/%Y"
43
+ long: "%A, %d de %B de %Y"
44
+ short: "%d de %b"
45
+ month_names:
46
+ -
47
+ - enero
48
+ - febrero
49
+ - marzo
50
+ - abril
51
+ - mayo
52
+ - junio
53
+ - julio
54
+ - agosto
55
+ - septiembre
56
+ - octubre
57
+ - noviembre
58
+ - diciembre
59
+ order:
60
+ - :day
61
+ - :month
62
+ - :year
63
+ datetime:
64
+ distance_in_words:
65
+ about_x_hours:
66
+ one: cerca de 1 hora
67
+ other: cerca de %{count} horas
68
+ about_x_months:
69
+ one: cerca de 1 mes
70
+ other: cerca de %{count} meses
71
+ about_x_years:
72
+ one: cerca de 1 año
73
+ other: cerca de %{count} años
74
+ almost_x_years:
75
+ one: casi 1 año
76
+ other: casi %{count} años
77
+ half_a_minute: medio minuto
78
+ less_than_x_seconds:
79
+ one: menos de 1 segundo
80
+ other: menos de %{count} segundos
81
+ less_than_x_minutes:
82
+ one: menos de 1 minuto
83
+ other: menos de %{count} minutos
84
+ over_x_years:
85
+ one: más de 1 año
86
+ other: más de %{count} años
87
+ x_seconds:
88
+ one: 1 segundo
89
+ other: "%{count} segundos"
90
+ x_minutes:
91
+ one: 1 minuto
92
+ other: "%{count} minutos"
93
+ x_days:
94
+ one: 1 día
95
+ other: "%{count} días"
96
+ x_months:
97
+ one: 1 mes
98
+ other: "%{count} meses"
99
+ x_years:
100
+ one: 1 año
101
+ other: "%{count} años"
102
+ prompts:
103
+ second: Segundos
104
+ minute: Minuto
105
+ hour: Hora
106
+ day: Día
107
+ month: Mes
108
+ year: Año
109
+ errors:
110
+ format: "%{attribute} %{message}"
111
+ messages:
112
+ accepted: debe ser aceptado
113
+ blank: no puede estar en blanco
114
+ confirmation: no coincide
115
+ empty: no puede estar vacío
116
+ equal_to: debe ser igual a %{count}
117
+ even: debe ser un número par
118
+ exclusion: está reservado
119
+ greater_than: debe ser mayor que %{count}
120
+ greater_than_or_equal_to: debe ser mayor o igual que %{count}
121
+ inclusion: no está incluido en la lista
122
+ invalid: es inválido
123
+ less_than: debe ser menor que %{count}
124
+ less_than_or_equal_to: debe ser menor o igual que %{count}
125
+ model_invalid: 'La validación falló: %{errors}'
126
+ not_a_number: no es un número
127
+ not_an_integer: debe ser un entero
128
+ odd: debe ser un número non
129
+ other_than: debe ser distinto de %{count}
130
+ present: debe estar en blanco
131
+ required: debe existir
132
+ taken: ya ha sido tomado
133
+ too_long:
134
+ one: es demasiado largo (máximo 1 caracter)
135
+ other: es demasiado largo (máximo %{count} caracteres)
136
+ too_short:
137
+ one: es demasiado corto (mínimo 1 caracter)
138
+ other: es demasiado corto (mínimo %{count} caracteres)
139
+ wrong_length:
140
+ one: longitud errónea (debe ser de 1 caracter)
141
+ other: longitud errónea (debe ser de %{count} caracteres)
142
+ template:
143
+ body: 'Revise que los siguientes campos sean válidos:'
144
+ header:
145
+ one: "%{model} no pudo guardarse debido a 1 error"
146
+ other: "%{model} no pudo guardarse debido a %{count} errores"
147
+ helpers:
148
+ select:
149
+ prompt: Por favor selecciona
150
+ submit:
151
+ create: Crear %{model}
152
+ submit: Guardar %{model}
153
+ update: Actualizar %{model}
154
+ number:
155
+ currency:
156
+ format:
157
+ delimiter: "."
158
+ format: "%u%n"
159
+ precision: 2
160
+ separator: ","
161
+ significant: false
162
+ strip_insignificant_zeros: false
163
+ unit: "$"
164
+ format:
165
+ delimiter: "."
166
+ precision: 2
167
+ separator: ","
168
+ significant: false
169
+ strip_insignificant_zeros: false
170
+ human:
171
+ decimal_units:
172
+ format: "%n %u"
173
+ units:
174
+ billion: mil millones
175
+ million:
176
+ one: millón
177
+ other: millones
178
+ quadrillion: mil billones
179
+ thousand: mil
180
+ trillion:
181
+ one: billón
182
+ other: billones
183
+ unit: ''
184
+ format:
185
+ delimiter: ","
186
+ precision: 3
187
+ significant: true
188
+ strip_insignificant_zeros: true
189
+ storage_units:
190
+ format: "%n %u"
191
+ units:
192
+ byte:
193
+ one: Byte
194
+ other: Bytes
195
+ eb: EB
196
+ gb: GB
197
+ kb: KB
198
+ mb: MB
199
+ pb: PB
200
+ tb: TB
201
+ percentage:
202
+ format:
203
+ delimiter: ","
204
+ format: "%n%"
205
+ precision:
206
+ format:
207
+ delimiter: ","
208
+ support:
209
+ array:
210
+ last_word_connector: " y "
211
+ two_words_connector: " y "
212
+ words_connector: ", "
213
+ time:
214
+ am: am
215
+ formats:
216
+ default: "%a, %d de %b de %Y a las %H:%M:%S %Z"
217
+ long: "%A, %d de %B de %Y a las %I:%M %p"
218
+ short: "%d de %b a las %H:%M hrs"
219
+ pm: pm
data/lib/yanapiri/bot.rb CHANGED
@@ -7,13 +7,18 @@ class Bot
7
7
  end
8
8
 
9
9
  def clonar_entrega!(nombre)
10
- result = @gh_client.search_repositories "org:#{@organization} #{nombre} in:name", {per_page: 200}
10
+ result = @gh_client.search_repositories "org:#{@organization} #{nombre}\\-", {per_page: 200}
11
11
  puts "Encontrados #{result.total_count} repositorios."
12
12
  FileUtils.mkdir_p nombre
13
13
  Dir.chdir(nombre) do
14
14
  result.items.each do |repo|
15
- puts "Clonando #{repo.name}..."
16
- clonar! repo.full_name
15
+ if File.exist? repo.name
16
+ puts "Actualizando #{repo.name}..."
17
+ actualizar! repo.name
18
+ else
19
+ puts "Clonando #{repo.name}..."
20
+ clonar! repo.full_name
21
+ end
17
22
  end
18
23
  end
19
24
  end
@@ -62,6 +67,10 @@ class Bot
62
67
  end
63
68
  end
64
69
 
70
+ def actualizar!(repo_path)
71
+ Git.open(repo_path).pull
72
+ end
73
+
65
74
  def clonar!(repo_slug)
66
75
  Git.clone "git@github.com:#{repo_slug}.git", repo_slug.split('/').last
67
76
  end
@@ -34,10 +34,6 @@ class Entrega
34
34
  end
35
35
  end
36
36
 
37
- def mensaje_ultimo_commit
38
- "#{autor} hizo su último commit el #{fecha}." + (fuera_de_termino? ? " Fuera de término." : "")
39
- end
40
-
41
37
  def crear_branch!(nombre, head)
42
38
  @repo.checkout head
43
39
  @repo.branch(nombre).checkout
@@ -1,3 +1,3 @@
1
1
  module Yanapiri
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
data/lib/yanapiri.rb CHANGED
@@ -4,6 +4,8 @@ require 'thor'
4
4
  require 'yaml'
5
5
  require 'ostruct'
6
6
  require 'active_support/all'
7
+ require 'action_view'
8
+ require 'action_view/helpers'
7
9
 
8
10
  require_relative './yanapiri/version'
9
11
  require_relative './yanapiri/entrega'
@@ -13,6 +15,8 @@ require_relative './yanapiri/transformacion_wollok'
13
15
  module Yanapiri
14
16
  class CLI < Thor
15
17
  include Thor::Actions
18
+ include ActionView::Helpers::DateHelper
19
+
16
20
  class_option :verbose, {type: :boolean, aliases: :v}
17
21
  class_option :orga, {aliases: :o}
18
22
  class_option :github_token
@@ -102,14 +106,20 @@ module Yanapiri
102
106
  option :fecha_limite, {default: Time.now.to_s, aliases: :l}
103
107
  option :solo_excedidos, {type: :boolean}
104
108
  def ultimo_commit(nombre)
105
- foreach_entrega(nombre) do |entrega|
106
- if not options.solo_excedidos or entrega.fuera_de_termino?
107
- say entrega.mensaje_ultimo_commit, entrega.fuera_de_termino? ? :red : :clear
108
- end
109
- end
109
+ print_table entregas(nombre)
110
+ .select {|e| not options.solo_excedidos or e.fuera_de_termino?}
111
+ .sort_by(&:fecha)
112
+ .reverse!
113
+ .map(&method(:fila_ultimo_commit))
110
114
  end
111
115
 
112
116
  no_commands do
117
+ def fila_ultimo_commit(entrega)
118
+ fila = [entrega.autor, "hace #{time_ago_in_words entrega.fecha}", entrega.fecha.strftime("%d/%m/%Y %H:%M"), if entrega.fuera_de_termino? then '(Fuera de término)' else '' end]
119
+ color = if entrega.fuera_de_termino? then :red else :white end
120
+ fila.map {|s| set_color s, color }
121
+ end
122
+
113
123
  def foreach_repo(dir_base)
114
124
  Dir.chdir(dir_base) do
115
125
  working_dir = Dir.pwd
@@ -131,6 +141,12 @@ module Yanapiri
131
141
  end
132
142
  end
133
143
 
144
+ def entregas(nombre)
145
+ resultado = []
146
+ foreach_entrega(nombre) { |e| resultado << e }
147
+ resultado
148
+ end
149
+
134
150
  def log(mensaje)
135
151
  puts mensaje if options[:verbose]
136
152
  end
@@ -180,3 +196,6 @@ module Yanapiri
180
196
  end
181
197
  end
182
198
  end
199
+
200
+ I18n.load_path << Dir[File.join(File.dirname(__FILE__), '/locales') + '/*.yml']
201
+ I18n.default_locale = 'es-AR'
data/yanapiri.gemspec CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_dependency "octokit", "~> 4.0"
26
26
  spec.add_dependency "git", "~> 1.5"
27
27
  spec.add_dependency "activesupport", "~> 5.2"
28
+ spec.add_dependency "actionview", '~> 5.2'
28
29
 
29
30
  spec.add_development_dependency "bundler", "~> 2.0"
30
31
  spec.add_development_dependency "rake", "~> 10.0"
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.2
4
+ version: 0.2.3
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-03 00:00:00.000000000 Z
11
+ date: 2019-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '5.2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: actionview
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '5.2'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '5.2'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -145,6 +159,7 @@ extensions: []
145
159
  extra_rdoc_files: []
146
160
  files:
147
161
  - ".gitignore"
162
+ - ".grenrc"
148
163
  - ".rspec"
149
164
  - ".ruby-version"
150
165
  - ".travis.yml"
@@ -156,6 +171,7 @@ files:
156
171
  - bin/console
157
172
  - bin/setup
158
173
  - bin/yanapiri
174
+ - lib/locales/es-AR.yml
159
175
  - lib/yanapiri.rb
160
176
  - lib/yanapiri/bot.rb
161
177
  - lib/yanapiri/entrega.rb