lucid-gen 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 20336f2ad83d1cbfbff0be3566ccaf63cb6a2592
4
+ data.tar.gz: dca848a7d5e33a48194d3bd5eada3bc79f01b916
5
+ SHA512:
6
+ metadata.gz: dac03e822416abb38976155d965a7ee54e79d81368953b39728d4526fbece34ea003b3f7e2140086bbd1b84636ca85b813012c0df15d5c0b4d3ee65c6916dccd
7
+ data.tar.gz: 47c6eb5b5ed28fd4f00b555a9860c8624a6df63c7d938954a703c8dcc23fc4eeb02465a358684261f9ccd2ef6283590949181c611019aca00d605f945ff54920
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .idea
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Jeff Nyman
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # LucidGen
2
+
3
+ LucidGen is a project generator for [Lucid](https://github.com/jnyman/lucid) test repositories.
4
+
5
+ ## Installation
6
+
7
+ Install the gem as normal:
8
+
9
+ $ gem install lucid-gen
10
+
11
+ ## Usage
12
+
13
+ The easiest way to use Venom would be to have it generate the default structure for you:
14
+
15
+ $ lucid-gen project project-spec
16
+
17
+ This command will create a project structure with the directory name as project-spec.
18
+
19
+ The default driver for the projects created is [Fluent](https://github.com/jnyman/fluent). You can change this by specifying a driver
20
+
21
+ $ lucid-gen project project-spec --driver=capybara
22
+
23
+ Do note that, for the moment, LucidGen only generates driver files relevant to Fluent.
24
+
25
+ ## Contributing
26
+
27
+ 1. [Fork the project](http://gun.io/blog/how-to-github-fork-branch-and-pull-request/).
28
+ 2. Create a feature branch. (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes. (`git commit -am 'new feature'`)
30
+ 4. Push the branch. (`git push origin my-new-feature`)
31
+ 5. Create a new [pull request](https://help.github.com/articles/using-pull-requests).
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/bin/lucid-gen ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'lucid-gen/generator'
4
+ LucidGen::Generator.start
data/lib/lucid-gen.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'lucid-gen/version'
2
+ require 'lucid-gen/generator'
@@ -0,0 +1,16 @@
1
+ require 'thor'
2
+ require 'lucid-gen/generators/project'
3
+
4
+ module LucidGen
5
+ class Generator < Thor
6
+ desc 'project NAME', 'Create a new project.'
7
+
8
+ method_option :driver, aliases: '-d', type: :string, required: false, desc: "Framework driver to use. (Default value is 'fluent'.)"
9
+
10
+ def project(name)
11
+ puts "Name of project: #{name}"
12
+ driver = options[:driver].nil? ? 'fluent' : options[:driver]
13
+ LucidGen::Generators::Project.start([name, driver])
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,51 @@
1
+ require 'thor/group'
2
+
3
+ module LucidGen
4
+ module Generators
5
+ class Project < Thor::Group
6
+ include Thor::Actions
7
+
8
+ argument :name, type: :string, desc: 'Name of the project.'
9
+ argument :driver, type: :string, desc: 'Framework driver to use.'
10
+
11
+ desc 'Generates a project structure.'
12
+
13
+ def self.source_root
14
+ File.dirname(__FILE__) + '/project'
15
+ end
16
+
17
+ def spit_back_values
18
+ puts "Create project '#{name}' using #{driver}."
19
+ end
20
+
21
+ def create_project_directory
22
+ empty_directory(name)
23
+ end
24
+
25
+ def create_project_structure
26
+ empty_directory("#{name}/specs")
27
+ empty_directory("#{name}/common")
28
+ empty_directory("#{name}/common/helpers")
29
+ empty_directory("#{name}/common/support")
30
+ empty_directory("#{name}/common/config")
31
+ empty_directory("#{name}/common/data")
32
+ empty_directory("#{name}/steps")
33
+ empty_directory("#{name}/pages")
34
+ end
35
+
36
+ def copy_errors
37
+ copy_file 'errors.rb', "#{name}/common/support/errors.rb"
38
+ end
39
+
40
+ def copy_driver
41
+ if driver.downcase == 'fluent'
42
+ copy_file 'driver-fluent.rb', "#{name}/common/support/driver.rb"
43
+ end
44
+ end
45
+
46
+ def copy_gemfile
47
+ template 'Gemfile.tt', "#{name}/Gemfile"
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'lucid'
4
+ <% if driver.downcase == 'fluent' -%>gem 'fluent'<% end -%>
5
+ gem 'syntax'
@@ -0,0 +1,85 @@
1
+ begin
2
+ require 'fluent'
3
+ rescue LoadError
4
+ STDOUT.puts ['The Fluent test execution library is not installed.',
5
+ 'The driver file is currently set to use the Fluent library but',
6
+ 'that gem was not found. Run the following command:', '',
7
+ ' gem install fluent'].join("\n")
8
+ Kernel.exit(1)
9
+ end
10
+
11
+ Domain(Fluent::Factory)
12
+
13
+ module Fluent
14
+ module Browser
15
+
16
+ @@browser = false
17
+
18
+ class Selenium::WebDriver::IE::Server
19
+ old_server_args = instance_method(:server_args)
20
+ define_method(:server_args) do
21
+ old_server_args.bind(self).() << "--silent"
22
+ end
23
+ end
24
+
25
+ class Selenium::WebDriver::Chrome::Service
26
+ old_initialize = instance_method(:initialize)
27
+ define_method(:initialize) do |executable_path, port, *extra_args|
28
+ old_initialize.bind(self).call(executable_path, port, '--silent', *extra_args)
29
+ end
30
+ end
31
+
32
+ def self.start
33
+ unless @@browser
34
+ target = ENV['BROWSER'] || 'firefox'
35
+ @@browser = watir_browser(target)
36
+ end
37
+ @@browser
38
+ end
39
+
40
+ def self.stop
41
+ @@browser.quit if @@browser
42
+ @@browser = false
43
+ end
44
+
45
+ private
46
+
47
+ def self.watir_browser(target)
48
+ Watir::Browser.new(target.to_sym)
49
+ end
50
+ end
51
+ end
52
+
53
+ AfterConfiguration do |config|
54
+ puts("Specs are being executed from: #{config.spec_location}")
55
+ end
56
+
57
+ Before('~@practice','~@sequence') do
58
+ @browser = Fluent::Browser.start
59
+ end
60
+
61
+ AfterStep('@pause') do
62
+ print 'Press ENTER to continue...'
63
+ STDIN.getc
64
+ end
65
+
66
+ After do |scenario|
67
+ if scenario.failed?
68
+ Dir::mkdir('results') if not File.directory?('results')
69
+ screenshot = "./results/FAILED_#{scenario.name.gsub(' ','_').gsub(/[^0-9A-Za-z_]/, '')}.png"
70
+
71
+ if @browser
72
+ # This way attempts to save the screenshot as a file.
73
+ #@browser.driver.save_screenshot(screenshot)
74
+
75
+ # This way the image is encoded into the results.
76
+ encoded_img = @browser.driver.screenshot_as(:base64)
77
+ embed("data:image/png;base64,#{encoded_img}", 'image/png')
78
+ end
79
+ end
80
+ Fluent::Browser.stop
81
+ end
82
+
83
+ at_exit do
84
+ Fluent::Browser.stop
85
+ end
@@ -0,0 +1,26 @@
1
+ class InvalidDataConditionError < StandardError
2
+ end
3
+
4
+ class NecessaryDataNotAvailableError < StandardError
5
+ end
6
+
7
+ class NecessaryDataAlreadyAvailableError < StandardError
8
+ end
9
+
10
+ class NotSpecificEnoughDataError < StandardError
11
+ end
12
+
13
+ class PossibleDataContextError < StandardError
14
+ end
15
+
16
+ class ContextCannotBeFulfilledError < StandardError
17
+ end
18
+
19
+ class DataValidationError < StandardError
20
+ end
21
+
22
+ class UnexpectedDataFoundError < StandardError
23
+ end
24
+
25
+ class TestDataNotFoundError < StandardError
26
+ end
@@ -0,0 +1,3 @@
1
+ module LucidGen
2
+ VERSION = '1.0.0'
3
+ end
data/lucid-gen.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'lucid-gen/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'lucid-gen'
8
+ spec.version = LucidGen::VERSION
9
+ spec.authors = ['Jeff Nyman']
10
+ spec.email = ['jeffnyman@gmail.com']
11
+ spec.summary = %q{Lucid Test Repository Project Generator}
12
+ spec.description = %q{
13
+ LucidGen generates test repositories for the Lucid framework.
14
+ Lucid is an opinionated framework that has definite ideas about
15
+ how test repositories should be set up. LucidGen allows you to
16
+ create projects that Lucid will, by convention, understand.
17
+ }
18
+ spec.homepage = 'https://github.com/jnyman/lucid-gen'
19
+ spec.license = 'MIT'
20
+
21
+ spec.files = `git ls-files -z`.split("\x0")
22
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
24
+ spec.require_paths = %w(lib)
25
+
26
+ spec.add_development_dependency 'bundler', '~> 1.5'
27
+ spec.add_development_dependency 'rake'
28
+
29
+ spec.add_runtime_dependency 'thor', '>= 0.18'
30
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lucid-gen
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jeff Nyman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0.18'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0.18'
55
+ description: "\n LucidGen generates test repositories for the Lucid framework.\n
56
+ \ Lucid is an opinionated framework that has definite ideas about\n how test
57
+ repositories should be set up. LucidGen allows you to\n create projects that
58
+ Lucid will, by convention, understand.\n "
59
+ email:
60
+ - jeffnyman@gmail.com
61
+ executables:
62
+ - lucid-gen
63
+ extensions: []
64
+ extra_rdoc_files: []
65
+ files:
66
+ - .gitignore
67
+ - Gemfile
68
+ - LICENSE.txt
69
+ - README.md
70
+ - Rakefile
71
+ - bin/lucid-gen
72
+ - lib/lucid-gen.rb
73
+ - lib/lucid-gen/generator.rb
74
+ - lib/lucid-gen/generators/project.rb
75
+ - lib/lucid-gen/generators/project/Gemfile.tt
76
+ - lib/lucid-gen/generators/project/driver-fluent.rb
77
+ - lib/lucid-gen/generators/project/errors.rb
78
+ - lib/lucid-gen/version.rb
79
+ - lucid-gen.gemspec
80
+ homepage: https://github.com/jnyman/lucid-gen
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 2.1.11
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: Lucid Test Repository Project Generator
104
+ test_files: []
105
+ has_rdoc: