auto_data 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +50 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +76 -0
- data/Rakefile +2 -0
- data/auto_data.gemspec +27 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/config/data/environment.yml +8 -0
- data/config/data/users.yml +9 -0
- data/lib/auto_data.rb +83 -0
- data/lib/auto_data/version.rb +3 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f979d9a19f6b1e9dca7c8da1cc6dcab1fb5ae631
|
4
|
+
data.tar.gz: c6bb8218cbf1cad7909a67128843b5601cc1823a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c1315a87b6a77fc343f6739933d1ad91771526943c0f29a0350c734dffceac89020641fae4cc1d3661321a10fff27a03d6eb192c814a497c8418555ac0ee93e1
|
7
|
+
data.tar.gz: e67012a0223c348cb8bf4d9f55ec12fe8581190d6bf8f3aef3398b60a4d79d5385cfcd1e1d39679a97ff55648c6eeb9a231e2859bc6af7b0a428fd975c5f6fc6
|
data/.gitignore
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at andrade@mx1.ibm.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Alejandro Aguilar Andrade
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# AutoData
|
2
|
+
|
3
|
+
Manage test data and environment configuration for automated test projects.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'auto_data'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install auto_data
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
YML files are needed to define data.
|
24
|
+
|
25
|
+
CONF_DATA_TEST : key section to use from YML file for test data
|
26
|
+
CONF_ENV_TEST : key section to use from YML file for environment data
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'auto_data'
|
30
|
+
#Define global key variables
|
31
|
+
ENV["CONF_DATA_TEST"] = "manager"
|
32
|
+
ENV["CONF_ENV_TEST"] = "testing"
|
33
|
+
|
34
|
+
#Create objects
|
35
|
+
login=AutoData::Data.new
|
36
|
+
env = AutoData::Env.new
|
37
|
+
|
38
|
+
#Set path file that contains value details
|
39
|
+
login.load('config/data/users.yml')
|
40
|
+
env.load('config/data/environment.yml')
|
41
|
+
|
42
|
+
#Use the information as you have defined in the yml conf file
|
43
|
+
puts login.login #=> manager_id
|
44
|
+
puts login.password #=> zaq12wsx
|
45
|
+
puts login.username #=> Batman
|
46
|
+
|
47
|
+
#environment
|
48
|
+
puts env.base_url #=> http://testing.sample.com
|
49
|
+
|
50
|
+
```
|
51
|
+
|
52
|
+
###Switch global keys
|
53
|
+
|
54
|
+
Switch global keys variable in runtime
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
login.change_scope('customer')
|
58
|
+
env.change_scope('uat')
|
59
|
+
|
60
|
+
#Use the information as you have defined in the yml conf file
|
61
|
+
puts login.login #=> customer_id
|
62
|
+
puts login.password #=> zaq12wsx
|
63
|
+
puts login.username #=> Robin
|
64
|
+
|
65
|
+
#environment
|
66
|
+
puts env.base_url #=> http://uat.sample.com
|
67
|
+
|
68
|
+
```
|
69
|
+
## Contributing
|
70
|
+
|
71
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/alekxaguilar/auto_data/issues. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
72
|
+
|
73
|
+
|
74
|
+
## License
|
75
|
+
|
76
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/auto_data.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'auto_data/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "auto_data"
|
8
|
+
spec.version = AutoData::VERSION
|
9
|
+
spec.authors = ["Alejandro Aguilar"]
|
10
|
+
spec.email = ["alekx.aguilar@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Manage Test and Configuration data. }
|
13
|
+
spec.description = %q{Manage Test and configuration data for any automated test project.}
|
14
|
+
spec.homepage = "https://github.com/alekxaguilar/auto_data"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
+
f.match(%r{^(test|spec|features)/})
|
20
|
+
end
|
21
|
+
spec.bindir = "exe"
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "auto_data"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/auto_data.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
require "auto_data/version"
|
2
|
+
require "yaml"
|
3
|
+
module AutoData
|
4
|
+
class Data
|
5
|
+
|
6
|
+
def initialize()
|
7
|
+
@data=ENV['CONF_DATA_TEST'].to_s.downcase
|
8
|
+
end
|
9
|
+
|
10
|
+
def load(file)
|
11
|
+
#@file = YAML.load_file(file)
|
12
|
+
|
13
|
+
@file = begin
|
14
|
+
YAML.load(File.open(file))
|
15
|
+
rescue Exception => e #ArgumentError
|
16
|
+
puts "Could not parse auto objects files: #{e.message}"
|
17
|
+
raise Exception.new('Could not parse auto objects files: #{e.message}')
|
18
|
+
end
|
19
|
+
#self
|
20
|
+
end
|
21
|
+
#Change environment key path
|
22
|
+
def change_scope(data)
|
23
|
+
@data=data.to_s.downcase
|
24
|
+
end
|
25
|
+
|
26
|
+
#Change data key path
|
27
|
+
def chage_scope(data_key)
|
28
|
+
@data=data_key.to_s.downcase
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def method_missing (method)
|
33
|
+
|
34
|
+
result= begin @file["#{@data}"]["#{method}"].nil? ? 'No Value Found' : @file["#{@data}"]["#{method}"]
|
35
|
+
rescue NoMethodError => e
|
36
|
+
puts "valdio dick #{e.message}"
|
37
|
+
end
|
38
|
+
|
39
|
+
result
|
40
|
+
end
|
41
|
+
|
42
|
+
#TODO: Validar si el cambio de data scope, es correcto (existe)
|
43
|
+
def valid_data?
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
class Env
|
50
|
+
|
51
|
+
def initialize()
|
52
|
+
@env = ENV['CONF_ENV_TEST'].to_s.downcase
|
53
|
+
end
|
54
|
+
|
55
|
+
def load(file)
|
56
|
+
#@file = YAML.load_file(file)
|
57
|
+
@file = begin
|
58
|
+
YAML.load(File.open(file))
|
59
|
+
rescue Exception => e #ArgumentError
|
60
|
+
puts "Could not parse auto objects files: #{e.message}"
|
61
|
+
e.exception('adsfasdfas')
|
62
|
+
end
|
63
|
+
#self
|
64
|
+
end
|
65
|
+
#Change environment key path
|
66
|
+
def change_scope(env)
|
67
|
+
@env=env.to_s.downcase
|
68
|
+
end
|
69
|
+
|
70
|
+
def method_missing (method)
|
71
|
+
result= begin @file["#{@env}"]["#{method}"].nil? ? 'No Value Found' : @file["#{@env}"]["#{method}"]
|
72
|
+
rescue NoMethodError => e
|
73
|
+
puts "valdio dick #{e.message}"
|
74
|
+
end
|
75
|
+
result
|
76
|
+
end
|
77
|
+
|
78
|
+
#TODO: Validar si el cambio de env, es correcto (existe)
|
79
|
+
def valid_environment?
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: auto_data
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alejandro Aguilar
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-02-16 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.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Manage Test and configuration data for any automated test project.
|
42
|
+
email:
|
43
|
+
- alekx.aguilar@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- CODE_OF_CONDUCT.md
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- auto_data.gemspec
|
55
|
+
- bin/console
|
56
|
+
- bin/setup
|
57
|
+
- config/data/environment.yml
|
58
|
+
- config/data/users.yml
|
59
|
+
- lib/auto_data.rb
|
60
|
+
- lib/auto_data/version.rb
|
61
|
+
homepage: https://github.com/alekxaguilar/auto_data
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.6.10
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: Manage Test and Configuration data.
|
85
|
+
test_files: []
|