-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7763bd
commit a46c90b
Showing
22 changed files
with
828 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
1.0.0 | ||
----- | ||
* First release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Este software puede ser utilizado sin cargo monetario(gratis) por el usuario. No se puede vender, no se puede obtener dinero de el. En el caso de que se distribuya públicamente por favor mencionarme como autor del mismo, gracias. IgorJorobus. | ||
This software can be used without monetary charge(free) by the user. Can not be sold, can't get money from it. In case you want to distribute it around please mention me, thank you. IgorJorobus. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
cocot | ||
===== | ||
|
||
Sometimes you have a good 'no-rails' idea, and say for yourself: "what a good idea!", what mostly of the time is followed by "okay, but...I can't, I'm in many proyects and I had to create all the folder and files stuff, will take me 15 minutes, or more, so no". You are lazy and you know it. We are great builders of tools which makes our life easy, cocot is one of those. cocot is a very simple tool that puts you to work in one second, you just have to tell him which will be the name of your proyect and it's done, it creates you the structure of your **BDD** proyect. | ||
|
||
It supposes that you... | ||
----------------------- | ||
|
||
use RSpec and Cucumber for BDD developing, so it creates the conventional files and folders for work with. | ||
|
||
How can I use it? | ||
----------------- | ||
|
||
`cocot NameOfTheProyect` or `cocot "name of the proyect"`. Will build the skeleton in the current working directory, so be aware of be positioned where you want your proyect to be. | ||
|
||
Gemfile | ||
------- | ||
|
||
If you don't have **RSpec** and **Cucumber** installed on your system(or want to update them) you can do it by calling `bundle install` standing on the main folder of your proyect created by cocot. If you neither have **bundler** you will need to install it by calling `gem install bundler`. | ||
|
||
Rakefile | ||
-------- | ||
|
||
cocot packs few pre-defined **rake** tasks: | ||
|
||
* `rake cucumber` : same like `cucumber` | ||
* `rake cucumber_wip` : same like `cucumber --format progress --color --wip --tags @wip:3`, specially for order | ||
* `rake spec` : same like `spec --color` | ||
* `rake test` : run minitest tests | ||
* `rake rdoc` : create a doc folder with **RDoc** documentation | ||
|
||
Skeleton | ||
-------- | ||
|
||
cocot builds: | ||
|
||
bin\ | ||
| proyect* | ||
doc\ | ||
features\ | ||
| step_definitions\ | ||
| support\ | ||
| | env.rb | ||
lib\ | ||
| proyect* | ||
| proyect*.rb | ||
spec\ | ||
| proyect* | ||
| spec_helper.rb | ||
Changelog.md | ||
Gemfile | ||
Gemfile.lock | ||
License.md | ||
Rakefile | ||
ReadMe.md | ||
|
||
*proyect is replaced by the name of your proyect | ||
|
||
TODO | ||
---- | ||
|
||
* --full option. It builds you extra folders, like "Data", "Share", and "Test". | ||
* --git-init option. Initialize a git repository(you will need to have **Git** in your system), and stash all the files created by cocot. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
#!/usr/bin/env ruby | ||
#encoding: utf-8 | ||
|
||
require_relative '../lib/cocot' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#language: es | ||
|
||
Característica: cocot construye el esqueleto del proyecto. | ||
|
||
Con el fin de cumplimentar el objetivo principal de la aplicación, | ||
como desarrollador, | ||
quiero poder lograr que cocot construya el esqueleto del nuevo proyecto en la ruta actual desde donde se está ejecutando la aplicación. | ||
|
||
@wip | ||
Escenario: genero el árbol de carpetas. | ||
Dado que el usuario ingresó correctamente el comando para esqueletizar su nuevo proyecto, por ejemplo: "cocot Proyecto", | ||
Cuando origino sus carpetas, | ||
Entonces debo encontrar creada una carpeta con nombre "Proyecto", | ||
#realmente el step definition de la siguiente línea testea que estén todos los archivos también | ||
Y dentro de ella debo encontrarme con la siguiente estructura de carpetas creadas: | ||
| bin | | ||
| lib | | ||
| lib/Proyecto | | ||
| spec | | ||
| spec/Proyecto | | ||
| features | | ||
| features/support | | ||
| features/step_definitions | | ||
| doc | |
49 changes: 49 additions & 0 deletions
49
features/step_definitions/cocot_construye_esqueleto_steps.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#encoding: utf-8 | ||
|
||
Dado(/^que el usuario ingresó correctamente el comando para esqueletizar su nuevo proyecto, por ejemplo: "cocot Proyecto",$/) do | ||
cocot.limpiar_argumentos(['Proyecto']) | ||
cocot.juzgar_argumentos | ||
cocot.interrogar_juzgador | ||
(cocot.instance_variable_get(:@error_existente).should_not be true) && (cocot.instance_variable_get(:@ayuda_invocada).should_not be true) | ||
end | ||
|
||
Cuando(/^origino sus carpetas,$/) do | ||
#si todo andubo bien, en el accionar se genera el esqueleto | ||
cocot.accionar | ||
end | ||
|
||
Entonces(/^debo encontrar creada una carpeta con nombre "Proyecto",$/) do | ||
Dir.exists?("#{Dir.pwd}/#{nombre_del_proyecto()}").should be true | ||
end | ||
|
||
Entonces(/^dentro de ella debo encontrarme con la siguiente estructura de carpetas creadas:$/) do |carpetas| | ||
viejo_directorio_de_trabajo = Dir.pwd #: String | ||
#me muevo una carpeta hacia adelante | ||
Dir.chdir("./#{nombre_del_proyecto()}") | ||
#tiene que haber lo siguiente | ||
archivos_y_carpetas = %W{ Changelog.md | ||
Gemfile | ||
Gemfile.lock | ||
License.md | ||
Rakefile | ||
ReadMe.md | ||
bin | ||
bin/#{nombre_del_proyecto()} | ||
doc | ||
features | ||
features/step_definitions | ||
features/support | ||
features/support/env.rb | ||
lib | ||
lib/#{nombre_del_proyecto()} | ||
lib/#{nombre_del_proyecto()}.rb | ||
spec | ||
spec/#{nombre_del_proyecto()} | ||
spec/spec_helper.rb } | ||
|
||
Dir.glob('**/**/*').sort.should be === archivos_y_carpetas.sort | ||
#vuelvo al viejo directorio de trabajo | ||
Dir.chdir('..') | ||
#elimino todas las carpetas y archivos creados | ||
FileUtils.remove_dir("./#{nombre_del_proyecto}", true) | ||
end |
64 changes: 64 additions & 0 deletions
64
features/step_definitions/usuario_ingresa_comando_steps.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#encoding: utf-8 | ||
|
||
#hooks del *.feature correspondiente | ||
Around('@carpeta_existente') do |escenario, bloque| | ||
directorio_implicito = 'Proyecto' | ||
unless Dir.exists?(directorio_implicito) then Dir.mkdir(directorio_implicito) end | ||
bloque.call | ||
if Dir.exists?(directorio_implicito) then FileUtils.remove_dir(directorio_implicito, true) end | ||
end | ||
|
||
Before do |escenario| | ||
#en el modelo del dominio ::COCOT es utilizada. Apunta a la única instancia Cocot, la aplicación en si. | ||
::COCOT = cocot() | ||
end | ||
|
||
#definiciones de pasos | ||
Dado(/^que aún no inicié la aplicación,$/) do | ||
cocot() | ||
end | ||
|
||
Cuando(/^ejecuto el comando: "([^"]*)",$/) do |comando_ejecutado| | ||
#extirpo la palabra 'cocot' venida del *.feature y otras | ||
argumentos = comando_ejecutado.split.select {|palabra| (palabra.!=('cocot')) && (palabra.!=('\'\'')) && (palabra.!=('""'))} #: Array | ||
#le digo a cocot que juzgue los argumentos pasados por el usuario al iniciar la aplicación | ||
cocot.limpiar_argumentos(argumentos) | ||
cocot.juzgar_argumentos | ||
end | ||
|
||
Entonces(/^debo recibir en consola: "([^"]*)"[.,]$/) do |salida| | ||
cocot.interrogar_juzgador | ||
#el atributo salida es un #Array, cada item es un #String | ||
cocot.instance_variable_get(:@salida).should include(salida.+("\n")) | ||
end | ||
|
||
Entonces(/^a continuación: "([^"]*)", terminando el programa.$/) do |salida| | ||
begin | ||
cocot.accionar.should raise_error(SystemExit) | ||
#cucumber falla si algún bloque levanta una excepción y no es rescatada, asi que... | ||
rescue SystemExit | ||
end | ||
end | ||
|
||
Entonces(/^el programa debe terminarse\.$/) do | ||
begin | ||
cocot.accionar.should raise_error(SystemExit) | ||
#cucumber falla si algún bloque levanta una excepción y no es rescatada, asi que... | ||
rescue SystemExit | ||
end | ||
end | ||
|
||
Entonces(/^debo recibir en consola información que me ayude a comprender el funcionamiento de cocot,$/) do | ||
cocot.interrogar_juzgador | ||
cocot.instance_variable_get(:@ayuda_invocada).should be true | ||
end | ||
|
||
Cuando(/^ejecuto el comando: "cocot 'Proyecto Fu Fu'", cocot entiende que el nombre del proyecto será "Proyecto Fu Fu",$/) do | ||
#le digo a cocot que juzgue los argumentos pasados por el usuario al iniciar la aplicación | ||
cocot.limpiar_argumentos(['Proyecto Fu Fu']) | ||
cocot.juzgar_argumentos | ||
end | ||
|
||
Dado(/^que existe la carpeta "([^"]*)" en el directorio actual,$/) do |carpeta| | ||
Dir.exists?(carpeta).should be true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#encoding: utf-8 | ||
|
||
module CocotHelpers | ||
|
||
def cocot | ||
@cocot ||= Cocot.new | ||
end | ||
|
||
def nombre_del_proyecto | ||
@nombre_del_proyecto ||= cocot.instance_variable_get(:@juzgador_de_argumentos).cual_será_el_nombre_del_proyecto? #: String | ||
end | ||
end | ||
|
||
World(CocotHelpers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.