time_log_robot 0.1.1 → 0.1.2.1

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: 0559ea642c0065a0807d04c0df40d65b50e6e285
4
- data.tar.gz: aa9f9fb89b4b9bfa8218fee09d5bfaa6b71b6af0
3
+ metadata.gz: 71827460802d842afc432e63f81e43dc67430b73
4
+ data.tar.gz: e298a0e013600b8ceecbb17c96f450b1f92eed4e
5
5
  SHA512:
6
- metadata.gz: e71c80181ea7bae7b217a18f9a0c3e03e6218d2b53803b32ab7272b7b22f6de60bc15cdb1d47cbdf8d6f8d243194d10f27bae4855acb1b0cd7594ba2a6f89ba3
7
- data.tar.gz: 90ece6f79709e99a83cf12040c687cfa3de7839c506e00ba877075674d5be22805bc992d05470bf1a73cf59bc13013d82dab308b4d51d39c8c0645747fe8e473
6
+ metadata.gz: cf45dbe4c59830766700c4b413ff40fd69deb342807ddf7cc6be3b662315b6f37f33fc9a4dcc1476c6c9c1da5962698ec89afa97910ab9d3633e00c33468310a
7
+ data.tar.gz: 3b7f530b071a53e1741167165adcc55d78fdb99a923dc63487b04397c1bc9660299734f79c7205f8bb3ab90f4b912894321c1ea37e7393461e9e1807e4c130d8
data/.settings.yml CHANGED
@@ -0,0 +1,7 @@
1
+ ---
2
+ toggl_token: 5f85129ba262ce647e2914b7eeaa4cbc
3
+ toggl_workspace_id: '702788'
4
+ toggl_user_agent: markopolo@gmail.com
5
+ toggl_default_log_tag: logged
6
+ jira_username: markl
7
+ jira_password: XDR%t6yhn
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- time_log_robot (0.1.1)
4
+ time_log_robot (0.1.2)
5
5
  activesupport (~> 4.2, >= 4.2.6)
6
6
  commander (~> 4.1, >= 4.1.6)
7
7
  httparty (~> 0.13, >= 0.13.0)
@@ -16,6 +16,9 @@ GEM
16
16
  minitest (~> 5.1)
17
17
  thread_safe (~> 0.3, >= 0.3.4)
18
18
  tzinfo (~> 1.1)
19
+ ansi (1.5.0)
20
+ builder (3.2.2)
21
+ coderay (1.1.1)
19
22
  commander (4.1.6)
20
23
  highline (~> 1.6.11)
21
24
  highline (1.6.21)
@@ -23,10 +26,27 @@ GEM
23
26
  json (~> 1.8)
24
27
  multi_xml (>= 0.5.2)
25
28
  i18n (0.7.0)
29
+ interception (0.5)
26
30
  json (1.8.3)
31
+ method_source (0.8.2)
27
32
  minitest (5.8.4)
33
+ minitest-emoji (2.0.0)
34
+ minitest-reporters (1.1.9)
35
+ ansi
36
+ builder
37
+ minitest (>= 5.0)
38
+ ruby-progressbar
28
39
  multi_xml (0.5.5)
40
+ pry (0.10.3)
41
+ coderay (~> 1.1.0)
42
+ method_source (~> 0.8.1)
43
+ slop (~> 3.4)
44
+ pry-rescue (1.4.4)
45
+ interception (>= 0.5)
46
+ pry
29
47
  rake (10.5.0)
48
+ ruby-progressbar (1.8.1)
49
+ slop (3.6.0)
30
50
  thread_safe (0.3.5)
31
51
  tzinfo (1.2.2)
32
52
  thread_safe (~> 0.1)
@@ -36,6 +56,10 @@ PLATFORMS
36
56
 
37
57
  DEPENDENCIES
38
58
  bundler (~> 1.3)
59
+ minitest
60
+ minitest-emoji
61
+ minitest-reporters
62
+ pry-rescue
39
63
  rake (~> 10.5)
40
64
  time_log_robot!
41
65
 
data/README.md CHANGED
@@ -1,6 +1,35 @@
1
1
  # Time Log Robot
2
2
  ***Let the robot do your work time logging.***
3
3
 
4
+ ,--. ,--.
5
+ ((O ))--((O ))
6
+ ,'_`--'____`--'_`.
7
+ _: ____________ :_
8
+ | | ||::::::::::|| | |
9
+ | | ||::::::::::|| | |
10
+ | | ||::::::::::|| | |
11
+ |_| |/__________\| |_|
12
+ |________________|
13
+ __..-' `-..__
14
+ .-| : .----------------. : |-.
15
+ ,\ || | |\______________/| | || /.
16
+ /`.\:| | || __ __ __ || | |;/,'\
17
+ :`-._\;.| || '--''--''--' || |,:/_.-':
18
+ | : | || .----------. || | : |
19
+ | | | || '----SSt---' || | | |
20
+ | | | || _ _ _ || | | |
21
+ :,--.; | || (_) (_) (_) || | :,--.;
22
+ (`-'|) | ||______________|| | (|`-')
23
+ `--' | |/______________\| | `--'
24
+ |____________________|
25
+ `.________________,'
26
+ (_______)(_______)
27
+ (_______)(_______)
28
+ (_______)(_______)
29
+ (_______)(_______)
30
+ | || |
31
+ '--------''--------'
32
+
4
33
  This is an integration between project management tools (like JIRA) and time logging apps (like Toggl). Currently, it only works as an import from Toggl into JIRA.
5
34
 
6
35
  ## Installation
@@ -39,7 +68,7 @@ Here are some notes about how to find the appropriate values for those environme
39
68
  * **TOGGL_TOKEN**: In your Toggl account, go to your profile page and look for the API token at the bottom.
40
69
  * **TOGGL_WORKSPACE_ID**: This is a little trickier. Your workspaces usually only show a human-readable name to you in Toggl's UI, and here you need the workspace's machine ID. But you can do a curl request to find it like this (replacing **TOGGL_TOKEN** with your token from above):
41
70
 
42
- curl -v -u TOGGL_TOKEN:api_token \ -X GET https://www.toggl.com/api/v8/workspaces
71
+ `curl -v -u TOGGL_TOKEN:api_token \ -X GET https://www.toggl.com/api/v8/workspaces`
43
72
 
44
73
  Look at the result and find the id given for the workspace you want to use.
45
74
 
@@ -48,6 +77,19 @@ Here are some notes about how to find the appropriate values for those environme
48
77
  * **JIRA_USERNAME**: This is your JIRA username, which is not an email, but usually your email minus the "@domain.com"
49
78
  * **JIRA_PASSWORD**: I know there's a lot of jargon, but some of these are pretty self-explanatory. :trollface:
50
79
 
80
+ ### Mapping keys
81
+
82
+ You can now map JIRA keys to specific phrases so that in your Toggl time entries, you won't need to enter the JIRA key. These mappings are stored in a YAML file in the gem root directory:
83
+
84
+ path/to/gem/mapping.yml
85
+
86
+ # Example usage
87
+ # --
88
+ # phrase: JIRA-KEY
89
+ weekly planning: PM-1
90
+
91
+ With this mapping, when logging time on on Toggl, instead of having to enter "weekly planning [PM-1]", you can just enter "weekly planning" and the robot will get the JIRA key from the `mapping.yml` file.
92
+
51
93
  ### Help
52
94
 
53
95
  For more details use the help flag:
@@ -72,4 +114,13 @@ To run the app in IRB for debugging run
72
114
  2. Create your feature branch (`git checkout -b my-new-feature`)
73
115
  3. Commit your changes (`git commit -am 'Add some feature'`)
74
116
  4. Push to the branch (`git push origin my-new-feature`)
75
- 5. Create new Pull Request to Dev
117
+ 5. Create new Pull Request to Dev
118
+
119
+ ## License
120
+
121
+ This program is provided under an MIT open source license, read the [MIT-LICENSE.txt](http://github.com/supremebeing7/jira_toggl_importer/blob/master/LICENSE.txt) file for details.
122
+
123
+
124
+ ## Copyright
125
+
126
+ Copyright (c) 2016 Mark J. Lehman
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ require 'rake/testtask'
1
2
  require 'bundler/gem_tasks'
2
3
 
3
4
  desc 'Run in IRB for debugging'
@@ -8,3 +9,10 @@ task :console do
8
9
  ARGV.clear
9
10
  IRB.start
10
11
  end
12
+
13
+ # @TODO Uncomment when it works! - `rake test`
14
+
15
+ Rake::TestTask.new do |t|
16
+ t.libs << 'test'
17
+ t.test_files = FileList['test/**/*_test.rb']
18
+ end
@@ -1,26 +1,27 @@
1
1
  module TimeLogRobot
2
2
  module JIRA
3
3
  class IssueKeyParser
4
+
4
5
  class << self
5
- def parse(entry)
6
- matches = entry['description'].match(/(\[(?<issue_key>[^\]]*)\])/)
7
- if matches.present?
8
- matches['issue_key']
9
- else
10
- get_key_from_key_mapping(entry['description'])
11
- end
6
+ def parse(description)
7
+ matches = description.match(/(\[(?<issue_key>[^\]]*)\])/)
8
+ return matches['issue_key'] unless matches.nil?
9
+ get_key_from_key_mapping(description)
12
10
  end
13
11
 
14
12
  private
15
13
 
16
14
  def get_key_from_key_mapping(description)
17
- mappings = YAML.load_file(mapping_file_path) || {}
18
- if found_key = mappings.keys.find { |key| /#{description}/ =~ key }
15
+ if found_key = mappings.keys.find { |key| description.include?(key) }
19
16
  mappings[found_key]
20
17
  end
21
18
  end
22
19
 
23
- def mapping_file_path
20
+ def mappings
21
+ YAML.load_file(keymap_file_path) || {}
22
+ end
23
+
24
+ def keymap_file_path
24
25
  File.join(TimeLogRobot.root, 'mapping.yml')
25
26
  end
26
27
  end
@@ -33,7 +33,7 @@ module TimeLogRobot
33
33
  end
34
34
 
35
35
  def log(entry)
36
- issue_key = JIRA::IssueKeyParser.parse(entry)
36
+ issue_key = JIRA::IssueKeyParser.parse(entry['description'])
37
37
  payload = build_payload(entry)
38
38
  puts "Attempting to log #{human_readable_duration(parse_duration(entry))}"
39
39
  puts "starting on #{parse_start(entry)}"
@@ -1,3 +1,3 @@
1
1
  module TimeLogRobot
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2.1'
3
3
  end
data/mapping.yml CHANGED
@@ -1,3 +1,8 @@
1
1
  monday meeting: PM-1
2
2
  weekly planning meeting: PM-1
3
- time log robot: OSS-5
3
+ architecture planning: PM-1
4
+ architecture meeting: PM-1
5
+ time log robot: OSS-5
6
+ code review: PM-38
7
+ daily planning: PM-35
8
+ hw checkin meeting: HW-10
@@ -0,0 +1,14 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/pride'
3
+ require 'minitest/emoji'
4
+ require 'minitest/reporters'
5
+ require 'yaml'
6
+ require 'active_support'
7
+ # require 'pry-rescue/minitest'
8
+ require 'httparty'
9
+
10
+ Dir[File.expand_path "lib/**/*.rb"].each{|file| require_relative file }
11
+
12
+ reporter_options = { color: true }
13
+ Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(reporter_options)]
14
+
@@ -0,0 +1,39 @@
1
+ require_relative '../../test_helper'
2
+
3
+ module TimeLogRobot
4
+ module JIRA
5
+ class IssueKeyParser
6
+ def self.mappings
7
+ {
8
+ "mapped description" => "HI-5"
9
+ }
10
+ end
11
+ end
12
+
13
+ class TestIssueKeyParser < Minitest::Test
14
+ def setup
15
+ @described_class = TimeLogRobot::JIRA::IssueKeyParser
16
+ end
17
+
18
+ def test_that_it_gets_the_issue_key
19
+ assert_equal "PM-12", @described_class.parse('description [PM-12]')
20
+ end
21
+
22
+ def test_that_it_gives_nothing_with_no_key_present
23
+ assert_equal nil, @described_class.parse('description')
24
+ end
25
+
26
+ def test_that_it_fetches_the_key_from_mapping
27
+ assert_equal "HI-5", @described_class.parse('mapped description')
28
+ end
29
+
30
+ def test_that_parse_is_not_too_strict_with_mappings
31
+ assert_equal "HI-5", @described_class.parse('mapped description with more text')
32
+ end
33
+
34
+ def test_that_parse_mappings_works_with_comments
35
+ assert_equal "HI-5", @described_class.parse('mapped description - {with comment}')
36
+ end
37
+ end
38
+ end
39
+ end
@@ -21,6 +21,10 @@ Gem::Specification.new do |spec|
21
21
  spec.required_ruby_version = '>= 2.0'
22
22
  spec.add_development_dependency 'bundler', '~> 1.3'
23
23
  spec.add_development_dependency 'rake', '~> 10.5'
24
+ spec.add_development_dependency 'minitest'
25
+ spec.add_development_dependency 'minitest-emoji'
26
+ spec.add_development_dependency 'minitest-reporters'
27
+ spec.add_development_dependency 'pry-rescue'
24
28
 
25
29
  spec.add_runtime_dependency 'activesupport', '~> 4.2', '>= 4.2.6'
26
30
  spec.add_runtime_dependency 'commander', '~> 4.1', '>= 4.1.6'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_log_robot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark J. Lehman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-20 00:00:00.000000000 Z
11
+ date: 2016-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,62 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest-emoji
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest-reporters
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-rescue
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
41
97
  - !ruby/object:Gem::Dependency
42
98
  name: activesupport
43
99
  requirement: !ruby/object:Gem::Requirement
@@ -143,6 +199,8 @@ files:
143
199
  - lib/time_log_robot/toggl/tagger.rb
144
200
  - lib/time_log_robot/version.rb
145
201
  - mapping.yml
202
+ - test/test_helper.rb
203
+ - test/time_log_robot/jira/issue_key_parser_test.rb
146
204
  - time_log_robot.gemspec
147
205
  homepage: https://github.com/supremebeing7/time_log_robot
148
206
  licenses:
@@ -168,5 +226,7 @@ rubygems_version: 2.4.8
168
226
  signing_key:
169
227
  specification_version: 4
170
228
  summary: Automate work time logging
171
- test_files: []
229
+ test_files:
230
+ - test/test_helper.rb
231
+ - test/time_log_robot/jira/issue_key_parser_test.rb
172
232
  has_rdoc: