bret-watircraft 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/BUGS.txt +5 -7
- data/History.txt +6 -2
- data/Manifest.txt +3 -6
- data/README.rdoc +4 -4
- data/VERSION.yml +2 -2
- data/{watircraft_generators/site → app_generators/watircraft}/templates/environments.yml.erb +0 -0
- data/{watircraft_generators/site → app_generators/watircraft}/templates/site.rb.erb +2 -2
- data/app_generators/watircraft/watircraft_generator.rb +4 -2
- data/lib/extensions/watir.rb +11 -2
- data/lib/taza/browser.rb +50 -45
- data/lib/watircraft/version.rb +1 -1
- data/spec/page_generator_spec.rb +7 -2
- data/spec/project_generator_spec.rb +73 -19
- data/spec/spec_generator_helper.rb +3 -10
- data/spec/watir_spec.rb +36 -0
- data/watircraft.gemspec +3 -3
- metadata +5 -8
- data/spec/site_generator_spec.rb +0 -62
- data/watircraft_generators/site/site_generator.rb +0 -51
data/BUGS.txt
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
Known Bugs
|
2
2
|
|
3
|
-
*
|
4
|
-
*
|
3
|
+
* Can't install on mac. (This used to work.)
|
4
|
+
* The name of the element underlying each field is not consistent. In pages,
|
5
|
+
it is called foo_field; in tables, foo_element. (Should probably be
|
6
|
+
foo_element in both places.)
|
7
|
+
* Page fields do not support Radio lists. Workaround: use elements.
|
5
8
|
* Need to provide homepage for project.
|
6
|
-
|
7
|
-
Reported Bugs which we can't reproduce
|
8
|
-
|
9
|
-
* "Couldn't find 'site' generator" when running watircraft command.
|
10
|
-
(using 0.3.1, neither taza nor watircraft-beta is also installed)
|
11
9
|
|
data/History.txt
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
=== 0.4.2 / 2009-03-24
|
2
|
+
|
3
|
+
* Fixed "can't find site generator" bug that occured when creating a new project.
|
4
|
+
* Page field and table fields now support Firefox.
|
5
|
+
|
1
6
|
=== 0.4.1 / 2009-02-24
|
2
7
|
|
3
|
-
*
|
8
|
+
* Fixed bug with script\console: no such file to load -- site_start
|
4
9
|
|
5
10
|
=== 0.4.0 / 2009-02-23
|
6
11
|
|
@@ -60,7 +65,6 @@ Other Changes
|
|
60
65
|
* Explicitly declare dependency on Watir 1.6.2 (or newer). Previously this
|
61
66
|
was assumed.
|
62
67
|
|
63
|
-
|
64
68
|
=== 0.3.2 / 2009-02-04
|
65
69
|
|
66
70
|
Another patch release. Like 0.3.1, no need to update if your project is
|
data/Manifest.txt
CHANGED
@@ -56,7 +56,6 @@ spec/sandbox/pages/foo/bar_page.rb
|
|
56
56
|
spec/sandbox/pages/foo/partials
|
57
57
|
spec/sandbox/pages/foo/partials/partial_the_reckoning.rb
|
58
58
|
spec/settings_spec.rb
|
59
|
-
spec/site_generator_spec.rb
|
60
59
|
spec/site_spec.rb
|
61
60
|
spec/spec_generator_helper.rb
|
62
61
|
spec/spec_generator_spec.rb
|
@@ -66,15 +65,18 @@ spec/string_spec.rb
|
|
66
65
|
spec/table_spec.rb
|
67
66
|
spec/taza_spec.rb
|
68
67
|
spec/watircraft_bin_spec.rb
|
68
|
+
spec/watir_spec.rb
|
69
69
|
app_generators/watircraft
|
70
70
|
app_generators/watircraft/templates
|
71
71
|
app_generators/watircraft/templates/config.yml.erb
|
72
|
+
app_generators/watircraft/templates/environments.yml.erb
|
72
73
|
app_generators/watircraft/templates/feature_helper.rb
|
73
74
|
app_generators/watircraft/templates/initialize.rb.erb
|
74
75
|
app_generators/watircraft/templates/rakefile.rb
|
75
76
|
app_generators/watircraft/templates/script
|
76
77
|
app_generators/watircraft/templates/script/console
|
77
78
|
app_generators/watircraft/templates/script/console.cmd
|
79
|
+
app_generators/watircraft/templates/site.rb.erb
|
78
80
|
app_generators/watircraft/templates/site_start.rb.erb
|
79
81
|
app_generators/watircraft/templates/spec_helper.rb
|
80
82
|
app_generators/watircraft/templates/spec_initialize.rb
|
@@ -86,11 +88,6 @@ watircraft_generators/page/page_generator.rb
|
|
86
88
|
watircraft_generators/page/templates
|
87
89
|
watircraft_generators/page/templates/page.rb.erb
|
88
90
|
watircraft_generators/page/USAGE
|
89
|
-
watircraft_generators/site
|
90
|
-
watircraft_generators/site/site_generator.rb
|
91
|
-
watircraft_generators/site/templates
|
92
|
-
watircraft_generators/site/templates/environments.yml.erb
|
93
|
-
watircraft_generators/site/templates/site.rb.erb
|
94
91
|
watircraft_generators/spec
|
95
92
|
watircraft_generators/spec/spec_generator.rb
|
96
93
|
watircraft_generators/spec/templates
|
data/README.rdoc
CHANGED
@@ -7,11 +7,11 @@ It allows tests to be expressed as Rspec or Cucumber tests and provides
|
|
7
7
|
a library structure to support maintainable testing. It gives you
|
8
8
|
a place to put things.
|
9
9
|
|
10
|
-
* http://testobsessed.com/2008/05/31/a-place-to-put-things
|
10
|
+
* http://testobsessed.com/2008/05/31/a-place-to-put-things
|
11
11
|
|
12
12
|
== FEATURES
|
13
13
|
|
14
|
-
*
|
14
|
+
* Generates a directory structure for your test suite with one command.
|
15
15
|
* Provides page adapters you can customize for your application.
|
16
16
|
* Configure application URL and browser type (IE, Firefox) in one location.
|
17
17
|
* Framework automatically initializes browser for testing.
|
@@ -30,8 +30,8 @@ get the benefit.
|
|
30
30
|
|
31
31
|
== INSTALL
|
32
32
|
|
33
|
-
|
34
|
-
|
33
|
+
gem update --system
|
34
|
+
gem install watircraft
|
35
35
|
|
36
36
|
== EXAMPLE
|
37
37
|
|
data/VERSION.yml
CHANGED
data/{watircraft_generators/site → app_generators/watircraft}/templates/environments.yml.erb
RENAMED
File without changes
|
@@ -44,7 +44,7 @@ class WatircraftGenerator < RubiGen::Base
|
|
44
44
|
m.file "spec_helper.rb", "test/specs/spec_helper.rb", :collision => :force
|
45
45
|
m.file "feature_helper.rb", "test/features/feature_helper.rb", :collision => :force
|
46
46
|
|
47
|
-
m.template "initialize.rb.erb", "lib/initialize.rb", :collision => :
|
47
|
+
m.template "initialize.rb.erb", "lib/initialize.rb", :collision => :skip # not sure what's right
|
48
48
|
m.file "spec_initialize.rb", "lib/init/spec_initialize.rb", :collision => :force
|
49
49
|
m.file "world.rb", "lib/steps/world.rb", :collision => :force
|
50
50
|
m.template "site_start.rb.erb", "lib/init/site_start.rb", :collision => :force
|
@@ -53,7 +53,9 @@ class WatircraftGenerator < RubiGen::Base
|
|
53
53
|
|
54
54
|
m.dependency "install_rubigen_scripts", [destination_root, 'watircraft'],
|
55
55
|
:shebang => options[:shebang], :collision => :ask
|
56
|
-
|
56
|
+
|
57
|
+
m.template "site.rb.erb", "lib/#{@site}.rb", :collision => :skip
|
58
|
+
m.template "environments.yml.erb", "config/environments.yml", :collision => :skip
|
57
59
|
end
|
58
60
|
end
|
59
61
|
|
data/lib/extensions/watir.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# TODO: support radiogroup
|
2
2
|
# TODO: migrate this code into Watir
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
def Watir.add_display_value_methods_to mod
|
5
|
+
mod.module_eval <<-CLASS_END
|
6
|
+
|
5
7
|
class TextField # includes Hidden
|
6
8
|
def display_value
|
7
9
|
value
|
@@ -34,8 +36,15 @@ module Watir
|
|
34
36
|
text
|
35
37
|
end
|
36
38
|
end
|
39
|
+
class NonControlElement
|
40
|
+
def display_value
|
41
|
+
text
|
42
|
+
end
|
43
|
+
end
|
37
44
|
|
38
45
|
class B < NonControlElement
|
39
46
|
TAG = 'B'
|
40
47
|
end
|
48
|
+
|
49
|
+
CLASS_END
|
41
50
|
end
|
data/lib/taza/browser.rb
CHANGED
@@ -1,45 +1,50 @@
|
|
1
|
-
module Taza
|
2
|
-
class Browser
|
3
|
-
|
4
|
-
# Create a browser instance depending on configuration. Configuration should be read in via Taza::Settings.config.
|
5
|
-
#
|
6
|
-
# Example:
|
7
|
-
# browser = Taza::Browser.create(Taza::Settings.config)
|
8
|
-
#
|
9
|
-
def self.create(params={})
|
10
|
-
self.send("create_#{params[:driver]}".to_sym,params)
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def self.create_watir(params)
|
16
|
-
require 'watir'
|
17
|
-
|
18
|
-
|
19
|
-
require '
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
1
|
+
module Taza
|
2
|
+
class Browser
|
3
|
+
|
4
|
+
# Create a browser instance depending on configuration. Configuration should be read in via Taza::Settings.config.
|
5
|
+
#
|
6
|
+
# Example:
|
7
|
+
# browser = Taza::Browser.create(Taza::Settings.config)
|
8
|
+
#
|
9
|
+
def self.create(params={})
|
10
|
+
self.send("create_#{params[:driver]}".to_sym,params)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def self.create_watir(params)
|
16
|
+
require 'watir'
|
17
|
+
require 'extensions/watir'
|
18
|
+
if params[:browser] == :ie
|
19
|
+
require 'watir/ie'
|
20
|
+
Watir.add_display_value_methods_to Watir
|
21
|
+
end
|
22
|
+
if params[:browser] == :firefox
|
23
|
+
require 'firewatir'
|
24
|
+
Watir.add_display_value_methods_to FireWatir
|
25
|
+
end
|
26
|
+
Watir::Browser.default = params[:browser].to_s
|
27
|
+
Watir::Browser.new
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.create_selenium(params)
|
31
|
+
require 'selenium'
|
32
|
+
Selenium::SeleniumDriver.new(params[:server_ip],params[:server_port],'*' + params[:browser].to_s,params[:timeout])
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.create_fake(params)
|
36
|
+
FakeBrowser.new
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
class FakeBrowser
|
42
|
+
def goto(*args)
|
43
|
+
end
|
44
|
+
def close
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
data/lib/watircraft/version.rb
CHANGED
data/spec/page_generator_spec.rb
CHANGED
@@ -10,8 +10,13 @@ describe "Page Generation" do
|
|
10
10
|
include Helpers::Taza
|
11
11
|
|
12
12
|
before :each do
|
13
|
-
|
14
|
-
|
13
|
+
site_name = "Gap#{Time.now.to_i}"
|
14
|
+
generate_project ["--site=#{site_name}"]
|
15
|
+
site_file_path = File.join(PROJECT_FOLDER,'lib',"#{site_name.underscore}.rb")
|
16
|
+
require site_file_path
|
17
|
+
"::#{site_name.camelize}::#{site_name.camelize}".constantize.any_instance.stubs(:base_path).returns(PROJECT_FOLDER)
|
18
|
+
@site_class = site_name.camelize.constantize
|
19
|
+
|
15
20
|
@site_name = @site_class.to_s.underscore
|
16
21
|
end
|
17
22
|
|
@@ -7,97 +7,151 @@ require 'taza'
|
|
7
7
|
|
8
8
|
describe "Project Generator" do
|
9
9
|
include RubiGen::GeneratorTestHelper
|
10
|
+
include Helpers::Generator
|
10
11
|
|
11
12
|
def project_file relative_path
|
12
13
|
File.join(TMP_ROOT, PROJECT_NAME, relative_path)
|
13
14
|
end
|
14
|
-
|
15
|
+
def project_folder project_name=PROJECT_NAME
|
16
|
+
File.join(TMP_ROOT, project_name)
|
17
|
+
end
|
18
|
+
|
15
19
|
before :each do
|
16
|
-
@spec_helper = project_file 'test/specs/spec_helper.rb'
|
17
|
-
@initializer = project_file 'lib/initialize.rb'
|
18
20
|
ENV['ENVIRONMENT'] = nil
|
19
21
|
bare_setup
|
22
|
+
|
23
|
+
@site_folder = project_file 'lib'
|
24
|
+
@page_folder = project_file 'lib/pages'
|
25
|
+
@initializer = project_file 'lib/initialize.rb'
|
20
26
|
end
|
21
27
|
|
22
28
|
after :each do
|
23
29
|
bare_teardown
|
24
30
|
end
|
25
31
|
|
26
|
-
def should_be_loadable file
|
27
|
-
options = [options] unless options.is_a? Array
|
28
|
-
generator_args = [APP_ROOT] + options
|
29
|
-
run_generator('watircraft', generator_args, generator_sources)
|
32
|
+
def should_be_loadable file
|
30
33
|
load_path = File.dirname(__FILE__) + '/../lib'
|
31
34
|
system("ruby -I#{load_path} #{file} > #{null_device}").should be_true
|
32
35
|
end
|
33
36
|
|
34
37
|
it "should generate a spec helper that can be required even when site name is different" do
|
35
|
-
|
36
|
-
|
38
|
+
generate_project ['--site=another_name', '--driver=fake']
|
39
|
+
spec_helper = project_file 'test/specs/spec_helper.rb'
|
40
|
+
should_be_loadable spec_helper
|
41
|
+
end
|
37
42
|
|
38
43
|
it "should generate a feature helper that can be required" do
|
44
|
+
generate_project ['--driver=fake']
|
39
45
|
feature_helper = project_file 'test/features/feature_helper.rb'
|
40
|
-
should_be_loadable feature_helper
|
46
|
+
should_be_loadable feature_helper
|
41
47
|
end
|
42
48
|
|
43
49
|
it "should generate a world file that can be required" do
|
50
|
+
generate_project ['--driver=fake']
|
44
51
|
world = project_file 'lib/steps/world.rb'
|
45
|
-
should_be_loadable world
|
52
|
+
should_be_loadable world
|
46
53
|
end
|
47
54
|
|
48
55
|
it "should generate a rakefile that can be required" do
|
56
|
+
generate_project
|
49
57
|
rakefile = project_file 'rakefile'
|
50
58
|
should_be_loadable rakefile
|
51
59
|
end
|
52
60
|
|
53
61
|
it "should generate an initializer that can be required" do
|
62
|
+
generate_project
|
54
63
|
should_be_loadable @initializer
|
55
64
|
end
|
56
65
|
|
57
66
|
it "should be able to update an existing project and figure out the site name" do
|
58
|
-
|
59
|
-
|
67
|
+
generate_project ['--site=crazy']
|
68
|
+
generate_project
|
60
69
|
Taza::Settings.config[:site].should == 'crazy'
|
61
70
|
end
|
62
71
|
|
63
72
|
it "initializer should set the ENVIRONMENT variable if it is not provided" do
|
64
|
-
|
73
|
+
generate_project
|
65
74
|
load @initializer
|
66
75
|
ENV['ENVIRONMENT'].should eql("test")
|
67
76
|
end
|
68
77
|
|
69
78
|
it "initializer should not override the ENVIRONMENT variable if was provided" do
|
70
79
|
ENV['ENVIRONMENT'] = 'orange pie? is there such a thing?'
|
71
|
-
|
80
|
+
generate_project
|
72
81
|
load @initializer
|
73
82
|
ENV['ENVIRONMENT'].should eql('orange pie? is there such a thing?')
|
74
83
|
end
|
75
84
|
|
76
85
|
it "should configure a project for watir, implicitly" do
|
77
|
-
|
86
|
+
generate_project
|
78
87
|
Taza::Settings.stubs(:path).returns(APP_ROOT)
|
79
88
|
ENV['ENVIRONMENT'] = 'test'
|
80
89
|
Taza::Settings.config[:driver].should == :watir
|
81
90
|
end
|
82
91
|
|
83
92
|
it "should allow a site name to be specified" do
|
84
|
-
|
93
|
+
generate_project ['--site=site_name']
|
85
94
|
Taza::Settings.stubs(:path).returns(APP_ROOT)
|
86
95
|
ENV['ENVIRONMENT'] = 'test'
|
87
96
|
Taza::Settings.config[:site].should == 'site_name'
|
88
97
|
end
|
89
98
|
|
90
99
|
it "should allow a browser driver to be specified" do
|
91
|
-
|
100
|
+
generate_project ['--driver=nine_iron']
|
92
101
|
Taza::Settings.stubs(:path).returns(APP_ROOT)
|
93
102
|
ENV['ENVIRONMENT'] = 'test'
|
94
103
|
Taza::Settings.config[:driver].should == :nine_iron
|
95
104
|
end
|
96
105
|
|
97
106
|
it "should generate a script/console" do
|
98
|
-
|
107
|
+
generate_project
|
99
108
|
File.exist?(project_file('script/console')).should be_true
|
100
109
|
File.exist?(project_file('script/console.cmd')).should be_true
|
101
110
|
end
|
102
111
|
|
112
|
+
it "should generate configuration file for a site" do
|
113
|
+
generate_project
|
114
|
+
File.exists?(File.join(PROJECT_FOLDER,'config','environments.yml')).should be_true
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should generate site files and folders" do
|
118
|
+
generate_project
|
119
|
+
File.directory?(@site_folder).should be_true
|
120
|
+
File.directory?(@page_folder).should be_true
|
121
|
+
File.exists?("#{@site_folder}/example.rb").should be_true
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should generate a site path even if the site name is given with spaces" do
|
125
|
+
generate_project ["--site=example foo"]
|
126
|
+
File.directory?(@site_folder).should be_true
|
127
|
+
File.directory?(@page_folder).should be_true
|
128
|
+
File.exists?("#{@site_folder}/example_foo.rb").should be_true
|
129
|
+
end
|
130
|
+
|
131
|
+
it "should generate a site path even if the site name is given with underscores" do
|
132
|
+
generate_project ["--site=example_foo"]
|
133
|
+
File.directory?(@site_folder).should be_true
|
134
|
+
File.directory?(@page_folder).should be_true
|
135
|
+
File.exists?("#{@site_folder}/example_foo.rb").should be_true
|
136
|
+
end
|
137
|
+
|
138
|
+
include Helpers::Taza
|
139
|
+
it "generated site that uses the block given in new" do
|
140
|
+
site_name = "example#{Time.now.to_i}"
|
141
|
+
generate_project ["--site=#{site_name}"]
|
142
|
+
|
143
|
+
site_file_path = project_file "lib/#{site_name.underscore}.rb"
|
144
|
+
require site_file_path
|
145
|
+
"::#{site_name.camelize}::#{site_name.camelize}".constantize.any_instance.stubs(:base_path).returns(PROJECT_FOLDER)
|
146
|
+
site_class = site_name.camelize.constantize
|
147
|
+
|
148
|
+
stub_settings
|
149
|
+
stub_browser
|
150
|
+
foo = nil
|
151
|
+
site_class.new {|site| foo = site}
|
152
|
+
foo.should_not be_nil
|
153
|
+
foo.should be_a_kind_of(Taza::Site)
|
154
|
+
end
|
155
|
+
|
156
|
+
|
103
157
|
end
|
@@ -10,16 +10,9 @@ end
|
|
10
10
|
|
11
11
|
module Helpers
|
12
12
|
module Generator
|
13
|
-
def
|
14
|
-
|
15
|
-
run_generator('
|
16
|
-
site_file_path = File.join(PROJECT_FOLDER,'lib',"#{site_name.underscore}.rb")
|
17
|
-
require site_file_path
|
18
|
-
"::#{site_name.camelize}::#{site_name.camelize}".constantize.any_instance.stubs(:base_path).returns(PROJECT_FOLDER)
|
19
|
-
site_name.camelize.constantize
|
20
|
-
end
|
21
|
-
def generate_project
|
22
|
-
run_generator('watircraft', [APP_ROOT], generator_sources)
|
13
|
+
def generate_project options=[]
|
14
|
+
generator_args = [APP_ROOT] + options
|
15
|
+
run_generator('watircraft', generator_args, generator_sources)
|
23
16
|
::Taza::Settings.stubs(:path).returns(APP_ROOT)
|
24
17
|
end
|
25
18
|
end
|
data/spec/watir_spec.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec/spec_helper'
|
2
|
+
require 'watir'
|
3
|
+
require 'watir/ie'
|
4
|
+
require 'firewatir'
|
5
|
+
require 'extensions/watir'
|
6
|
+
|
7
|
+
describe 'Watir Extensions' do
|
8
|
+
share_examples_for 'extended watir' do
|
9
|
+
def should_provide_display_value_method_for_class klass
|
10
|
+
container = stub()
|
11
|
+
container.stubs(:page_container)
|
12
|
+
element = klass.new container, :index, 1
|
13
|
+
element.method(:display_value) # should be defined
|
14
|
+
end
|
15
|
+
|
16
|
+
specify { should_provide_display_value_method_for_class @module::TextField }
|
17
|
+
specify { should_provide_display_value_method_for_class @module::NonControlElement}
|
18
|
+
specify { should_provide_display_value_method_for_class @module::H3 }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "IE Watir" do
|
22
|
+
it_should_behave_like 'extended watir'
|
23
|
+
Watir.add_display_value_methods_to Watir
|
24
|
+
before do
|
25
|
+
@module = Watir
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "Fire Watir" do
|
30
|
+
it_should_behave_like 'extended watir'
|
31
|
+
Watir.add_display_value_methods_to FireWatir
|
32
|
+
before do
|
33
|
+
@module = FireWatir
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/watircraft.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{watircraft}
|
5
|
-
s.version = "0.4.
|
5
|
+
s.version = "0.4.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Bret Pettichord", "Jim Matthews", "Charley Baker", "Adam Anderson"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-03-24}
|
10
10
|
s.default_executable = %q{watircraft}
|
11
11
|
s.description = %q{WatirCraft is a framework for web testing.}
|
12
12
|
s.email = %q{bret@pettichord.com}
|
13
13
|
s.executables = ["watircraft"]
|
14
14
|
s.extra_rdoc_files = ["History.txt", "README.rdoc"]
|
15
|
-
s.files = ["BUGS.txt", "History.txt", "Manifest.txt", "README.rdoc", "VERSION.yml", "watircraft.gemspec", "bin/watircraft", "lib/extensions", "lib/extensions/array.rb", "lib/extensions/hash.rb", "lib/extensions/object.rb", "lib/extensions/string.rb", "lib/extensions/watir.rb", "lib/taza", "lib/taza/browser.rb", "lib/taza/entity.rb", "lib/taza/fixture.rb", "lib/taza/flow.rb", "lib/taza/page.rb", "lib/taza/settings.rb", "lib/taza/site.rb", "lib/taza/tasks.rb", "lib/taza.rb", "lib/watircraft", "lib/watircraft/generator_helper.rb", "lib/watircraft/table.rb", "lib/watircraft/version.rb", "lib/watircraft.rb", "spec/array_spec.rb", "spec/browser_spec.rb", "spec/entity_spec.rb", "spec/fake_table.rb", "spec/fixtures_spec.rb", "spec/fixture_spec.rb", "spec/hash_spec.rb", "spec/object_spec.rb", "spec/page_generator_spec.rb", "spec/page_spec.rb", "spec/project_generator_spec.rb", "spec/sandbox", "spec/sandbox/config", "spec/sandbox/config/config.yml", "spec/sandbox/config/environments.yml", "spec/sandbox/config/simpler.yml", "spec/sandbox/config/simpler_site.yml", "spec/sandbox/config.yml", "spec/sandbox/fixtures", "spec/sandbox/fixtures/examples.yml", "spec/sandbox/fixtures/users.yml", "spec/sandbox/flows", "spec/sandbox/flows/batman.rb", "spec/sandbox/flows/robin.rb", "spec/sandbox/pages", "spec/sandbox/pages/foo", "spec/sandbox/pages/foo/bar_page.rb", "spec/sandbox/pages/foo/partials", "spec/sandbox/pages/foo/partials/partial_the_reckoning.rb", "spec/settings_spec.rb", "spec/
|
15
|
+
s.files = ["BUGS.txt", "History.txt", "Manifest.txt", "README.rdoc", "VERSION.yml", "watircraft.gemspec", "bin/watircraft", "lib/extensions", "lib/extensions/array.rb", "lib/extensions/hash.rb", "lib/extensions/object.rb", "lib/extensions/string.rb", "lib/extensions/watir.rb", "lib/taza", "lib/taza/browser.rb", "lib/taza/entity.rb", "lib/taza/fixture.rb", "lib/taza/flow.rb", "lib/taza/page.rb", "lib/taza/settings.rb", "lib/taza/site.rb", "lib/taza/tasks.rb", "lib/taza.rb", "lib/watircraft", "lib/watircraft/generator_helper.rb", "lib/watircraft/table.rb", "lib/watircraft/version.rb", "lib/watircraft.rb", "spec/array_spec.rb", "spec/browser_spec.rb", "spec/entity_spec.rb", "spec/fake_table.rb", "spec/fixtures_spec.rb", "spec/fixture_spec.rb", "spec/hash_spec.rb", "spec/object_spec.rb", "spec/page_generator_spec.rb", "spec/page_spec.rb", "spec/project_generator_spec.rb", "spec/sandbox", "spec/sandbox/config", "spec/sandbox/config/config.yml", "spec/sandbox/config/environments.yml", "spec/sandbox/config/simpler.yml", "spec/sandbox/config/simpler_site.yml", "spec/sandbox/config.yml", "spec/sandbox/fixtures", "spec/sandbox/fixtures/examples.yml", "spec/sandbox/fixtures/users.yml", "spec/sandbox/flows", "spec/sandbox/flows/batman.rb", "spec/sandbox/flows/robin.rb", "spec/sandbox/pages", "spec/sandbox/pages/foo", "spec/sandbox/pages/foo/bar_page.rb", "spec/sandbox/pages/foo/partials", "spec/sandbox/pages/foo/partials/partial_the_reckoning.rb", "spec/settings_spec.rb", "spec/site_spec.rb", "spec/spec_generator_helper.rb", "spec/spec_generator_spec.rb", "spec/spec_helper.rb", "spec/steps_generator_spec.rb", "spec/string_spec.rb", "spec/table_spec.rb", "spec/taza_spec.rb", "spec/watircraft_bin_spec.rb", "spec/watir_spec.rb", "app_generators/watircraft", "app_generators/watircraft/templates", "app_generators/watircraft/templates/config.yml.erb", "app_generators/watircraft/templates/environments.yml.erb", "app_generators/watircraft/templates/feature_helper.rb", "app_generators/watircraft/templates/initialize.rb.erb", "app_generators/watircraft/templates/rakefile.rb", "app_generators/watircraft/templates/script", "app_generators/watircraft/templates/script/console", "app_generators/watircraft/templates/script/console.cmd", "app_generators/watircraft/templates/site.rb.erb", "app_generators/watircraft/templates/site_start.rb.erb", "app_generators/watircraft/templates/spec_helper.rb", "app_generators/watircraft/templates/spec_initialize.rb", "app_generators/watircraft/templates/world.rb", "app_generators/watircraft/USAGE", "app_generators/watircraft/watircraft_generator.rb", "watircraft_generators/page", "watircraft_generators/page/page_generator.rb", "watircraft_generators/page/templates", "watircraft_generators/page/templates/page.rb.erb", "watircraft_generators/page/USAGE", "watircraft_generators/spec", "watircraft_generators/spec/spec_generator.rb", "watircraft_generators/spec/templates", "watircraft_generators/spec/templates/spec.rb.erb", "watircraft_generators/spec/USAGE", "watircraft_generators/steps", "watircraft_generators/steps/steps_generator.rb", "watircraft_generators/steps/templates", "watircraft_generators/steps/templates/steps.rb.erb", "watircraft_generators/steps/USAGE"]
|
16
16
|
s.has_rdoc = true
|
17
17
|
s.rdoc_options = ["--main", "README.rdoc"]
|
18
18
|
s.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bret-watircraft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bret Pettichord
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2009-
|
15
|
+
date: 2009-03-24 00:00:00 -07:00
|
16
16
|
default_executable: watircraft
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -153,7 +153,6 @@ files:
|
|
153
153
|
- spec/sandbox/pages/foo/partials
|
154
154
|
- spec/sandbox/pages/foo/partials/partial_the_reckoning.rb
|
155
155
|
- spec/settings_spec.rb
|
156
|
-
- spec/site_generator_spec.rb
|
157
156
|
- spec/site_spec.rb
|
158
157
|
- spec/spec_generator_helper.rb
|
159
158
|
- spec/spec_generator_spec.rb
|
@@ -163,15 +162,18 @@ files:
|
|
163
162
|
- spec/table_spec.rb
|
164
163
|
- spec/taza_spec.rb
|
165
164
|
- spec/watircraft_bin_spec.rb
|
165
|
+
- spec/watir_spec.rb
|
166
166
|
- app_generators/watircraft
|
167
167
|
- app_generators/watircraft/templates
|
168
168
|
- app_generators/watircraft/templates/config.yml.erb
|
169
|
+
- app_generators/watircraft/templates/environments.yml.erb
|
169
170
|
- app_generators/watircraft/templates/feature_helper.rb
|
170
171
|
- app_generators/watircraft/templates/initialize.rb.erb
|
171
172
|
- app_generators/watircraft/templates/rakefile.rb
|
172
173
|
- app_generators/watircraft/templates/script
|
173
174
|
- app_generators/watircraft/templates/script/console
|
174
175
|
- app_generators/watircraft/templates/script/console.cmd
|
176
|
+
- app_generators/watircraft/templates/site.rb.erb
|
175
177
|
- app_generators/watircraft/templates/site_start.rb.erb
|
176
178
|
- app_generators/watircraft/templates/spec_helper.rb
|
177
179
|
- app_generators/watircraft/templates/spec_initialize.rb
|
@@ -183,11 +185,6 @@ files:
|
|
183
185
|
- watircraft_generators/page/templates
|
184
186
|
- watircraft_generators/page/templates/page.rb.erb
|
185
187
|
- watircraft_generators/page/USAGE
|
186
|
-
- watircraft_generators/site
|
187
|
-
- watircraft_generators/site/site_generator.rb
|
188
|
-
- watircraft_generators/site/templates
|
189
|
-
- watircraft_generators/site/templates/environments.yml.erb
|
190
|
-
- watircraft_generators/site/templates/site.rb.erb
|
191
188
|
- watircraft_generators/spec
|
192
189
|
- watircraft_generators/spec/spec_generator.rb
|
193
190
|
- watircraft_generators/spec/templates
|
data/spec/site_generator_spec.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'spec/spec_helper'
|
2
|
-
require 'spec/spec_generator_helper'
|
3
|
-
require 'rubygems'
|
4
|
-
require 'fileutils'
|
5
|
-
require 'taza'
|
6
|
-
|
7
|
-
describe "Site Generation" do
|
8
|
-
include RubiGen::GeneratorTestHelper
|
9
|
-
include Helpers::Generator
|
10
|
-
include Helpers::Taza
|
11
|
-
|
12
|
-
before :all do
|
13
|
-
@spec_helper = File.join(TMP_ROOT,PROJECT_NAME,'spec','spec_helper.rb')
|
14
|
-
@site_name = "WikipediaFoo"
|
15
|
-
@site_file = File.join(PROJECT_FOLDER,'lib', "wikipedia_foo.rb")
|
16
|
-
@site_folder = File.join(PROJECT_FOLDER,'lib')
|
17
|
-
@page_folder = File.join(@site_folder, 'pages')
|
18
|
-
end
|
19
|
-
|
20
|
-
before :each do
|
21
|
-
bare_setup
|
22
|
-
run_generator('watircraft', [APP_ROOT], generator_sources)
|
23
|
-
end
|
24
|
-
|
25
|
-
after :each do
|
26
|
-
bare_teardown
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should generate configuration file for a site" do
|
30
|
-
run_generator('site', [@site_name], generator_sources)
|
31
|
-
File.exists?(File.join(PROJECT_FOLDER,'config','environments.yml')).should be_true
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should generate a site path for pages" do
|
35
|
-
run_generator('site', [@site_name], generator_sources)
|
36
|
-
File.directory?(@site_folder).should be_true
|
37
|
-
File.directory?(@page_folder).should be_true
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should generate a site path even if the site name is given with spaces" do
|
41
|
-
run_generator('site', ["Wikipedia Foo"], generator_sources)
|
42
|
-
File.directory?(@site_folder).should be_true
|
43
|
-
File.directory?(@page_folder).should be_true
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should generate a site path even if the site name is given with underscores" do
|
47
|
-
run_generator('site', ["wikipedia_foo"], generator_sources)
|
48
|
-
File.directory?(@site_folder).should be_true
|
49
|
-
File.directory?(@page_folder).should be_true
|
50
|
-
end
|
51
|
-
|
52
|
-
it "generated site that uses the block given in new" do
|
53
|
-
@site_class = generate_site(@site_name)
|
54
|
-
stub_settings
|
55
|
-
stub_browser
|
56
|
-
foo = nil
|
57
|
-
@site_class.new {|site| foo = site}
|
58
|
-
foo.should_not be_nil
|
59
|
-
foo.should be_a_kind_of(Taza::Site)
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rubigen'
|
3
|
-
require 'extensions/string'
|
4
|
-
|
5
|
-
class SiteGenerator < RubiGen::Base
|
6
|
-
default_options :author => nil
|
7
|
-
attr_reader :name
|
8
|
-
|
9
|
-
def initialize(runtime_args, runtime_options = {})
|
10
|
-
super
|
11
|
-
usage if args.empty?
|
12
|
-
@name = args.shift.computerize
|
13
|
-
extract_options
|
14
|
-
end
|
15
|
-
|
16
|
-
def manifest
|
17
|
-
record do |m|
|
18
|
-
m.template "site.rb.erb", "lib/#{name}.rb", :collision => :skip
|
19
|
-
m.template "environments.yml.erb", "config/environments.yml", :collision => :skip
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
protected
|
24
|
-
def banner
|
25
|
-
<<-EOS
|
26
|
-
Creates the site for a watircraft project.
|
27
|
-
|
28
|
-
USAGE: #{$0} #{spec.name} name
|
29
|
-
|
30
|
-
EOS
|
31
|
-
end
|
32
|
-
|
33
|
-
def add_options!(opts)
|
34
|
-
# opts.separator ''
|
35
|
-
# opts.separator 'Options:'
|
36
|
-
# For each option below, place the default
|
37
|
-
# at the top of the file next to "default_options"
|
38
|
-
# opts.on("-a", "--author=\"Your Name\"", String,
|
39
|
-
# "Some comment about this option",
|
40
|
-
# "Default: none") { |options[:author]| }
|
41
|
-
# opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
42
|
-
end
|
43
|
-
|
44
|
-
def extract_options
|
45
|
-
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
46
|
-
# Templates can access these value via the attr_reader-generated methods, but not the
|
47
|
-
# raw instance variable value.
|
48
|
-
# @author = options[:author]
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|