cucumber-java 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.txt CHANGED
@@ -1 +1,5 @@
1
- See README.textile
1
+ See http://cukes.info/java
2
+
3
+ History:
4
+ * 0.0.2
5
+ ** Fix ambiguous registration of steps
@@ -4,7 +4,7 @@ module Cucumber #:nodoc:
4
4
  class VERSION #:nodoc:
5
5
  MAJOR = 0
6
6
  MINOR = 0
7
- TINY = 1
7
+ TINY = 2
8
8
  PATCH = nil # Set to nil for official release
9
9
 
10
10
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-java
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Aslak Helles\xC3\xB8y"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-25 00:00:00 +01:00
12
+ date: 2009-04-20 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.2.2
23
+ version: 0.3.0
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: hoe
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.3
33
+ version: 1.11.0
34
34
  version:
35
35
  description: Cucumber for Java
36
36
  email:
@@ -40,24 +40,12 @@ executables: []
40
40
  extensions: []
41
41
 
42
42
  extra_rdoc_files:
43
- - History.txt
44
- - Manifest.txt
45
43
  - README.txt
46
44
  files:
47
- - History.txt
48
- - Manifest.txt
49
- - README.textile
50
45
  - README.txt
51
- - Rakefile
52
- - examples/simple/README.textile
53
- - examples/simple/features/demo.feature
54
- - examples/simple/features/support/env.rb
55
- - examples/simple/pom.xml
56
- - examples/simple/src/main/java/simple/StuffSteps.java
57
- - lib/cucumber-java-0.0.1.jar
46
+ - lib/cucumber-java-0.0.2.jar
58
47
  - lib/cucumber/java.rb
59
48
  - lib/cucumber/java/version.rb
60
- - pom.xml
61
49
  has_rdoc: true
62
50
  homepage: http://cukes.info
63
51
  post_install_message:
@@ -1,5 +0,0 @@
1
- === 0.0.1 / 2009-03-25
2
-
3
- * 1 major enhancement
4
- * Birthday!
5
-
@@ -1,14 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- README.textile
4
- README.txt
5
- Rakefile
6
- examples/simple/README.textile
7
- examples/simple/features/demo.feature
8
- examples/simple/features/support/env.rb
9
- examples/simple/pom.xml
10
- examples/simple/src/main/java/simple/StuffSteps.java
11
- lib/cucumber-java-0.0.1.jar
12
- lib/cucumber/java.rb
13
- lib/cucumber/java/version.rb
14
- pom.xml
@@ -1,70 +0,0 @@
1
- h1. Have a Cuke, Duke
2
-
3
- Cucumber runs on Java! This gem lets you write Cucumber steps in pure Java. Example:
4
-
5
- <pre>
6
- package simple;
7
-
8
- import java.util.Map;
9
- import java.util.HashMap;
10
- import cucumber.*;
11
- import static org.junit.Assert.assertEquals;
12
-
13
- public class StuffSteps {
14
- private final Map<String,String> cukes = new HashMap<String,String>();
15
-
16
- @Given("I have (\\d+) (.*) cukes")
17
- public void iHaveNCukes(String n, String color) {
18
- this.cukes.put(color, n);
19
- }
20
-
21
- @When("I add a table")
22
- public void iAddATable(Table table) {
23
- Map<String,String> hash = table.hashes().get(0);
24
- assertEquals("1", hash.get("a"));
25
- assertEquals("2", hash.get("b"));
26
- }
27
-
28
- @Then("I should have (\\d+) (.*) cukes")
29
- public void iShouldHaveNCukes(String n, String color) {
30
- if(!n.equals(cukes.get(color))) {
31
- throw new RuntimeException("Expected " + n + ", got " + cukes.get(color));
32
- }
33
- }
34
-
35
- public void thisIsNotAStep() {}
36
- }
37
- </pre>
38
-
39
- Check out the examples for more details.
40
-
41
- h2. Building the cucumber-java gem
42
-
43
- This is for hackers. If you just want to use Cucumber with Java, head straight to
44
- the examples.
45
-
46
- h3. Install Maven
47
-
48
- You can grab it "here":http://maven.apache.org/
49
-
50
- h3. Install JRuby
51
-
52
- You can grab it "here":http://jruby.org/
53
- Make sure you get 1.2.0 or later.
54
-
55
- h3. Install Hoe
56
-
57
- This gem is needed to build the Cucumber Java gem
58
-
59
- <pre>
60
- jruby -S gem install hoe --no-rdoc --no-ri
61
- </pre>
62
-
63
- h3. Build and install the gem
64
-
65
- <pre>
66
- jruby -S rake gem
67
- jruby -S gem install pkg/cucumber-java --no-rdoc --no-ri
68
- </pre>
69
-
70
- Now head to the simple example and run it. It serves well as a testbed.
data/Rakefile DELETED
@@ -1,80 +0,0 @@
1
- # encoding: utf-8
2
- ENV['NODOT'] = 'true' # We don't want class diagrams in RDoc
3
- $:.unshift(File.join(File.dirname(__FILE__), 'lib'))
4
- task :gem => :jar
5
- require 'cucumber/java/version'
6
- require 'hoe'
7
-
8
- AUTHOR = 'Aslak Hellesøy' # can also be an array of Authors
9
- EMAIL = "aslak.hellesoy@gmail.com"
10
- DESCRIPTION = "Cucumber for Java"
11
- GEM_NAME = 'cucumber-java' # what ppl will type to install your gem
12
- HOMEPATH = "http://cukes.info"
13
- RUBYFORGE_PROJECT = 'rspec'
14
-
15
- @config_file = "~/.rubyforge/user-config.yml"
16
- @config = nil
17
- RUBYFORGE_USERNAME = "aslak_hellesoy"
18
- def rubyforge_username
19
- unless @config
20
- begin
21
- @config = YAML.load(File.read(File.expand_path(@config_file)))
22
- rescue
23
- puts <<-EOS
24
- ERROR: No rubyforge config file found: #{@config_file}
25
- Run 'rubyforge setup' to prepare your env for access to Rubyforge
26
- - See http://newgem.rubyforge.org/rubyforge.html for more details
27
- EOS
28
- exit
29
- end
30
- end
31
- RUBYFORGE_USERNAME.replace @config["username"]
32
- end
33
-
34
- RDOC_OPTS = ['--quiet', '--title', 'Cucumber documentation',
35
- "--opname", "index.html",
36
- "--line-numbers",
37
- "--main", "README.textile",
38
- "--inline-source"]
39
-
40
- class Hoe
41
- def extra_deps
42
- @extra_deps.reject! { |x| Array(x).first == 'hoe' }
43
- @extra_deps
44
- end
45
- end
46
-
47
- # Generate all the Rake tasks
48
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
49
- $hoe = Hoe.new(GEM_NAME, Cucumber::Java::VERSION::STRING) do |p|
50
- p.developer(AUTHOR, EMAIL)
51
- p.description = DESCRIPTION
52
- p.summary = DESCRIPTION
53
- p.url = HOMEPATH
54
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
55
- p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store', '**/*.class'] #An array of file patterns to delete on clean.
56
-
57
- # == Optional
58
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
59
- #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
60
- p.extra_deps = [
61
- ['cucumber', '>= 0.2.2']
62
- ]
63
-
64
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
65
-
66
- end
67
-
68
- CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
69
- PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
70
- $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
71
- $hoe.rsync_args = '-av --delete --ignore-errors'
72
-
73
- # Hoe gives us :default => :test, but we don't have Test::Unit tests.
74
- Rake::Task[:default].clear_prerequisites rescue nil # For some super weird reason this fails for some...
75
-
76
- task :jar do
77
- sh 'mvn clean compile jar:jar'
78
- mv "target/cucumber-java-#{Cucumber::Java::VERSION::STRING}.jar", 'lib'
79
- sh 'mvn clean'
80
- end
@@ -1,56 +0,0 @@
1
- h1. Cucumber Java Simple example
2
-
3
- This project is a very basic example that illustrates how to use Cucumber with
4
- Java, writing step definitions in pure Java.
5
-
6
- h2. Prerequisites
7
-
8
- * Install Maven
9
- * Install JRuby (1.2.0 or newer)
10
- * jruby -S gem install cucumber-java
11
- * Download PicoContainer and JUnit jars
12
- ** See features/support/env.rb for details. You may have to change the paths there depending on where you put jars.
13
-
14
- h2. Running it
15
-
16
- h3. Build the java code
17
-
18
- <pre>
19
- mvn clean compile jar:jar
20
- </pre>
21
-
22
- You will get an error from Maven complaining that the cucumber-java jar file doesn't
23
- exist. (You'll need that jar if you want to use Cucumber tables in Java). Just do what Maven
24
- says - the cucumber jar can be found inside your cucumber-java gem, for example:
25
-
26
- <pre>
27
- mvn install:install-file -DgroupId=cucumber -DartifactId=cucumber-java -Dversion=0.0.1 -Dpackaging=jar -Dfile=/usr/local/jruby/lib/ruby/gems/1.8/gems/cucumber-java-0.0.1/lib/cucumber-java-0.0.1.jar
28
- </pre>
29
-
30
- Now, just try building again.
31
-
32
- h3. Run the features:
33
-
34
- <pre>
35
- jruby -S cucumber features
36
- </pre>
37
-
38
- Try to make the features fail by modifying the java code or the feature file - check out the output...
39
-
40
- See the "Cucumber Wiki":http://wiki.github.com/aslakhellesoy/cucumber for more info.
41
-
42
- h2. Hacking
43
-
44
- If you want to hack on the cucumber-java gem and use this example as a testbed, it's easier to run off
45
- cucumber and cucumber-java as "source" instead of gems.
46
- Here is what I do:
47
-
48
- <pre>
49
- jruby -I../../lib PATH_TO_CUCUMBER_SRC/bin/cucumber features
50
- </pre>
51
-
52
- h2. TODO
53
-
54
- * Make it possible to run Cucumber from Maven
55
- ** Make maven launch JRuby with a classpath that includes picocontainer, junit, step defnitions, code to test, any other deps.
56
- ** Remove all of the jar requires from env.rb
@@ -1,8 +0,0 @@
1
- Feature: Simple
2
-
3
- Scenario: 3 cukes
4
- Given I have 3 green cukes
5
- When I add a table
6
- |a|b|
7
- |1|2|
8
- Then I should have 3 green cukes
@@ -1,15 +0,0 @@
1
- # Cucumber Java depends on PicoContainer to instantiate classes with Step definitions
2
- require File.expand_path('~/.m2/repository/org/picocontainer/picocontainer/2.8/picocontainer-2.8.jar')
3
-
4
- # Load Cucumber Java support
5
- require 'cucumber/java'
6
-
7
- # Load JUnit - our Step definitions use it for assertions
8
- require File.expand_path('~/.m2/repository/junit/junit/4.4/junit-4.4.jar')
9
-
10
- # Load our step definitions
11
- require File.expand_path(File.dirname(__FILE__) + '/../../target/cucumber-simple-example-1.0.0.jar')
12
-
13
- # Register our steps definitions.
14
- import 'simple.StuffSteps'
15
- register_steps(StuffSteps)
@@ -1,48 +0,0 @@
1
- <project xmlns="http://maven.apache.org/POM/4.0.0"
2
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
4
- http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
- <modelVersion>4.0.0</modelVersion>
6
- <groupId>cucumber</groupId>
7
- <artifactId>cucumber-simple-example</artifactId>
8
- <packaging>jar</packaging>
9
- <version>1.0.0</version>
10
- <name>Cucumber Java Support</name>
11
- <url>http://cukes.info/</url>
12
-
13
- <repositories>
14
- <repository>
15
- <id>codehaus</id>
16
- <url>http://repository.codehaus.org</url>
17
- </repository>
18
- </repositories>
19
-
20
- <dependencies>
21
- <dependency>
22
- <groupId>cucumber</groupId>
23
- <artifactId>cucumber-java</artifactId>
24
- <version>0.0.1</version>
25
- </dependency>
26
- <dependency>
27
- <groupId>junit</groupId>
28
- <artifactId>junit</artifactId>
29
- <version>4.4</version>
30
- </dependency>
31
- </dependencies>
32
-
33
- <build>
34
- <pluginManagement>
35
- <plugins>
36
- <plugin>
37
- <groupId>org.apache.maven.plugins</groupId>
38
- <artifactId>maven-compiler-plugin</artifactId>
39
- <version>2.0.2</version>
40
- <configuration>
41
- <source>1.5</source>
42
- <target>1.5</target>
43
- </configuration>
44
- </plugin>
45
- </plugins>
46
- </pluginManagement>
47
- </build>
48
- </project>
@@ -1,30 +0,0 @@
1
- package simple;
2
-
3
- import java.util.Map;
4
- import java.util.HashMap;
5
- import cucumber.*;
6
- import static org.junit.Assert.assertEquals;
7
-
8
- // TODO: This is just testing a Map. We should have some own code to test!!
9
- public class StuffSteps {
10
- private final Map<String,String> cukes = new HashMap<String,String>();
11
-
12
- @Given("I have (\\d+) (.*) cukes")
13
- public void iHaveNCukes(String n, String color) {
14
- this.cukes.put(color, n);
15
- }
16
-
17
- @When("I add a table")
18
- public void iAddATable(Table table) {
19
- Map<String,String> hash = table.hashes().get(0);
20
- assertEquals("1", hash.get("a"));
21
- assertEquals("2", hash.get("b"));
22
- }
23
-
24
- @Then("I should have (\\d+) (.*) cukes")
25
- public void iShouldHaveNCukes(String n, String color) {
26
- assertEquals(n, cukes.get(color));
27
- }
28
-
29
- public void thisIsNotAStep() {}
30
- }
Binary file
data/pom.xml DELETED
@@ -1,54 +0,0 @@
1
- <project xmlns="http://maven.apache.org/POM/4.0.0"
2
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
4
- http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
- <modelVersion>4.0.0</modelVersion>
6
- <groupId>cucumber</groupId>
7
- <artifactId>cucumber-java</artifactId>
8
- <packaging>jar</packaging>
9
- <!-- IMPORTANT - KEEP IN SYNC WITH version.rb version and Manifest.txt -->
10
- <version>0.0.1</version>
11
- <name>Cucumber Java Support</name>
12
- <url>http://cukes.info/</url>
13
-
14
- <repositories>
15
- <repository>
16
- <id>codehaus</id>
17
- <url>http://repository.codehaus.org</url>
18
- </repository>
19
- </repositories>
20
-
21
- <dependencies>
22
- <dependency>
23
- <groupId>org.picocontainer</groupId>
24
- <artifactId>picocontainer</artifactId>
25
- <version>2.8</version>
26
- </dependency>
27
- <dependency>
28
- <groupId>junit</groupId>
29
- <artifactId>junit</artifactId>
30
- <version>4.4</version>
31
- </dependency>
32
- <dependency>
33
- <groupId>org.jruby</groupId>
34
- <artifactId>jruby</artifactId>
35
- <version>1.2.0</version>
36
- </dependency>
37
- </dependencies>
38
-
39
- <build>
40
- <pluginManagement>
41
- <plugins>
42
- <plugin>
43
- <groupId>org.apache.maven.plugins</groupId>
44
- <artifactId>maven-compiler-plugin</artifactId>
45
- <version>2.0.2</version>
46
- <configuration>
47
- <source>1.5</source>
48
- <target>1.5</target>
49
- </configuration>
50
- </plugin>
51
- </plugins>
52
- </pluginManagement>
53
- </build>
54
- </project>