trackinator 0.0.8 → 0.0.9

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
@@ -25,6 +25,7 @@ unless opts[:create_rc]
25
25
  value = /=(.*)$/.match(line)[1]
26
26
 
27
27
  encoded_value = key.include?("password") ? Base64.decode64(value).chomp : value.chomp
28
+
28
29
  opts[key.to_sym] = encoded_value
29
30
  end
30
31
  end
@@ -41,14 +42,14 @@ google = Trackinator::Google.new opts
41
42
 
42
43
  Trollop::die "Check your YouTrack credentials and try again" unless you_track.is_logged_in?
43
44
  Trollop::die "Check your Google credentials and try again" unless google.is_logged_in?
44
- Trollop::die "You must supply a Google doc filename to import" if ARGV.empty? && opts[:create_rc]
45
+ Trollop::die "You must supply a Google doc filename to import" if ARGV.empty? && !opts[:create_rc]
45
46
 
46
47
  if opts[:create_rc]
47
48
  unless File.exists?("#{Etc.getpwuid.dir}/.trackinatorrc")
48
49
  file = File.new("#{Etc.getpwuid.dir}/.trackinatorrc", "w")
49
50
  opts.keys.each do |key|
50
51
  key_string = key.to_s
51
- unless key_string.include?("given")
52
+ if TRACKINATOR_RC.include?(key_string) && !key_string.include?("given")
52
53
  value_string = opts[key]
53
54
 
54
55
  value = key_string.include?("password") ? Base64.encode64(value_string) : value_string
@@ -60,7 +61,7 @@ end
60
61
 
61
62
  if ARGV.length == 1
62
63
  importer = Trackinator::Importer.new you_track, google
63
- issues = importer.import ARGV[0], "YTTP"
64
+ issues = importer.import(ARGV[0])
64
65
 
65
66
  if issues.length > 0
66
67
  issues.each do |issue|
data/lib/trackinator.rb CHANGED
@@ -19,4 +19,13 @@ module Trackinator
19
19
  outcome
20
20
  }
21
21
 
22
- end
22
+ TRACKINATOR_RC = %w{
23
+ youtrack_username
24
+ youtrack_password
25
+ google_username
26
+ google_password
27
+ host
28
+ path_prefix
29
+ }
30
+
31
+ end
@@ -13,15 +13,15 @@ module Trackinator
13
13
  @google = google
14
14
  end
15
15
 
16
- def import file_name, project = nil
16
+ def import file_name
17
17
  ticket_data = @google.get_tickets file_name
18
18
 
19
- issues = validate_tickets(project, ticket_data)
19
+ issues = validate_tickets(ticket_data)
20
20
 
21
21
  if issues.length == 0
22
22
  ticket_data.each do |entry|
23
23
  issue_id = @you_track.is_issue_exists? entry
24
- #false unless !issue_id.nil? ? @you_track.update_ticket(issue_id, entry) : @you_track.create_ticket(entry)
24
+ false unless !issue_id.nil? ? @you_track.update_ticket(issue_id, entry) : @you_track.create_ticket(entry)
25
25
  end
26
26
  end
27
27
 
@@ -30,9 +30,11 @@ module Trackinator
30
30
 
31
31
  private
32
32
 
33
- def validate_tickets project, tickets
33
+ def validate_tickets tickets
34
34
  issues = []
35
35
 
36
+ project = tickets[0]['project']
37
+
36
38
  issues.concat(@you_track.project_exists?(project))
37
39
  issues.concat(@you_track.you_track_fields_defined?(project, tickets[0].keys))
38
40
 
@@ -1,3 +1,3 @@
1
1
  module Trackinator
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
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.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: