ticket-replicator 0.1.1

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.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +20 -0
  4. data/CHANGELOG.md +5 -0
  5. data/CODE_OF_CONDUCT.md +132 -0
  6. data/Guardfile +158 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +136 -0
  9. data/Rakefile +23 -0
  10. data/bin/ticket-replicator +67 -0
  11. data/config/examples/ticket-replicator.mappings.yml +54 -0
  12. data/cucumber.yml +7 -0
  13. data/features/extract-sap-solution-manager-defect-tickets.feature +45 -0
  14. data/features/load_tickets_in_jira.feature +129 -0
  15. data/features/setup_ticket_replicator.feature +85 -0
  16. data/features/step_definitions/anonymized_sample.xlsx +0 -0
  17. data/features/step_definitions/anonymized_sample.xlsx:Zone.Identifier +3 -0
  18. data/features/step_definitions/execution_context_steps.rb +13 -0
  19. data/features/step_definitions/extract_defect_tickets_from_sap_solution_manager_steps.rb.rb +29 -0
  20. data/features/step_definitions/load_tickets_in_jira_steps.rb +47 -0
  21. data/features/step_definitions/transform_solution_manager_tickets_steps.rb +21 -0
  22. data/features/support/10.setup_cucumber.rb +10 -0
  23. data/features/support/env.rb +15 -0
  24. data/features/support/hooks.rb +13 -0
  25. data/features/support/manage_mock_sap_solution_manager.rb.DISABLED +12 -0
  26. data/features/support/mocks/mock_defect_ticket_server.rb.DISABLED +251 -0
  27. data/features/support/setup_rspec.rb +15 -0
  28. data/features/support/setup_simplecov.rb +5 -0
  29. data/features/transform-solution-manager-tickets-into-jira-loadable-tickets.feature +313 -0
  30. data/features/transform_and_load_extracted_ticket_queue.feature +121 -0
  31. data/lib/tasks/version.rake +55 -0
  32. data/lib/ticket/replicator/defect_export_automation.rb.DISABLED +128 -0
  33. data/lib/ticket/replicator/file_loader.rb +46 -0
  34. data/lib/ticket/replicator/file_replicator.rb +67 -0
  35. data/lib/ticket/replicator/file_transformer/for_csv.rb +22 -0
  36. data/lib/ticket/replicator/file_transformer/for_xlsx.rb +34 -0
  37. data/lib/ticket/replicator/file_transformer.rb +70 -0
  38. data/lib/ticket/replicator/jira_project.rb +65 -0
  39. data/lib/ticket/replicator/replicated_summary.rb +73 -0
  40. data/lib/ticket/replicator/row_loader.rb +109 -0
  41. data/lib/ticket/replicator/row_transformer.rb +126 -0
  42. data/lib/ticket/replicator/s_a_p_solution_manager_client.rb.DISABLED +169 -0
  43. data/lib/ticket/replicator/setup.rb +49 -0
  44. data/lib/ticket/replicator/ticket.rb +70 -0
  45. data/lib/ticket/replicator/ticket_status_transitioner.rb +45 -0
  46. data/lib/ticket/replicator/version.rb +7 -0
  47. data/lib/ticket/replicator.rb +90 -0
  48. data/sig/ticket/replicator.rbs +6 -0
  49. data/spec/spec_helper.rb +19 -0
  50. data/spec/ticket/replicator/file_loader_spec.rb +77 -0
  51. data/spec/ticket/replicator/file_replicator_spec.rb +153 -0
  52. data/spec/ticket/replicator/file_transformer/for_csv_spec.rb +52 -0
  53. data/spec/ticket/replicator/file_transformer/for_xlsx_spec.rb +52 -0
  54. data/spec/ticket/replicator/file_transformer_spec.rb +83 -0
  55. data/spec/ticket/replicator/jira_project_spec.rb +127 -0
  56. data/spec/ticket/replicator/replicated_summary_spec.rb +70 -0
  57. data/spec/ticket/replicator/row_loader_spec.rb +245 -0
  58. data/spec/ticket/replicator/row_transformer_spec.rb +234 -0
  59. data/spec/ticket/replicator/setup_spec.rb +80 -0
  60. data/spec/ticket/replicator/ticket_spec.rb +244 -0
  61. data/spec/ticket/replicator/ticket_status_transitioner_spec.rb +123 -0
  62. data/spec/ticket/replicator_spec.rb +137 -0
  63. data/transformed_file1 +1 -0
  64. metadata +235 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a75b95b01e3dcdc1937e0b795196c22c1bf351e856fe07880c2151b1c7f2eeee
4
+ data.tar.gz: e5c1ab35f039f7e1e07bfe1ad06103053602f25a2c7f17273730b0383cc7f871
5
+ SHA512:
6
+ metadata.gz: 5c0923f1770341ee1e9c106c6073c60c7316bb58694069b9abffa5e023ed538d83a4a8af195050da47d9d664a8176adc5edaff7c03bea88c24b5e22869decf2c
7
+ data.tar.gz: c15c602ec455f084eddcf051644e359783ff3ac2366aa4935233a97731d28c3731f2c31c540161d563be626e7c34237cde171975ffa5725d1eb436d7f8ae1bc9
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,20 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.4
3
+ NewCops: enable
4
+
5
+
6
+ Metrics/BlockLength:
7
+ AllowedMethods:
8
+ - describe
9
+
10
+ Style/Documentation:
11
+ Enabled: false
12
+
13
+ Style/HashSyntax:
14
+ Enabled: false
15
+
16
+ Style/StringLiterals:
17
+ EnforcedStyle: double_quotes
18
+
19
+ Style/StringLiteralsInInterpolation:
20
+ EnforcedStyle: double_quotes
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-03-29
4
+
5
+ - Initial release
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/Guardfile ADDED
@@ -0,0 +1,158 @@
1
+ # frozen_string_literal: true
2
+
3
+ # A sample Guardfile
4
+ # More info at https://github.com/guard/guard#readme
5
+
6
+ ## Uncomment and set this to only include directories you want to watch
7
+ # directories %w(app lib config test spec features) \
8
+ # .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
9
+
10
+ ## Note: if you are using the `directories` clause above and you are not
11
+ ## watching the project directory ('.'), then you will want to move
12
+ ## the Guardfile to a watched dir and symlink it back, e.g.
13
+ #
14
+ # $ mkdir config
15
+ # $ mv Guardfile config/
16
+ # $ ln -s config/Guardfile .
17
+ #
18
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
19
+
20
+ def guard_bundler
21
+ guard :bundler do
22
+ require "guard/bundler"
23
+ require "guard/bundler/verify"
24
+ helper = Guard::Bundler::Verify.new
25
+
26
+ files = ["Gemfile"]
27
+ files += Dir["*.gemspec"] if files.any? { |f| helper.uses_gemspec?(f) }
28
+
29
+ # Assume files are symlinked from somewhere
30
+ files.each { |file| watch(helper.real_path(file)) }
31
+ end
32
+ end
33
+
34
+ def watch_rspec_files(watch_proc)
35
+ watch_proc.call(rspec.spec_helper) { rspec.spec_dir }
36
+ watch_proc.call(rspec.spec_support) { rspec.spec_dir }
37
+ watch_proc.call(rspec.spec_files)
38
+ end
39
+
40
+ def watch_ruby_files
41
+ dsl.watch_spec_files_for(ruby.lib_files)
42
+ end
43
+
44
+ def watch_rails_files(watch_proc)
45
+ dsl.watch_spec_files_for(rails.app_files)
46
+ dsl.watch_spec_files_for(rails.views)
47
+ watch_rails_controllers(watch_proc)
48
+ end
49
+
50
+ def watch_rails_controllers(watch_proc)
51
+ watch_proc.call(rails.controllers) do |m|
52
+ [
53
+ rspec.spec.call("routing/#{m[1]}_routing"),
54
+ rspec.spec.call("controllers/#{m[1]}_controller"),
55
+ rspec.spec.call("acceptance/#{m[1]}")
56
+ ]
57
+ end
58
+ end
59
+
60
+ def watch_rails_config(watch_proc)
61
+ watch_proc.call(rails.spec_helper) { rspec.spec_dir }
62
+ watch_proc.call(rails.routes) { "#{rspec.spec_dir}/routing" }
63
+ watch_proc.call(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
64
+ end
65
+
66
+ def watch_capybara_features(watch_proc)
67
+ watch_proc.call(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
68
+ watch_proc.call(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
69
+ end
70
+
71
+ def watch_turnip_features(watch_proc)
72
+ watch_proc.call(%r{^spec/acceptance/(.+)\.feature$})
73
+ watch_proc.call(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
74
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
75
+ end
76
+ end
77
+
78
+ # NOTE: The cmd option is now required due to the increasing number of ways
79
+ # rspec may be run, below are examples of the most common uses.
80
+ # * bundler: 'bundle exec rspec'
81
+ # * bundler binstubs: 'bin/rspec'
82
+ # * spring: 'bin/rspec' (This will use spring if running and you have
83
+ # installed the spring binstubs per the docs)
84
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
85
+ # * 'just' rspec: 'rspec'
86
+
87
+ require "guard/rspec/dsl"
88
+
89
+ def dsl
90
+ @dsl ||= Guard::RSpec::Dsl.new(self)
91
+ end
92
+
93
+ def rspec
94
+ @rspec ||= dsl.rspec
95
+ end
96
+
97
+ def ruby
98
+ @ruby ||= dsl.ruby
99
+ end
100
+
101
+ def rails
102
+ @rails ||= dsl.rails(view_extensions: %w[erb haml slim])
103
+ end
104
+
105
+ def guard_rspec
106
+ guard :rspec, cmd: "bundle exec rspec --format progress" do
107
+ watch_rspec_files(method(:watch))
108
+ watch_ruby_files
109
+ watch_rails_files(method(:watch))
110
+ watch_rails_config(method(:watch))
111
+ watch_capybara_features(method(:watch))
112
+ watch_turnip_features(method(:watch))
113
+ end
114
+ end
115
+
116
+ def guard_rubocop
117
+ guard :rubocop, cli: ["--format", "clang", "--autocorrect"] do
118
+ watch(/.+\.rb$/)
119
+ watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
120
+ end
121
+ end
122
+
123
+ def cucumber_options
124
+ {
125
+ # Below are examples overriding defaults
126
+
127
+ # cmd: 'bin/cucumber',
128
+ cmd_additional_args: "--profile guard",
129
+
130
+ all_after_pass: false,
131
+ # all_on_start: false,
132
+ keep_failed: true,
133
+ # feature_sets: ['features/frontend', 'features/experimental'],
134
+
135
+ # run_all: { cmd_additional_args: '--profile guard_all' },
136
+ # focus_on: { 'wip' }, # @wip
137
+ notification: false
138
+ }
139
+ end
140
+
141
+ def guard_cucumber
142
+ guard "cucumber", cucumber_options do
143
+ watch(%r{^features/.+\.feature$})
144
+ watch(%r{^features/support/.+$}) { "features" }
145
+ watch(%r{^(bin|lib)/.+$}) { "features" }
146
+
147
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) do |m|
148
+ Dir[File.join("**/#{m[1]}.feature")][0] || "features"
149
+ end
150
+ end
151
+ end
152
+
153
+ group :red_green_refactor, halt_on_fail: true do
154
+ guard_bundler
155
+ guard_rspec
156
+ guard_rubocop
157
+ guard_cucumber
158
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Christophe Broult
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,136 @@
1
+ # Ticket::Replicator
2
+
3
+ [![Ruby](https://github.com/cbroult/ticket-replicator/actions/workflows/main.yml/badge.svg)](https://github.com/cbroult/ticket-replicator/actions/workflows/main.yml)
4
+
5
+ ## Purpose
6
+
7
+ In order to:
8
+ * have an overall transparency about all the activities pertaining to a project/product,
9
+ * track progress
10
+ * act accordingly
11
+
12
+ As a stakeholder
13
+
14
+ I need to replicate defect information from one system to a single reference system.
15
+
16
+ ## Installation
17
+
18
+ 1. Install [Ruby](https://www.ruby-lang.org/en/downloads/).
19
+ 1. Install the gem...
20
+ * ... and add to the application's Gemfile by executing:
21
+
22
+ ```bash
23
+ bundle add TODO: GEM_NAME
24
+ ```
25
+
26
+ * ... if bundler is not being used to manage dependencies, by executing:
27
+
28
+ ```bash
29
+ gem install TODO: GEM_NAME
30
+ ```
31
+
32
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
33
+
34
+ ## Setup
35
+
36
+ ### Set environment variables
37
+
38
+ Define the following environment variables
39
+ - `TICKET_REPLICATOR_JIRA_PROJECT_KEY`
40
+ - `TICKET_REPLICATOR_JIRA_TICKET_TYPE_NAME`
41
+
42
+ For your JIRA access the following variables have to be defined:
43
+
44
+ - `JIRA_USERNAME` - Your Jira account username (e.g., "user@company.com").
45
+ - `JIRA_API_TOKEN` - Your Jira API authentication token.
46
+ - `JIRA_SITE_URL` - Base URL of your Jira instance (e.g., "https://your-domain.atlassian.net").
47
+
48
+ Optional environment variables:
49
+
50
+ - `JIRA_CONTEXT_PATH` - Context path for the Jira instance (if needed typically "/jira").
51
+ - `JIRA_HTTP_DEBUG` - Enable HTTP debug logging (set to "true" or "false").
52
+ - `JAT_RATE_INTERVAL_IN_SECONDS` - Interval for rate limiting in seconds (e.g., "1").
53
+ - `JAT_RATE_LIMIT_PER_INTERVAL` - Rate limit per interval for Jira API calls (e.g., "1")
54
+
55
+
56
+ ### Setup Queue Folder And Field Mapping
57
+
58
+ 1. Create the queue folder and create an example field mapping configuration file using:
59
+ ```bash
60
+ ticket-replication --setup
61
+ ```
62
+ 1. Edit the field mapping configuration file to fit your context.
63
+
64
+ ### Target Jira Ticket Type Workflow Expectation - Any to Any
65
+
66
+ The target issue type in Jira must have a workflow that allows direct transitions between any states. This avoids
67
+ the need for administrative rights to calculate complex transition paths or discover workflow states through trial
68
+ and error. Status transitions can be done directly using the transition information available to regular users.
69
+
70
+ ## Usage
71
+
72
+ 1. Move files containing tickets to replicate to the `queue/10.extracted` folder
73
+ 2. Transform and load the tickets (i.e., replicate them) to the Jira project:
74
+ ```bash
75
+ ticket-replicator --ticket-queue-transform-and-load
76
+ ```
77
+
78
+ For more information:
79
+ * Use the built-in help
80
+ ```bash
81
+ ticket-replicator --help
82
+ ```
83
+ * Leverage the content of the [feature files](./features).
84
+
85
+ ## Development
86
+
87
+ After checking out this repository.
88
+
89
+ ### Install Dependencies
90
+
91
+ ```bash
92
+ bundle install
93
+ ```
94
+
95
+ ### Continuous Testing While Making Changes
96
+
97
+ ```bash
98
+ bundle exec guard
99
+ ```
100
+
101
+ ### Experiment Using An Interactive Prompt
102
+
103
+ ```bash
104
+ bin/console
105
+ ```
106
+
107
+ ### Install Locally
108
+
109
+ To install this gem onto your local machine, run `bundle exec rake install`.
110
+
111
+ ### Release
112
+
113
+ 1. Bump the gem version:
114
+ ```bash
115
+ bundle exec rake version:bump[{major|minor|patch}]
116
+ ```
117
+ 2. Release the version to [rubygems.org](https://rubygems.org):
118
+ ```bash
119
+ bundle exec rake release
120
+ ```
121
+ which will:
122
+ * create a git tag for the version
123
+ * push git commits and the created tag
124
+ * push the `.gem` file to [rubygems.org](https://rubygems.org).
125
+
126
+ ## Contributing
127
+
128
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ticket-replicator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/ticket-replicator/blob/main/CODE_OF_CONDUCT.md).
129
+
130
+ ## License
131
+
132
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
133
+
134
+ ## Code of Conduct
135
+
136
+ Everyone interacting in the Ticket::Replicator project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/ticket-replicator/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "cucumber"
6
+ require "cucumber/rake/task"
7
+
8
+ # Load custom tasks
9
+ Dir.glob("lib/tasks/**/*.rake").each { |r| load r }
10
+
11
+ RSpec::Core::RakeTask.new(:spec)
12
+
13
+ require "rubocop/rake_task"
14
+
15
+ RuboCop::RakeTask.new(:rubocop) do |task|
16
+ task.options = ["--autocorrect"]
17
+ end
18
+
19
+ Cucumber::Rake::Task.new do |t|
20
+ t.profile = "rake"
21
+ end
22
+
23
+ task default: %i[rubocop spec cucumber]
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ GEM_ROOT = File.expand_path("..", __dir__)
5
+ LIBRARY_PATH = File.join(GEM_ROOT, "lib")
6
+ $LOAD_PATH.unshift(LIBRARY_PATH)
7
+
8
+ DEBUG = false
9
+
10
+ if DEBUG
11
+ puts "GEM_ROOT: #{GEM_ROOT}"
12
+ puts "LIBRARY_PATH: #{LIBRARY_PATH}"
13
+ puts "$LOAD_PATH: #{$LOAD_PATH}"
14
+ end
15
+
16
+ require "bundler/setup"
17
+ require "active_support/core_ext/object/blank"
18
+ require "jira/auto/tool/common_options"
19
+ require "jira/auto/tool/jira_http_options"
20
+ require "ticket/replicator"
21
+
22
+ require "optparse"
23
+ require "optparse/date"
24
+
25
+ ticket_replicator = Ticket::Replicator.new
26
+
27
+ option_parser = OptionParser.new do |parser|
28
+ parser.banner = <<~EOBANNER
29
+ Usage: #{File.basename(__FILE__)} [options]*
30
+
31
+ EOBANNER
32
+
33
+ Jira::Auto::Tool::CommonOptions.add(ticket_replicator, parser)
34
+ Jira::Auto::Tool::JiraHttpOptions.add(ticket_replicator.jira_auto_tool, parser)
35
+
36
+ parser.section_header("Main features")
37
+
38
+ parser.on("--setup", "Setup ticket queue and generate initial configuration file") { ticket_replicator.setup.run }
39
+
40
+ parser.on("--run", "--ticket-queue-transform-and-load", "--tqtal", "Transform and load the ticket queue into Jira") do
41
+ ticket_replicator.ticket_queue_transform_and_load
42
+ end
43
+
44
+ parser.section_header("Steps")
45
+
46
+ parser.on("--load", "-l", "Load the ticket into Jira") do
47
+ ticket_replicator.load
48
+ end
49
+
50
+ parser.on("--transform", "-t", "Transform the ticket into Jira ready format") do
51
+ ticket_replicator.transform
52
+ end
53
+ end
54
+
55
+ begin
56
+ option_parser.parse!
57
+ rescue StandardError => e
58
+ error_message = <<~EOERROR_MESSAGE
59
+ #{e.class}: #{e.message}
60
+ #{e.backtrace.join("\n")}
61
+ EOERROR_MESSAGE
62
+
63
+ log.error { error_message }
64
+ warn error_message
65
+
66
+ exit 1
67
+ end
@@ -0,0 +1,54 @@
1
+ ---
2
+ ### WARNING
3
+ ### WARNING - Example config: Please adapt to your context
4
+ ### WARNING
5
+ field_mapping:
6
+ id: Defect
7
+ summary: Defect (2)
8
+ priority: Defect Priority
9
+ resolution: Defect Status
10
+ status: Defect Status
11
+ team: Defect Support Team (2)
12
+
13
+ priority_mapping:
14
+ "1: Critical": "Highest"
15
+ "2: High": "High"
16
+ "3: Medium": "Medium"
17
+ "4: Low": "Low"
18
+
19
+ status_mapping:
20
+ defaults_to: keep_original_value
21
+
22
+ resolution_mapping:
23
+ defaults_to: keep_original_value
24
+ "New":
25
+ "Open":
26
+ "In Process":
27
+ "In Review":
28
+ "On Hold":
29
+ Deferred:
30
+ Defect Correction in Process:
31
+ "Fixed": "Fixed"
32
+ "Closed": "Done"
33
+ "Rejected": "Won't Do"
34
+ "Resolved": "Fixed"
35
+ "Confirmed":
36
+ "Forwarded":
37
+ "Information Required":
38
+ Wait for Defect Correction:
39
+ Solution Proposal:
40
+ Tester Action:
41
+ Wait on External:
42
+
43
+ team_mapping:
44
+ defaults_to: keep_original_value
45
+ "Frontend": "Web Team"
46
+ "Backend": "Server Team"
47
+ "Integration": "Integration Team"
48
+ "Mobile": "Mobile Team"
49
+ "Security": "Security Team"
50
+ "DevOps": "DevOps Team"
51
+ "QA": "Quality Assurance"
52
+ "Architecture": "Architecture Team"
53
+ "UX": "Design Team"
54
+ "Performance": "Performance Team"
data/cucumber.yml ADDED
@@ -0,0 +1,7 @@
1
+ <%
2
+ default_tags = 'not @in-specification'
3
+ shared_args = "--publish-quiet --expand"
4
+ %>
5
+ default: <%= shared_args %> --format pretty --tags ' <%= default_tags %>'
6
+ guard: <%= shared_args %> --format rerun --out rerun_failures.txt --format progress --tags ' <%= default_tags %>'
7
+ rake: <%= shared_args %> --format progress --tags 'not @wip'