create_ticket 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d84978bafbf48d30399598ca2bfd256b9707226
4
- data.tar.gz: 9f45cf6775cfa23244fc627ee3ade885d4374275
3
+ metadata.gz: 73ab251a7382b54198e7c1830125e6cc7167b1d7
4
+ data.tar.gz: c98af4da77d50084804ec1d4e64703d8f89916c5
5
5
  SHA512:
6
- metadata.gz: 120c7d694a88676bdd31f6d13dea3272c254a9c9e6872c7f28dd2d43527dd45420f78deac6bd45077df2c4cdaff5e0bd52a4f926ce3cc16da03edde9ee470116
7
- data.tar.gz: 91eaeae759e02cc00e29af9ca8293deb518ca18e1ce4aa57f776abec03f07ece03f4a5f3bc765d2c8e3607889a987e66b2906f9093c7b04d8235eedfe1d2e7f9
6
+ metadata.gz: 997a48983c059a4bfe8edbda17963abcee4a192d58aa777f650071a179da59b5f62600e99dd958105371609ea499a0782ad27ffb16ae5e33197c5c79f1eb3fee
7
+ data.tar.gz: 82336605d4282b272f7f8bfe677a08bba2936245dc173ad320e5cc0058c6701cec8d5dd334765b1449a142c0e37018530b3780f9304449da40019af0ee978f0e
data/.rubocop_todo.yml CHANGED
@@ -14,10 +14,7 @@ Metrics/LineLength:
14
14
 
15
15
  # Offense count: 1
16
16
  Style/Documentation:
17
- Exclude:
18
- - 'spec/**/*'
19
- - 'test/**/*'
20
- - 'lib/create_ticket.rb'
17
+ Enabled: false
21
18
 
22
19
  # Offense count: 1
23
20
  # Configuration parameters: EnforcedStyle, SupportedStyles.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rake/testtask'
3
5
 
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'create_ticket'
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  lib = File.expand_path('../lib', __FILE__)
3
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
6
  require 'create_ticket/version'
data/exe/create_ticket CHANGED
@@ -3,4 +3,4 @@
3
3
 
4
4
  require 'create_ticket'
5
5
 
6
- CreateTicket.create_ticket
6
+ CreateTicket::CLI.new.run!
data/lib/create_ticket.rb CHANGED
@@ -1,34 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'create_ticket/version'
2
4
  require 'markdown2confluence'
3
5
  require 'faraday'
4
6
  require 'json'
5
7
  require 'erb'
6
8
 
7
- module CreateTicket
8
- extend self
9
-
10
- def jira_url
11
- ENV.fetch('JIRA_URL')
12
- end
13
-
14
- def project
15
- ENV.fetch('JIRA_PROJECT')
16
- end
17
-
18
- def jira_token
19
- ENV.fetch('JIRA_TOKEN')
20
- end
21
-
22
- def template_filename
23
- ENV.fetch('TEMPLATE_FILENAME')
24
- end
9
+ class CreateTicket
10
+ attr_reader *%i[jira_url project jira_token template_filename assignee issue_type]
25
11
 
26
- def assignee
27
- ENV.fetch('JIRA_ASSIGNEE')
28
- end
29
-
30
- def issue_type
31
- ENV.fetch('JIRA_ISSUE_TYPE')
12
+ def initialize(conf)
13
+ @jira_url = conf.fetch(:jira_url)
14
+ @project = conf.fetch(:project)
15
+ @jira_token = conf.fetch(:jira_token)
16
+ @template_filename = conf.fetch(:template_filename)
17
+ @assignee = conf.fetch(:assignee)
18
+ @issue_type = conf.fetch(:issue_type)
32
19
  end
33
20
 
34
21
  def template
@@ -92,7 +79,7 @@ module CreateTicket
92
79
  def description
93
80
  # TODO: Assumes Markdown with an h1 at the top.
94
81
  markdown = content.sub(/# .*\n/, '')
95
-
82
+
96
83
  Kramdown::Document.new(markdown, kramdown_options).to_confluence
97
84
  end
98
85
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateTicket
4
+ class Cli
5
+ def conf
6
+ {
7
+ jira_url: ENV.fetch('JIRA_URL'),
8
+ project: ENV.fetch('JIRA_PROJECT'),
9
+ jira_token: ENV.fetch('JIRA_TOKEN'),
10
+ template_filename: ENV.fetch('TEMPLATE_FILENAME'),
11
+ assignee: ENV.fetch('JIRA_ASSIGNEE'),
12
+ issue_type: ENV.fetch('JIRA_ISSUE_TYPE')
13
+ }
14
+ end
15
+
16
+ def run!
17
+ CreateTicket.new(conf).create_ticket!
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,5 @@
1
- module CreateTicket
2
- VERSION = '0.1.1'.freeze
1
+ # frozen_string_literal: true
2
+
3
+ class CreateTicket
4
+ VERSION = '0.2.0'
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: create_ticket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Marek-Spartz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-26 00:00:00.000000000 Z
11
+ date: 2017-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -131,6 +131,7 @@ files:
131
131
  - create_ticket.gemspec
132
132
  - exe/create_ticket
133
133
  - lib/create_ticket.rb
134
+ - lib/create_ticket/cli.rb
134
135
  - lib/create_ticket/version.rb
135
136
  homepage: https://github.com/govdelivery/create_ticket
136
137
  licenses: