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 +4 -3
- data/lib/trackinator.rb +10 -1
- data/lib/trackinator/importer.rb +6 -4
- data/lib/trackinator/version.rb +1 -1
- metadata +1 -1
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
|
-
|
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
|
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
data/lib/trackinator/importer.rb
CHANGED
@@ -13,15 +13,15 @@ module Trackinator
|
|
13
13
|
@google = google
|
14
14
|
end
|
15
15
|
|
16
|
-
def import file_name
|
16
|
+
def import file_name
|
17
17
|
ticket_data = @google.get_tickets file_name
|
18
18
|
|
19
|
-
issues = validate_tickets(
|
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
|
-
|
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
|
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
|
|
data/lib/trackinator/version.rb
CHANGED