cucumber_off_rails 0.0.1 → 0.0.2

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.
Files changed (26) hide show
  1. data/Changelog.markdown +9 -0
  2. data/README.rdoc +7 -3
  3. data/Rakefile +0 -2
  4. data/VERSION +1 -1
  5. data/bin/cucumber_off_rails +5 -1
  6. data/cucumber_off_rails.gemspec +93 -0
  7. data/lib/cucumber_off_rails.rb +6 -0
  8. data/lib/cucumber_off_rails/generator.rb +77 -0
  9. data/lib/cucumber_off_rails/generator/application.rb +38 -0
  10. data/lib/cucumber_off_rails/generator/options.rb +36 -0
  11. data/lib/{generators/cucumber_off_rails → cucumber_off_rails}/templates/Gemfile +0 -0
  12. data/lib/{generators/cucumber_off_rails → cucumber_off_rails}/templates/Rakefile +0 -0
  13. data/lib/{generators/cucumber_off_rails → cucumber_off_rails}/templates/features/.htaccess +0 -0
  14. data/lib/{generators/cucumber_off_rails → cucumber_off_rails}/templates/features/sample.feature +0 -0
  15. data/lib/{generators/cucumber_off_rails → cucumber_off_rails}/templates/features/step_definitions/debugging_steps.rb +0 -0
  16. data/lib/{generators/cucumber_off_rails → cucumber_off_rails}/templates/features/step_definitions/linking_steps.rb +0 -0
  17. data/lib/{generators/cucumber_off_rails → cucumber_off_rails}/templates/features/step_definitions/login_steps.rb +0 -0
  18. data/lib/{generators/cucumber_off_rails → cucumber_off_rails}/templates/features/step_definitions/selector_steps.rb +0 -0
  19. data/lib/{generators/cucumber_off_rails/templates/features/step_definitions/validations_steps.rb → cucumber_off_rails/templates/features/step_definitions/validation_steps.rb} +0 -0
  20. data/lib/{generators/cucumber_off_rails → cucumber_off_rails}/templates/features/support/env.rb +0 -0
  21. data/lib/{generators/cucumber_off_rails → cucumber_off_rails}/templates/features/support/hooks.rb +0 -0
  22. data/lib/{generators/cucumber_off_rails → cucumber_off_rails}/templates/features/support/paths.rb +0 -0
  23. data/lib/{generators/cucumber_off_rails → cucumber_off_rails}/templates/features/support/selectors.rb +0 -0
  24. metadata +21 -18
  25. data/lib/generators/cucumber_off_rails/install_generator.rb +0 -1
  26. data/lib/generators/cucumber_off_rails/update_generator.rb +0 -0
@@ -0,0 +1,9 @@
1
+ # 0.0.2
2
+
3
+ * Generator works with no arguments
4
+ * Project works with manual configuration and without many of the features
5
+
6
+ # 0.0.1
7
+
8
+ * Initial commit
9
+ * Nothing works at all
@@ -2,13 +2,15 @@
2
2
 
3
3
  Nondestructive cucumber testing without the rails stack. Setup to work with the hudson/jenkins ci system to run regular tests on your project. The capybara-mechanize gem is used to fetch remote sites and capybara bathcers are used to verify the data.
4
4
 
5
+ This gem is currently in a very basic state, some ways away from even a 0.1.x release. You will have to manually configure quite a bit to get everything working. The most important parts are the capybara app and user login information in the support/env file. Also take a look at the login steps in the support/hooks file. They may need to be changed depending on the setup of your site.
6
+
5
7
  = install
6
8
 
7
9
  Run the installation generator
8
10
 
9
- cucumber_off_rails install --site http://yoursitehere.com
11
+ cucumber_off_rails install
10
12
 
11
- This will generate a basic cucumber environment.
13
+ This will generate a basic cucumber environment in the folder cucumber_off_rails_project
12
14
 
13
15
  = future work
14
16
 
@@ -16,9 +18,11 @@ This will generate a basic cucumber environment.
16
18
  * Add login support
17
19
  * Version the gems
18
20
  * Add support to specify the site in the generator
19
- * Write the generators
20
21
  * Setup javascript tests
21
22
  * Setup hudson support
23
+ * Figure out why you have to manually include bindir in the gemspec
24
+ * Reenable options generator
25
+ * Add a directory option to options generator
22
26
 
23
27
  == Contributing to cucumber_off_rails
24
28
 
data/Rakefile CHANGED
@@ -21,8 +21,6 @@ Jeweler::Tasks.new do |gem|
21
21
  gem.description = %Q{Nondestructive cucumber testing without using the rails stack setup for Hudson/Jenkins integration}
22
22
  gem.email = "jeremiah@cloudspace.com"
23
23
  gem.authors = ["Jeremiah Hemphill"]
24
- gem.bindir = 'bin'
25
- gem.executables = ['cucumber_off_rails']
26
24
  # dependencies defined in Gemfile
27
25
  end
28
26
  Jeweler::RubygemsDotOrgTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -1 +1,5 @@
1
- require "lib/generators/install_generator"
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
+ require 'cucumber_off_rails/generator'
4
+
5
+ exit CucumberOffRails::Generator::Application.run!(*ARGV)
@@ -0,0 +1,93 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{cucumber_off_rails}
8
+ s.version = "0.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = [%q{Jeremiah Hemphill}]
12
+ s.date = %q{2011-07-22}
13
+ s.description = %q{Nondestructive cucumber testing without using the rails stack setup for Hudson/Jenkins integration}
14
+ s.email = %q{jeremiah@cloudspace.com}
15
+ s.executables = [%q{cucumber_off_rails}]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ "Changelog.markdown",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE.txt",
26
+ "README.rdoc",
27
+ "Rakefile",
28
+ "VERSION",
29
+ "bin/cucumber_off_rails",
30
+ "cucumber_off_rails.gemspec",
31
+ "lib/cucumber_off_rails.rb",
32
+ "lib/cucumber_off_rails/generator.rb",
33
+ "lib/cucumber_off_rails/generator/application.rb",
34
+ "lib/cucumber_off_rails/generator/options.rb",
35
+ "lib/cucumber_off_rails/templates/Gemfile",
36
+ "lib/cucumber_off_rails/templates/Rakefile",
37
+ "lib/cucumber_off_rails/templates/features/.htaccess",
38
+ "lib/cucumber_off_rails/templates/features/sample.feature",
39
+ "lib/cucumber_off_rails/templates/features/step_definitions/debugging_steps.rb",
40
+ "lib/cucumber_off_rails/templates/features/step_definitions/linking_steps.rb",
41
+ "lib/cucumber_off_rails/templates/features/step_definitions/login_steps.rb",
42
+ "lib/cucumber_off_rails/templates/features/step_definitions/selector_steps.rb",
43
+ "lib/cucumber_off_rails/templates/features/step_definitions/validation_steps.rb",
44
+ "lib/cucumber_off_rails/templates/features/support/env.rb",
45
+ "lib/cucumber_off_rails/templates/features/support/hooks.rb",
46
+ "lib/cucumber_off_rails/templates/features/support/paths.rb",
47
+ "lib/cucumber_off_rails/templates/features/support/selectors.rb",
48
+ "spec/cucumber_off_rails_spec.rb",
49
+ "spec/spec_helper.rb"
50
+ ]
51
+ s.homepage = %q{http://github.com/jeremiahishere/cucumber_off_rails}
52
+ s.licenses = [%q{MIT}]
53
+ s.require_paths = [%q{lib}]
54
+ s.rubygems_version = %q{1.8.5}
55
+ s.summary = %q{Nondestructive Cucumber Testing}
56
+
57
+ if s.respond_to? :specification_version then
58
+ s.specification_version = 3
59
+
60
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
61
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
62
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
63
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.3"])
64
+ s.add_development_dependency(%q<rcov>, [">= 0"])
65
+ s.add_development_dependency(%q<cucumber>, [">= 0"])
66
+ s.add_development_dependency(%q<mechanize>, ["~> 1.0.0"])
67
+ s.add_development_dependency(%q<rspec>, [">= 0"])
68
+ s.add_development_dependency(%q<capybara>, ["~> 0.4.0"])
69
+ s.add_development_dependency(%q<capybara-mechanize>, ["~> 0.2.7"])
70
+ else
71
+ s.add_dependency(%q<shoulda>, [">= 0"])
72
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
73
+ s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
74
+ s.add_dependency(%q<rcov>, [">= 0"])
75
+ s.add_dependency(%q<cucumber>, [">= 0"])
76
+ s.add_dependency(%q<mechanize>, ["~> 1.0.0"])
77
+ s.add_dependency(%q<rspec>, [">= 0"])
78
+ s.add_dependency(%q<capybara>, ["~> 0.4.0"])
79
+ s.add_dependency(%q<capybara-mechanize>, ["~> 0.2.7"])
80
+ end
81
+ else
82
+ s.add_dependency(%q<shoulda>, [">= 0"])
83
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
84
+ s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
85
+ s.add_dependency(%q<rcov>, [">= 0"])
86
+ s.add_dependency(%q<cucumber>, [">= 0"])
87
+ s.add_dependency(%q<mechanize>, ["~> 1.0.0"])
88
+ s.add_dependency(%q<rspec>, [">= 0"])
89
+ s.add_dependency(%q<capybara>, ["~> 0.4.0"])
90
+ s.add_dependency(%q<capybara-mechanize>, ["~> 0.2.7"])
91
+ end
92
+ end
93
+
@@ -0,0 +1,6 @@
1
+ class CucumberOffRails
2
+ require 'rubygems/user_interaction'
3
+ require 'cucumber_off_rais/generator/application'
4
+ require 'cucumber_off_rais/generator/options'
5
+ autoload :Generator, 'cucumber_of_rails/generator'
6
+ end
@@ -0,0 +1,77 @@
1
+ require 'erb'
2
+ require 'fileutils'
3
+ require 'ruby-debug'
4
+
5
+ class CucumberOffRails
6
+ class Generator
7
+ #require "cucumber_off_rails/generator/options"
8
+ require "cucumber_off_rails/generator/application"
9
+
10
+ attr_accessor :options, :remote_site, :project_name, :target_dir
11
+
12
+ def initialize(options = {})
13
+ self.options = options
14
+ self.remote_site = options[:remote_site] || "http://www.google.com"
15
+ self.project_name = options[:project_name]
16
+ self.target_dir = options[:directory] || self.project_name || "cucumber_off_rails_project"
17
+ end
18
+
19
+ def run
20
+ create_files
21
+ end
22
+
23
+ def create_files
24
+ unless File.exists?(target_dir) || File.directory?(target_dir)
25
+ FileUtils.mkdir target_dir
26
+ else
27
+ raise "The directory #{target_dir} already exists, aborting. Maybe move it out of the way before continuing?"
28
+ end
29
+
30
+ output_template_in_target "Gemfile"
31
+ output_template_in_target "Rakefile"
32
+ mkdir_in_target "features"
33
+ output_template_in_target File.join("features", "sample.feature")
34
+ mkdir_in_target "features/step_definitions"
35
+ output_template_in_target File.join("features", "step_definitions", "debugging_steps.rb")
36
+ output_template_in_target File.join("features", "step_definitions", "linking_steps.rb")
37
+ output_template_in_target File.join("features", "step_definitions", "login_steps.rb")
38
+ output_template_in_target File.join("features", "step_definitions", "selector_steps.rb")
39
+ output_template_in_target File.join("features", "step_definitions", "validation_steps.rb")
40
+ mkdir_in_target "features/support"
41
+ output_template_in_target File.join("features", "support", "env.rb")
42
+ output_template_in_target File.join("features", "support", "hooks.rb")
43
+ output_template_in_target File.join("features", "support", "paths.rb")
44
+ output_template_in_target File.join("features", "support", "selectors.rb")
45
+
46
+ end
47
+
48
+ def output_template_in_target(source, destination = source)
49
+ final_destination = File.join(target_dir, destination)
50
+ template_result = render_template(source)
51
+
52
+ File.open(final_destination, 'w') {|file| file.write(template_result)}
53
+
54
+ $stdout.puts "\tcreate\t#{destination}"
55
+ end
56
+
57
+ def render_template(source)
58
+ template_contents = File.read(File.join(template_dir, source))
59
+ template = ERB.new(template_contents, nil, '<>')
60
+
61
+ # squish extraneous whitespace from some of the conditionals
62
+ template.result(binding).gsub(/\n\n\n+/, "\n\n")
63
+ end
64
+
65
+ def template_dir
66
+ File.join(File.dirname(__FILE__), 'templates')
67
+ end
68
+
69
+ def mkdir_in_target(directory)
70
+ final_destination = File.join(target_dir, directory)
71
+
72
+ FileUtils.mkdir final_destination
73
+
74
+ $stdout.puts "\tcreate\t#{directory}"
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,38 @@
1
+ require 'shellwords'
2
+
3
+ class CucumberOffRails
4
+ class Generator
5
+ class Application
6
+ class << self
7
+ include Shellwords
8
+ def run!(*arguments)
9
+ # cant get options generator included for some reason
10
+ #options = build_options(arguments)
11
+ options = {}
12
+
13
+ if options[:invalid_argument]
14
+ $stderr.puts options[:invalid_argument]
15
+ options[:show_help] = true
16
+ end
17
+
18
+ if options[:show_help]
19
+ $stderr.puts options.opts
20
+ return 1
21
+ end
22
+
23
+ generator = CucumberOffRails::Generator.new(options)
24
+ generator.run
25
+ return 0
26
+ end
27
+
28
+ def build_options(arguments)
29
+ env_opts_string = ENV['CUCUMBER_OFF_RAILS_OPTS'] || ""
30
+ env_opts = CucumberOffRails::Generator::Options.new(shellwords(env_opts_string))
31
+ argument_opts = CucumberOffRails::Generator::Options.new(arguments)
32
+
33
+ env_opts.merge(argument_opts)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,36 @@
1
+ class CucumberOffRails
2
+ class Generator
3
+ class Options < Hash
4
+ attr_reader :opts, :orig_args
5
+
6
+ def initialize(args)
7
+ super()
8
+ @orig_args = args.clone
9
+
10
+ require 'optparse'
11
+ @opts = OptionParser.new do |o|
12
+ o.banner = "Usage: #{File.basename($0)} [options]\ne.g. #{File.basename($0)} --set http://www.google.com"
13
+
14
+ # need to add a directory option
15
+
16
+ o.on('--site [SITE]', 'specify the site to remotely access through capybara' do |site|
17
+ self[:site] = site
18
+ end
19
+
20
+ end
21
+
22
+ begin
23
+ @opts.parse!(args)
24
+ rescue OptionParser::InvalidOption => e
25
+ self[:invalid_argument] = e.message
26
+ end
27
+ end
28
+
29
+ # what this for?
30
+ def merge(other)
31
+ self.class.new(@orig_args + other.orig_args)
32
+ end
33
+
34
+ end
35
+ end
36
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cucumber_off_rails
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jeremiah Hemphill
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-14 00:00:00 Z
13
+ date: 2011-07-22 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: shoulda
@@ -122,6 +122,7 @@ extra_rdoc_files:
122
122
  - README.rdoc
123
123
  files:
124
124
  - .document
125
+ - Changelog.markdown
125
126
  - Gemfile
126
127
  - Gemfile.lock
127
128
  - LICENSE.txt
@@ -129,22 +130,24 @@ files:
129
130
  - Rakefile
130
131
  - VERSION
131
132
  - bin/cucumber_off_rails
133
+ - cucumber_off_rails.gemspec
132
134
  - lib/cucumber_off_rails.rb
133
- - lib/generators/cucumber_off_rails/install_generator.rb
134
- - lib/generators/cucumber_off_rails/templates/Gemfile
135
- - lib/generators/cucumber_off_rails/templates/Rakefile
136
- - lib/generators/cucumber_off_rails/templates/features/.htaccess
137
- - lib/generators/cucumber_off_rails/templates/features/sample.feature
138
- - lib/generators/cucumber_off_rails/templates/features/step_definitions/debugging_steps.rb
139
- - lib/generators/cucumber_off_rails/templates/features/step_definitions/linking_steps.rb
140
- - lib/generators/cucumber_off_rails/templates/features/step_definitions/login_steps.rb
141
- - lib/generators/cucumber_off_rails/templates/features/step_definitions/selector_steps.rb
142
- - lib/generators/cucumber_off_rails/templates/features/step_definitions/validations_steps.rb
143
- - lib/generators/cucumber_off_rails/templates/features/support/env.rb
144
- - lib/generators/cucumber_off_rails/templates/features/support/hooks.rb
145
- - lib/generators/cucumber_off_rails/templates/features/support/paths.rb
146
- - lib/generators/cucumber_off_rails/templates/features/support/selectors.rb
147
- - lib/generators/cucumber_off_rails/update_generator.rb
135
+ - lib/cucumber_off_rails/generator.rb
136
+ - lib/cucumber_off_rails/generator/application.rb
137
+ - lib/cucumber_off_rails/generator/options.rb
138
+ - lib/cucumber_off_rails/templates/Gemfile
139
+ - lib/cucumber_off_rails/templates/Rakefile
140
+ - lib/cucumber_off_rails/templates/features/.htaccess
141
+ - lib/cucumber_off_rails/templates/features/sample.feature
142
+ - lib/cucumber_off_rails/templates/features/step_definitions/debugging_steps.rb
143
+ - lib/cucumber_off_rails/templates/features/step_definitions/linking_steps.rb
144
+ - lib/cucumber_off_rails/templates/features/step_definitions/login_steps.rb
145
+ - lib/cucumber_off_rails/templates/features/step_definitions/selector_steps.rb
146
+ - lib/cucumber_off_rails/templates/features/step_definitions/validation_steps.rb
147
+ - lib/cucumber_off_rails/templates/features/support/env.rb
148
+ - lib/cucumber_off_rails/templates/features/support/hooks.rb
149
+ - lib/cucumber_off_rails/templates/features/support/paths.rb
150
+ - lib/cucumber_off_rails/templates/features/support/selectors.rb
148
151
  - spec/cucumber_off_rails_spec.rb
149
152
  - spec/spec_helper.rb
150
153
  homepage: http://github.com/jeremiahishere/cucumber_off_rails
@@ -160,7 +163,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
163
  requirements:
161
164
  - - ">="
162
165
  - !ruby/object:Gem::Version
163
- hash: 4147910063496360604
166
+ hash: -192157366348720091
164
167
  segments:
165
168
  - 0
166
169
  version: "0"