project_id 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/bin/project_id +56 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b5c27454b2492f4dc0068732a0f02c2e51981558
4
+ data.tar.gz: 12cfd2f62bf208ea4aaf56c4eeaa5dbf0d67fb17
5
+ SHA512:
6
+ metadata.gz: 527debcc899769527d54d1a9e2975eafbc36b5701cf24b7066609d205916c247bcf6d488b0218826d5092c10cec181057b3b731b999afbb02ff5781851d43377
7
+ data.tar.gz: e0aa7be523bc390047263729e4c80861b05bd6b9d5c5349b12088de6995fdc505c1bde83f9bcc9f6ee35d1119338f33b43a730cb047ffc7042722093b43c6b23
data/bin/project_id ADDED
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+
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
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: project_id
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Denis Vazhenin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-12 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Project id generator
14
+ email: denis.vazhenin@me.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - bin/project_id
20
+ homepage: https://github.com/denvazh/project_id
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.0.14
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Project id generator
44
+ test_files: []