agile-cli 0.0.10 → 0.0.11

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
  SHA256:
3
- metadata.gz: 902ad8a483681222f966f8712d5a09ab1d6b9012431464fe39ccd628b2e8b33d
4
- data.tar.gz: 3a8991ce2ebd3792e86ed216ff1a1f177ce7cfd6ef6e0d8172079ac3fe692fb0
3
+ metadata.gz: 8343b20f864b9087c903e2bdf4a0c7dbc879dbd0675e98918c235d4fa88b18ef
4
+ data.tar.gz: 07bdd7283c5ec3f56f6b6556da4aa27df85a88cf08dd69e907ab0103ce32eb80
5
5
  SHA512:
6
- metadata.gz: 78d152568de29ef366a3fcc104d1f22a94f97699ed9e07c3cffb2cfbd2af5109857831ac5b1667dba4cedec3e4aa2cffbc83e51405a42333f165f7965ff949ce
7
- data.tar.gz: d16724797db0750bd7bc97c2037e2167f4021c515f6270116ebeb5951f259f2f588ce10d39a9218d3c44ef91a121061c11d542e3ccb69ba9b2eaab647bafb440
6
+ metadata.gz: 5714b3d98508a8a58c8c255d3e0e7ece917eb2f1b793c458dd864b92ee1ba01c46d9181d3a2b94888ab2c083beeaf7dd16af81d16370af0b21f7e7cee4009abb
7
+ data.tar.gz: 5d94825a5ce075551dbdd5691813ffd15549cc17a45d0440a1216e483ca4506805f8147ca2f27397cbb32df8dd7662261dc844208614bb97032adbc1c3b26155
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- agile-cli (0.0.7)
4
+ agile-cli (0.0.10)
5
5
  rainbow (~> 3.0.0)
6
6
  rest-client (~> 2.0.2)
7
7
  terminal-table (~> 1.8.0)
data/lib/.config.json CHANGED
@@ -1 +1 @@
1
- {"current_remote":"https://agile-cli.herokuapp.com","current_user":null}
1
+ {"current_remote":"localhost:3000","current_user":"nieisnuje","current_project":"AgileCli"}
data/lib/agile.rb CHANGED
@@ -8,6 +8,8 @@ Dir[File.join(__dir__, "agile/commands", "*.rb")].each { |file| require file }
8
8
 
9
9
  module Agile
10
10
  GEM_PATH = `gem which agile`.chomp.chomp("agile.rb")
11
+ CONFIG = JSON.parse(File.read("#{GEM_PATH}.config.json"))
12
+
11
13
  class CLI < Thor
12
14
  end
13
15
  end
@@ -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
@@ -1,15 +1,13 @@
1
- Definition of Ready
2
-
3
1
  All work should have a related Ticket.
4
2
  Developer should not start development unless a Ticket is "Ready for development"
5
3
  We consider a Ticket "Ready for development" if it meets following requirements:
6
4
 
7
5
  Ticket Requirements must have:
8
6
 
9
- Ticket should have a short title;
10
- Ticket should have a clear description;
11
- Description should including "How to demo" section;
12
- Description may have "Acceptance Criteria" section which includes all important(specific) requirements;
13
- All blocker should be resolved;
14
- Ticket can reasonably be "Done" within the Sprint time-box;
15
- Ticket should have estimation.
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,13 @@
1
+ # rubocop:disable Naming/MethodName
2
+ # :reek:UncommunicativeMethodName
3
+ module Agile
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}/agile/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
@@ -1,10 +1,13 @@
1
+ # rubocop:disable Naming/MethodName
2
+ # :reek:UncommunicativeMethodName
1
3
  module Agile
2
4
  class CLI < Thor
3
- desc Rainbow("dor").cornflower, Rainbow("Shows you rules of writing items").darkgoldenrod
4
- def dor
5
+ desc Rainbow("DoR").cornflower, Rainbow("Shows you rules of writing items").darkgoldenrod
6
+ def DoR
5
7
  dor = []
6
8
  dor << File.read("#{GEM_PATH}/agile/assets/definition_of_ready.txt")
7
9
  say Terminal::Table.new title: "Definition of Ready", rows: [dor], style: TERMINAL_STYLE
8
10
  end
9
11
  end
10
12
  end
13
+ # rubocop:enable Naming/MethodName
@@ -6,22 +6,13 @@ module Agile
6
6
 
7
7
  def init(remote)
8
8
  create_config_file
9
- @config = read_config_content
10
- @config["current_remote"] = remote
11
- File.write("#{GEM_PATH}.config.json", JSON.generate(@config))
9
+ CONFIG["current_remote"] = remote
10
+ File.write("#{GEM_PATH}.config.json", JSON.generate(CONFIG))
12
11
  say "Successfully added new remote!"
13
12
  end
14
13
 
15
14
  private
16
-
17
- def read_config_content
18
- if File.read("#{GEM_PATH}.config.json").empty?
19
- {}
20
- else
21
- JSON.parse(File.read("#{GEM_PATH}.config.json"))
22
- end
23
- end
24
-
15
+
25
16
  def create_config_file
26
17
  `touch #{GEM_PATH}.config.json` if `find "#{GEM_PATH}" -name .config.json`.empty?
27
18
  end
@@ -2,10 +2,8 @@
2
2
  module Agile
3
3
  class CLI < Thor
4
4
  desc Rainbow("login LOGIN_FROM_GITHUB").cornflower, Rainbow("Sign in github.").darkgoldenrod
5
-
6
5
  def login(username)
7
- @config = JSON.parse(File.read("#{GEM_PATH}.config.json"))
8
- if @config
6
+ if CONFIG
9
7
  write_to_config(username)
10
8
  authorize
11
9
  else
@@ -20,14 +18,13 @@ module Agile
20
18
  end
21
19
 
22
20
  def authorize
23
- RestClient.get "#{@config['current_remote']}/api/v1/users/#{@curr_user}"
24
- say "Hello, #{@curr_user}"
25
- # say responce.body
21
+ RestClient.get "#{CONFIG['current_remote']}/api/v1/users/#{@curr_user}"
22
+ say "Hello, #{@curr_user}" if @curr_user
26
23
  end
27
24
 
28
25
  def write_to_config(username)
29
- @config["current_user"] = github_user_login(username)
30
- File.write("#{GEM_PATH}.config.json", JSON.generate(@config))
26
+ CONFIG["current_user"] = github_user_login(username)
27
+ File.write("#{GEM_PATH}.config.json", JSON.generate(CONFIG))
31
28
  end
32
29
  end
33
- end
30
+ end
@@ -2,11 +2,10 @@
2
2
  module Agile
3
3
  class Projects < Thor
4
4
  desc "create <project>", "Create new project"
5
- def create(project)
6
- @config = JSON.parse(File.read("#{GEM_PATH}.config.json"))
7
- responce = RestClient.get "#{@config['current_remote']}/api/v1/projects/#{project}"
8
- if responce.body
9
- say "Successelly create project #{project}"
5
+ def create(project_name)
6
+ response = RestClient.post "#{CONFIG['current_remote']}/api/v1/projects/", { name: project_name }
7
+ if response.body
8
+ say "Successelly create project #{project_name}"
10
9
  else
11
10
  say "Try again"
12
11
  end
@@ -14,31 +13,53 @@ module Agile
14
13
 
15
14
  desc "list", "Show projects"
16
15
  def list
17
- @config = JSON.parse(File.read("#{GEM_PATH}.config.json"))
18
- responce = RestClient.get "#{@config['current_remote']}/api/v1/projects/"
19
- data = JSON.parse(responce)
20
- projects_name = data["projects"].map { |name| name["name"] }
16
+ response = RestClient.get "#{CONFIG['current_remote']}/api/v1/projects/"
17
+ data = JSON.parse(response)
18
+ array = data.map { |hash| hash.values }
19
+ info = array.map { |hash| hash[1]}
21
20
  say Rainbow("<<Your Projects>>").cornflower
22
- projects_name.map { |name| p name }
21
+ info.map { |name| p name }
23
22
  end
24
23
 
25
24
  desc "use <project>", "Select current project"
26
25
  def use(project)
27
- @config = JSON.parse(File.read("#{GEM_PATH}.config.json"))
28
- if @config
29
- data = RestClient.get "#{@config['current_remote']}/api/v1/projects/"
26
+ if CONFIG
27
+ response = RestClient.get "#{CONFIG['current_remote']}/api/v1/projects/"
30
28
  else
31
29
  say "You need to add a remote!"
32
30
  end
33
- project_search(data, project)
31
+ project_search(response, project)
34
32
  end
35
33
 
34
+ desc "delete <project>", "Delete project"
35
+ def delete(project)
36
+ response = RestClient.delete "#{CONFIG['current_remote']}/api/v1/projects/#{project}", { name: project}
37
+ if response.body
38
+ say "Successelly delete project #{project}"
39
+ else
40
+ say "Try again"
41
+ end
42
+ end
43
+
44
+ desc "update <project_name> <new_project_name>", "Update project name"
45
+ def update(project, new_project)
46
+ response = RestClient.put "#{CONFIG['current_remote']}/api/v1/projects/#{project}", name: project, new_name: new_project
47
+ if response.body
48
+ say "Successelly update project #{project}"
49
+ else
50
+ say "Try again"
51
+ end
52
+ end
53
+
36
54
  private
37
55
 
38
- def project_search(data, project)
39
- if JSON.parse(data)["projects"].find { |proj| proj["name"] == project }
40
- @config["current_project"] = project
41
- File.write("#{GEM_PATH}.config.json", JSON.generate(@config))
56
+ def project_search(response, project)
57
+ array = JSON.parse(response)
58
+ info = array.map { |hash| hash.values }
59
+ names = info.map{ |hash| hash[1] }
60
+ if names.include?(project)
61
+ CONFIG["current_project"] = project
62
+ File.write("#{GEM_PATH}.config.json", JSON.generate(CONFIG))
42
63
  say "Your project: #{project}"
43
64
  else
44
65
  say "Such a project does not exist. Try again"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Agile
4
- VERSION = "0.0.10"
4
+ VERSION = "0.0.11"
5
5
  GITHUB_URL = %(https://api.github.com/user)
6
6
  TERMINAL_STYLE = { border_x: "=", border_i: "x", padding_left: 3 }.freeze
7
7
  end
@@ -0,0 +1,26 @@
1
+ RSpec.describe Agile::CLI do
2
+ describe "#DoD" do
3
+ subject(:cli) { described_class.new }
4
+ dod = <<~DOD
5
+ We consider a ticket ‘Done’ when:
6
+
7
+ 1. The ticket is merged into master and deployed
8
+ 2. All "Acceptance Criteria" are met
9
+ 3. It is presented to Product Owner
10
+ 4. Product Owner agrees that ticket is completed
11
+ DOD
12
+
13
+ before do
14
+ allow(cli).to receive(:say).with(Terminal::Table)
15
+ end
16
+
17
+ it "receive definition of done" do
18
+ expect(dod).to eq(File.read("#{Agile::GEM_PATH}/agile/assets/definition_of_done.txt"))
19
+ end
20
+
21
+ it "shows you table" do
22
+ cli.DoD
23
+ expect(cli).to have_received(:say).with(Terminal::Table)
24
+ end
25
+ end
26
+ end
@@ -1,22 +1,20 @@
1
1
  RSpec.describe Agile::CLI do
2
- describe "#dor" do
2
+ describe "#DoR" do
3
3
  subject(:cli) { described_class.new }
4
4
  dor = <<~DOR
5
- Definition of Ready
6
-
7
5
  All work should have a related Ticket.
8
6
  Developer should not start development unless a Ticket is "Ready for development"
9
7
  We consider a Ticket "Ready for development" if it meets following requirements:
10
8
 
11
9
  Ticket Requirements must have:
12
10
 
13
- Ticket should have a short title;
14
- Ticket should have a clear description;
15
- Description should including "How to demo" section;
16
- Description may have "Acceptance Criteria" section which includes all important(specific) requirements;
17
- All blocker should be resolved;
18
- Ticket can reasonably be "Done" within the Sprint time-box;
19
- Ticket should have estimation.
11
+ 1. Ticket should have a short title
12
+ 2. Ticket should have a clear description
13
+ 3. Description should including "How to demo" section
14
+ 4. Description may have "Acceptance Criteria" section which includes all important(specific) requirements
15
+ 5. All Blocker should be resolved
16
+ 6. Ticket can reasonably be "Done" within the Sprint time-box
17
+ 7. Ticket should have Estimation
20
18
  DOR
21
19
 
22
20
  before do
@@ -28,7 +26,7 @@ RSpec.describe Agile::CLI do
28
26
  end
29
27
 
30
28
  it "shows you table" do
31
- cli.dor
29
+ cli.DoR
32
30
  expect(cli).to have_received(:say).with(Terminal::Table)
33
31
  end
34
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agile-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - rubizza-camp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-16 00:00:00.000000000 Z
11
+ date: 2019-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -217,8 +217,10 @@ files:
217
217
  - lib/agile.rb
218
218
  - lib/agile/assets/agile_principles.txt
219
219
  - lib/agile/assets/agile_values.txt
220
+ - lib/agile/assets/definition_of_done.txt
220
221
  - lib/agile/assets/definition_of_ready.txt
221
222
  - lib/agile/assets/manifesto.txt
223
+ - lib/agile/commands/dod.rb
222
224
  - lib/agile/commands/dor.rb
223
225
  - lib/agile/commands/hello.rb
224
226
  - lib/agile/commands/help.rb
@@ -230,6 +232,7 @@ files:
230
232
  - lib/agile/commands/values.rb
231
233
  - lib/agile/commands/version.rb
232
234
  - lib/agile/constants.rb
235
+ - spec/agile/dod_spec.rb
233
236
  - spec/agile/dor_spec.rb
234
237
  - spec/agile/hello_spec.rb
235
238
  - spec/agile/principles_spec.rb