yanapiri 0.1.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 +7 -0
- data/.gitignore +41 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +64 -0
- data/Guardfile +5 -0
- data/LICENSE +21 -0
- data/README.md +52 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/yanapiri +5 -0
- data/lib/yanapiri/bot.rb +67 -0
- data/lib/yanapiri/entrega.rb +51 -0
- data/lib/yanapiri/version.rb +3 -0
- data/lib/yanapiri.rb +169 -0
- data/yanapiri.gemspec +32 -0
- metadata +161 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 250ac7618be318da8f0fcb91f4e59a5498837a10
|
4
|
+
data.tar.gz: d7dbe0528eaddf91a39581d9bcd015b570286c44
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 11f3bfb7276987ee0d90304ed2b022c587c9fd6b0c666ce520de4480e13fd9036a778cc02d2f9d7749903c0bc84b12257182757083fb2621595c32016cef5c90
|
7
|
+
data.tar.gz: d46ac724a68a62169385640dcc65b1833d56ec043a0c3d1e6ede99567f405547abc310064a1eb806d603a3b93e1ad214ce0d28f4388dc0bda5aaafc0e370927e
|
data/.gitignore
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
#### joe made this: http://goel.io/joe
|
2
|
+
|
3
|
+
#### ruby ####
|
4
|
+
*.gem
|
5
|
+
*.rbc
|
6
|
+
/.config
|
7
|
+
/coverage/
|
8
|
+
/InstalledFiles
|
9
|
+
/pkg/
|
10
|
+
/spec/reports/
|
11
|
+
/spec/examples.txt
|
12
|
+
/test/tmp/
|
13
|
+
/test/version_tmp/
|
14
|
+
/tmp/
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Documentation cache and generated files:
|
25
|
+
/.yardoc/
|
26
|
+
/_yardoc/
|
27
|
+
/doc/
|
28
|
+
/rdoc/
|
29
|
+
|
30
|
+
## Environment normalization:
|
31
|
+
/.bundle/
|
32
|
+
/vendor/bundle
|
33
|
+
/lib/bundler/man/
|
34
|
+
|
35
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
36
|
+
.rvmrc
|
37
|
+
|
38
|
+
.rspec_status
|
39
|
+
|
40
|
+
#### jetbrains ####
|
41
|
+
.idea
|
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
yanapiri (0.1.0)
|
5
|
+
activesupport (~> 4.2)
|
6
|
+
git (~> 1.5)
|
7
|
+
octokit (~> 4.0)
|
8
|
+
thor (~> 0.20)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
activesupport (4.2.10)
|
14
|
+
i18n (~> 0.7)
|
15
|
+
minitest (~> 5.1)
|
16
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
17
|
+
tzinfo (~> 1.1)
|
18
|
+
addressable (2.5.2)
|
19
|
+
public_suffix (>= 2.0.2, < 4.0)
|
20
|
+
concurrent-ruby (1.1.5)
|
21
|
+
diff-lcs (1.3)
|
22
|
+
faraday (0.15.4)
|
23
|
+
multipart-post (>= 1.2, < 3)
|
24
|
+
git (1.5.0)
|
25
|
+
i18n (0.9.5)
|
26
|
+
concurrent-ruby (~> 1.0)
|
27
|
+
minitest (5.11.3)
|
28
|
+
multipart-post (2.0.0)
|
29
|
+
octokit (4.14.0)
|
30
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
31
|
+
public_suffix (3.0.3)
|
32
|
+
rake (10.5.0)
|
33
|
+
rspec (3.8.0)
|
34
|
+
rspec-core (~> 3.8.0)
|
35
|
+
rspec-expectations (~> 3.8.0)
|
36
|
+
rspec-mocks (~> 3.8.0)
|
37
|
+
rspec-core (3.8.0)
|
38
|
+
rspec-support (~> 3.8.0)
|
39
|
+
rspec-expectations (3.8.3)
|
40
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
+
rspec-support (~> 3.8.0)
|
42
|
+
rspec-mocks (3.8.0)
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
+
rspec-support (~> 3.8.0)
|
45
|
+
rspec-support (3.8.0)
|
46
|
+
sawyer (0.8.1)
|
47
|
+
addressable (>= 2.3.5, < 2.6)
|
48
|
+
faraday (~> 0.8, < 1.0)
|
49
|
+
thor (0.20.3)
|
50
|
+
thread_safe (0.3.6)
|
51
|
+
tzinfo (1.2.5)
|
52
|
+
thread_safe (~> 0.1)
|
53
|
+
|
54
|
+
PLATFORMS
|
55
|
+
ruby
|
56
|
+
|
57
|
+
DEPENDENCIES
|
58
|
+
bundler (~> 2.0)
|
59
|
+
rake (~> 10.0)
|
60
|
+
rspec (~> 3.0)
|
61
|
+
yanapiri!
|
62
|
+
|
63
|
+
BUNDLED WITH
|
64
|
+
2.0.1
|
data/Guardfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 Federico Aloi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Yanapiri
|
2
|
+
|
3
|
+
## Instalación
|
4
|
+
|
5
|
+
Yanapiri funciona con Ruby, por lo cual es necesario instalarlo antes. Podés consultar cómo hacerlo en [la documentación oficial](https://www.ruby-lang.org/es/documentation/installation/).
|
6
|
+
|
7
|
+
Una vez que tu entorno Ruby esté funcionando, ejecutá lo siguiente:
|
8
|
+
|
9
|
+
```
|
10
|
+
gem install yanapiri
|
11
|
+
```
|
12
|
+
|
13
|
+
## Uso
|
14
|
+
|
15
|
+
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.
|
16
|
+
|
17
|
+
Luego podrás ejecutar cualquiera de los demás comandos. Podés ver una lista ejecutando `yanapiri help`.
|
18
|
+
Un flujo de trabajo típico sería el siguiente:
|
19
|
+
|
20
|
+
```
|
21
|
+
yanapiri clonar entrega-1
|
22
|
+
yanapiri corregir entrega-1 --commit-base 326336a8ba771611 --fecha-limite "2019-05-01 23:59:59"
|
23
|
+
```
|
24
|
+
|
25
|
+
### Trabajando con más de una organización
|
26
|
+
|
27
|
+
Yanapiri soporta tres formas de configurar la organización:
|
28
|
+
* global, que se configura con `yanapiri setup`;
|
29
|
+
* local, que se configura con `yanapiri init`;
|
30
|
+
* por parámetro, que se configura con la opción `--orga`.
|
31
|
+
|
32
|
+
Para los casos en que se necesite trabajar regularmente con más de una organización (por ejemplo, si tenés varios cursos) conviene utilizar la configuración local.
|
33
|
+
|
34
|
+
Un ejemplo de estructura de directorios podría ser el siguiente:
|
35
|
+
|
36
|
+
```
|
37
|
+
entregas
|
38
|
+
├── une-objetos1
|
39
|
+
└── unlu-intro
|
40
|
+
```
|
41
|
+
|
42
|
+
Para escribir la configuración local, habría que ejecutar `yanapiri init` en cada uno de los subdirectorios.
|
43
|
+
|
44
|
+
## Development
|
45
|
+
|
46
|
+
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.
|
47
|
+
|
48
|
+
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).
|
49
|
+
|
50
|
+
## Contributing
|
51
|
+
|
52
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/faloi/yanapiri.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "yanapiri"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/bin/yanapiri
ADDED
data/lib/yanapiri/bot.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
class Bot
|
2
|
+
attr_reader :organization
|
3
|
+
|
4
|
+
def initialize(organization, gh_token)
|
5
|
+
@organization = organization
|
6
|
+
@gh_client = Octokit::Client.new(access_token: gh_token)
|
7
|
+
end
|
8
|
+
|
9
|
+
def clonar_entrega!(nombre)
|
10
|
+
result = @gh_client.search_repositories "org:#{@organization} #{nombre} in:name", {per_page: 200}
|
11
|
+
puts "Encontrados #{result.total_count} repositorios."
|
12
|
+
FileUtils.mkdir_p nombre
|
13
|
+
Dir.chdir(nombre) do
|
14
|
+
result.items.each do |repo|
|
15
|
+
puts "Clonando #{repo.name}..."
|
16
|
+
Git.clone repo.ssh_url, repo.name
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def preparar_correccion!(entrega, commit_base)
|
22
|
+
entrega.crear_branch! 'base', commit_base
|
23
|
+
entrega.crear_branch! 'entrega', 'master'
|
24
|
+
renombrar_proyecto_wollok! entrega
|
25
|
+
publicar_cambios! entrega
|
26
|
+
crear_pull_request! entrega
|
27
|
+
end
|
28
|
+
|
29
|
+
def nombre
|
30
|
+
'Yanapiri Bot'
|
31
|
+
end
|
32
|
+
|
33
|
+
def email
|
34
|
+
'bot@yanapiri.org'
|
35
|
+
end
|
36
|
+
|
37
|
+
def git_author
|
38
|
+
"#{nombre} <#{email}>"
|
39
|
+
end
|
40
|
+
|
41
|
+
def github_user
|
42
|
+
@gh_client.user
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def crear_pull_request!(entrega)
|
48
|
+
@gh_client.create_pull_request("#{@organization}/#{entrega.id}", "base", "entrega", "Corrección", entrega.mensaje_pull_request) rescue nil
|
49
|
+
end
|
50
|
+
|
51
|
+
def renombrar_proyecto_wollok!(entrega)
|
52
|
+
entrega.repo.chdir do
|
53
|
+
xml = File.read proyecto_wollok
|
54
|
+
File.open(proyecto_wollok, "w") {|file| file.puts xml.sub(/<name>.*<\/name>/, "<name>#{entrega.id}</name>") }
|
55
|
+
end
|
56
|
+
|
57
|
+
entrega.repo.commit_all 'Renombrado proyecto Wollok', author: git_author
|
58
|
+
end
|
59
|
+
|
60
|
+
def publicar_cambios!(entrega)
|
61
|
+
entrega.repo.push 'origin', '--all'
|
62
|
+
end
|
63
|
+
|
64
|
+
def proyecto_wollok
|
65
|
+
'.project'
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class Entrega
|
2
|
+
attr_reader :id, :fecha_limite, :repo
|
3
|
+
|
4
|
+
def initialize(base_path, id, fecha_limite = Time.now)
|
5
|
+
@base_path = base_path
|
6
|
+
@id = id
|
7
|
+
@fecha_limite = fecha_limite
|
8
|
+
@repo = Git.open "#{@base_path}/#{@id}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def crear_pull_request!(bot)
|
12
|
+
bot.crear_pull_request!(@id, mensaje_pull_request)
|
13
|
+
end
|
14
|
+
|
15
|
+
def fuera_de_termino?
|
16
|
+
@repo.checkout 'master'
|
17
|
+
@repo.log.since(@fecha_limite.iso8601).any?
|
18
|
+
end
|
19
|
+
|
20
|
+
def autor
|
21
|
+
@id.split('-').last
|
22
|
+
end
|
23
|
+
|
24
|
+
def fecha
|
25
|
+
@repo.checkout 'master'
|
26
|
+
@repo.log.first.author_date
|
27
|
+
end
|
28
|
+
|
29
|
+
def mensaje_pull_request
|
30
|
+
if fuera_de_termino?
|
31
|
+
"**Ojo:** tu último commit fue el #{formato_humano fecha}, pero la fecha límite era el #{formato_humano fecha_limite}.\n\n¡Tenés que respetar la fecha de entrega establecida! :point_up:"
|
32
|
+
else
|
33
|
+
''
|
34
|
+
end
|
35
|
+
end
|
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
|
+
def crear_branch!(nombre, head)
|
42
|
+
@repo.checkout head
|
43
|
+
@repo.branch(nombre).checkout
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def formato_humano(fecha)
|
49
|
+
fecha.strftime("%d/%m/%Y a las %H:%M")
|
50
|
+
end
|
51
|
+
end
|
data/lib/yanapiri.rb
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
require 'octokit'
|
2
|
+
require 'git'
|
3
|
+
require 'thor'
|
4
|
+
require 'yaml'
|
5
|
+
require 'ostruct'
|
6
|
+
require 'active_support/all'
|
7
|
+
|
8
|
+
require_relative './yanapiri/version'
|
9
|
+
require_relative './yanapiri/entrega'
|
10
|
+
require_relative './yanapiri/bot'
|
11
|
+
|
12
|
+
module Yanapiri
|
13
|
+
class CLI < Thor
|
14
|
+
include Thor::Actions
|
15
|
+
class_option :verbose, {type: :boolean, aliases: :v}
|
16
|
+
class_option :orga, {aliases: :o}
|
17
|
+
class_option :github_token
|
18
|
+
|
19
|
+
def initialize(args = [], local_options = {}, config = {})
|
20
|
+
super(args, local_options, config)
|
21
|
+
@bot = Bot.new(options.orga, options.github_token)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.exit_on_failure?
|
25
|
+
true
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'setup', 'Configura a Yanapiri para el primer uso'
|
29
|
+
def setup
|
30
|
+
say '¡Kamisaraki! Yo soy Yanapiri, tu ayudante, y necesito algunos datos antes de empezar:', :bold
|
31
|
+
|
32
|
+
config = OpenStruct.new
|
33
|
+
config.github_token = ask 'Token de GitHub (lo necesito para armar los pull requests):'
|
34
|
+
config.orga = ask 'Organización por defecto:'
|
35
|
+
|
36
|
+
begin
|
37
|
+
bot = Bot.new(config.orga, config.github_token)
|
38
|
+
success "Los pull requests serán creados por @#{bot.github_user.login}, asegurate de que tenga los permisos necesarios en las organizaciones que uses."
|
39
|
+
dump_global_config! config
|
40
|
+
rescue Octokit::Unauthorized
|
41
|
+
raise 'El access token de GitHub no es correcto, revisalo por favor.'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
desc 'init', 'Inicializa una carpeta para contener entregas'
|
46
|
+
def init
|
47
|
+
config = OpenStruct.new
|
48
|
+
config.orga = ask 'Nombre de la organización:', default: File.basename(Dir.pwd)
|
49
|
+
success "De ahora en más, trabajaré con la organización #{config.orga} siempre que estés dentro de esta carpeta."
|
50
|
+
dump_local_config! config
|
51
|
+
end
|
52
|
+
|
53
|
+
desc 'whoami', 'Muestra organización y usuario con el que se está trabajando'
|
54
|
+
def whoami
|
55
|
+
say "Estoy trabajando en la organización #{@bot.organization}, commiteando con el usuario #{@bot.git_author}."
|
56
|
+
end
|
57
|
+
|
58
|
+
desc 'clonar [ENTREGA]', 'Clona todos los repositorios de la entrega dentro de una subcarpeta'
|
59
|
+
def clonar(nombre)
|
60
|
+
@bot.clonar_entrega!(nombre)
|
61
|
+
end
|
62
|
+
|
63
|
+
option :repo_base, {required: true, aliases: :b}
|
64
|
+
desc 'actualizar [ENTREGA]', 'Actualiza cada repositorio con el contenido que haya en el repositorio base'
|
65
|
+
def actualizar(nombre)
|
66
|
+
path_repo_base = "#{nombre}-base"
|
67
|
+
`git clone git@github.com:#{options.repo_base}.git #{path_repo_base}`
|
68
|
+
|
69
|
+
foreach_repo(nombre) do
|
70
|
+
`git remote rm base`
|
71
|
+
`git remote add base ../../#{path_repo_base}`
|
72
|
+
`git pull base master`
|
73
|
+
`git push origin master`
|
74
|
+
end
|
75
|
+
|
76
|
+
`rm -rf #{path_repo_base}`
|
77
|
+
end
|
78
|
+
|
79
|
+
desc 'corregir [ENTREGA]', 'Prepara la entrega para la corrección, creando los archivos y el pull request'
|
80
|
+
option :commit_base, {required: true, aliases: :b}
|
81
|
+
option :fecha_limite, {default: Time.now.to_s, aliases: :l}
|
82
|
+
def corregir(nombre)
|
83
|
+
foreach_entrega(nombre) do |entrega|
|
84
|
+
@bot.preparar_correccion! entrega, options.commit_base
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
desc 'ultimo_commit [ENTREGA]', 'Muestra la fecha del último commit de cada repositorio e indica si se pasó de la fecha límite'
|
89
|
+
option :fecha_limite, {default: Time.now.to_s, aliases: :l}
|
90
|
+
option :solo_excedidos, {type: :boolean}
|
91
|
+
def ultimo_commit(nombre)
|
92
|
+
foreach_entrega(nombre) do |entrega|
|
93
|
+
if not options.solo_excedidos or entrega.fuera_de_termino?
|
94
|
+
say entrega.mensaje_ultimo_commit, entrega.fuera_de_termino? ? :red : :clear
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
no_commands do
|
100
|
+
def foreach_repo(dir_base)
|
101
|
+
Dir.chdir(dir_base) do
|
102
|
+
working_dir = Dir.pwd
|
103
|
+
repos = Dir.glob('*').select {|f| File.directory? f}.sort
|
104
|
+
|
105
|
+
for repo in repos
|
106
|
+
log "Trabajando con #{repo}..."
|
107
|
+
Dir.chdir "#{working_dir}/#{repo}" do
|
108
|
+
yield repo, working_dir
|
109
|
+
end
|
110
|
+
log "==============================\n"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def foreach_entrega(nombre)
|
116
|
+
foreach_repo(nombre) do |repo, base_path|
|
117
|
+
yield Entrega.new base_path, repo, Time.parse(options.fecha_limite)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def log(mensaje)
|
122
|
+
puts mensaje if options[:verbose]
|
123
|
+
end
|
124
|
+
|
125
|
+
def global_config_file
|
126
|
+
File.expand_path "~/#{config_file_name}"
|
127
|
+
end
|
128
|
+
|
129
|
+
def local_config_file
|
130
|
+
File.expand_path config_file_name
|
131
|
+
end
|
132
|
+
|
133
|
+
def config_file_name
|
134
|
+
'.yanapiri'
|
135
|
+
end
|
136
|
+
|
137
|
+
def dump_global_config!(config)
|
138
|
+
dump_config! global_config_file, config
|
139
|
+
end
|
140
|
+
|
141
|
+
def dump_local_config!(config)
|
142
|
+
dump_config! local_config_file, config
|
143
|
+
end
|
144
|
+
|
145
|
+
def dump_config!(destination, config)
|
146
|
+
File.write destination, config.to_h.stringify_keys.to_yaml
|
147
|
+
end
|
148
|
+
|
149
|
+
def load_config(source)
|
150
|
+
if File.exist? source then YAML.load_file source else {} end
|
151
|
+
end
|
152
|
+
|
153
|
+
def options
|
154
|
+
original_options = super
|
155
|
+
defaults_global = load_config global_config_file
|
156
|
+
defaults_local = load_config local_config_file
|
157
|
+
Thor::CoreExt::HashWithIndifferentAccess.new defaults_global.merge(defaults_local).merge(original_options)
|
158
|
+
end
|
159
|
+
|
160
|
+
def raise(message)
|
161
|
+
super Thor::Error, set_color(message, :red)
|
162
|
+
end
|
163
|
+
|
164
|
+
def success(message)
|
165
|
+
say "Yuspagara. #{message}", :green
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
data/yanapiri.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "yanapiri/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "yanapiri"
|
8
|
+
spec.version = Yanapiri::VERSION
|
9
|
+
spec.authors = ["Federico Aloi"]
|
10
|
+
spec.email = ["federico.aloi@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "Ayudante para administrar entregas via GitHub Classroom."
|
13
|
+
spec.homepage = "https://github.com/faloi/yanapiri"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
spec.executables = ["yanapiri"]
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_dependency "thor", "~> 0.20"
|
25
|
+
spec.add_dependency "octokit", "~> 4.0"
|
26
|
+
spec.add_dependency "git", "~> 1.5"
|
27
|
+
spec.add_dependency "activesupport", "~> 4.2"
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yanapiri
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Federico Aloi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-05-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.20'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.20'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: octokit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '4.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: git
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.5'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '4.2'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '4.2'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- federico.aloi@gmail.com
|
114
|
+
executables:
|
115
|
+
- yanapiri
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rspec"
|
121
|
+
- ".ruby-version"
|
122
|
+
- ".travis.yml"
|
123
|
+
- Gemfile
|
124
|
+
- Gemfile.lock
|
125
|
+
- Guardfile
|
126
|
+
- LICENSE
|
127
|
+
- README.md
|
128
|
+
- Rakefile
|
129
|
+
- bin/console
|
130
|
+
- bin/setup
|
131
|
+
- bin/yanapiri
|
132
|
+
- lib/yanapiri.rb
|
133
|
+
- lib/yanapiri/bot.rb
|
134
|
+
- lib/yanapiri/entrega.rb
|
135
|
+
- lib/yanapiri/version.rb
|
136
|
+
- yanapiri.gemspec
|
137
|
+
homepage: https://github.com/faloi/yanapiri
|
138
|
+
licenses:
|
139
|
+
- MIT
|
140
|
+
metadata: {}
|
141
|
+
post_install_message:
|
142
|
+
rdoc_options: []
|
143
|
+
require_paths:
|
144
|
+
- lib
|
145
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
requirements: []
|
156
|
+
rubyforge_project:
|
157
|
+
rubygems_version: 2.5.1
|
158
|
+
signing_key:
|
159
|
+
specification_version: 4
|
160
|
+
summary: Ayudante para administrar entregas via GitHub Classroom.
|
161
|
+
test_files: []
|