willpower 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.localized +0 -0
  4. data/.rspec +3 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +5 -0
  7. data/Rakefile +6 -0
  8. data/bin/setup +8 -0
  9. data/bin/willpower +5 -0
  10. data/lib/willpower.rb +21 -0
  11. data/lib/willpower/assets/agile_principles.txt +43 -0
  12. data/lib/willpower/assets/agile_values.txt +7 -0
  13. data/lib/willpower/assets/definition_of_done.txt +6 -0
  14. data/lib/willpower/assets/definition_of_ready.txt +13 -0
  15. data/lib/willpower/assets/manifesto.txt +26 -0
  16. data/lib/willpower/commands/dod.rb +13 -0
  17. data/lib/willpower/commands/dor.rb +13 -0
  18. data/lib/willpower/commands/events.rb +89 -0
  19. data/lib/willpower/commands/hello.rb +8 -0
  20. data/lib/willpower/commands/help.rb +27 -0
  21. data/lib/willpower/commands/init.rb +25 -0
  22. data/lib/willpower/commands/login.rb +52 -0
  23. data/lib/willpower/commands/manifesto.rb +10 -0
  24. data/lib/willpower/commands/principles.rb +10 -0
  25. data/lib/willpower/commands/projects.rb +106 -0
  26. data/lib/willpower/commands/remotes.rb +48 -0
  27. data/lib/willpower/commands/tickets.rb +214 -0
  28. data/lib/willpower/commands/users.rb +50 -0
  29. data/lib/willpower/commands/values.rb +10 -0
  30. data/lib/willpower/commands/version.rb +8 -0
  31. data/lib/willpower/constants.rb +6 -0
  32. data/spec/spec_helper.rb +19 -0
  33. data/spec/willpower/dod_spec.rb +26 -0
  34. data/spec/willpower/dor_spec.rb +33 -0
  35. data/spec/willpower/hello_spec.rb +15 -0
  36. data/spec/willpower/init_spec.rb +36 -0
  37. data/spec/willpower/principles_spec.rb +63 -0
  38. data/spec/willpower/remote_spec.rb +94 -0
  39. data/spec/willpower/values_spec.rb +27 -0
  40. data/spec/willpower/version_spec.rb +15 -0
  41. data/willpower.gemspec +28 -0
  42. metadata +278 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 59e7bd3b77b7f2017dfaac5e08131130dcc84e4f452169b1aa5a62ae3c0d0b54
4
+ data.tar.gz: ed023080f6b4c05b82324980f7c1cf145670b6f5ba6249fbc5dbe6f96aadf062
5
+ SHA512:
6
+ metadata.gz: 1219840e34734b9ae57b6c4dfc86ca76c968586b417f7b2af4919744902c47d451fd53a5910eaa98050d590df78fbeb11813bac82ee4477b3e0e790665d44ec8
7
+ data.tar.gz: dd74863f4a8310a148e4b4d8ca54a23629e9120c052db95edd121617dfa33a868b54657d4a6ee9456def656cbf59418dba0045a62bde1a748388e5667cf2694a
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ lib/.config.json
10
+ Gemfile.lock
11
+ .idea/
12
+ # rspec failure tracking
13
+ .rspec_status
data/.localized ADDED
File without changes
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.2
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
3
+
4
+ # Specify your gem's dependencies in willpower.gemspec
5
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/bin/willpower ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../lib/willpower"
4
+
5
+ Willpower::CLI.start
data/lib/willpower.rb ADDED
@@ -0,0 +1,21 @@
1
+ require "thor"
2
+ require "rainbow"
3
+ require "willpower/constants"
4
+ require "json"
5
+ require "rest-client"
6
+ require "terminal-table"
7
+ require "highline"
8
+ Dir[File.join(__dir__, "willpower/commands", "*.rb")].each { |file| require file }
9
+
10
+ module Willpower
11
+ GEM_PATH = `gem which willpower`.chomp.chomp("willpower.rb")
12
+ if `find "#{GEM_PATH}" -name .config.json`.empty?
13
+ `touch #{GEM_PATH}.config.json`
14
+ File.write("#{GEM_PATH}.config.json", {})
15
+ end
16
+
17
+ CONFIG = JSON.parse(File.read("#{GEM_PATH}.config.json"))
18
+
19
+ class CLI < Thor
20
+ end
21
+ end
@@ -0,0 +1,43 @@
1
+ Our highest priority is to satisfy the customer
2
+ through early and continuous delivery
3
+ of valuable software.
4
+
5
+ Welcome changing requirements, even late in
6
+ development. Agile processes harness change for
7
+ the customer's competitive advantage.
8
+
9
+ Deliver working software frequently, from a
10
+ couple of weeks to a couple of months, with a
11
+ preference to the shorter timescale.
12
+
13
+ Business people and developers must work
14
+ together daily throughout the project.
15
+
16
+ Build projects around motivated individuals.
17
+
18
+ Give them the environment and support they need,
19
+ and trust them to get the job done.
20
+
21
+ The most efficient and effective method of
22
+ conveying information to and within a development
23
+ team is face-to-face conversation.
24
+
25
+ Working software is the primary measure of progress.
26
+
27
+ Agile processes promote sustainable development.
28
+
29
+ The sponsors, developers, and users should be able
30
+ to maintain a constant pace indefinitely.
31
+
32
+ Continuous attention to technical excellence
33
+ and good design enhances agility.
34
+
35
+ Simplicity--the art of maximizing the amount
36
+ of work not done--is essential.
37
+
38
+ The best architectures, requirements, and designs
39
+ emerge from self-organizing teams.
40
+
41
+ At regular intervals, the team reflects on how
42
+ to become more effective, then tunes and adjusts
43
+ its behavior accordingly.
@@ -0,0 +1,7 @@
1
+ Individuals and interactions over processes and tools
2
+
3
+ Working software over comprehensive documentation
4
+
5
+ Customer collaboration over contract negotiation
6
+
7
+ Responding to change over following a plan
@@ -0,0 +1,6 @@
1
+ We consider a ticket ‘Done’ when:
2
+
3
+ 1. The ticket is merged into master and deployed
4
+ 2. All "Acceptance Criteria" are met
5
+ 3. It is presented to Product Owner
6
+ 4. Product Owner agrees that ticket is completed
@@ -0,0 +1,13 @@
1
+ All work should have a related Ticket.
2
+ Developer should not start development unless a Ticket is "Ready for development"
3
+ We consider a Ticket "Ready for development" if it meets following requirements:
4
+
5
+ Ticket Requirements must have:
6
+
7
+ 1. Ticket should have a short title
8
+ 2. Ticket should have a clear description
9
+ 3. Description should including "How to demo" section
10
+ 4. Description may have "Acceptance Criteria" section which includes all important(specific) requirements
11
+ 5. All Blocker should be resolved
12
+ 6. Ticket can reasonably be "Done" within the Sprint time-box
13
+ 7. Ticket should have Estimation
@@ -0,0 +1,26 @@
1
+ Manifesto for Agile Software Development
2
+
3
+ We are uncovering better ways of developing
4
+ software by doing it and helping others do it.
5
+ Through this work we have come to value:
6
+
7
+ Individuals and interactions over processes and tools
8
+ Working software over comprehensive documentation
9
+ Customer collaboration over contract negotiation
10
+ Responding to change over following a plan
11
+
12
+ That is, while there is value in the items on
13
+ the right, we value the items on the left more.
14
+
15
+
16
+
17
+
18
+ Kent Beck | Andrew Hunt
19
+ Mike Beedle | Ron Jeffries
20
+ Arie van Bennekum | Jon Kern
21
+ Alistair Cockburn | Brian Marick
22
+ Ward Cunningham | Robert C. Martin
23
+ Martin Fowler | Steve Mellor
24
+ James Grenning | Ken Schwaber
25
+ Jim Highsmith | Jeff Sutherland
26
+ Dave Thomas |
@@ -0,0 +1,13 @@
1
+ # rubocop:disable Naming/MethodName
2
+ # :reek:UncommunicativeMethodName
3
+ module Willpower
4
+ class CLI < Thor
5
+ desc Rainbow("DoD").cornflower, Rainbow("Shows you rules of display done tasks").darkgoldenrod
6
+ def DoD
7
+ dod = []
8
+ dod << File.read("#{GEM_PATH}/willpower/assets/definition_of_done.txt")
9
+ say Terminal::Table.new title: "Definition of Done", rows: [dod], style: TERMINAL_STYLE
10
+ end
11
+ end
12
+ end
13
+ # rubocop:enable Naming/MethodName
@@ -0,0 +1,13 @@
1
+ # rubocop:disable Naming/MethodName
2
+ # :reek:UncommunicativeMethodName
3
+ module Willpower
4
+ class CLI < Thor
5
+ desc Rainbow("DoR").cornflower, Rainbow("Shows you rules of writing items").darkgoldenrod
6
+ def DoR
7
+ dor = []
8
+ dor << File.read("#{GEM_PATH}/willpower/assets/definition_of_ready.txt")
9
+ say Terminal::Table.new title: "Definition of Ready", rows: [dor], style: TERMINAL_STYLE
10
+ end
11
+ end
12
+ end
13
+ # rubocop:enable Naming/MethodName
@@ -0,0 +1,89 @@
1
+ module Willpower
2
+ class Events < Thor
3
+ desc "create", "Add new event"
4
+ def create
5
+ error_checking_events
6
+ cli = HighLine.new
7
+ event_description = cli.ask("description for event: ", String)
8
+ RestClient.post"#{CONFIG['current_remote']}/api/v1/events/",
9
+ event_type: type_cli, date: date_cli, start_time: start_time_cli,
10
+ end_time: end_time_cli, desc: event_description,
11
+ current_user: CONFIG["current_user"], project_id: CONFIG["current_project_id"]
12
+ say "Successfully added new event!"
13
+ end
14
+
15
+ desc "list", "Show all events"
16
+ def list
17
+ error_checking_events
18
+ response = RestClient.get "#{CONFIG['current_remote']}/api/v1/events/"
19
+ say "<<Project events>>"
20
+ JSON.parse(response).each do |event|
21
+ if event["project_id"] == CONFIG["current_project_id"]
22
+ info = parse_info(event)
23
+ say "#{(event['event_type']).upcase} starts at #{parse_date(event)} #{info[:start]} and ends at #{info[:end]}"
24
+ end
25
+ end
26
+ end
27
+
28
+ desc "show <date (yyyy-mm-dd)>", "Show event"
29
+ # :reek:ControlParameter
30
+ def show(date)
31
+ error_checking_events
32
+ response = RestClient.get "#{CONFIG['current_remote']}/api/v1/events/"
33
+ JSON.parse(response).each { |event| puts_info(event) if event["date"] == date }
34
+ end
35
+
36
+ private
37
+
38
+ def error_checking_events
39
+ abort "You haven't done init yet!" unless CONFIG["current_remote"]
40
+ abort "Please, log in!" unless CONFIG["current_user"]
41
+ abort "Please, choose a project to work with!" unless CONFIG["current_project"]
42
+ end
43
+
44
+ def puts_info(event)
45
+ say "Type of event: #{event['event_type']}\nDescription: #{event['description']}"
46
+ say "Start at #{norm_time(event['start_time'])}\nEnd at #{norm_time(event['end_time'])}"
47
+ puts ""
48
+ end
49
+
50
+ def parse_info(event)
51
+ { start: norm_time(event["start_time"]),
52
+ end: norm_time(event["end_time"]) }
53
+ end
54
+
55
+ def parse_date(event)
56
+ Date.parse(event["date"]).strftime("%B %d")
57
+ end
58
+
59
+ def norm_time(param)
60
+ Time.parse(param).strftime("%I:%M")
61
+ end
62
+
63
+ def type_cli
64
+ cli = HighLine.new
65
+ puts "0 - scrum\n1 - retro\n2 - planning\n3 - review"
66
+ cli.ask("Choose type of event (select number): ", Integer)
67
+ end
68
+
69
+ def date_cli
70
+ cli = HighLine.new
71
+ cli.ask("Select data for event (yyyy.mm.dd): ", String)
72
+ end
73
+
74
+ def start_time_cli
75
+ cli = HighLine.new
76
+ cli.ask("Select start time for event (hh:mm): ", String)
77
+ end
78
+
79
+ def end_time_cli
80
+ cli = HighLine.new
81
+ cli.ask("Select end time for event (hh:mm): ", String)
82
+ end
83
+ end
84
+
85
+ class CLI < Thor
86
+ desc Rainbow("events SUBCOMMAND ...ARGS").cornflower, Rainbow("Command for work with events").darkgoldenrod
87
+ subcommand "events", Events
88
+ end
89
+ end
@@ -0,0 +1,8 @@
1
+ module Willpower
2
+ class CLI < Thor
3
+ desc Rainbow("hello").cornflower, Rainbow("Print hello world").darkgoldenrod
4
+ def hello
5
+ say "Hello world!"
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,27 @@
1
+ # rubocop: disable all
2
+ # :reek:disable
3
+ module Willpower
4
+ class CLI < Thor
5
+ class << self
6
+ def help(shell, subcommand = false)
7
+ list = printable_commands(true, subcommand)
8
+ Thor::Util.thor_classes_in(self).each do |klass|
9
+ list += klass.printable_commands(false)
10
+ end
11
+ list.sort! { |a, b| a[0] <=> b[0] }
12
+ list.reject! { |l| l[0].split[1] == 'help' }
13
+
14
+ if defined?(@package_name) && @package_name
15
+ shell.say "#{@package_name} commands:"
16
+ else
17
+ shell.say Rainbow('Commands:').whitesmoke
18
+ end
19
+
20
+ shell.print_table(list, indent: 2, truncate: true)
21
+ shell.say
22
+ class_options_help(shell)
23
+ shell.say Rainbow('All commands can be run with -h (or --help) for more information.').whitesmoke
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,25 @@
1
+ # :reek:InstanceVariableAssumption
2
+ module Willpower
3
+ class CLI < Thor
4
+ include Thor::Actions
5
+ desc Rainbow("init REMOTE_URL").cornflower, Rainbow("Add default remote").darkgoldenrod
6
+
7
+ def init(remote)
8
+ error_checking_init
9
+ write_remote_to_config(remote)
10
+ say "Successfully added new remote!"
11
+ end
12
+
13
+ private
14
+
15
+ def error_checking_init
16
+ abort "You've already did init! Try to add more remotes" if CONFIG["current_remote"]
17
+ end
18
+
19
+ def write_remote_to_config(remote)
20
+ CONFIG["current_remote"] = remote
21
+ CONFIG["remotes"] = [remote]
22
+ File.write("#{GEM_PATH}.config.json", JSON.generate(CONFIG))
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,52 @@
1
+ # :reek:InstanceVariableAssumption:TooManyStatements
2
+
3
+ module Willpower
4
+ class CLI < Thor
5
+ desc Rainbow("login").cornflower, Rainbow("Sign in github.").darkgoldenrod
6
+ def login
7
+ error_checking_login
8
+ open_link
9
+ @secret_node = call_cli
10
+ @response = RestClient.get "#{CONFIG['current_remote']}/api/v1/users/#{@secret_node}"
11
+ if JSON.parse(@response)["data"]["attributes"]
12
+ parse_login
13
+ else
14
+ say "Something went wrong"
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def write_to_config(login)
21
+ CONFIG["current_user"] = login
22
+ CONFIG["user_node"] = @secret_node
23
+ File.write("#{GEM_PATH}.config.json", JSON.generate(CONFIG))
24
+ end
25
+
26
+ def parse_login
27
+ login = JSON.parse(@response)["data"]["attributes"]["github_login"]
28
+ write_to_config(login)
29
+ say "Hello, #{login}!"
30
+ end
31
+
32
+ def call_cli
33
+ cli = HighLine.new
34
+ cli.ask("Enter your secret code: ", String)
35
+ end
36
+
37
+ def open_link
38
+ link = "#{GITHUB_URL}/oauth/authorize?client_id=#{CLIENT_ID}"
39
+ if RbConfig::CONFIG["host_os"].match?(/mswin|mingw|cygwin/)
40
+ system "start #{link}"
41
+ elsif RbConfig::CONFIG["host_os"].match?(/darwin/)
42
+ system "open #{link}"
43
+ elsif RbConfig::CONFIG["host_os"].match?(/linux|bsd/)
44
+ system "xdg-open #{link}"
45
+ end
46
+ end
47
+
48
+ def error_checking_login
49
+ abort "You haven't done init yet!" unless CONFIG["current_remote"]
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,10 @@
1
+ module Willpower
2
+ class CLI < Thor
3
+ desc Rainbow("manifesto").cornflower, Rainbow("Shows manifesto").darkgoldenrod
4
+ def manifesto
5
+ manifest = []
6
+ manifest << File.read("#{GEM_PATH}/willpower/assets/manifesto.txt")
7
+ say Terminal::Table.new title: "Manifesto", rows: [manifest], style: TERMINAL_STYLE
8
+ end
9
+ end
10
+ end