prgen 0.1.0

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
+ SHA1:
3
+ metadata.gz: 2b41826423cbc5e49fc26ba1d4ef5b8fb49d25ef
4
+ data.tar.gz: 18852a0dff33282bdfc43796159ba043e4ecc221
5
+ SHA512:
6
+ metadata.gz: 9fc00eb0354f3efea90a07efbb6d3e39baacd7f60c5fbe141d8e235d8e69f5a40115eda665354a8c021dd570d2dd6a6481687728593fe8be4dfb10b4dde76098
7
+ data.tar.gz: fc6d2000e9cca6d320d2c0af335411ab3c0d08cc59dd09790ac72edbe86b2d5f63d9e0470b965a864f3e99de090da779ecb7f67a34905452d23b12770ddd1da2
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /rdoc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /gemfiles/*.gemfile.lock
10
+ /gemfiles/.bundle
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
@@ -0,0 +1,8 @@
1
+ [To:0000001] Lord Voldemort
2
+
3
+ [info][title]PULL #<%= task_id %>[/title]Redmine:
4
+ - https://voldemortcorp.com/redmine/issues/<%= task_id %>
5
+
6
+ GitHub:
7
+ - https://github.com/voldemortcorp/test1/pull/<%= pr_id %>
8
+ [/info]
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.16.1
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,53 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ prgen (0.1.0)
5
+ clipboard (~> 1.1)
6
+ thor (~> 0.20)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ clipboard (1.1.1)
12
+ coderay (1.1.2)
13
+ diff-lcs (1.3)
14
+ docile (1.3.0)
15
+ json (2.1.0)
16
+ method_source (0.9.0)
17
+ pry (0.11.3)
18
+ coderay (~> 1.1.0)
19
+ method_source (~> 0.9.0)
20
+ rake (10.5.0)
21
+ rspec (3.7.0)
22
+ rspec-core (~> 3.7.0)
23
+ rspec-expectations (~> 3.7.0)
24
+ rspec-mocks (~> 3.7.0)
25
+ rspec-core (3.7.1)
26
+ rspec-support (~> 3.7.0)
27
+ rspec-expectations (3.7.0)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.7.0)
30
+ rspec-mocks (3.7.0)
31
+ diff-lcs (>= 1.2.0, < 2.0)
32
+ rspec-support (~> 3.7.0)
33
+ rspec-support (3.7.1)
34
+ simplecov (0.16.1)
35
+ docile (~> 1.1)
36
+ json (>= 1.8, < 3)
37
+ simplecov-html (~> 0.10.0)
38
+ simplecov-html (0.10.2)
39
+ thor (0.20.0)
40
+
41
+ PLATFORMS
42
+ ruby
43
+
44
+ DEPENDENCIES
45
+ bundler (~> 1.16)
46
+ prgen!
47
+ pry (~> 0.11)
48
+ rake (~> 10.0)
49
+ rspec (~> 3.0)
50
+ simplecov (~> 0.16)
51
+
52
+ BUNDLED WITH
53
+ 1.16.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Tahmid Shakil
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,47 @@
1
+ # PRGen
2
+
3
+ PRGen is a pull request message generator for chatwork.
4
+
5
+ ## Installation
6
+
7
+ Linux installation requires `xclip`, which can be installed as follows.
8
+
9
+ ```
10
+ $ apt install xclip
11
+ ```
12
+
13
+ ```ruby
14
+ gem 'prgen'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install prgen
24
+
25
+ ## Usage
26
+
27
+ Prepare a message template (e.g. `.prgen.template.example`) and store it in `~/.prgen.template`
28
+
29
+ Now, generate and copy messages to clipboard using,
30
+
31
+ ```sh
32
+ prgen copy <redmine_issue_id> <git_pull_id>
33
+ ```
34
+
35
+ ## Development
36
+
37
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
38
+
39
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/at-shakil/prgen.
44
+
45
+ ## License
46
+
47
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,19 @@
1
+ require "rubygems"
2
+ require "bundler/setup"
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "rdoc/task"
6
+
7
+ RDoc::Task.new(:rdoc) do |rdoc|
8
+ rdoc.main = "README.md"
9
+ rdoc.rdoc_dir = "rdoc"
10
+ rdoc.title = "PRGen"
11
+ rdoc.markup = "markdown"
12
+ rdoc.options << "--line-numbers"
13
+ rdoc.rdoc_files.include("README.md")
14
+ rdoc.rdoc_files.include("lib/**/*.rb")
15
+ end
16
+
17
+ RSpec::Core::RakeTask.new(:spec)
18
+
19
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "prgen"
5
+ require "pry"
6
+ require "irb"
7
+
8
+ Pry.start
9
+ IRB.start __FILE__
data/bin/setup ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
data/exe/prgen ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+ require "thor"
3
+ require "prgen"
4
+
5
+ class PRGen::CLI < Thor
6
+ desc "setup <redmine_issue_id> <github_pr_id>", "Setup generator context"
7
+ def setup issue_id, pr_id
8
+ puts "Error: Not yet implemented!"
9
+ end
10
+
11
+ desc "copy", "Prepare PR message for chatwork and copy to system clipboard"
12
+ def copy issue_id, pr_id
13
+ data = PRGen::Generator.new(issue_id, pr_id).render
14
+ Clipboard.copy data[:message]
15
+ return unless RUBY_PLATFORM =~ /linux/
16
+ if data[:has_template]
17
+ title = "Message Ready!"
18
+ message = "Chatwork message for\nTask: \##{issue_id}\nPR: \##{
19
+ pr_id}\n is now ready to launch!"
20
+ else
21
+ title = "No template!"
22
+ message = "Please provide a message template."
23
+ end
24
+ system("notify-send --urgency=normal \"#{title}\" \"#{message}\"")
25
+ end
26
+ end
27
+
28
+ PRGen::CLI.start ARGV
data/lib/prgen.rb ADDED
@@ -0,0 +1,8 @@
1
+ require "erb"
2
+ require "clipboard"
3
+ require "prgen/version"
4
+ require "prgen/generator"
5
+
6
+ module PRGen
7
+ TEMPLATE_PATH = File.expand_path(ENV["PRGEN_TEMPLATE"] || "~/.prgen.template")
8
+ end
@@ -0,0 +1,20 @@
1
+ module PRGen
2
+ class Generator
3
+ attr_reader :task_id, :pr_id
4
+
5
+ def initialize task_id, pr_id
6
+ @template, @has_template =
7
+ begin
8
+ [open(PRGen::TEMPLATE_PATH, "r") {|file| file.read}, true]
9
+ rescue Errno::ENOENT => e
10
+ ["", false]
11
+ end
12
+ @task_id = task_id
13
+ @pr_id = pr_id
14
+ end
15
+
16
+ def render
17
+ {has_template: @has_template, message: ERB.new(@template).result(binding)}
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,3 @@
1
+ module PRGen
2
+ VERSION = "0.1.0"
3
+ end
data/prgen.gemspec ADDED
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path("../lib", __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "prgen/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "prgen"
9
+ spec.version = PRGen::VERSION
10
+ spec.authors = ["Tahmid Shakil"]
11
+ spec.email = ["at.shakil.92@gmail.com"]
12
+
13
+ spec.summary = "PR Generator"
14
+ spec.description = "A CLI utility to accompany pull request submission"
15
+ spec.homepage = "https://github.com/at-shakil/prgen"
16
+ spec.license = "MIT"
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
+ spec.required_ruby_version = [">= 2.4.0"]
25
+ spec.rdoc_options = %w[-t PRGen -m README.md -N --markup markdown]
26
+
27
+ spec.add_dependency "thor", "~> 0.20"
28
+ spec.add_dependency "clipboard", "~> 1.1"
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.16"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "rspec", "~> 3.0"
33
+ spec.add_development_dependency "simplecov", "~> 0.16"
34
+ spec.add_development_dependency "pry", "~> 0.11"
35
+
36
+ if ENV["TRAVIS"]
37
+ spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.8"
38
+ end
39
+ end
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: prgen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tahmid Shakil
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-04-07 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'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.20'
27
+ - !ruby/object:Gem::Dependency
28
+ name: clipboard
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.16'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.16'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.16'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.16'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.11'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.11'
111
+ description: A CLI utility to accompany pull request submission
112
+ email:
113
+ - at.shakil.92@gmail.com
114
+ executables:
115
+ - prgen
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".gitignore"
120
+ - ".prgen.template.example"
121
+ - ".rspec"
122
+ - ".travis.yml"
123
+ - Gemfile
124
+ - Gemfile.lock
125
+ - LICENSE.txt
126
+ - README.md
127
+ - Rakefile
128
+ - bin/console
129
+ - bin/setup
130
+ - exe/prgen
131
+ - lib/prgen.rb
132
+ - lib/prgen/generator.rb
133
+ - lib/prgen/version.rb
134
+ - prgen.gemspec
135
+ homepage: https://github.com/at-shakil/prgen
136
+ licenses:
137
+ - MIT
138
+ metadata: {}
139
+ post_install_message:
140
+ rdoc_options:
141
+ - "-t"
142
+ - PRGen
143
+ - "-m"
144
+ - README.md
145
+ - "-N"
146
+ - "--markup"
147
+ - markdown
148
+ require_paths:
149
+ - lib
150
+ required_ruby_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: 2.4.0
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ requirements: []
161
+ rubyforge_project:
162
+ rubygems_version: 2.6.11
163
+ signing_key:
164
+ specification_version: 4
165
+ summary: PR Generator
166
+ test_files: []