java-autotest 0.0.1.beta2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +32 -0
- data/LICENSE +20 -0
- data/README.rdoc +40 -0
- data/Rakefile +44 -0
- data/VERSION.yml +5 -0
- data/bin/java-autotest +7 -0
- data/java-autotest.gemspec +66 -0
- data/lib/file.rb +5 -0
- data/lib/java_autotest/autotest.rb +44 -0
- data/lib/java_autotest.rb +22 -0
- data/spec/file_spec.rb +18 -0
- data/spec/java_autotest/autotest_spec.rb +20 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/src/main/java/Impl.java +0 -0
- data/spec/src/test/java/ImplTest.java +0 -0
- metadata +106 -0
data/.document
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
columnize (0.3.1)
|
5
|
+
gemcutter (0.6.1)
|
6
|
+
git (1.2.5)
|
7
|
+
jeweler (1.4.0)
|
8
|
+
gemcutter (>= 0.1.0)
|
9
|
+
git (>= 1.2.5)
|
10
|
+
rubyforge (>= 2.0.0)
|
11
|
+
json_pure (1.4.6)
|
12
|
+
linecache (0.43)
|
13
|
+
rake (0.8.7)
|
14
|
+
rcov (0.9.8)
|
15
|
+
rspec (1.3.0)
|
16
|
+
ruby-debug (0.10.3)
|
17
|
+
columnize (>= 0.1)
|
18
|
+
ruby-debug-base (~> 0.10.3.0)
|
19
|
+
ruby-debug-base (0.10.3)
|
20
|
+
linecache (>= 0.3)
|
21
|
+
rubyforge (2.0.4)
|
22
|
+
json_pure (>= 1.1.7)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
jeweler (>= 1.4.0)
|
29
|
+
rake (>= 0.8.7)
|
30
|
+
rcov (>= 0.9.8)
|
31
|
+
rspec (>= 1.3.0)
|
32
|
+
ruby-debug
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 rodolfoliviero
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
= java-autotest
|
2
|
+
|
3
|
+
Instant feedback for yours tests.
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
gem install java-autotest --pre
|
7
|
+
|
8
|
+
== Dependencies
|
9
|
+
Ensures that you already have installed:
|
10
|
+
|
11
|
+
- Java
|
12
|
+
- Maven 2
|
13
|
+
|
14
|
+
== How its works
|
15
|
+
|
16
|
+
* Find all java files inside src folder.
|
17
|
+
* Run all tests.
|
18
|
+
* Wait for changes.
|
19
|
+
* Run modified test.
|
20
|
+
* All green? run all testes
|
21
|
+
|
22
|
+
== Usage
|
23
|
+
java-autotest at the project root folder.
|
24
|
+
|
25
|
+
== Where next?
|
26
|
+
- Ant, Ivy and gralde suppport.
|
27
|
+
|
28
|
+
== Note on Patches/Pull Requests
|
29
|
+
|
30
|
+
* Fork the project.
|
31
|
+
* Make your feature addition or bug fix.
|
32
|
+
* Add tests for it. This is important so I don't break it in a
|
33
|
+
future version unintentionally.
|
34
|
+
* Commit, do not mess with rakefile, version, or history.
|
35
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
36
|
+
* Send me a pull request. Bonus points for topic branches.
|
37
|
+
|
38
|
+
== Copyright
|
39
|
+
|
40
|
+
Copyright (c) 2010 rodolfoliviero. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "java-autotest"
|
8
|
+
gem.summary = %Q{Java AutoTest}
|
9
|
+
gem.description = %Q{Java AutoTest}
|
10
|
+
gem.email = "rodolfoliviero@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/rodolfoliviero/java-autotest"
|
12
|
+
gem.authors = ["rodolfoliviero"]
|
13
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
end
|
15
|
+
Jeweler::GemcutterTasks.new
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'spec/rake/spectask'
|
21
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
22
|
+
spec.libs << 'lib' << 'spec'
|
23
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
24
|
+
end
|
25
|
+
|
26
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
27
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
28
|
+
spec.rcov_opts = ['--exclude', 'spec/*,gems/*']
|
29
|
+
spec.rcov = true
|
30
|
+
end
|
31
|
+
|
32
|
+
task :spec => :check_dependencies
|
33
|
+
|
34
|
+
task :default => :spec
|
35
|
+
|
36
|
+
require 'rake/rdoctask'
|
37
|
+
Rake::RDocTask.new do |rdoc|
|
38
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
39
|
+
|
40
|
+
rdoc.rdoc_dir = 'rdoc'
|
41
|
+
rdoc.title = "java_autotest #{version}"
|
42
|
+
rdoc.rdoc_files.include('README*')
|
43
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
44
|
+
end
|
data/VERSION.yml
ADDED
data/bin/java-autotest
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{java-autotest}
|
8
|
+
s.version = "0.0.1.beta2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["rodolfoliviero"]
|
12
|
+
s.date = %q{2010-08-21}
|
13
|
+
s.default_executable = %q{java-autotest}
|
14
|
+
s.description = %q{Java AutoTest}
|
15
|
+
s.email = %q{rodolfoliviero@gmail.com}
|
16
|
+
s.executables = ["java-autotest"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".gitignore",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"LICENSE",
|
27
|
+
"README.rdoc",
|
28
|
+
"Rakefile",
|
29
|
+
"VERSION.yml",
|
30
|
+
"bin/java-autotest",
|
31
|
+
"java-autotest.gemspec",
|
32
|
+
"lib/file.rb",
|
33
|
+
"lib/java_autotest.rb",
|
34
|
+
"lib/java_autotest/autotest.rb",
|
35
|
+
"spec/file_spec.rb",
|
36
|
+
"spec/java_autotest/autotest_spec.rb",
|
37
|
+
"spec/spec.opts",
|
38
|
+
"spec/spec_helper.rb",
|
39
|
+
"spec/src/main/java/Impl.java",
|
40
|
+
"spec/src/test/java/ImplTest.java"
|
41
|
+
]
|
42
|
+
s.homepage = %q{http://github.com/rodolfoliviero/java-autotest}
|
43
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
44
|
+
s.require_paths = ["lib"]
|
45
|
+
s.rubygems_version = %q{1.3.7}
|
46
|
+
s.summary = %q{Java AutoTest}
|
47
|
+
s.test_files = [
|
48
|
+
"spec/spec_helper.rb",
|
49
|
+
"spec/java_autotest/autotest_spec.rb",
|
50
|
+
"spec/file_spec.rb"
|
51
|
+
]
|
52
|
+
|
53
|
+
if s.respond_to? :specification_version then
|
54
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
55
|
+
s.specification_version = 3
|
56
|
+
|
57
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
58
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
59
|
+
else
|
60
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
61
|
+
end
|
62
|
+
else
|
63
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
data/lib/file.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
class AutoTest
|
2
|
+
attr_accessor :data, :files
|
3
|
+
|
4
|
+
def initialize
|
5
|
+
@data = Time.new
|
6
|
+
@files = File.find_java_files
|
7
|
+
run_all_tests
|
8
|
+
end
|
9
|
+
|
10
|
+
def listen
|
11
|
+
@files.each do |file|
|
12
|
+
if (File.atime(file).to_i > @data.to_i)
|
13
|
+
run(file)
|
14
|
+
break
|
15
|
+
end
|
16
|
+
end
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
def run(file)
|
21
|
+
test_class = find_test_class file
|
22
|
+
puts "Running test to #{test_class}."
|
23
|
+
green = run_test(test_class)
|
24
|
+
run_all_tests if green
|
25
|
+
reset
|
26
|
+
end
|
27
|
+
|
28
|
+
def find_test_class(file)
|
29
|
+
return file.split("/").last.split(".java").last.concat("Test.java") unless file.include? "Test.java"
|
30
|
+
return file.split("/").last if file.include? "Test.java"
|
31
|
+
end
|
32
|
+
|
33
|
+
def run_test(test_class)
|
34
|
+
system("mvn -Dtest=#{test_class} test")
|
35
|
+
end
|
36
|
+
|
37
|
+
def run_all_tests
|
38
|
+
system("mvn test")
|
39
|
+
end
|
40
|
+
|
41
|
+
def reset
|
42
|
+
@data = Time.new
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../lib/java_autotest/autotest'
|
2
|
+
require File.dirname(__FILE__) + '/../lib/file'
|
3
|
+
|
4
|
+
module JavaAutoTest
|
5
|
+
class Main
|
6
|
+
def self.execute
|
7
|
+
autotest = AutoTest.new
|
8
|
+
loop do
|
9
|
+
begin
|
10
|
+
sleep until autotest.listen
|
11
|
+
rescue Interrupt
|
12
|
+
break
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
data/spec/file_spec.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
2
|
+
|
3
|
+
describe File do
|
4
|
+
|
5
|
+
context "find java files in source folder" do
|
6
|
+
before(:each) do
|
7
|
+
@files = File.find_java_files("spec/src")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should find impl file" do
|
11
|
+
@files[0].should == "spec/src/main/java/Impl.java"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should find test file" do
|
15
|
+
@files[1].should == "spec/src/test/java/ImplTest.java"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe AutoTest do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@autotest = AutoTest.new
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should run all tests" do
|
10
|
+
@autotest.should_receive(:system).with("mvn test")
|
11
|
+
@autotest.run_all_tests
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should run single test" do
|
15
|
+
test_class = "ImplTest.java"
|
16
|
+
@autotest.should_receive(:system).with("mvn -Dtest=#{test_class} test")
|
17
|
+
@autotest.run_test(test_class)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
File without changes
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: java-autotest
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 299253582
|
5
|
+
prerelease: true
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
- beta2
|
11
|
+
version: 0.0.1.beta2
|
12
|
+
platform: ruby
|
13
|
+
authors:
|
14
|
+
- rodolfoliviero
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2010-08-21 00:00:00 -03:00
|
20
|
+
default_executable: java-autotest
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: rspec
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 13
|
31
|
+
segments:
|
32
|
+
- 1
|
33
|
+
- 2
|
34
|
+
- 9
|
35
|
+
version: 1.2.9
|
36
|
+
type: :development
|
37
|
+
version_requirements: *id001
|
38
|
+
description: Java AutoTest
|
39
|
+
email: rodolfoliviero@gmail.com
|
40
|
+
executables:
|
41
|
+
- java-autotest
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files:
|
45
|
+
- LICENSE
|
46
|
+
- README.rdoc
|
47
|
+
files:
|
48
|
+
- .document
|
49
|
+
- .gitignore
|
50
|
+
- Gemfile
|
51
|
+
- Gemfile.lock
|
52
|
+
- LICENSE
|
53
|
+
- README.rdoc
|
54
|
+
- Rakefile
|
55
|
+
- VERSION.yml
|
56
|
+
- bin/java-autotest
|
57
|
+
- java-autotest.gemspec
|
58
|
+
- lib/file.rb
|
59
|
+
- lib/java_autotest.rb
|
60
|
+
- lib/java_autotest/autotest.rb
|
61
|
+
- spec/file_spec.rb
|
62
|
+
- spec/java_autotest/autotest_spec.rb
|
63
|
+
- spec/spec.opts
|
64
|
+
- spec/spec_helper.rb
|
65
|
+
- spec/src/main/java/Impl.java
|
66
|
+
- spec/src/test/java/ImplTest.java
|
67
|
+
has_rdoc: true
|
68
|
+
homepage: http://github.com/rodolfoliviero/java-autotest
|
69
|
+
licenses: []
|
70
|
+
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options:
|
73
|
+
- --charset=UTF-8
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
hash: 3
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
version: "0"
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 25
|
91
|
+
segments:
|
92
|
+
- 1
|
93
|
+
- 3
|
94
|
+
- 1
|
95
|
+
version: 1.3.1
|
96
|
+
requirements: []
|
97
|
+
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 1.3.7
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: Java AutoTest
|
103
|
+
test_files:
|
104
|
+
- spec/spec_helper.rb
|
105
|
+
- spec/java_autotest/autotest_spec.rb
|
106
|
+
- spec/file_spec.rb
|