project_id 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: fd792f7361551f3b53e6e2f0ff43c68ffa8925a8
4
- data.tar.gz: 2e5e566aca0935ebab7a11938743c84dbdac5f1c
3
+ metadata.gz: b4d08f44dbce85b96753f67a79507838c704daa2
4
+ data.tar.gz: 7f09878fa31bdebd04fc5cacbb8c7149c4ed83b7
5
5
  SHA512:
6
- metadata.gz: a89319618233996c63f68ef932c82136acc97a88f8a9a257734c94711c8ecc2bc6ddc46ffd94abba6e84cc1a42485ca6c528a9fe52d40dfdc8895a7f8db0db3c
7
- data.tar.gz: 0db3f99158558b1f2b1e8f0efce43175485cd39a773f75da3c4a6020476b145549d9448cc74ce7b20aa94a4bc40bd38d2aaf91044a4cd410449c94dcd6a31473
6
+ metadata.gz: 9267f389592cab25b68d0abb592953ba3840798b30fa80684e845676f9db0c6d85a8ac53631b2734703807055a1c2e8f55c307b40fb770d5994a717b9a01dff7
7
+ data.tar.gz: 9db94914e246fb3d6939103476e93a110095451ecd803b808064c99084a4742b4b8dacfb3232a9019a19de0942269fa6ef867d2c2ebc1b9e72b047c270c4e8ee
data/.gitignore ADDED
@@ -0,0 +1,66 @@
1
+ #
2
+ # Taken from gitignore project: https://github.com/github/gitignore
3
+ #
4
+ .DS_Store
5
+ .AppleDouble
6
+ .LSOverride
7
+
8
+ # Icon must end with two \r
9
+ Icon
10
+
11
+ # Thumbnails
12
+ ._*
13
+
14
+ # Files that might appear on external disk
15
+ .Spotlight-V100
16
+ .Trashes
17
+
18
+ # Directories potentially created on remote AFP share
19
+ .AppleDB
20
+ .AppleDesktop
21
+ Network Trash Folder
22
+ Temporary Items
23
+ .apdisk
24
+
25
+ [._]*.s[a-w][a-z]
26
+ [._]s[a-w][a-z]
27
+ *.un~
28
+ Session.vim
29
+ .netrwhist
30
+ *~
31
+ *.gem
32
+ *.rbc
33
+ /.config
34
+ /coverage/
35
+ /InstalledFiles
36
+ /pkg/
37
+ /spec/reports/
38
+ /test/tmp/
39
+ /test/version_tmp/
40
+ /tmp/
41
+
42
+ ## Specific to RubyMotion:
43
+ .dat*
44
+ .repl_history
45
+ build/
46
+
47
+ ## Documentation cache and generated files:
48
+ /.yardoc/
49
+ /_yardoc/
50
+ /doc/
51
+ /rdoc/
52
+
53
+ ## Environment normalisation:
54
+ /.bundle/
55
+ /lib/bundler/man/
56
+
57
+ # for a library or gem, you might want to ignore these files since the code is
58
+ # intended to run in multiple environments; otherwise, check them in:
59
+ # Gemfile.lock
60
+ # .ruby-version
61
+ # .ruby-gemset
62
+
63
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
64
+ .rvmrc
65
+
66
+ /.bin
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
data/Gemfile.lock ADDED
@@ -0,0 +1,16 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ project_id (0.2.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ rake (0.9.6)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ project_id!
16
+ rake
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Denis Vazhenin
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Project id generator
2
+
3
+ This is a small tool to generate unique id from JIRA project key.
4
+
5
+ Main reason for creating this tool was a huge amount of projects in JIRA for which I had to create corresponding project id prefix on the build server.
6
+
7
+ ## Background
8
+
9
+ Suppose you have a JIRA project and its key is "TEST" (i.e. all related issues would look like TEST-1, TEST-2 and etc.). At the same time, assuming on the build server one like to use incremental build numbers for all projects. In this case, using "just" build number for every project makes it difficult to create overview and see which builds amongs all projects are failing or passing.
10
+
11
+ ## Usage
12
+
13
+ To have some connection with project key in JIRA and build project on the build server, I created this tool. To generate project id out of JIRA key one would need to do only the following:
14
+
15
+ ```
16
+ $: project_id -k TEST
17
+ TEST => 1026
18
+ ```
19
+
20
+ Then this number would be possible to use as a prefix for project on the build server and create unique incremental builds for every project like:
21
+
22
+ Project TEST | Project TWOTHINGS
23
+ --- | ---
24
+ 10261 | 358541
25
+ 10262 | 358542
26
+ 10261 | 358543
27
+
28
+ ## License
29
+
30
+ (The MIT License)
31
+
32
+ See LICENSE.txt .
33
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/project_id CHANGED
@@ -1,56 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # coding: utf-8
2
3
 
3
- require 'optparse'
4
+ require 'project_id'
4
5
 
5
- # force help if no arguments
6
- ARGV << '-h' if ARGV.empty?
7
-
8
- options = {}
9
- opt_parser =OptionParser.new do |opts|
10
- opts.banner = "Usage: make_project_id [project_key]"
11
-
12
- options[:key] = nil
13
- opts.on("-k", "--key [JIRA KEY]", String, "Project key in Jira") do |k|
14
- if k.nil?
15
- puts opt_parser
16
- else
17
- options[:key] = k
18
- end
19
- end
20
-
21
- opts.on("-h", "--help", "Show help") do |h|
22
- options[:help] = h
23
- puts opt_parser
24
- exit
25
- end
26
- end
27
-
28
- begin
29
- opt_parser.parse!
30
-
31
- if (options[:key])
32
- begin
33
- pkey = options[:key]
34
-
35
- codes = []
36
- pkey.each_char do |c|
37
- codes.push(c.ord) if (c.is_a?(String) || c.is_a?(Integer))
38
- end
39
-
40
- new_id = 0
41
- codes.each do |cc|
42
- new_id += cc
43
- end
44
-
45
- puts "#{pkey} => #{new_id}"
46
-
47
- rescue
48
- puts "[Error] Unable to generate project id"
49
- exit 1
50
- end
51
- end
52
- rescue OptionParser::InvalidOption, OptionParser::MissingArgument
53
- puts $!.to_s
54
- puts opt_parser
55
- exit
56
- end
6
+ ProjectId.run!(ARGV)
@@ -0,0 +1,4 @@
1
+ # coding: utf-8
2
+ module ProjectId
3
+ VERSION = "0.2.0"
4
+ end
data/lib/project_id.rb ADDED
@@ -0,0 +1,60 @@
1
+ require "project_id/version"
2
+ require 'optparse'
3
+ require 'digest'
4
+
5
+ module ProjectId
6
+ def self.run!(argv)
7
+ argv << '-h' if argv.empty?
8
+
9
+ options = {}
10
+ opt_parser =OptionParser.new do |opts|
11
+ opts.banner = "Usage: project_id [options]"
12
+
13
+ options[:key] = nil
14
+ opts.on("-k", "--key [JIRA KEY]", String, "Project key in Jira") do |k|
15
+ if k.nil?
16
+ puts opt_parser
17
+ else
18
+ options[:key] = k
19
+ end
20
+ end
21
+
22
+ opts.on("-h", "--help", "Show help") do |h|
23
+ options[:help] = h
24
+ puts opt_parser
25
+ exit
26
+ end
27
+
28
+ opts.on("-v", "--version", "Show version") do |v|
29
+ options[:version] = v
30
+ puts ProjectId::VERSION
31
+ exit
32
+ end
33
+ end
34
+
35
+ begin
36
+ opt_parser.parse!(argv)
37
+
38
+ if (options[:key])
39
+ begin
40
+ pkey = options[:key]
41
+ digest = Digest::SHA256.new
42
+
43
+ num = digest.hexdigest(pkey).hex % (10 ** 5)
44
+ new_id = num.abs
45
+
46
+ puts "#{pkey} => #{new_id}"
47
+
48
+ rescue
49
+ puts "[Error] Unable to generate project id"
50
+ exit 1
51
+ end
52
+ end
53
+ rescue OptionParser::InvalidOption, OptionParser::MissingArgument
54
+ puts $!.to_s
55
+ puts opt_parser
56
+ exit
57
+ end
58
+ end
59
+ end
60
+
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'project_id/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'project_id'
8
+ s.version = ProjectId::VERSION
9
+ s.date = '2014-04-23'
10
+ s.summary = %q{Generate project id from JIRA project key.}
11
+ s.description = %{Simple tool to create project id for builds on the build server}
12
+ s.authors = ["Denis Vazhenin"]
13
+ s.email = 'denis.vazhenin@me.com'
14
+ s.license = 'MIT'
15
+
16
+ s.files = `git ls-files`.split($/)
17
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.executables = %w(project_id)
21
+ s.homepage = 'https://github.com/denvazh/project_id'
22
+
23
+ s.required_ruby_version = '>= 1.9.3'
24
+
25
+ s.add_development_dependency "rake"
26
+ end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: project_id
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
  - Denis Vazhenin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-12 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2014-04-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: Simple tool to create project id for builds on the build server
14
28
  email: denis.vazhenin@me.com
15
29
  executables:
@@ -17,7 +31,16 @@ executables:
17
31
  extensions: []
18
32
  extra_rdoc_files: []
19
33
  files:
34
+ - .gitignore
35
+ - Gemfile
36
+ - Gemfile.lock
37
+ - LICENSE.txt
38
+ - README.md
39
+ - Rakefile
20
40
  - bin/project_id
41
+ - lib/project_id.rb
42
+ - lib/project_id/version.rb
43
+ - project_id.gemspec
21
44
  homepage: https://github.com/denvazh/project_id
22
45
  licenses:
23
46
  - MIT
@@ -41,5 +64,5 @@ rubyforge_project:
41
64
  rubygems_version: 2.0.14
42
65
  signing_key:
43
66
  specification_version: 4
44
- summary: Generate project id from JIRA project key
67
+ summary: Generate project id from JIRA project key.
45
68
  test_files: []