testgen 0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ tmp
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm 1.9.2-p290
data/ChangeLog ADDED
@@ -0,0 +1,3 @@
1
+ === Version 0.1 / 2011-09-27
2
+ * Initial release that contains a simple project generator
3
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in testgen.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'cucumber'
4
+ require 'cucumber/rake/task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec) do |spec|
7
+ spec.ruby_opts = "-I lib:spec"
8
+ spec.pattern = 'spec/**/*_spec.rb'
9
+ end
10
+ task :spec
11
+
12
+ Cucumber::Rake::Task.new(:features, "Run features") do |t|
13
+ t.profile = 'default'
14
+ end
15
+
16
+ task :lib do
17
+ $LOAD_PATH.unshift(File.expand_path("lib", File.dirname(__FILE__)))
18
+ end
19
+
20
+ desc 'Run all specs and cukes'
21
+ task :test => ['spec', 'features']
22
+
23
+ task :default => :test
data/Readme.md ADDED
@@ -0,0 +1,10 @@
1
+ # TestGen
2
+
3
+ A gem that contains generators that create things testers need.
4
+
5
+ Currently it only generates a cucumber project. You can do this by executing:
6
+
7
+ testgen project <project_name>
8
+
9
+ This command will create a project in the <em>project_name</em> directory with the files needed to begin
10
+ developing cucumber features.
data/bin/testgen ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'testgen/cli'
4
+ TestGen::CLI.start
data/cucumber.yml ADDED
@@ -0,0 +1,2 @@
1
+ default: --no-source --color --format pretty
2
+ autotest: --no-source --color --format pretty
@@ -0,0 +1,3 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'lib'))
2
+
3
+ require 'aruba/cucumber'
@@ -0,0 +1,6 @@
1
+ require 'fileutils'
2
+
3
+ After do
4
+ dir = File.join(File.dirname(__FILE__), '../../', 'tmp/aruba/sample')
5
+ FileUtils.rm_rf dir
6
+ end
@@ -0,0 +1,41 @@
1
+ Feature: Generating a project with TestGen
2
+
3
+ Background:
4
+ When I run `testgen project sample`
5
+
6
+ Scenario: Creating the top level project directory
7
+ Then a directory named "sample" should exist
8
+
9
+ Scenario: Generating the cucumber.yml file
10
+ Then a file named "sample/cucumber.yml" should exist
11
+ And the file "sample/cucumber.yml" should contain "default: --no-source --color --format pretty"
12
+
13
+ Scenario: Generating the Gemfile file
14
+ Then a file named "sample/Gemfile" should exist
15
+ And the file "sample/Gemfile" should contain "gem 'cucumber'"
16
+ And the file "sample/Gemfile" should contain "gem 'rspec'"
17
+
18
+ Scenario: Generating the Rakefile file
19
+ Then a file named "sample/Rakefile" should exist
20
+ And the file "sample/Rakefile" should contain "Cucumber::Rake::Task.new(:features)"
21
+ And the file "sample/Rakefile" should contain exactly:
22
+ """
23
+ require 'rubygems'
24
+ require 'cucumber'
25
+ require 'cucumber/rake/task'
26
+
27
+ Cucumber::Rake::Task.new(:features) do |t|
28
+ t.profile 'default'
29
+ end
30
+
31
+ task :default => :features
32
+ """
33
+ Scenario: Creating the features set of directories
34
+ Then the following directories should exist:
35
+ | sample/features |
36
+ | sample/features/support |
37
+ | sample/features/step_definitions |
38
+
39
+ Scenario: Generating the env.rb file
40
+ Then a file named "sample/features/support/env.rb" should exist
41
+ And the file "sample/features/support/env.rb" should contain "require 'rspec-expectations'"
@@ -0,0 +1,11 @@
1
+ require 'thor'
2
+ require 'testgen/generators/project'
3
+
4
+ module TestGen
5
+ class CLI < Thor
6
+ desc "project <project_name>", "Create a new test project"
7
+ def project(name)
8
+ TestGen::Generators::Project.start([name])
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ gem 'cucumber'
2
+ gem 'rspec'
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'cucumber'
3
+ require 'cucumber/rake/task'
4
+
5
+ Cucumber::Rake::Task.new(:features) do |t|
6
+ t.profile 'default'
7
+ end
8
+
9
+ task :default => :features
@@ -0,0 +1 @@
1
+ default: --no-source --color --format pretty
@@ -0,0 +1 @@
1
+ require 'rspec-expectations'
@@ -0,0 +1,43 @@
1
+ require 'thor/group'
2
+ require 'sys/uname'
3
+
4
+ module TestGen
5
+ module Generators
6
+ class Project < Thor::Group
7
+ include Thor::Actions
8
+
9
+ argument :name, :type => :string, :desc => 'The name of the project'
10
+ desc "Generates a project structure for testing with Cucumber"
11
+
12
+ def self.source_root
13
+ File.dirname(__FILE__) + "/project"
14
+ end
15
+
16
+ def create_top_directory
17
+ empty_directory(name)
18
+ end
19
+
20
+ def copy_cucumber_yml
21
+ template("cucumber.yml", "#{name}/cucumber.yml")
22
+ end
23
+
24
+ def copy_gemfile
25
+ copy_file "Gemfile", "#{name}/Gemfile"
26
+ end
27
+
28
+ def copy_rakefile
29
+ copy_file "Rakefile", "#{name}/Rakefile"
30
+ end
31
+
32
+ def create_cucumber_directories
33
+ empty_directory("#{name}/features")
34
+ empty_directory("#{name}/features/support")
35
+ empty_directory("#{name}/features/step_definitions")
36
+ end
37
+
38
+ def copy_env
39
+ copy_file "env.rb", "#{name}/features/support/env.rb"
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,3 @@
1
+ module TestGen
2
+ VERSION = "0.1"
3
+ end
data/lib/testgen.rb ADDED
@@ -0,0 +1,2 @@
1
+ require "testgen/version"
2
+ require 'testgen/cli'
data/testgen.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "testgen/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "testgen"
7
+ s.version = TestGen::VERSION
8
+ s.authors = ["Jeffrey S. Morgan"]
9
+ s.email = ["jeff.morgan@leandog.com"]
10
+ s.homepage = "http://github.com/cheezy/testgen"
11
+ s.summary = %q{Generators for testers using Cucumber}
12
+ s.description = %q{A collection of generators build things for testers using Cucumber}
13
+
14
+ s.rubyforge_project = "testgen"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency 'thor', '>=0.14.6'
22
+ s.add_dependency 'cucumber', '>=1.0.0'
23
+ s.add_dependency 'rspec', '>=2.6.0'
24
+ s.add_dependency 'sys-uname'
25
+
26
+ s.add_development_dependency 'aruba'
27
+ end
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: testgen
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: "0.1"
6
+ platform: ruby
7
+ authors:
8
+ - Jeffrey S. Morgan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-09-27 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: thor
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.14.6
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: cucumber
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 1.0.0
35
+ type: :runtime
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: rspec
39
+ prerelease: false
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 2.6.0
46
+ type: :runtime
47
+ version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: sys-uname
50
+ prerelease: false
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ type: :runtime
58
+ version_requirements: *id004
59
+ - !ruby/object:Gem::Dependency
60
+ name: aruba
61
+ prerelease: false
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ type: :development
69
+ version_requirements: *id005
70
+ description: A collection of generators build things for testers using Cucumber
71
+ email:
72
+ - jeff.morgan@leandog.com
73
+ executables:
74
+ - testgen
75
+ extensions: []
76
+
77
+ extra_rdoc_files: []
78
+
79
+ files:
80
+ - .gitignore
81
+ - .rvmrc
82
+ - ChangeLog
83
+ - Gemfile
84
+ - Rakefile
85
+ - Readme.md
86
+ - bin/testgen
87
+ - cucumber.yml
88
+ - features/support/env.rb
89
+ - features/support/hooks.rb
90
+ - features/testgen_project.feature
91
+ - lib/testgen.rb
92
+ - lib/testgen/cli.rb
93
+ - lib/testgen/generators/project.rb
94
+ - lib/testgen/generators/project/Gemfile
95
+ - lib/testgen/generators/project/Rakefile
96
+ - lib/testgen/generators/project/cucumber.yml
97
+ - lib/testgen/generators/project/env.rb
98
+ - lib/testgen/version.rb
99
+ - testgen.gemspec
100
+ homepage: http://github.com/cheezy/testgen
101
+ licenses: []
102
+
103
+ post_install_message:
104
+ rdoc_options: []
105
+
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: "0"
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: "0"
120
+ requirements: []
121
+
122
+ rubyforge_project: testgen
123
+ rubygems_version: 1.8.10
124
+ signing_key:
125
+ specification_version: 3
126
+ summary: Generators for testers using Cucumber
127
+ test_files:
128
+ - features/support/env.rb
129
+ - features/support/hooks.rb
130
+ - features/testgen_project.feature