cocot 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/Changelog.md +11 -2
- data/License.md +2 -2
- data/ReadMe.md +30 -14
- data/data/contenido_de_archivos.cocot +64 -14
- data/features/cocot_construye_esqueleto.feature +0 -1
- data/features/step_definitions/usuario_ingresa_comando_steps.rb +24 -0
- data/features/usuario_ingresa_comando.feature +8 -2
- data/lib/cocot/cocot.rb +2 -2
- data/lib/cocot/constructor_de_esqueleto.rb +69 -7
- data/lib/cocot/contenido_de_archivos.rb +79 -13
- data/lib/cocot/juzgador_de_argumentos.rb +35 -8
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YTY1ZGM0OWI1ZmE3YzkxNGYzNGQ5YzQzYWJlYzRkMmQ3ZTU1NTA3Mw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c6d11981088f683d5398b64fc35339c81552693c
|
4
|
+
data.tar.gz: 2ffdc092d790b105ff3576f011cfd95471516ddd
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
Mzc2MTE3YWMxMzEzYzg2YzcyZGI2NmEzM2E0NjBjNGQyZWY0NTFhMTgyMjRl
|
11
|
-
OTA1Mzg2ZGExN2I4MDc4OTVjOWVjZmFkYWJmNzI4YzNiNGU0Y2I=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YTljZjA1MWMwOWY5ZWY1MmRiNDE1MjY2NzBhYjhhODEwZDg4OTk2M2EwMTRk
|
14
|
-
YmIxODYyNjczNTNjZDdiYzhhYTYyNjMxODQwYjY5OGNhOTMwOGNjZDAzNjU1
|
15
|
-
MTdiZGEyMDUzOWExNmI3NzFiMWQwOWRjZDg2ZGU0M2VkM2M3MDM=
|
6
|
+
metadata.gz: ecdeae1041490af69e40828cc5bada0034c5148c80a88523469007f3b3b63a4b6eb8f3a2d60cd0b8197f0de682fa68ebc296f0a8a2b510f08dca344423edb25e
|
7
|
+
data.tar.gz: 9f906a104cc78fc023f1b91b4a25c7c88f5572dc3d97bdd5d42a25d034a77c107abd51e1b244603bdb110c27f9e71de8467927bc8b5592e0eb6d8ecf546e2166
|
data/Changelog.md
CHANGED
@@ -1,8 +1,17 @@
|
|
1
|
+
1.1.0
|
2
|
+
-----
|
3
|
+
* Changed LICENSE.md
|
4
|
+
* Changed ReadMe.md
|
5
|
+
* Files generated does not have anymore "\#encoding: utf-8" on its first line
|
6
|
+
* New options added: --full, --rspec-only, --cucumber-only, --minitest-only, --clean
|
7
|
+
* Rakefile content is generated according to the options passed
|
8
|
+
* Improved feedback from cocot
|
9
|
+
|
1
10
|
1.0.1
|
2
11
|
-----
|
3
12
|
* Changed LICENSE.md
|
4
|
-
* When you install cocot no rdoc is
|
5
|
-
*
|
13
|
+
* When you install cocot no rdoc is built, it's not needed
|
14
|
+
* Fixed few misspelled words in the README.md
|
6
15
|
|
7
16
|
|
8
17
|
1.0.0
|
data/License.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
Copyright (c)
|
1
|
+
Copyright (c) 2015 cocot
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
4
|
this software and associated documentation files (the "Software"), to deal in
|
5
5
|
the Software with the rights to use, copy, modify, merge, publish and distribute.
|
6
6
|
This software can not be sold, can't get money from it. In case you want to
|
7
|
-
distribute it around please mention the author
|
7
|
+
distribute it around please mention the author.
|
8
8
|
|
9
9
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
10
10
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
data/ReadMe.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
cocot
|
2
2
|
=====
|
3
3
|
|
4
|
-
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
|
4
|
+
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, have to check out the file convention arragment, will take me 10 minutes, so no". You are lazy and you know it. We are great builders of tools which make 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/TDD/"free of tests"** proyect.
|
5
5
|
|
6
6
|
It supposes that you...
|
7
7
|
-----------------------
|
8
8
|
|
9
|
-
use RSpec and Cucumber for BDD developing, so it creates the conventional files and folders for work with.
|
9
|
+
may use **RSpec** and/or **Cucumber** and/or **minitest** for **BDD** developing, so it creates the conventional files and folders for work with.
|
10
10
|
|
11
11
|
How can I install it?
|
12
12
|
-----------------
|
@@ -21,23 +21,39 @@ How can I use it?
|
|
21
21
|
Gemfile
|
22
22
|
-------
|
23
23
|
|
24
|
-
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`.
|
24
|
+
If you don't have **RSpec** and **Cucumber** installed on your system(or want to update them) and want to use 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`.
|
25
25
|
|
26
26
|
Rakefile
|
27
27
|
--------
|
28
28
|
|
29
|
-
**cocot** packs few pre-defined **rake** tasks:
|
29
|
+
**cocot** packs few pre-defined **rake** tasks on standard mode:
|
30
30
|
|
31
31
|
* `rake cucumber` : same like `cucumber`
|
32
32
|
* `rake cucumber_wip` : same like `cucumber --format progress --color --wip --tags @wip:3`, specially for order
|
33
33
|
* `rake spec` : same like `spec --color`
|
34
34
|
* `rake test` : run minitest tests
|
35
|
-
* `rake rdoc` : create a doc folder with **RDoc** documentation
|
35
|
+
* `rake rdoc` : same like `rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output`, create a doc folder with **RDoc** documentation
|
36
36
|
|
37
|
-
|
38
|
-
|
37
|
+
If you pass some option(see below) to the program, the rake task list may be reduced.
|
38
|
+
|
39
|
+
Options
|
40
|
+
-------
|
41
|
+
|
42
|
+
Version 1.1.0 introduces few nice options:
|
43
|
+
|
44
|
+
* **--full** Builds these extra-folders: "share", "ext" and "data". If your project is kind of big, you may use them for order.
|
39
45
|
|
40
|
-
|
46
|
+
Next ones can be played as solo optionally in conjunction with the above one:
|
47
|
+
|
48
|
+
* **--rspec-only** Builds the standard skeleton minus the folders and files related to Cucumber.
|
49
|
+
* **--cucumber-only** Builds the standard skeleton minus the folders and files related to RSpec.
|
50
|
+
* **--minitest-only** Builds the standard skeleton without the support for RSpec and Cucumber and adds the folder "test" with the purpose of placing minitest tests there.
|
51
|
+
* **--clean** Builds the standard skeleton without the support for RSpec and Cucumber. This option may be fine for very small projects, which will have no unit testing at all.
|
52
|
+
|
53
|
+
Standard skeleton
|
54
|
+
-----------------
|
55
|
+
|
56
|
+
By default **cocot** builds support for **RSpec** and **Cucumber**:
|
41
57
|
|
42
58
|
<pre>
|
43
59
|
bin\
|
@@ -63,22 +79,22 @@ Skeleton
|
|
63
79
|
|
64
80
|
*proyect is replaced by the name of your proyect
|
65
81
|
|
66
|
-
TODO
|
67
|
-
----
|
68
82
|
|
69
|
-
|
70
|
-
|
83
|
+
NOTES
|
84
|
+
-----
|
85
|
+
|
86
|
+
Only tested on Windows. Should work in most operative systems.
|
71
87
|
|
72
88
|
License
|
73
89
|
-------
|
74
90
|
|
75
|
-
Copyright (c)
|
91
|
+
Copyright (c) 2015 cocot
|
76
92
|
|
77
93
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
78
94
|
this software and associated documentation files (the "Software"), to deal in
|
79
95
|
the Software with the rights to use, copy, modify, merge, publish and distribute.
|
80
96
|
This software can not be sold, can't get money from it. In case you want to
|
81
|
-
distribute it around please mention the author
|
97
|
+
distribute it around please mention the author.
|
82
98
|
|
83
99
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
84
100
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
@@ -1,16 +1,13 @@
|
|
1
|
-
{
|
2
|
-
#encoding: utf-8
|
1
|
+
{:bin/proyectI"H#!/usr/bin/env ruby
|
3
2
|
|
4
3
|
require_relative '../lib/name_of_the_proyect'
|
5
|
-
:ET:features/support/env.rbI"�#
|
6
|
-
|
7
|
-
#if you respect the convention of a Ruby proyect layout then the next lines are fixed
|
4
|
+
:ET:features/support/env.rbI"�#if you respect the convention of a Ruby proyect layout then the next lines are fixed
|
8
5
|
$LOAD_PATH << File.expand_path('../../../lib', __FILE__)
|
9
6
|
require 'name_of_the_proyect'
|
10
|
-
;T:lib/proyect.rbI"
|
11
|
-
;T:spec/spec_helper.rbI"
|
7
|
+
;T:lib/proyect.rbI"
|
8
|
+
;T:spec/spec_helper.rbI"%require 'name_of_the_proyect'
|
9
|
+
|
12
10
|
|
13
|
-
require 'name_of_the_proyect'
|
14
11
|
;T:GemfileI"csource 'https://rubygems.org'
|
15
12
|
|
16
13
|
gem 'rspec'
|
@@ -18,20 +15,18 @@ gem 'cucumber'
|
|
18
15
|
gem 'rake'
|
19
16
|
gem 'rdoc'
|
20
17
|
gem 'bundler'
|
21
|
-
;T:
|
22
|
-
|
23
|
-
#necesary for minitest tests
|
18
|
+
;T:
|
24
19
|
require 'rake/testtask'
|
25
|
-
#
|
20
|
+
#necessary for cucumber tests
|
26
21
|
require 'cucumber/rake/task'
|
27
|
-
#
|
22
|
+
#necessary for rspec tests
|
28
23
|
require 'rspec/core/rake_task'
|
29
24
|
|
30
25
|
#################TASKS#######################
|
31
26
|
|
32
27
|
#to execute minitest tests with `rake test`
|
33
28
|
Rake::TestTask.new do |t|
|
34
|
-
#search recursively under the folder test for files called test*. You have to create the folder manually.
|
29
|
+
#search recursively under the folder test for files called test*. You may have to create the folder manually.
|
35
30
|
t.pattern = 'test/**/test*.rb'
|
36
31
|
end
|
37
32
|
|
@@ -51,6 +46,61 @@ RSpec::Core::RakeTask.new do |t|
|
|
51
46
|
t.rspec_opts = ['--color']
|
52
47
|
end
|
53
48
|
|
49
|
+
desc 'to generate RDoc documentation'
|
50
|
+
task :rdoc do
|
51
|
+
system('rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output')
|
52
|
+
end
|
53
|
+
;T:rakefile_rspec_onlyI"#necessary for rspec tests
|
54
|
+
require 'rspec/core/rake_task'
|
55
|
+
|
56
|
+
#################TASKS#######################
|
57
|
+
|
58
|
+
#to execute all RSpec tests with `rake spec`
|
59
|
+
RSpec::Core::RakeTask.new do |t|
|
60
|
+
#opciones de rspec a correr
|
61
|
+
t.rspec_opts = ['--color']
|
62
|
+
end
|
63
|
+
|
64
|
+
desc 'to generate RDoc documentation'
|
65
|
+
task :rdoc do
|
66
|
+
system('rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output')
|
67
|
+
end
|
68
|
+
;T:rakefile_cucumber_onlyI"�#necessary for cucumber tests
|
69
|
+
require 'cucumber/rake/task'
|
70
|
+
|
71
|
+
#################TASKS#######################
|
72
|
+
|
73
|
+
#to execute cucumber tests with `rake cucumber`
|
74
|
+
Cucumber::Rake::Task.new
|
75
|
+
|
76
|
+
#to execute cucumber wip(work in progress) with 'rake cucumber_wip'. It will kick you if you are working in more than 3 scenarios
|
77
|
+
#remember to tag each wip scenarios with @wip above the Scenario keyword in the implicit *.feature
|
78
|
+
desc 'Executes cucumber wip'
|
79
|
+
task :cucumber_wip do
|
80
|
+
system('cucumber --format progress --color --wip --tags @wip:3')
|
81
|
+
end
|
82
|
+
|
83
|
+
desc 'to generate RDoc documentation'
|
84
|
+
task :rdoc do
|
85
|
+
system('rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output')
|
86
|
+
end
|
87
|
+
;T:rakefile_minitest_onlyI"�#necessary for minitest tests
|
88
|
+
require 'rake/testtask'
|
89
|
+
|
90
|
+
#################TASKS#######################
|
91
|
+
|
92
|
+
#to execute minitest tests with `rake test`
|
93
|
+
Rake::TestTask.new do |t|
|
94
|
+
#search recursively under the folder test for files called test*. You may have to create the folder manually.
|
95
|
+
t.pattern = 'test/**/test*.rb'
|
96
|
+
end
|
97
|
+
|
98
|
+
desc 'to generate RDoc documentation'
|
99
|
+
task :rdoc do
|
100
|
+
system('rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output')
|
101
|
+
end
|
102
|
+
;T:rakefile_cleanI"�#################TASKS#######################
|
103
|
+
|
54
104
|
desc 'to generate RDoc documentation'
|
55
105
|
task :rdoc do
|
56
106
|
system('rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output')
|
@@ -6,7 +6,6 @@ Característica: cocot construye el esqueleto del proyecto.
|
|
6
6
|
como desarrollador,
|
7
7
|
quiero poder lograr que cocot construya el esqueleto del nuevo proyecto en la ruta actual desde donde se está ejecutando la aplicación.
|
8
8
|
|
9
|
-
@wip
|
10
9
|
Escenario: genero el árbol de carpetas.
|
11
10
|
Dado que el usuario ingresó correctamente el comando para esqueletizar su nuevo proyecto, por ejemplo: "cocot Proyecto",
|
12
11
|
Cuando origino sus carpetas,
|
@@ -61,4 +61,28 @@ end
|
|
61
61
|
|
62
62
|
Dado(/^que existe la carpeta "([^"]*)" en el directorio actual,$/) do |carpeta|
|
63
63
|
Dir.exists?(carpeta).should be true
|
64
|
+
end
|
65
|
+
|
66
|
+
Entonces(/^debo ver generada además de las carpetas convencionales: '\.\/data\/', '\.\/share\/' y '\.\/ext\/'\.$/) do
|
67
|
+
nombre_del_proyecto = 'ProyectoFu'
|
68
|
+
#si estoy dentro del directorio del proyecto...
|
69
|
+
if Dir.getwd[(-(nombre_del_proyecto.length))..-1].==(nombre_del_proyecto)
|
70
|
+
existen_carpetas_extras?.should be true
|
71
|
+
else
|
72
|
+
#si no lo estoy me paso
|
73
|
+
Dir.chdir('./ProyectoFu')
|
74
|
+
existen_carpetas_extras?.should be true
|
75
|
+
#terminado el test..
|
76
|
+
Dir.chdir('..')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
#metodo helper del anterior step definition
|
81
|
+
def existen_carpetas_extras?
|
82
|
+
archivos_en_wd = Dir['./*'] #: Array
|
83
|
+
if (archivos_en_wd.include?('./data')) and (archivos_en_wd.include?('./share')) and (archivos_en_wd.include?('./ext'))
|
84
|
+
true
|
85
|
+
else
|
86
|
+
false
|
87
|
+
end
|
64
88
|
end
|
@@ -42,8 +42,14 @@ Característica: el usuario ingresa un comando y obtiene una respuesta.
|
|
42
42
|
|
43
43
|
Escenario: arranco el programa satisfactoriamente.
|
44
44
|
Cuando ejecuto el comando: "cocot ProyectoFu",
|
45
|
-
Entonces debo recibir en consola: "Building skeletal structure for ProyectoFu."
|
45
|
+
Entonces debo recibir en consola: "Building skeletal structure for ProyectoFu.".
|
46
46
|
|
47
47
|
Escenario: arranco el programa satisfactoriamente.
|
48
48
|
Cuando ejecuto el comando: "cocot 'Proyecto Fu Fu'", cocot entiende que el nombre del proyecto será "Proyecto Fu Fu",
|
49
|
-
Entonces debo recibir en consola: "Building skeletal structure for Proyecto Fu Fu."
|
49
|
+
Entonces debo recibir en consola: "Building skeletal structure for Proyecto Fu Fu.".
|
50
|
+
|
51
|
+
@wip
|
52
|
+
Escenario: paso la opción --full.
|
53
|
+
Cuando ejecuto el comando: "cocot --full ProyectoFu",
|
54
|
+
Entonces debo recibir en consola: "Building skeletal structure for ProyectoFu",
|
55
|
+
Y debo ver generada además de las carpetas convencionales: './data/', './share/' y './ext/'.
|
data/lib/cocot/cocot.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
#Clase principal de la aplicación.
|
4
4
|
class Cocot
|
5
5
|
|
6
|
-
attr_reader :salida
|
6
|
+
attr_reader :salida, :juzgador_de_argumentos
|
7
7
|
|
8
8
|
def initialize
|
9
9
|
@salida = SalidaEstándar.new($stdout)
|
@@ -56,7 +56,7 @@ class Cocot
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def mostrar_ayuda_en_pantalla
|
59
|
-
msj_de_ayuda = "cocot builds the skeleton layout of your BDD proyects
|
59
|
+
msj_de_ayuda = " cocot builds the skeleton layout of your BDD proyects.\n\n You just have to give him the name of your proyect like this: `cocot \"name of the proyect\"`.\n\n You can pass around these options:\n\n --full\t\t\tBuild extra folders suchs as \"data\", \"share\" and \"ext\".\n\n The next options works as solo and can be combined with previous one:\n\n --rspec-only\t\tStandard skeleton + folders and files needed to work with RSpec.\n --cucumber-only\tStandard skeleton + folders and files needed to work with Cucumber.\n --minitest-only\tStandard skeleton + folders and files needed to work with minitest.\n --clean\t\tStandard skeleton.\n\n If you don't use any of the previous 4 options cocot will build the standard skeleton plus folders and files needed to work with Cucumber and RSpec."
|
60
60
|
@salida.escribir(msj_de_ayuda)
|
61
61
|
end
|
62
62
|
end
|
@@ -6,8 +6,14 @@ class ConstructorDeEsqueleto
|
|
6
6
|
attr_reader :inconveniente
|
7
7
|
|
8
8
|
#todo lo que sea 'proyect' debe ser reemplazado por el nombre original del proyecto
|
9
|
-
SUBCARPETAS = %w{bin lib lib/proyect
|
10
|
-
|
9
|
+
SUBCARPETAS = %w{bin lib lib/proyect doc}
|
10
|
+
SUBCARPETAS_RSPEC = %w{spec spec/proyect}
|
11
|
+
SUBCARPETAS_CUCUMBER = %w{features features/support features/step_definitions}
|
12
|
+
SUBCARPETAS_MINITEST = %w{test}
|
13
|
+
SUBCARPETAS_FULL = %w{data share ext}
|
14
|
+
ARCHIVOS = %w{Changelog.md Gemfile Gemfile.lock License.md Rakefile ReadMe.md bin/proyect lib/proyect.rb}
|
15
|
+
ARCHIVOS_RSPEC = %w{spec/spec_helper.rb}
|
16
|
+
ARCHIVOS_CUCUMBER = %w{features/support/env.rb}
|
11
17
|
|
12
18
|
#@param nombre_del_proyecto [String]. @return [TrueClass or FalseClass].
|
13
19
|
def construir_esqueleto(nombre_del_proyecto)
|
@@ -39,25 +45,81 @@ class ConstructorDeEsqueleto
|
|
39
45
|
end
|
40
46
|
|
41
47
|
def crear_subcarpetas
|
42
|
-
|
48
|
+
# creo las comunes
|
49
|
+
crear_subcarpetas!(SUBCARPETAS)
|
50
|
+
# chequeo las extras
|
51
|
+
case ::COCOT.juzgador_de_argumentos.modo
|
52
|
+
when '--rspec-only'
|
53
|
+
crear_subcarpetas!(SUBCARPETAS_RSPEC)
|
54
|
+
when '--cucumber-only'
|
55
|
+
crear_subcarpetas!(SUBCARPETAS_CUCUMBER)
|
56
|
+
when '--minitest-only'
|
57
|
+
crear_subcarpetas!(SUBCARPETAS_MINITEST)
|
58
|
+
when nil
|
59
|
+
crear_subcarpetas!(SUBCARPETAS_RSPEC)
|
60
|
+
crear_subcarpetas!(SUBCARPETAS_CUCUMBER)
|
61
|
+
else
|
62
|
+
end
|
63
|
+
# chequeo si el usuario quiere las carpetas extras
|
64
|
+
if ::COCOT.juzgador_de_argumentos.full then crear_subcarpetas!(SUBCARPETAS_FULL) end
|
65
|
+
end
|
66
|
+
|
67
|
+
def crear_subcarpetas!(subcarpetas)
|
68
|
+
subcarpetas.collect {|carpeta| if carpeta.include?('proyect') then carpeta.sub('proyect', @nombre_del_proyecto) else carpeta end}.each do |carpeta|
|
43
69
|
Dir.mkdir(carpeta)
|
44
70
|
::COCOT.salida.escribir('.')
|
45
71
|
end
|
46
72
|
end
|
47
73
|
|
48
74
|
def crear_archivos
|
49
|
-
|
75
|
+
# creo los archivos principales
|
76
|
+
crear_archivos!(ARCHIVOS)
|
77
|
+
# dependiendo de las opciones pasadas creo resto de archivos
|
78
|
+
case ::COCOT.juzgador_de_argumentos.modo
|
79
|
+
when '--rspec-only'
|
80
|
+
crear_archivos!(ARCHIVOS_RSPEC)
|
81
|
+
when '--cucumber-only'
|
82
|
+
crear_archivos!(ARCHIVOS_CUCUMBER)
|
83
|
+
when nil
|
84
|
+
crear_archivos!(ARCHIVOS_RSPEC)
|
85
|
+
crear_archivos!(ARCHIVOS_CUCUMBER)
|
86
|
+
end
|
87
|
+
# fin de creación de archivos
|
88
|
+
::COCOT.salida.escribir("\n")
|
89
|
+
end
|
90
|
+
|
91
|
+
def crear_archivos!(archivos)
|
92
|
+
archivos.collect {|archivo| if archivo.include?('proyect') then archivo.sub('proyect', @nombre_del_proyecto) else archivo end}.each do |archivo|
|
50
93
|
File.new(archivo, 'w+').close
|
51
94
|
::COCOT.salida.escribir('.')
|
52
95
|
end
|
53
|
-
::COCOT.salida.escribir("\n")
|
54
96
|
end
|
55
97
|
|
56
98
|
def escribir_archivos
|
57
99
|
obtener_contenido_de_archivos() #: Hash
|
58
100
|
@contenido_de_archivos.each_pair do |nombre_del_archivo, contenido|
|
59
|
-
|
60
|
-
|
101
|
+
_nombre_del_archivo = nombre_del_archivo.to_s.sub('proyect', @nombre_del_proyecto)
|
102
|
+
# chequeo si el archivo existe
|
103
|
+
if(File.exist?(_nombre_del_archivo))
|
104
|
+
# existe, lo escribo
|
105
|
+
File.open(_nombre_del_archivo, 'w+') do |archivo|
|
106
|
+
archivo.write(contenido.gsub('name_of_the_proyect', @nombre_del_proyecto))
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
# por ultimo escribo el Rakefile
|
111
|
+
File.open('Rakefile', 'w+') do |archivo|
|
112
|
+
case ::COCOT.juzgador_de_argumentos.modo
|
113
|
+
when '--rspec-only'
|
114
|
+
archivo.write(@contenido_de_archivos[:rakefile_rspec_only])
|
115
|
+
when '--cucumber-only'
|
116
|
+
archivo.write(@contenido_de_archivos[:rakefile_cucumber_only])
|
117
|
+
when '--minitest-only'
|
118
|
+
archivo.write(@contenido_de_archivos[:rakefile_minitest_only])
|
119
|
+
when '--clean'
|
120
|
+
archivo.write(@contenido_de_archivos[:rakefile_clean])
|
121
|
+
else
|
122
|
+
archivo.write(@contenido_de_archivos[:rakefile])
|
61
123
|
end
|
62
124
|
end
|
63
125
|
end
|
@@ -7,15 +7,12 @@ COCOT::CONTENIDO_DE_ARCHIVOS = {}
|
|
7
7
|
COCOT::CONTENIDO_DE_ARCHIVOS[:'bin/proyect'] = \
|
8
8
|
<<STR
|
9
9
|
#!/usr/bin/env ruby
|
10
|
-
#encoding: utf-8
|
11
10
|
|
12
11
|
require_relative '../lib/name_of_the_proyect'
|
13
12
|
STR
|
14
13
|
|
15
14
|
COCOT::CONTENIDO_DE_ARCHIVOS[:'features/support/env.rb'] = \
|
16
15
|
<<STR
|
17
|
-
#encoding: utf-8
|
18
|
-
|
19
16
|
#if you respect the convention of a Ruby proyect layout then the next lines are fixed
|
20
17
|
$LOAD_PATH << File.expand_path('../../../lib', __FILE__)
|
21
18
|
require 'name_of_the_proyect'
|
@@ -23,14 +20,14 @@ STR
|
|
23
20
|
|
24
21
|
COCOT::CONTENIDO_DE_ARCHIVOS[:'lib/proyect.rb'] = \
|
25
22
|
<<STR
|
26
|
-
|
23
|
+
|
27
24
|
STR
|
28
25
|
|
29
26
|
COCOT::CONTENIDO_DE_ARCHIVOS[:'spec/spec_helper.rb'] = \
|
30
27
|
<<STR
|
31
|
-
#encoding: utf-8
|
32
|
-
|
33
28
|
require 'name_of_the_proyect'
|
29
|
+
|
30
|
+
|
34
31
|
STR
|
35
32
|
|
36
33
|
COCOT::CONTENIDO_DE_ARCHIVOS[:'Gemfile'] = \
|
@@ -44,22 +41,20 @@ gem 'rdoc'
|
|
44
41
|
gem 'bundler'
|
45
42
|
STR
|
46
43
|
|
47
|
-
COCOT::CONTENIDO_DE_ARCHIVOS[:
|
44
|
+
COCOT::CONTENIDO_DE_ARCHIVOS[:rakefile] = \
|
48
45
|
<<STR
|
49
|
-
#
|
50
|
-
|
51
|
-
#necesary for minitest tests
|
46
|
+
#necessary for minitest tests
|
52
47
|
require 'rake/testtask'
|
53
|
-
#
|
48
|
+
#necessary for cucumber tests
|
54
49
|
require 'cucumber/rake/task'
|
55
|
-
#
|
50
|
+
#necessary for rspec tests
|
56
51
|
require 'rspec/core/rake_task'
|
57
52
|
|
58
53
|
#################TASKS#######################
|
59
54
|
|
60
55
|
#to execute minitest tests with `rake test`
|
61
56
|
Rake::TestTask.new do |t|
|
62
|
-
#search recursively under the folder test for files called test*. You have to create the folder manually.
|
57
|
+
#search recursively under the folder test for files called test*. You may have to create the folder manually.
|
63
58
|
t.pattern = 'test/**/test*.rb'
|
64
59
|
end
|
65
60
|
|
@@ -79,6 +74,77 @@ RSpec::Core::RakeTask.new do |t|
|
|
79
74
|
t.rspec_opts = ['--color']
|
80
75
|
end
|
81
76
|
|
77
|
+
desc 'to generate RDoc documentation'
|
78
|
+
task :rdoc do
|
79
|
+
system('rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output')
|
80
|
+
end
|
81
|
+
STR
|
82
|
+
|
83
|
+
COCOT::CONTENIDO_DE_ARCHIVOS[:rakefile_rspec_only] = \
|
84
|
+
<<STR
|
85
|
+
#necessary for rspec tests
|
86
|
+
require 'rspec/core/rake_task'
|
87
|
+
|
88
|
+
#################TASKS#######################
|
89
|
+
|
90
|
+
#to execute all RSpec tests with `rake spec`
|
91
|
+
RSpec::Core::RakeTask.new do |t|
|
92
|
+
#opciones de rspec a correr
|
93
|
+
t.rspec_opts = ['--color']
|
94
|
+
end
|
95
|
+
|
96
|
+
desc 'to generate RDoc documentation'
|
97
|
+
task :rdoc do
|
98
|
+
system('rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output')
|
99
|
+
end
|
100
|
+
STR
|
101
|
+
|
102
|
+
COCOT::CONTENIDO_DE_ARCHIVOS[:rakefile_cucumber_only] = \
|
103
|
+
<<STR
|
104
|
+
#necessary for cucumber tests
|
105
|
+
require 'cucumber/rake/task'
|
106
|
+
|
107
|
+
#################TASKS#######################
|
108
|
+
|
109
|
+
#to execute cucumber tests with `rake cucumber`
|
110
|
+
Cucumber::Rake::Task.new
|
111
|
+
|
112
|
+
#to execute cucumber wip(work in progress) with 'rake cucumber_wip'. It will kick you if you are working in more than 3 scenarios
|
113
|
+
#remember to tag each wip scenarios with @wip above the Scenario keyword in the implicit *.feature
|
114
|
+
desc 'Executes cucumber wip'
|
115
|
+
task :cucumber_wip do
|
116
|
+
system('cucumber --format progress --color --wip --tags @wip:3')
|
117
|
+
end
|
118
|
+
|
119
|
+
desc 'to generate RDoc documentation'
|
120
|
+
task :rdoc do
|
121
|
+
system('rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output')
|
122
|
+
end
|
123
|
+
STR
|
124
|
+
|
125
|
+
COCOT::CONTENIDO_DE_ARCHIVOS[:rakefile_minitest_only] = \
|
126
|
+
<<STR
|
127
|
+
#necessary for minitest tests
|
128
|
+
require 'rake/testtask'
|
129
|
+
|
130
|
+
#################TASKS#######################
|
131
|
+
|
132
|
+
#to execute minitest tests with `rake test`
|
133
|
+
Rake::TestTask.new do |t|
|
134
|
+
#search recursively under the folder test for files called test*. You may have to create the folder manually.
|
135
|
+
t.pattern = 'test/**/test*.rb'
|
136
|
+
end
|
137
|
+
|
138
|
+
desc 'to generate RDoc documentation'
|
139
|
+
task :rdoc do
|
140
|
+
system('rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output')
|
141
|
+
end
|
142
|
+
STR
|
143
|
+
|
144
|
+
COCOT::CONTENIDO_DE_ARCHIVOS[:rakefile_clean] = \
|
145
|
+
<<STR
|
146
|
+
#################TASKS#######################
|
147
|
+
|
82
148
|
desc 'to generate RDoc documentation'
|
83
149
|
task :rdoc do
|
84
150
|
system('rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output')
|
@@ -3,24 +3,51 @@
|
|
3
3
|
class JuzgadorDeArgumentos
|
4
4
|
|
5
5
|
ERRORES_CONOCIDOS = {ningun_argumento: "Error: cocot needs to know the name of the further proyect. `cocot '<name_of_the_proyect>'`.\n", \
|
6
|
-
dos_o_mas_argumentos_como_nombre: "Error: cocot just need one argument: the name of the further proyect. If its name have more than a word you must put these inside
|
7
|
-
|
6
|
+
dos_o_mas_argumentos_como_nombre: "Error: cocot just need one argument: the name of the further proyect. If its name have more than a word you must put these inside "".\n"}
|
7
|
+
|
8
|
+
attr_reader :full, :modo
|
8
9
|
|
9
10
|
#@param argumentos [Array].
|
10
11
|
def juzgar_argumentos(argumentos)
|
11
12
|
if argumentos.length.==(0)
|
12
13
|
@error_presente_en_argumentos = :ningun_argumento #: Symbol
|
13
|
-
elsif
|
14
|
-
@error_presente_en_argumentos = :ayuda_y_esqueletizado_invocados_a_la_vez
|
15
|
-
elsif cantidad_de_argumentos_sin_help.>(1)
|
16
|
-
@error_presente_en_argumentos = :dos_o_mas_argumentos_como_nombre
|
17
|
-
elsif argumentos[0].==('--help')
|
14
|
+
elsif argumentos.include?('--help')
|
18
15
|
@ayuda_solicitada = true
|
19
16
|
else
|
20
|
-
|
17
|
+
# voy a limpiar los argumentos opciones para que me quede(n) el potencial nombre del proyecto
|
18
|
+
if(_argumentos = argumentos.select {|i| i[0..1].!=('--')}).length == 1
|
19
|
+
@full = \
|
20
|
+
if argumentos.include?('--full')
|
21
|
+
::COCOT.salida.escribir("\"Full\" option detected.\n")
|
22
|
+
true
|
23
|
+
else
|
24
|
+
false
|
25
|
+
end
|
26
|
+
@modo = \
|
27
|
+
if argumentos.include?('--rspec-only')
|
28
|
+
::COCOT.salida.escribir("\"RSpec only\" option detected.\n")
|
29
|
+
'--rspec-only'
|
30
|
+
elsif argumentos.include?('--cucumber-only')
|
31
|
+
::COCOT.salida.escribir("\"Cucumber only\" option detected.\n")
|
32
|
+
'--cucumber-only'
|
33
|
+
elsif argumentos.include?('--minitest-only')
|
34
|
+
::COCOT.salida.escribir("\"Minitest only\" option detected.\n")
|
35
|
+
'--minitest-only'
|
36
|
+
elsif argumentos.include?('--clean')
|
37
|
+
::COCOT.salida.escribir("\"Clean\" option detected.\n")
|
38
|
+
'--clean'
|
39
|
+
else
|
40
|
+
::COCOT.salida.escribir("Attempting to make a normal instalation(RSpec and Cucumber support).\n")
|
41
|
+
nil
|
42
|
+
end
|
43
|
+
@nombre_del_proyecto = _argumentos[0].strip
|
44
|
+
else
|
45
|
+
@error_presente_en_argumentos = :dos_o_mas_argumentos_como_nombre #: Symbol
|
46
|
+
end
|
21
47
|
end
|
22
48
|
end
|
23
49
|
|
50
|
+
|
24
51
|
def hubo_algun_error?
|
25
52
|
true if @error_presente_en_argumentos
|
26
53
|
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damián M. González
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Skeleton builder of a new proyect which
|
14
|
-
application build the folders and
|
15
|
-
|
16
|
-
RSpec(perhaps also minitest). This have no
|
13
|
+
description: Skeleton builder of a new proyect which could be developed with BDD/TDD.
|
14
|
+
This application build the folders and files needed to start developing fast a new
|
15
|
+
proyect potentially BDD/TDD oriented. For that, it's supposed that will be used
|
16
|
+
Cucumber and/or RSpec(perhaps also minitest). This have no relationship with Rails.
|
17
17
|
email:
|
18
18
|
executables:
|
19
19
|
- cocot
|
20
20
|
extensions: []
|
21
21
|
extra_rdoc_files: []
|
22
22
|
files:
|
23
|
-
- bin/cocot
|
24
|
-
- data/contenido_de_archivos.cocot
|
25
23
|
- Changelog.md
|
26
24
|
- License.md
|
27
25
|
- ReadMe.md
|
26
|
+
- bin/cocot
|
27
|
+
- data/contenido_de_archivos.cocot
|
28
28
|
- features/cocot_construye_esqueleto.feature
|
29
|
-
- features/usuario_ingresa_comando.feature
|
30
29
|
- features/step_definitions/cocot_construye_esqueleto_steps.rb
|
31
30
|
- features/step_definitions/usuario_ingresa_comando_steps.rb
|
32
31
|
- features/support/cocot_helpers.rb
|
33
32
|
- features/support/env.rb
|
33
|
+
- features/usuario_ingresa_comando.feature
|
34
|
+
- lib/cocot.rb
|
34
35
|
- lib/cocot/cocot.rb
|
35
36
|
- lib/cocot/constructor_de_esqueleto.rb
|
36
37
|
- lib/cocot/contenido_de_archivos.rb
|
37
38
|
- lib/cocot/juzgador_de_argumentos.rb
|
38
39
|
- lib/cocot/salida_estandar.rb
|
39
40
|
- lib/cocot/salvador_de_contenidos.rb
|
40
|
-
- lib/cocot.rb
|
41
41
|
- spec/cocot/cocot_spec.rb
|
42
42
|
- spec/cocot/juzgador_de_argumentos_spec.rb
|
43
43
|
- spec/cocot/salida_estandar_spec.rb
|
@@ -52,18 +52,18 @@ require_paths:
|
|
52
52
|
- lib
|
53
53
|
required_ruby_version: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- -
|
55
|
+
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0'
|
58
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
64
|
rubyforge_project:
|
65
|
-
rubygems_version: 2.
|
65
|
+
rubygems_version: 2.2.3
|
66
66
|
signing_key:
|
67
67
|
specification_version: 4
|
68
|
-
summary: Skeleton builder of a new proyect which
|
68
|
+
summary: Skeleton builder of a new proyect which could be developed with BDD/TDD.
|
69
69
|
test_files: []
|