trackinator 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/trackinate CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'trackinator/importer'
4
4
  require 'trollop'
5
+ require 'etc'
5
6
 
6
7
  opts = Trollop::options do
7
8
  opt :youtrack_username, "Your YouTrack username", :type => :string, :short => "y"
@@ -11,15 +12,40 @@ opts = Trollop::options do
11
12
  opt :youtrack_host, "YouTrack host", :type => :string, :short => "o"
12
13
  opt :youtrack_port, "YouTrack port", :type => :int, :default => 80, :short => "r"
13
14
  opt :youtrack_path_prefix, "YouTrack path prefix (e.g. '/youtrack/')", :type => :string, :default => "/", :short =>"e"
15
+ opt :create_rc, "Create a .trackinatorrc file in your home dir", :default => false, :short => "c"
14
16
  end
15
17
 
16
- p opts
18
+ unless opts[:create_rc]
19
+ if File.exists?("#{Etc.getpwuid.dir}/.trackinatorrc")
20
+ file = File.open("#{Etc.getpwuid.dir}/.trackinatorrc", "r")
21
+ file.each do |line|
22
+ key = /^(.*?)=/.match(line)[1]
23
+ value = /=(.*)$/.match(line)[1]
17
24
 
18
- Trollop::die :youtrack_username, "is required" if opts[:youtrack_username].empty?
19
- Trollop::die :youtrack_password, "is required" if opts[:youtrack_password].empty?
20
- Trollop::die :google_username, "is required" if opts[:google_username].empty?
21
- Trollop::die :google_password, "is required" if opts[:google_password].empty?
22
- Trollop::die :youtrack_host, "is required" if opts[:youtrack_host].empty?
25
+ encoded_value = key.include?("password") ? Base64.decode64(value).chomp : value.chomp
26
+ opts[key.to_sym] = encoded_value
27
+ end
28
+ end
29
+ end
30
+
31
+ Trollop::die :youtrack_username, "is required" if opts[:youtrack_username].nil?
32
+ Trollop::die :youtrack_password, "is required" if opts[:youtrack_password].nil?
33
+ Trollop::die :google_username, "is required" if opts[:google_username].nil?
34
+ Trollop::die :google_password, "is required" if opts[:google_password].nil?
35
+ Trollop::die :youtrack_host, "is required" if opts[:youtrack_host].nil?
36
+
37
+ if opts[:create_rc]
38
+ unless File.exists?("#{Etc.getpwuid.dir}/.trackinatorrc")
39
+ file = File.new("#{Etc.getpwuid.dir}/.trackinatorrc", "w")
40
+ opts.keys.each do |key|
41
+ key_string = key.to_s
42
+ value_string = opts[key]
43
+
44
+ value = key_string.include?("password") ? Base64.encode64(value_string) : value_string
45
+ file.puts "#{key_string}=#{value}"
46
+ end
47
+ end
48
+ end
23
49
 
24
50
  importer = Trackinator::Importer.new opts
25
51
  importer.import ARGV[0]
@@ -29,8 +29,8 @@ module Trackinator
29
29
  @youtrack_port = opts[:youtrack_port]
30
30
  @youtrack_path_prefix = opts[:youtrack_path_prefix]
31
31
 
32
- google_password = params[:google_password]
33
- youtrack_password = params[:youtrack_password]
32
+ google_password = opts[:google_password]
33
+ youtrack_password = opts[:youtrack_password]
34
34
 
35
35
  login_youtrack youtrack_login, youtrack_password
36
36
 
@@ -1,3 +1,3 @@
1
1
  module Trackinator
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/trackinator.gemspec CHANGED
@@ -5,11 +5,11 @@ Gem::Specification.new do |gem|
5
5
  gem.authors = ["Justin Beck"]
6
6
  gem.email = %w{justinbeck@mac.com}
7
7
  gem.description = <<-EOF
8
- In order to introduce in to my main development process
9
- I decided that creating a test plan prior to development
10
- and then using that as the basis for my YouTrack tickets
11
- would be a good approach. Think of it as TDD at a macro
12
- level.
8
+ In order to introduce testing in to my main development
9
+ process I decided that creating a test plan prior to
10
+ development and then using that as the basis for my
11
+ YouTrack tickets would be a good approach. Think of
12
+ it as TDD at a macro level.
13
13
  EOF
14
14
  gem.summary = %q{Imports a spreadsheet in to YouTrack}
15
15
  gem.homepage = "https://github.com/justincbeck/trackinator"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,10 +43,10 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
- description: ! " In order to introduce in to my main development process\n I
47
- decided that creating a test plan prior to development\n and then using that
48
- as the basis for my YouTrack tickets\n would be a good approach. Think of it
49
- as TDD at a macro\n level.\n"
46
+ description: ! " In order to introduce testing in to my main development\n process
47
+ I decided that creating a test plan prior to\n development and then using that
48
+ as the basis for my\n YouTrack tickets would be a good approach. Think of\n
49
+ \ it as TDD at a macro level.\n"
50
50
  email:
51
51
  - justinbeck@mac.com
52
52
  executables: