Giter Site home page Giter Site logo

billp / jira-logwork Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 278 KB

๐Ÿ•‘ Minimize your time spent logging your work hours on Jira.

Home Page: https://billp.github.io/jira-logwork

License: MIT License

Ruby 100.00%
jira hours wizard automation ruby gem logging

jira-logwork's People

Contributors

billp avatar sotcha avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sotcha

jira-logwork's Issues

Implement initial setup wizard

We need to add settings/configuration functionality where it will store:

  • jira endpoint
  • user credentials
    • username
    • user password , this can be plain text (maybe as phase 1) or encrypted

Translate TestLogworkManager from minitest to rspec

Tasks

  • Write specs for TestLogworkManager:
    • Translate the existing test cases in tests/test_logwork_manager.rb to rspec. You run specs with the following command: bundle exec rspec
    • Because LogworkIssue is a subclass of ActiveRecord::Base, it needs database initialization. For specs, you should stub (create a fake implementation) the Database.prepare_database method to establish a connection in memory instead of disk. This can be achieved with the following code: ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
    • Remove the /tests folder

To stub a method, use allow(...).to
To make assertions, use expect(...).to

Implement WorklogManager functionality

Add functionality in WorklogManager.update_worklog.
The description of method's Input/Output is described in WorklogManager.update_worklog definition.

Commands

issues = [
    WorklogIssue.new(id: 'ABC-1234', description: 'Bug #1', adjustment_mode: :auto, duration: nil, start_time: "10:00", date: "10/10/2020", repeat: 5),
    WorklogIssue.new(id: 'ASDC-2131', description: 'Bug #2', adjustment_mode: :auto, duration: '20m', repeat: 5),
    WorklogIssue.new(id: 'AXA-385', description: 'Bug #3', , adjustment_mode: :auto, duration: '60m', repeat: 5),
    WorklogIssue.new(id: 'BAX-994', description: 'Bug #4', adjustment_mode: :auto, duration: nil, date: "10/10/2020", repeat: 5)
]

# add issue to table
WorklogManager.update_worklog(8, issues, 'i ABC-1232')

# move issue from position 2 to position 1
WorklogManager.update_worklog(8, issues, 'm 2 1')

# update start_time of issue in position 2 to 10:10
WorklogManager.update_worklog(8, issues, 's 10:10')

# update duration of issue in position 2 to 3 hours
WorklogManager.update_worklog(8, issues, 'd 2 3h')

# remove second issue from table
WorklogManager.update_worklog(8, issues, 'r 2')

Implement the logger functionality

Description

A user will be able to log hours by providing ticket ids and optionally durations by using a specific syntax.
He can also specify a date for hours to be logged in different date than the current one (today).

Command

bin/jira-logwork log [ISSUES_WITH_DURATIONS] --date [DATE]

Arguments

ISSUES_WITH_DURATIONS log argument (Required): It's a string which contains comma-separated issues with optional durations and start times. To clarify things a little bit, lets say a user enters the following command:
jira-logwork log ABC-123=10:00|1h30m,ERS-52=1h,ESS-312,EF-4123 --date 23/06/2020

The parser will execute the following steps:

  1. Splits the ISSUES_WITH_DURATIONS string to separate issues and get their options (if any). It uses comma separator(,) for issues and pipe separator(|) for options. In our case it will create the following table:
jira_id start_time duration adjustment_mode converted_duration
ABC-123 10:00 1h30m fixed
ERS-52 1h fixed
ESS-312 auto
EF-4123 auto
  1. Fills the missing values by making conversions. The final table will be the following:
jira_id start_time duration adjustment_mode converted_duration
ABC-123 10:00 1h30m fixed 5400
ERS-52 11:30 1h fixed 3600
ESS-312 12:30 2h45m auto 9900
EF-4123 15:15 2h45m auto 9900
TOTAL - 8h - 28800

It takes into account the configuration params given in configuration step. In this example, they are the following: shift_start: 10:00, shift_end: 18:00

Implement scheduled issues

The user should be able to register one or more issues he wants to log every day (like stand up meeting)

The tool will provide the following commands in order to add or remove repeatable issues.

jira-logwork scheduled add XYZ-123 --repeat=[REPEAT] --date=[DATE] --start=[START-TIME] --duration=[DURATION] 
jira-logwork scheduled remove XYZ-123
jira-logwork scheduled list

[REPEAT]: An integer that indicates the day of the week that this issue will be repeated.

0: Every day
1: Monday
2: Tuesday
3: Wednesday
4: Thursday
5: Friday
6: Saturday
7: Sunday

[DATE]: The date that the issue will be scheduled in MM/DD/YYYY format.
[START TIME]: Time in 24h format, e.g. 10:00
[DURATION]: String representation of duration, e.g. 30m, 1h30m, etc.

@sotcha what do you think?

Missing gems from Gemfile , os specifc gems

Gemfile is missing :

  • byebug
  • bcrypt
  • keychain - this is an OS specific gem, a check should be added on Gemfile and on require statement

hint: check RbConfig::CONFIG['host_os'] value , a helping utility may provide os family.

Write specs for login/logout

Tasks

  • Write specs for bin/jiralogwork login command as described bellow:
    • Valid username/password -> should print success message & configuration parameters should be updated
    • Invalid username/password -> should print failure message
    • Login while already logged in -> should print an already logged in message
  • Write specs for bin/jiralogwork logout
    • If not logged in -> should print a not logged in message
    • If logged in -> should print log out successful & clear configuration parameters

Spec filename: spec/account_actions_spec.rb

Implement log functionality via wizard

The user will be able to log his ours by following an easy to use wizard

The wizard steps will be:

  1. Prompt user to select zero or more favorite tickets.
  2. Prompt user to select zero or more from last visited tickets based in the given date.
  3. Prompt user to edit his selections with add, remove or move commands, and optionally specify durations for each one.
  4. Prompt user to save the logs

Crash on login

After trying to run

./jira-logwork.rb --login

the app crashes

Traceback (most recent call last):
	8: from ./jira-logwork.rb:23:in `<main>'
	7: from /home/sotcha/development/my/jira-logwork/jira-logwork/lib/communicator.rb:144:in `login'
	6: from /home/sotcha/development/my/jira-logwork/jira-logwork/lib/communicator.rb:86:in `post'
	5: from /home/sotcha/development/my/jira-logwork/jira-logwork/lib/communicator.rb:60:in `handle_response'
	4: from /home/sotcha/development/my/jira-logwork/jira-logwork/lib/communicator.rb:88:in `block in post'
	3: from /home/sotcha/development/my/jira-logwork/jira-logwork/lib/communicator.rb:148:in `block in login'
	2: from /home/sotcha/development/my/jira-logwork/jira-logwork/lib/configuration_manager.rb:49:in `update_login_credentials'
	1: from /home/sotcha/development/my/jira-logwork/jira-logwork/lib/configuration_manager.rb:79:in `save_configuration'
/home/sotcha/development/my/jira-logwork/jira-logwork/lib/configuration_manager.rb:79:in `write': No such file or directory @ rb_sysopen - /home/sotcha/.jira-logwork/.jira-logwork.yml (Errno::ENOENT)

Seems that needs to create and check if writable the config file/directory.

Implement favourites functionality

A user will be able to add tickets as favourites, so they can be selected in log wizard for quick access.

The tool will provide the following command to add/remove or list favourites

jira-logwork favorites add [ticket-id]
jira-logwork favorites remove [ticket-id]
jira-logwork favorites list

Write specs for configuration classes

Write specs for the following methods

ConfigurationManager

  • configuration_path โ‡’ String
  • jira_server_url โ‡’ String
  • save_configuration โ‡’ Object
  • update_jira_server_url(url) โ‡’ Object

CredentialsConfiguration

  • decrypted_password โ‡’ Object
  • login_credentials โ‡’ AccountCredentials
  • login_credentials_empty? โ‡’ Boolean
  • update_login_credentials(username, password) โ‡’ Object

ShiftConfiguration

  • shift_duration โ‡’ Int
  • shift_end โ‡’ String
  • shift_start โ‡’ String
  • update_shift_end(shift_end) โ‡’ Object
  • update_shift_start(shift_start) โ‡’ Object
  • validate_saved_shift_end โ‡’ Object
  • validate_saved_shift_start โ‡’ Object

Write specs for Communicator

Write specs for the following methods:

  • add_cookie_if_needed(req) โ‡’ Object
  • cache_call(path, success_block, &callback) โ‡’ Object
  • delete(path, &success_block) โ‡’ Object
  • get(path, &success_block) โ‡’ Object
  • handle_response(res) โ‡’ Object
  • parse_json(body) โ‡’ Object
  • post(path, params = {}, &success_block) โ‡’ Object
  • store_cookie(cookie) โ‡’ Object

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.