factory-test-combination 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2b09849675e03ba98668235dd1ef340f85a9026e43ad6d3906e236af2b530a56
4
+ data.tar.gz: 3641ff90f8a76f74c50b9e3cf76f6a630eb4ccecdcdc606349d0d588d869aa33
5
+ SHA512:
6
+ metadata.gz: fb896378945e3b2d7db2f1d0a804024e1e094f35a82ec3ebef509c21f9709ac23b16190070b1d9a12cdfb81f960c643d825942b0541bee7c8012801d284e0bd7
7
+ data.tar.gz: 0416ef8b7dca0ab1da8e3990d6e88f85983fbe8ac8836c10839620231ab9f505e7b4b18b55f1513e6c54b8fc871adc3404437385739c202a86373a94c26f8522
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in factory-test-combination.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,21 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ factory-test-combination (0.1.0)
5
+ thor
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ rake (13.0.6)
11
+ thor (1.2.1)
12
+
13
+ PLATFORMS
14
+ x86_64-darwin-20
15
+
16
+ DEPENDENCIES
17
+ factory-test-combination!
18
+ rake (~> 13.0)
19
+
20
+ BUNDLED WITH
21
+ 2.3.5
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 katuo
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # Factory::Test::Combination
2
+ A gem library to generate test case combinations, etc.
3
+
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ ```ruby
9
+ gem 'factory-test-combination'
10
+ ```
11
+
12
+ And then execute:
13
+
14
+ $ bundle install
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install factory-test-combination
19
+
20
+ ## Contributing
21
+
22
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/factory-test-combination.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "factory/test/combination"
4
+
5
+ Factory::Test::Combination::CLI.start
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/factory/test/combination/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "factory-test-combination"
7
+ spec.version = Factory::Test::Combination::VERSION
8
+ spec.authors = ["katuo0011"]
9
+ spec.email = ["yuskeisono1996@gmail.com"]
10
+
11
+ spec.summary = "create array combination for testcase"
12
+ # spec.homepage = "TODO: Put your gem's website or public repo URL here."
13
+ spec.required_ruby_version = ">= 2.5.0"
14
+
15
+ # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
16
+
17
+ spec.metadata["homepage_uri"] = "https://github.com/katuo0011/factory-test-combination"
18
+
19
+ # Specify which files should be added to the gem when it is released.
20
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
+ `git ls-files -z`.split("\x0").reject do |f|
23
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
24
+ end
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ # Uncomment to register a new dependency of your gem
31
+ spec.add_dependency "thor"
32
+ # For more information and examples about making a new gem, check out our
33
+ # guide at: https://bundler.io/guides/creating_gem.html
34
+ end
@@ -0,0 +1,33 @@
1
+ require 'csv'
2
+
3
+ class AbstractorCreator
4
+ @output = []
5
+
6
+ def initialize(input_file, output_file)
7
+ @input_file = input_file
8
+ @output_file = output_file
9
+ end
10
+
11
+ def export
12
+ read_csv
13
+
14
+ create
15
+
16
+ write_csv
17
+ end
18
+
19
+ def read_csv
20
+ @csv_rows = CSV.read(@input_file)
21
+ end
22
+
23
+ def create
24
+ end
25
+
26
+ def write_csv
27
+ CSV.open(@output_file,'w') do |test|
28
+ @output.each do |a|
29
+ test << a
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,25 @@
1
+ require "factory/test/combination"
2
+ require "thor"
3
+ require_relative "./concrete_creators/combination_creator"
4
+
5
+ module Factory
6
+ module Test
7
+ module Combination
8
+ class CLI < Thor
9
+ desc "create", "create array combination"
10
+ option "input", aliases: "i"
11
+ option "output", aliases: "o"
12
+ def create(input="input.csv", output="output.csv")
13
+ unless options["input"].nil?
14
+ input = options["input"]
15
+ end
16
+ unless options["output"].nil?
17
+ output = options["output"]
18
+ end
19
+ creator = CombinationCreator.new(input, output)
20
+ creator.export
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,18 @@
1
+ require_relative "../abstract_creator"
2
+
3
+ class CombinationCreator < AbstractorCreator
4
+ def create
5
+ arr = []
6
+ i = 0
7
+ @csv_rows.each do |row|
8
+ if i == 0
9
+ i = 1
10
+ next
11
+ end
12
+ arr << row
13
+ i += 1
14
+ end
15
+
16
+ @output = @csv_rows.first.product(*arr)
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Factory
4
+ module Test
5
+ module Combination
6
+ VERSION = "0.1.0"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "combination/version"
4
+ require_relative "combination/cli"
5
+
6
+ module Factory
7
+ module Test
8
+ module Combination
9
+ class Error < StandardError; end
10
+ # Your code goes here...
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,8 @@
1
+ module Factory
2
+ module Test
3
+ module Combination
4
+ VERSION: String
5
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
6
+ end
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: factory-test-combination
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - katuo0011
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-01-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description:
28
+ email:
29
+ - yuskeisono1996@gmail.com
30
+ executables:
31
+ - factory-test-combination
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - Gemfile
36
+ - Gemfile.lock
37
+ - LICENSE
38
+ - README.md
39
+ - Rakefile
40
+ - exe/factory-test-combination
41
+ - factory-test-combination.gemspec
42
+ - lib/factory/test/combination.rb
43
+ - lib/factory/test/combination/abstract_creator.rb
44
+ - lib/factory/test/combination/cli.rb
45
+ - lib/factory/test/combination/concrete_creators/combination_creator.rb
46
+ - lib/factory/test/combination/version.rb
47
+ - sig/factory/test/combination.rbs
48
+ homepage:
49
+ licenses: []
50
+ metadata:
51
+ homepage_uri: https://github.com/katuo0011/factory-test-combination
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 2.5.0
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubyforge_project:
68
+ rubygems_version: 2.7.6
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: create array combination for testcase
72
+ test_files: []