taza 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+ === 0.5.0 / 2008-10-03
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
@@ -0,0 +1,17 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ bin/taza
6
+ lib/taza/generators/site.rb
7
+ lib/taza/generators/project.rb
8
+ lib/taza/generators/base.rb
9
+ lib/taza/generators/page.rb
10
+ lib/taza/generators.rb
11
+ lib/taza/generators/templates/rakefile.rb.erb
12
+ lib/taza/generators/templates/page.rb.erb
13
+ lib/taza/generators/templates/site.rb.erb
14
+ lib/taza/page.rb
15
+ lib/taza/site.rb
16
+ lib/taza/tasks.rb
17
+ lib/taza.rb
@@ -0,0 +1,57 @@
1
+ = taza
2
+
3
+ * http://github.com/scudco/taza/tree/master
4
+
5
+ == DESCRIPTION:
6
+
7
+ Taza is meant to make acceptance testing more sane for developers(or QA where applicable) and customers.
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * Generate a project for application testing
12
+ * Generate pages and sites for different applications
13
+ * Manage tests by tags
14
+ * Cross-site testing
15
+
16
+ == SYNOPSIS:
17
+
18
+ To generate a new skeleton for acceptance testing
19
+ $ taza foo
20
+
21
+ Inside your new skeleton you'll have a few rake tasks available to help you get started
22
+ $ rake generate:site name=google
23
+ $ rake generate:page site=google name=home_page
24
+
25
+ == REQUIREMENTS:
26
+
27
+ * taglob
28
+
29
+ == INSTALL:
30
+
31
+ * sudo gem install taza
32
+ * gem install taza
33
+
34
+ == LICENSE:
35
+
36
+ (The MIT License)
37
+
38
+ Copyright (c) 2008 Charley Baker
39
+
40
+ Permission is hereby granted, free of charge, to any person obtaining
41
+ a copy of this software and associated documentation files (the
42
+ 'Software'), to deal in the Software without restriction, including
43
+ without limitation the rights to use, copy, modify, merge, publish,
44
+ distribute, sublicense, and/or sell copies of the Software, and to
45
+ permit persons to whom the Software is furnished to do so, subject to
46
+ the following conditions:
47
+
48
+ The above copyright notice and this permission notice shall be
49
+ included in all copies or substantial portions of the Software.
50
+
51
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
52
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
53
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
54
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
55
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
56
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
57
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,66 @@
1
+ # -*- ruby -*-
2
+ $:.unshift(File.join(File.dirname(__FILE__), 'lib'))
3
+
4
+ require 'rubygems'
5
+ require 'hoe'
6
+ require 'taza'
7
+ require 'rbconfig'
8
+ require 'spec/rake/spectask'
9
+
10
+ private
11
+ def windows?
12
+ Config::CONFIG['host_os'].include?("mswin")
13
+ end
14
+
15
+ public
16
+
17
+ Hoe.new('taza', Taza::VERSION) do |p|
18
+ p.rubyforge_name = 'taza' # if different than lowercase project name
19
+ p.developer('Adam Anderson', 'adamandersonis@gmail.com')
20
+ p.remote_rdoc_dir = ''
21
+ end
22
+
23
+ Spec::Rake::SpecTask.new do |t|
24
+ t.libs << File.join(File.dirname(__FILE__), 'lib')
25
+ t.spec_files = FileList['spec/**/*_spec.rb']
26
+ end
27
+
28
+ desc "Run all examples with RCov"
29
+ Spec::Rake::SpecTask.new('rcov') do |t|
30
+ t.spec_files = FileList['spec/**/*_spec.rb']
31
+ t.rcov = true
32
+ t.rcov_dir = 'artifacts'
33
+ t.rcov_opts = ['--exclude', 'spec']
34
+
35
+ end
36
+
37
+ desc "Run flog against all the files in the lib"
38
+ task :flog do
39
+ require "flog"
40
+ flogger = Flog.new
41
+ flogger.flog_files Dir["lib/**/*.rb"]
42
+ File.open("artifacts/flogreport.txt","w") do |file|
43
+ flogger.report file
44
+ end
45
+ end
46
+
47
+ desc "Run saikuro cyclo complexity against the lib"
48
+ task :saikuro do
49
+ #we can specify options like ignore filters and set warning or error thresholds
50
+ system "ruby vendor/gems/gems/Saikuro-1.1.0/bin/saikuro -c -t -i lib -y 0 -o artifacts"
51
+ end
52
+
53
+ namespace :gem do
54
+ desc "install a gem into vendor/gems"
55
+ task :install do
56
+ if ENV["name"].nil?
57
+ STDERR.puts "Usage: rake gem:install name=the_gem_name"; exit 1
58
+ end
59
+ gem = windows? ? "gem.bat" : "gem"
60
+ system "#{gem} install #{ENV['name']} --install-dir=vendor/gems --no-rdoc --no-ri -p ""http://10.8.77.100:8080"""
61
+ end
62
+ end
63
+
64
+ #define a task which uses flog
65
+ # vim: syntax=ruby
66
+
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
3
+ require 'taza/generators'
4
+ Taza::Generators::Project.new(ARGV[0]).generate
@@ -0,0 +1,13 @@
1
+ require 'taza/generators'
2
+ require 'taza/page'
3
+ require 'taza/site'
4
+ require 'taza/tasks'
5
+
6
+ module Taza
7
+ VERSION = '0.5.0'
8
+
9
+ def self.windows?
10
+ PLATFORM.include?("mswin")
11
+ end
12
+
13
+ end
@@ -0,0 +1,4 @@
1
+ require 'taza/generators/base'
2
+ require 'taza/generators/site'
3
+ require 'taza/generators/project'
4
+ require 'taza/generators/page'
@@ -0,0 +1,33 @@
1
+ require 'rubygems'
2
+ require 'activesupport'
3
+ require 'erb'
4
+
5
+ module Taza
6
+ module Generators
7
+ class Base
8
+ def file(template_file_name,output_file)
9
+ write_file(output_file,render_template(template_file_name))
10
+ end
11
+
12
+ def render_template(template_file_name)
13
+ template = ERB.new(read_template(template_file_name))
14
+ template.result(binding)
15
+ end
16
+
17
+ def folder(path)
18
+ underscored_path = Inflector.underscore(path)
19
+ Dir.mkdir(underscored_path) unless File.directory?(underscored_path)
20
+ end
21
+
22
+ def write_file(output_file,contents)
23
+ File.open(Inflector.underscore(output_file),"w") do |out|
24
+ out << contents
25
+ end
26
+ end
27
+
28
+ def read_template(template_file_name)
29
+ File.read(File.join(File.dirname(__FILE__),"templates",template_file_name))
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,22 @@
1
+ require 'taza/generators/base'
2
+
3
+ module Taza
4
+ module Generators
5
+ class Page < Base
6
+ attr_accessor :file_name
7
+ def initialize(file_name,site_name)
8
+ @file_name = file_name
9
+ @site_name = site_name
10
+ end
11
+
12
+ def folder_path
13
+ File.join('lib','sites')
14
+ end
15
+
16
+ def generate
17
+ file "page.rb.erb", File.join(folder_path, @site_name, "pages", "#{@file_name}.rb")
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,18 @@
1
+ require 'taza/generators/base'
2
+
3
+ module Taza
4
+ module Generators
5
+ class Project < Base
6
+ def initialize(path)
7
+ @path = path
8
+ end
9
+ def generate
10
+ folder @path
11
+ file "rakefile.rb.erb", File.join(@path,"rakefile")
12
+ folder File.join(@path,"lib")
13
+ folder File.join(@path,"lib","sites")
14
+ folder File.join(@path,"lib","flows")
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,24 @@
1
+ require 'taza/generators/base'
2
+
3
+ module Taza
4
+ module Generators
5
+ class Site < Base
6
+ attr_accessor :file_name
7
+
8
+ def initialize(file_name)
9
+ @file_name = file_name
10
+ end
11
+
12
+ def folder_path
13
+ File.join('lib','sites')
14
+ end
15
+
16
+ def generate
17
+ file "site.rb.erb", File.join(folder_path,"#{file_name}.rb")
18
+ folder File.join(folder_path,"#{file_name}")
19
+ folder File.join(folder_path,"#{file_name}","flows")
20
+ folder File.join(folder_path,"#{file_name}","pages")
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ require 'taza/page'
3
+
4
+ class <%= Inflector.camelize(file_name) %> < Taza::Page
5
+
6
+ end
@@ -0,0 +1,3 @@
1
+ <%= "#Generated at #{Time.now}" %>
2
+ require 'rubygems'
3
+ require 'taza/tasks'
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ require 'taza/site'
3
+
4
+ class <%= Inflector.camelize(file_name) %> < Taza::Site
5
+
6
+ end
@@ -0,0 +1,48 @@
1
+ module Taza
2
+ class Page
3
+ class << self
4
+ attr_accessor :filters, :elements
5
+ end
6
+
7
+ self.filters = Hash.new { [] }
8
+ self.elements = {}
9
+
10
+ def self.element(name,&block)
11
+ self.elements[name] = block
12
+ end
13
+
14
+ def self.filter(params,&block)
15
+ params[:elements] = [:all] unless params.has_key? :elements
16
+
17
+ params[:elements].each do |element|
18
+ self.filters[element] = self.filters[element] << [params[:name],block]
19
+ end
20
+ end
21
+
22
+ def initialize
23
+ add_element_methods
24
+ end
25
+
26
+ def add_element_methods
27
+ self.class.elements.each do |element_name,element_block|
28
+ filters = self.class.filters[element_name] + self.class.filters[:all]
29
+ add_element_method(:filters => filters, :method_name => element_name, :method_block => element_block)
30
+ end
31
+ end
32
+
33
+ def add_element_method(params)
34
+ self.class.class_eval do
35
+ define_method(params[:method_name]) do
36
+ params[:filters].each do |(filter_name,filter_block)|
37
+ unless filter_block.call
38
+ raise FilterError, "#{filter_name} returned false for #{params[:method_name]}"
39
+ end
40
+ end
41
+ params[:method_block].call
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ class FilterError < StandardError; end
48
+ end
@@ -0,0 +1,28 @@
1
+ require 'rubygems'
2
+ require 'activesupport'
3
+
4
+ module Taza
5
+ class Site
6
+ def initialize
7
+ define_site_pages
8
+ end
9
+
10
+ def define_site_pages
11
+ Dir.glob(path) do |file|
12
+ require file
13
+
14
+ page_name = File.basename(file,'.rb')
15
+ self.class.class_eval <<-EOS
16
+ def #{page_name}
17
+ yield '#{page_name}'.camelcase.constantize.new
18
+ end
19
+ EOS
20
+ end
21
+ end
22
+
23
+ def path
24
+ File.join('pages',self.class.to_s.underscore,'*.rb')
25
+ end
26
+ end
27
+ end
28
+
@@ -0,0 +1,46 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rubygems'
4
+ require 'taglob'
5
+ require 'spec/rake/spectask'
6
+ require 'taza/generators'
7
+
8
+ private
9
+ def get_tagged_files(test_file_pattern)
10
+ Dir.taglob(test_file_pattern,ENV['tags'])
11
+ end
12
+
13
+ def validate_required_environment_input_present(error_message, *environment_variable_keys)
14
+ environment_variable_keys.each do |environment_variable_key|
15
+ if ENV[environment_variable_key].nil?
16
+ STDERR.puts error_message
17
+ exit 1
18
+ end
19
+ end
20
+ end
21
+
22
+ public
23
+
24
+ desc "invoke tests by tag"
25
+ Rake::TestTask.new :test_tag do |t|
26
+ t.test_files = get_tagged_files('test/**/test_*.rb')
27
+ end
28
+
29
+ desc "invoke specs by tag"
30
+ Spec::Rake::SpecTask.new :spec_tag do |t|
31
+ t.spec_files = get_tagged_files('spec/**/*_spec.rb')
32
+ end
33
+
34
+ namespace :generate do
35
+ desc "generate a site(rake generate:site name=foo)"
36
+ task :site do
37
+ validate_required_environment_input_present("Usage: rake generate:site name=the_site_name",'name')
38
+ Taza::Generators::Site.new(ENV['name']).generate
39
+ end
40
+
41
+ desc "generate a page(rake generate:page site=foo page=bar)"
42
+ task :page do
43
+ validate_required_environment_input_present("Usage: rake generate:page name=the_page_name site=the_site_name",'name','site')
44
+ Taza::Generators::Page.new(ENV['name'],ENV['site']).generate
45
+ end
46
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: taza
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ platform: ruby
6
+ authors:
7
+ - Adam Anderson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-10-06 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.7.0
24
+ version:
25
+ description: Taza is meant to make acceptance testing more sane for developers(or QA where applicable) and customers.
26
+ email:
27
+ - adamandersonis@gmail.com
28
+ executables:
29
+ - taza
30
+ extensions: []
31
+
32
+ extra_rdoc_files:
33
+ - History.txt
34
+ - Manifest.txt
35
+ - README.txt
36
+ files:
37
+ - History.txt
38
+ - Manifest.txt
39
+ - README.txt
40
+ - Rakefile
41
+ - bin/taza
42
+ - lib/taza/generators/site.rb
43
+ - lib/taza/generators/project.rb
44
+ - lib/taza/generators/base.rb
45
+ - lib/taza/generators/page.rb
46
+ - lib/taza/generators.rb
47
+ - lib/taza/generators/templates/rakefile.rb.erb
48
+ - lib/taza/generators/templates/page.rb.erb
49
+ - lib/taza/generators/templates/site.rb.erb
50
+ - lib/taza/page.rb
51
+ - lib/taza/site.rb
52
+ - lib/taza/tasks.rb
53
+ - lib/taza.rb
54
+ has_rdoc: true
55
+ homepage: "http://github.com/scudco/taza/tree/master "
56
+ post_install_message:
57
+ rdoc_options:
58
+ - --main
59
+ - README.txt
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ version:
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: "0"
73
+ version:
74
+ requirements: []
75
+
76
+ rubyforge_project: taza
77
+ rubygems_version: 1.2.0
78
+ signing_key:
79
+ specification_version: 2
80
+ summary: Taza is meant to make acceptance testing more sane for developers(or QA where applicable) and customers.
81
+ test_files: []
82
+