Skip to content

Commit

Permalink
Version 1.1.0
Browse files Browse the repository at this point in the history
* Changed LICENSE.md
* Changed ReadMe.md
* Files generated does not have anymore "\#encoding: utf-8" on its first line
* New options added: --full, --rspec-only, --cucumber-only, --minitest-only, --clean
* Rakefile content is generated according to the options passed
* Improved feedback from cocot
  • Loading branch information
damian-m-g committed Apr 12, 2015
1 parent bb6a9c7 commit 7814eed
Show file tree
Hide file tree
Showing 11 changed files with 322 additions and 63 deletions.
9 changes: 9 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
1.1.0
-----
* Changed LICENSE.md
* Changed ReadMe.md
* Files generated does not have anymore "\#encoding: utf-8" on its first line
* New options added: --full, --rspec-only, --cucumber-only, --minitest-only, --clean
* Rakefile content is generated according to the options passed
* Improved feedback from cocot

1.0.1
-----
* Changed LICENSE.md
Expand Down
4 changes: 2 additions & 2 deletions License.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Copyright (c) 2013 cocot
Copyright (c) 2015 cocot

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software with the rights to use, copy, modify, merge, publish and distribute.
This software can not be sold, can't get money from it. In case you want to
distribute it around please mention the author, thank you.
distribute it around please mention the author.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
Expand Down
44 changes: 30 additions & 14 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
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.
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.

It supposes that you...
-----------------------

use RSpec and Cucumber for BDD developing, so it creates the conventional files and folders for work with.
may use **RSpec** and/or **Cucumber** and/or **minitest** for **BDD** developing, so it creates the conventional files and folders for work with.

How can I install it?
-----------------
Expand All @@ -21,23 +21,39 @@ How can I use it?
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`.
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`.

Rakefile
--------

**cocot** packs few pre-defined **rake** tasks:
**cocot** packs few pre-defined **rake** tasks on standard mode:

* `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
* `rake rdoc` : same like `rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output`, create a doc folder with **RDoc** documentation

Skeleton
--------
If you pass some option(see below) to the program, the rake task list may be reduced.

Options
-------

Version 1.1.0 introduces few nice options:

* **--full** Builds these extra-folders: "share", "ext" and "data". If your project is kind of big, you may use them for order.

**cocot** builds:
Next ones can be played as solo optionally in conjunction with the above one:

* **--rspec-only** Builds the standard skeleton minus the folders and files related to Cucumber.
* **--cucumber-only** Builds the standard skeleton minus the folders and files related to RSpec.
* **--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.
* **--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.

Standard skeleton
-----------------

By default **cocot** builds support for **RSpec** and **Cucumber**:

<pre>
bin\
Expand All @@ -63,22 +79,22 @@ Skeleton

*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**.
NOTES
-----

Only tested on Windows. Should work in most operative systems.

License
-------

Copyright (c) 2013 cocot
Copyright (c) 2015 cocot

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software with the rights to use, copy, modify, merge, publish and distribute.
This software can not be sold, can't get money from it. In case you want to
distribute it around please mention the author, thank you.
distribute it around please mention the author.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
Expand Down
78 changes: 64 additions & 14 deletions data/contenido_de_archivos.cocot
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
{ :bin/proyectI"Y#!/usr/bin/env ruby
#encoding: utf-8
{:bin/proyectI"H#!/usr/bin/env ruby

require_relative '../lib/name_of_the_proyect'
:ET:features/support/env.rbI"�#encoding: utf-8

#if you respect the convention of a Ruby proyect layout then the next lines are fixed
:ET:features/support/env.rbI"�#if you respect the convention of a Ruby proyect layout then the next lines are fixed
$LOAD_PATH << File.expand_path('../../../lib', __FILE__)
require 'name_of_the_proyect'
;T:lib/proyect.rbI"#encoding: utf-8
;T:spec/spec_helper.rbI"5#encoding: utf-8
;T:lib/proyect.rbI"
;T:spec/spec_helper.rbI"%require 'name_of_the_proyect'


require 'name_of_the_proyect'
;T: GemfileI"csource 'https://rubygems.org'

gem 'rspec'
gem 'cucumber'
gem 'rake'
gem 'rdoc'
gem 'bundler'
;T:RakefileI"�#encoding: utf-8

#necesary for minitest tests
;T:rakefileI"v#necessary for minitest tests
require 'rake/testtask'
#necesary for cucumber tests
#necessary for cucumber tests
require 'cucumber/rake/task'
#necesary for rspec tests
#necessary for rspec tests
require 'rspec/core/rake_task'

#################TASKS#######################

#to execute minitest tests with `rake test`
Rake::TestTask.new do |t|
#search recursively under the folder test for files called test*. You have to create the folder manually.
#search recursively under the folder test for files called test*. You may have to create the folder manually.
t.pattern = 'test/**/test*.rb'
end

Expand All @@ -51,6 +46,61 @@ RSpec::Core::RakeTask.new do |t|
t.rspec_opts = ['--color']
end

desc 'to generate RDoc documentation'
task :rdoc do
system('rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output')
end
;T:rakefile_rspec_onlyI"#necessary for rspec tests
require 'rspec/core/rake_task'

#################TASKS#######################

#to execute all RSpec tests with `rake spec`
RSpec::Core::RakeTask.new do |t|
#opciones de rspec a correr
t.rspec_opts = ['--color']
end

desc 'to generate RDoc documentation'
task :rdoc do
system('rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output')
end
;T:rakefile_cucumber_onlyI"�#necessary for cucumber tests
require 'cucumber/rake/task'

#################TASKS#######################

#to execute cucumber tests with `rake cucumber`
Cucumber::Rake::Task.new

#to execute cucumber wip(work in progress) with 'rake cucumber_wip'. It will kick you if you are working in more than 3 scenarios
#remember to tag each wip scenarios with @wip above the Scenario keyword in the implicit *.feature
desc 'Executes cucumber wip'
task :cucumber_wip do
system('cucumber --format progress --color --wip --tags @wip:3')
end

desc 'to generate RDoc documentation'
task :rdoc do
system('rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output')
end
;T:rakefile_minitest_onlyI"�#necessary for minitest tests
require 'rake/testtask'

#################TASKS#######################

#to execute minitest tests with `rake test`
Rake::TestTask.new do |t|
#search recursively under the folder test for files called test*. You may have to create the folder manually.
t.pattern = 'test/**/test*.rb'
end

desc 'to generate RDoc documentation'
task :rdoc do
system('rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output')
end
;T:rakefile_cleanI"�#################TASKS#######################

desc 'to generate RDoc documentation'
task :rdoc do
system('rdoc --all --tab-width=1 --format=darkfish --op=doc --force-output')
Expand Down
1 change: 0 additions & 1 deletion features/cocot_construye_esqueleto.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Característica: cocot construye el esqueleto del proyecto.
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,
Expand Down
24 changes: 24 additions & 0 deletions features/step_definitions/usuario_ingresa_comando_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,28 @@

Dado(/^que existe la carpeta "([^"]*)" en el directorio actual,$/) do |carpeta|
Dir.exists?(carpeta).should be true
end

Entonces(/^debo ver generada además de las carpetas convencionales: '\.\/data\/', '\.\/share\/' y '\.\/ext\/'\.$/) do
nombre_del_proyecto = 'ProyectoFu'
#si estoy dentro del directorio del proyecto...
if Dir.getwd[(-(nombre_del_proyecto.length))..-1].==(nombre_del_proyecto)
existen_carpetas_extras?.should be true
else
#si no lo estoy me paso
Dir.chdir('./ProyectoFu')
existen_carpetas_extras?.should be true
#terminado el test..
Dir.chdir('..')
end
end

#metodo helper del anterior step definition
def existen_carpetas_extras?
archivos_en_wd = Dir['./*'] #: Array
if (archivos_en_wd.include?('./data')) and (archivos_en_wd.include?('./share')) and (archivos_en_wd.include?('./ext'))
true
else
false
end
end
10 changes: 8 additions & 2 deletions features/usuario_ingresa_comando.feature
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,14 @@ Característica: el usuario ingresa un comando y obtiene una respuesta.

Escenario: arranco el programa satisfactoriamente.
Cuando ejecuto el comando: "cocot ProyectoFu",
Entonces debo recibir en consola: "Building skeletal structure for ProyectoFu.",
Entonces debo recibir en consola: "Building skeletal structure for ProyectoFu.".

Escenario: arranco el programa satisfactoriamente.
Cuando ejecuto el comando: "cocot 'Proyecto Fu Fu'", cocot entiende que el nombre del proyecto será "Proyecto Fu Fu",
Entonces debo recibir en consola: "Building skeletal structure for Proyecto Fu Fu.",
Entonces debo recibir en consola: "Building skeletal structure for Proyecto Fu Fu.".

@wip
Escenario: paso la opción --full.
Cuando ejecuto el comando: "cocot --full ProyectoFu",
Entonces debo recibir en consola: "Building skeletal structure for ProyectoFu",
Y debo ver generada además de las carpetas convencionales: './data/', './share/' y './ext/'.
4 changes: 2 additions & 2 deletions lib/cocot/cocot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#Clase principal de la aplicación.
class Cocot

attr_reader :salida
attr_reader :salida, :juzgador_de_argumentos

def initialize
@salida = SalidaEstándar.new($stdout)
Expand Down Expand Up @@ -56,7 +56,7 @@ def construir_esqueleto
end

def mostrar_ayuda_en_pantalla
msj_de_ayuda = "cocot builds the skeleton layout of your BDD proyects. You just have to give him the name of your proyect like this: `cocot \"name of the proyect\"`.\n"
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."
@salida.escribir(msj_de_ayuda)
end
end
Loading

0 comments on commit 7814eed

Please sign in to comment.