issue_scheduler 0.1.1

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
+ SHA256:
3
+ metadata.gz: cb4fce5a900cd6f6b8c5ddb71a544612bad9031f861075eb42ad05098ff36f9a
4
+ data.tar.gz: 1639180c4fcf1ab5e64c9319deb9eb4ae6c2d27c0e2977d07bb3ab67dcf8d75c
5
+ SHA512:
6
+ metadata.gz: 47a6e4b7ba1c410089798718220ebe0821f94397f463ed6f6752585d3664dcee8db5faae2f877ea2dcc3b598f73fc4e75f74c95f5f51cf1f9fe3f6828aae24a7
7
+ data.tar.gz: c19b097f8b1560f4a2cd3abb6277f8e8140628079d9404d33ae4368977455dec0ed01c004fcd3300829cf0bfa123a38d860cf85f5e76cb35018ef8844ff6fb96
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,28 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ # Output extra information for each offense to make it easier to diagnose:
4
+ DisplayCopNames: true
5
+ DisplayStyleGuide: true
6
+ ExtraDetails: true
7
+ SuggestExtensions: false
8
+ # RuboCop enforces rules depending on the oldest version of Ruby which
9
+ # your project supports:
10
+ TargetRubyVersion: 2.7
11
+ Exclude:
12
+ - bin/create-release
13
+ - vendor/bundle/**/*
14
+
15
+ # The default max line length is 80 characters
16
+ Layout/LineLength:
17
+ Max: 120
18
+
19
+ # The DSL for RSpec and the gemspec file make it very hard to limit block length:
20
+ Metrics/BlockLength:
21
+ Exclude:
22
+ - "spec/**/*_spec.rb"
23
+ - "*.gemspec"
24
+
25
+ # When writing minitest tests, it is very hard to limit test class length:
26
+ Metrics/ClassLength:
27
+ Exclude:
28
+ - "test/**/*_test.rb"
data/CHANGELOG.md ADDED
@@ -0,0 +1,44 @@
1
+ <!--
2
+ # @markup markdown
3
+ # @title Change Log
4
+ -->
5
+
6
+ # Change Log
7
+
8
+ The full change log is stored on [this project's GitHub releases page](https://github.com/jcouball/issue_scheduler).
9
+
10
+ ## v0.1.1
11
+
12
+ * 21efe6f Correctly set allowed_push_host in gemspec
13
+ * 9e1a722 Create initial CHANGELOG.md
14
+ * 559d3a3 Add changelog-rs Dockerfile
15
+ * 37ef841 Use gh to get repo web url instead of hardcoding the url
16
+ * d007d5f Add JRuby support to build and checkout yard from head
17
+ * 1b62347 Exclude vendor/bundle/**/* from rubocop
18
+ * 1c15d36 Exclude bin/create-release from rubocop
19
+ * 5456538 Add build and release scripts
20
+ * a66e8f8 Fix Markdown lint offenses
21
+ * cc807ac Add more usage documentation in the README.md
22
+ * 8bd404d Only require Ruby 2.7
23
+ * 6665fc0 Add script that shows example for creating an issue
24
+ * 87d893d Refactor the server script to make Rubocop happy
25
+ * c500c95 Add Config#load_issue_templates
26
+ * b9d482a Refactor reading and parsing YAML
27
+ * 0b5225b Add lib_dir method
28
+ * 725f7ee Create the script to start the admin ui
29
+ * dfbdfa2 Create the main issue-scheduler service start script
30
+ * b049b13 Rename Config#issue_files to Config#issue_templates
31
+ * 4ebb1fd Refactor IssueTemplate to use ActiveRecord
32
+ * dab32f8 Add template_name to IssueTemplate
33
+ * bf8c835 Add the IssueTemplate class
34
+ * 5dd23a0 Remove Gemfile.lock from git
35
+ * 6bd612b Documentation cleanup
36
+ * ba1564a Refactor config to take a YAML string instead of a filename
37
+ * ae393bc Add the IssueScheduler::Config class
38
+ * 32219f2 List undocumented objects in the yard task
39
+
40
+ See https://github.com/jcouball/issue_scheduler/releases/tag/v0.1.1
41
+
42
+ ## v0.1.0
43
+
44
+ * caad020 Initial version
@@ -0,0 +1,12 @@
1
+ FROM rust
2
+
3
+ # Build the docker image (from this project's root directory):
4
+ # docker build --file Dockerfile.changelog-rs --tag changelog-rs .
5
+ #
6
+ # Use this image to output a changelog (from this project's root directory):
7
+ # docker run --rm --volume "$PWD:/worktree" changelog-rs v1.9.1 v1.10.0
8
+
9
+ RUN cargo install changelog-rs
10
+ WORKDIR /worktree
11
+
12
+ ENTRYPOINT ["/usr/local/cargo/bin/changelog-rs", "/worktree"]
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git 'https://github.com/lsegal/yard', branch: 'main' do
6
+ gem 'yard'
7
+ end
8
+
9
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 James Couball
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,99 @@
1
+ # IssueScheduler
2
+
3
+ Create new Jira issues on a cron like scheduler
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'issue_scheduler'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```shell
16
+ $ bundle install
17
+ ...
18
+ Installing issue_scheduler 5.14.1
19
+ ...
20
+ $
21
+ ```
22
+
23
+ Or install it yourself as:
24
+
25
+ ```ruby
26
+ $ gem install issue_scheduler
27
+ ...
28
+ $
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ ### Configuration
34
+
35
+ Add config in the following format to ~/.issue_scheduler.yaml:
36
+
37
+ ```text
38
+ username: your_username
39
+ password: Qwerty13456!
40
+ site: https://jira.mydomain.com/
41
+ context_path: ""
42
+ auth_type: :basic
43
+ issue_templates: ~/issue_templates/**/*.yaml
44
+ ```
45
+
46
+ Place issue templates in the issue_templates subdirectory. Each teamplate is a yaml
47
+ file in the following format:
48
+
49
+ ```text
50
+ recurrance_rule: 'RRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR'
51
+ project: JIRAPROJECT
52
+ component: Internal
53
+ type: Story
54
+ summary: Take out the trash
55
+ description: |
56
+ Remember to take out the trash in the following rooms:
57
+ * Kitchen
58
+ * Bathroom
59
+ * Bedroom
60
+ * Laundry Room
61
+
62
+ When you finish this task, you will feel a lot better!
63
+ ```
64
+
65
+ ### Running the Scheduler
66
+
67
+ Once configuration is finished, run the scheduyler with the following command:
68
+
69
+ ```shell
70
+ issue-scheduler
71
+ ```
72
+
73
+ Press CTRL-C to exit the scheduler.
74
+
75
+ ### Running the Admin UI
76
+
77
+ Run the admin UI with the following command:
78
+
79
+ ```shell
80
+ issue-scheduler-admin-ui
81
+ ```
82
+
83
+ Press CTRL-C to exit the admin UI.
84
+
85
+ ## Development
86
+
87
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake`
88
+ to run the tests. You can also run `bin/console` for an interactive prompt that will
89
+ allow you to experiment.
90
+
91
+ To install this gem onto your local machine, run `bundle exec rake install`. To
92
+ release a new version, update the version number in `version.rb`, and then run
93
+ `bundle exec rake release`, which will create a git tag for the version, push git
94
+ commits and the created tag, and push the `.gem` file to
95
+ [rubygems.org](https://rubygems.org).
96
+
97
+ ## Contributing
98
+
99
+ Bug reports and pull requests are welcome on GitHub at [jcouball/issue_scheduler](https://github.com/jcouball/issue_scheduler).
data/Rakefile ADDED
@@ -0,0 +1,98 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rake/clean'
4
+
5
+ # The default task
6
+
7
+ desc 'Run the same tasks that the CI build will run'
8
+ if RUBY_PLATFORM == 'java'
9
+ task default: %w[spec rubocop bundle:audit build]
10
+ else
11
+ task default: %w[spec rubocop yard yard:audit yard:coverage bundle:audit build]
12
+ end
13
+
14
+ # RSpec
15
+
16
+ require 'rspec/core/rake_task'
17
+
18
+ RSpec::Core::RakeTask.new
19
+
20
+ CLEAN << 'coverage'
21
+ CLEAN << '.rspec_status'
22
+ CLEAN << 'rspec-report.xml'
23
+
24
+ # Bundler Audit
25
+
26
+ require 'bundler/audit/task'
27
+ Bundler::Audit::Task.new
28
+
29
+ # Bundler Gem Build
30
+
31
+ require 'bundler'
32
+ require 'bundler/gem_tasks'
33
+
34
+ begin
35
+ Bundler.setup(:default, :development)
36
+ rescue Bundler::BundlerError => e
37
+ warn e.message
38
+ warn 'Run `bundle install` to install missing gems'
39
+ exit e.status_code
40
+ end
41
+
42
+ CLEAN << 'pkg'
43
+ CLOBBER << 'Gemfile.lock'
44
+
45
+ # Bump
46
+
47
+ require 'bump/tasks'
48
+
49
+ # Rubocop
50
+
51
+ require 'rubocop/rake_task'
52
+
53
+ RuboCop::RakeTask.new do |t|
54
+ t.options = %w[
55
+ --format progress
56
+ --format json --out rubocop-report.json
57
+ ]
58
+ end
59
+
60
+ CLEAN << 'rubocop-report.json'
61
+
62
+ unless RUBY_PLATFORM == 'java'
63
+ # YARD
64
+
65
+ require 'yard'
66
+
67
+ YARD::Rake::YardocTask.new do |t|
68
+ t.files = %w[lib/**/*.rb examples/**/*]
69
+ t.stats_options = ['--list-undoc']
70
+ end
71
+
72
+ CLEAN << '.yardoc'
73
+ CLEAN << 'doc'
74
+
75
+ # Yardstick
76
+
77
+ desc 'Run yardstick to show missing YARD doc elements'
78
+ task :'yard:audit' do
79
+ sh "yardstick 'lib/**/*.rb'"
80
+ end
81
+
82
+ # Yardstick coverage
83
+
84
+ require 'yardstick/rake/verify'
85
+
86
+ Yardstick::Rake::Verify.new(:'yard:coverage') do |verify|
87
+ verify.threshold = 100
88
+ end
89
+
90
+ # Publish YARD documentation to GitHub
91
+
92
+ require 'github_pages_rake_tasks'
93
+
94
+ GithubPagesRakeTasks::PublishTask.new do |task|
95
+ # task.doc_dir = 'documentation'
96
+ task.verbose = true
97
+ end
98
+ end
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (c) 2021 Verizon
3
+ # frozen_string_literal: true
4
+
5
+ require 'issue_scheduler'
6
+ require 'pp'
7
+
8
+ config = IssueScheduler::Config.new(IssueScheduler.load_yaml('config/config.yaml'))
9
+ config.load_issue_templates
10
+
11
+ pp IssueScheduler::IssueTemplate.all.first
12
+
13
+ client = JIRA::Client.new(config.to_jira_options)
14
+
15
+ project = client.Project.find('WARPDRIVE')
16
+ component = project.components.find { |c| c.name == 'Internal' }
17
+
18
+ puts "Project: '#{project.id}: #{project.name}'"
19
+
20
+ # puts project.issuetypes.map(&:name)
21
+ # exit
22
+
23
+ puts "Component: '#{component.id}: #{component.name}'"
24
+
25
+ issue = client.Issue.build
26
+
27
+ issue.save(
28
+ {
29
+ 'fields' => {
30
+ 'summary' => 'Sample Ticket',
31
+ 'project' => { 'key' => 'YPEDTO' },
32
+ 'issuetype' => { 'name' => 'Story' }
33
+ }
34
+ }
35
+ )
36
+
37
+ puts issue.pretty_inspect
38
+
39
+ issue.fetch
40
+
41
+ puts "Created issue #{issue.key}"
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'issue_scheduler'
5
+
6
+ sidekiq_file = File.join(IssueScheduler.lib_dir, 'server.rb')
7
+
8
+ system('sidekiq', '-r', sidekiq_file)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'issue_scheduler'
5
+
6
+ rackup_file = File.join(IssueScheduler.lib_dir, 'admin_ui.ru')
7
+
8
+ system('rackup', rackup_file)
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/issue_scheduler/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'issue_scheduler'
7
+ spec.version = IssueScheduler::VERSION
8
+ spec.authors = ['James Couball']
9
+ spec.email = ['jcouball@yahoo.com']
10
+
11
+ spec.summary = 'Schedule recurring Jira issue creation'
12
+ spec.description = 'Allow Jira issues to be created at a specified recurrence'
13
+ spec.homepage = 'https://github.com/jcouball/issue_scheduler'
14
+ spec.required_ruby_version = '>= 2.7.0'
15
+ spec.license = 'MIT'
16
+
17
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
18
+ spec.metadata['rubygems_mfa_required'] = 'true'
19
+
20
+ spec.metadata['homepage_uri'] = spec.homepage
21
+ spec.metadata['source_code_uri'] = spec.homepage
22
+ spec.metadata['changelog_uri'] = File.join(spec.homepage, 'blob/master/CHANGELOG.md')
23
+
24
+ # Specify which files should be added to the gem when it is released.
25
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
27
+ `git ls-files -z`.split("\x0").reject do |f|
28
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
29
+ end
30
+ end
31
+ spec.bindir = 'exe'
32
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ['lib']
34
+
35
+ spec.add_dependency 'active_model_persistence', '~> 0.5.0'
36
+ spec.add_dependency 'jira-ruby', '~> 2.2'
37
+ spec.add_dependency 'sidekiq-cron', '~> 1.4'
38
+
39
+ spec.add_development_dependency 'bump', '~> 0.10'
40
+ spec.add_development_dependency 'bundler-audit', '~> 0.9'
41
+ spec.add_development_dependency 'github_pages_rake_tasks', '~> 0.1'
42
+ spec.add_development_dependency 'rake', '~> 13.0'
43
+ spec.add_development_dependency 'rspec', '~> 3.11'
44
+ spec.add_development_dependency 'rubocop', '~> 1.28'
45
+ spec.add_development_dependency 'simplecov', '~> 0.21'
46
+ spec.add_development_dependency 'solargraph'
47
+
48
+ unless RUBY_PLATFORM == 'java'
49
+ spec.add_development_dependency 'redcarpet', '~> 3.5'
50
+ spec.add_development_dependency 'yard', '~> 0.9'
51
+ spec.add_development_dependency 'yardstick', '~> 0.9'
52
+ end
53
+
54
+ # For more information and examples about making a new gem, check out our
55
+ # guide at: https://bundler.io/guides/creating_gem.html
56
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'sidekiq/web'
4
+ require 'sidekiq/cron/web'
5
+
6
+ # Run the admin UI from the command line using:
7
+ # $ rackup admin_ui.rb
8
+
9
+ # A Web process always runs as client, no need to configure server
10
+ Sidekiq.configure_client do |config|
11
+ config.redis = { db: 1 }
12
+ end
13
+
14
+ # Sidekiq::Client.push('class' => "HardWorker", 'args' => [])
15
+
16
+ # In a multi-process deployment, all Web UI instances should share
17
+ # this secret key so they can all decode the encrypted browser cookies
18
+ # and provide a working session.
19
+ # Rails does this in /config/initializers/secret_token.rb
20
+ secret_key = SecureRandom.hex(32)
21
+ use Rack::Session::Cookie, secret: secret_key, same_site: true, max_age: 86_400
22
+
23
+ run Sidekiq::Web