agile-cli 0.0.9 → 0.0.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db16095d59fd0c8c52581937bfcdcbc3740ac34f75248950cc26e354a67432d8
4
- data.tar.gz: 90e302c36f8896050bb7a3e71db18122c23eec8ad3e9e1d0c2f60a1201525bde
3
+ metadata.gz: 902ad8a483681222f966f8712d5a09ab1d6b9012431464fe39ccd628b2e8b33d
4
+ data.tar.gz: 3a8991ce2ebd3792e86ed216ff1a1f177ce7cfd6ef6e0d8172079ac3fe692fb0
5
5
  SHA512:
6
- metadata.gz: 322400a4552505e65d9d9d1860a3b9996b1a1f81faa9d3d9c4ba4cd9148576480e771f108e490a780d77c19f27a505ef26c7e0421afebf8f099a9a56645f6d0e
7
- data.tar.gz: 34363b189f6695774a0481ed8fcd4d27554b282b7a7b47a198d8c8a7851f0455f9f9d23a814b57f35380a15326d09da4c3232859eefaf5dd843ff012d15b15b2
6
+ metadata.gz: 78d152568de29ef366a3fcc104d1f22a94f97699ed9e07c3cffb2cfbd2af5109857831ac5b1667dba4cedec3e4aa2cffbc83e51405a42333f165f7965ff949ce
7
+ data.tar.gz: d16724797db0750bd7bc97c2037e2167f4021c515f6270116ebeb5951f259f2f588ce10d39a9218d3c44ef91a121061c11d542e3ccb69ba9b2eaab647bafb440
data/.gitignore CHANGED
@@ -9,4 +9,3 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
- Gemfile.lock
data/Gemfile.lock CHANGED
@@ -3,6 +3,8 @@ PATH
3
3
  specs:
4
4
  agile-cli (0.0.7)
5
5
  rainbow (~> 3.0.0)
6
+ rest-client (~> 2.0.2)
7
+ terminal-table (~> 1.8.0)
6
8
  thor (~> 0.20.3)
7
9
 
8
10
  GEM
@@ -28,9 +30,13 @@ GEM
28
30
  thread_safe (~> 0.3, >= 0.3.1)
29
31
  diff-lcs (1.3)
30
32
  docile (1.3.2)
33
+ domain_name (0.5.20190701)
34
+ unf (>= 0.0.5, < 1.0.0)
31
35
  equalizer (0.0.11)
32
36
  factory_bot (5.0.2)
33
37
  activesupport (>= 4.2.0)
38
+ http-cookie (1.0.3)
39
+ domain_name (~> 0.5)
34
40
  i18n (1.6.0)
35
41
  concurrent-ruby (~> 1.0)
36
42
  ice_nine (0.11.2)
@@ -38,7 +44,11 @@ GEM
38
44
  json (2.2.0)
39
45
  kwalify (0.7.2)
40
46
  method_source (0.9.2)
47
+ mime-types (3.2.2)
48
+ mime-types-data (~> 3.2015)
49
+ mime-types-data (3.2019.0331)
41
50
  minitest (5.11.3)
51
+ netrc (0.11.0)
42
52
  parallel (1.17.0)
43
53
  parser (2.6.3.0)
44
54
  ast (~> 2.4.0)
@@ -54,6 +64,10 @@ GEM
54
64
  parser (>= 2.5.0.0, < 2.7, != 2.5.1.1)
55
65
  psych (~> 3.1.0)
56
66
  rainbow (>= 2.0, < 4.0)
67
+ rest-client (2.0.2)
68
+ http-cookie (>= 1.0.2, < 2.0)
69
+ mime-types (>= 1.16, < 4.0)
70
+ netrc (~> 0.8)
57
71
  rspec (3.8.0)
58
72
  rspec-core (~> 3.8.0)
59
73
  rspec-expectations (~> 3.8.0)
@@ -80,11 +94,16 @@ GEM
80
94
  json (>= 1.8, < 3)
81
95
  simplecov-html (~> 0.10.0)
82
96
  simplecov-html (0.10.2)
97
+ terminal-table (1.8.0)
98
+ unicode-display_width (~> 1.1, >= 1.1.1)
83
99
  thor (0.20.3)
84
100
  thread_safe (0.3.6)
85
101
  timecop (0.9.1)
86
102
  tzinfo (1.2.5)
87
103
  thread_safe (~> 0.1)
104
+ unf (0.1.4)
105
+ unf_ext
106
+ unf_ext (0.0.7.6)
88
107
  unicode-display_width (1.6.0)
89
108
  virtus (1.0.5)
90
109
  axiom-types (~> 0.1)
data/agile-cli.gemspec CHANGED
@@ -14,6 +14,8 @@ Gem::Specification.new do |spec|
14
14
  spec.executables = ["agile"]
15
15
 
16
16
  spec.add_dependency "rainbow", "~> 3.0.0"
17
+ spec.add_dependency "rest-client", "~> 2.0.2"
18
+ spec.add_dependency "terminal-table", "~> 1.8.0"
17
19
  spec.add_dependency "thor", "~> 0.20.3"
18
20
 
19
21
  spec.add_development_dependency "bundler", "~> 2.0.2"
data/lib/.config.json ADDED
@@ -0,0 +1 @@
1
+ {"current_remote":"https://agile-cli.herokuapp.com","current_user":null}
@@ -1,4 +1,7 @@
1
1
  Individuals and interactions over processes and tools
2
+
2
3
  Working software over comprehensive documentation
4
+
3
5
  Customer collaboration over contract negotiation
6
+
4
7
  Responding to change over following a plan
@@ -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 |
@@ -2,7 +2,9 @@ module Agile
2
2
  class CLI < Thor
3
3
  desc Rainbow("dor").cornflower, Rainbow("Shows you rules of writing items").darkgoldenrod
4
4
  def dor
5
- say File.read("#{`gem which agile`.chomp.chomp('agile.rb')}/agile/assets/definition_of_ready.txt")
5
+ dor = []
6
+ dor << File.read("#{GEM_PATH}/agile/assets/definition_of_ready.txt")
7
+ say Terminal::Table.new title: "Definition of Ready", rows: [dor], style: TERMINAL_STYLE
6
8
  end
7
9
  end
8
10
  end
@@ -1,4 +1,4 @@
1
- # rubocop: disable Metrics/AbcSize
1
+ # rubocop: disable all
2
2
  # :reek:disable
3
3
  module Agile
4
4
  class CLI < Thor
@@ -9,20 +9,20 @@ module Agile
9
9
  list += klass.printable_commands(false)
10
10
  end
11
11
  list.sort! { |a, b| a[0] <=> b[0] }
12
- list.reject! { |l| l[0].split[1] == "help" }
12
+ list.reject! { |l| l[0].split[1] == 'help' }
13
13
 
14
14
  if defined?(@package_name) && @package_name
15
15
  shell.say "#{@package_name} commands:"
16
16
  else
17
- shell.say Rainbow("Commands:").whitesmoke
17
+ shell.say Rainbow('Commands:').whitesmoke
18
18
  end
19
19
 
20
20
  shell.print_table(list, indent: 2, truncate: true)
21
21
  shell.say
22
22
  class_options_help(shell)
23
- shell.say Rainbow("All commands can be run with -h (or --help) for more information.").whitesmoke
23
+ shell.say Rainbow('All commands can be run with -h (or --help) for more information.').whitesmoke
24
+ shell.say Rainbow('Homepage https://github.com/rubizza-camp/AgileCli').whitesmoke
24
25
  end
25
26
  end
26
27
  end
27
28
  end
28
- # rubocop: enable Metrics/AbcSize
@@ -0,0 +1,29 @@
1
+ # :reek:InstanceVariableAssumption
2
+ module Agile
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
+ create_config_file
9
+ @config = read_config_content
10
+ @config["current_remote"] = remote
11
+ File.write("#{GEM_PATH}.config.json", JSON.generate(@config))
12
+ say "Successfully added new remote!"
13
+ end
14
+
15
+ 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
+
25
+ def create_config_file
26
+ `touch #{GEM_PATH}.config.json` if `find "#{GEM_PATH}" -name .config.json`.empty?
27
+ end
28
+ end
29
+ end
@@ -1,9 +1,33 @@
1
+ # :reek:InstanceVariableAssumption
1
2
  module Agile
2
3
  class CLI < Thor
3
- include Thor::Actions
4
4
  desc Rainbow("login LOGIN_FROM_GITHUB").cornflower, Rainbow("Sign in github.").darkgoldenrod
5
+
5
6
  def login(username)
6
- run %(`which curl` -u #{username} #{GITHUB_URL} )
7
+ @config = JSON.parse(File.read("#{GEM_PATH}.config.json"))
8
+ if @config
9
+ write_to_config(username)
10
+ authorize
11
+ else
12
+ say "You need to add a remote!"
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ def github_user_login(username)
19
+ @curr_user = JSON.parse(`curl -s -u "#{username}" "#{GITHUB_URL}"`)["login"]
20
+ end
21
+
22
+ def authorize
23
+ RestClient.get "#{@config['current_remote']}/api/v1/users/#{@curr_user}"
24
+ say "Hello, #{@curr_user}"
25
+ # say responce.body
26
+ end
27
+
28
+ def write_to_config(username)
29
+ @config["current_user"] = github_user_login(username)
30
+ File.write("#{GEM_PATH}.config.json", JSON.generate(@config))
7
31
  end
8
32
  end
9
33
  end
@@ -0,0 +1,10 @@
1
+ module Agile
2
+ class CLI < Thor
3
+ desc Rainbow("manifesto").cornflower, Rainbow("Shows manifesto").darkgoldenrod
4
+ def manifesto
5
+ manifest = []
6
+ manifest << File.read("#{GEM_PATH}/agile/assets/manifesto.txt")
7
+ say Terminal::Table.new title: "Manifesto", rows: [manifest], style: TERMINAL_STYLE
8
+ end
9
+ end
10
+ end
@@ -2,7 +2,9 @@ module Agile
2
2
  class CLI < Thor
3
3
  desc Rainbow("principles").cornflower, Rainbow("Shows twelwe agile principles").darkgoldenrod
4
4
  def principles
5
- say File.read("#{`gem which agile`.chomp.chomp('agile.rb')}/agile/assets/agile_principles.txt")
5
+ principl = []
6
+ principl << File.read("#{GEM_PATH}/agile/assets/agile_principles.txt")
7
+ say Terminal::Table.new title: "Agile principles", rows: [principl], style: TERMINAL_STYLE
6
8
  end
7
9
  end
8
10
  end
@@ -0,0 +1,53 @@
1
+ # :reek:Lint/Syntax
2
+ module Agile
3
+ class Projects < Thor
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}"
10
+ else
11
+ say "Try again"
12
+ end
13
+ end
14
+
15
+ desc "list", "Show projects"
16
+ 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"] }
21
+ say Rainbow("<<Your Projects>>").cornflower
22
+ projects_name.map { |name| p name }
23
+ end
24
+
25
+ desc "use <project>", "Select current project"
26
+ 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/"
30
+ else
31
+ say "You need to add a remote!"
32
+ end
33
+ project_search(data, project)
34
+ end
35
+
36
+ private
37
+
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))
42
+ say "Your project: #{project}"
43
+ else
44
+ say "Such a project does not exist. Try again"
45
+ end
46
+ end
47
+ end
48
+
49
+ class CLI < Thor
50
+ desc Rainbow("projects SUBCOMMAND ...ARGS").cornflower, Rainbow("Command for work with projects").darkgoldenrod
51
+ subcommand "projects", Projects
52
+ end
53
+ end
@@ -2,7 +2,9 @@ module Agile
2
2
  class CLI < Thor
3
3
  desc Rainbow("values").cornflower, Rainbow("Shows core agile values").darkgoldenrod
4
4
  def values
5
- say File.read("#{`gem which agile`.chomp.chomp('agile.rb')}/agile/assets/agile_values.txt")
5
+ values = []
6
+ values << File.read("#{GEM_PATH}/agile/assets/agile_values.txt")
7
+ say Terminal::Table.new title: "Values", rows: [values], style: TERMINAL_STYLE
6
8
  end
7
9
  end
8
10
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Agile
4
- VERSION = "0.0.9"
4
+ VERSION = "0.0.10"
5
5
  GITHUB_URL = %(https://api.github.com/user)
6
+ TERMINAL_STYLE = { border_x: "=", border_i: "x", padding_left: 3 }.freeze
6
7
  end
data/lib/agile.rb CHANGED
@@ -1,9 +1,13 @@
1
1
  require "thor"
2
2
  require "rainbow"
3
3
  require "agile/constants"
4
+ require "json"
5
+ require "rest-client"
6
+ require "terminal-table"
4
7
  Dir[File.join(__dir__, "agile/commands", "*.rb")].each { |file| require file }
5
8
 
6
9
  module Agile
10
+ GEM_PATH = `gem which agile`.chomp.chomp("agile.rb")
7
11
  class CLI < Thor
8
12
  end
9
13
  end
@@ -1,15 +1,35 @@
1
1
  RSpec.describe Agile::CLI do
2
2
  describe "#dor" do
3
3
  subject(:cli) { described_class.new }
4
+ dor = <<~DOR
5
+ Definition of Ready
6
+
7
+ All work should have a related Ticket.
8
+ Developer should not start development unless a Ticket is "Ready for development"
9
+ We consider a Ticket "Ready for development" if it meets following requirements:
10
+
11
+ Ticket Requirements must have:
12
+
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.
20
+ DOR
4
21
 
5
22
  before do
6
- allow(cli).to receive(:say).with(File.read("lib/agile/assets/definition_of_ready.txt"))
23
+ allow(cli).to receive(:say).with(Terminal::Table)
7
24
  end
8
25
 
9
- it "helps you to make correct item" do
10
- cli.dor
26
+ it "receive definition of ready" do
27
+ expect(dor).to eq(File.read("#{Agile::GEM_PATH}/agile/assets/definition_of_ready.txt"))
28
+ end
11
29
 
12
- expect(cli).to have_received(:say).with(File.read("lib/agile/assets/definition_of_ready.txt"))
30
+ it "shows you table" do
31
+ cli.dor
32
+ expect(cli).to have_received(:say).with(Terminal::Table)
13
33
  end
14
34
  end
15
35
  end
@@ -1,15 +1,63 @@
1
1
  RSpec.describe Agile::CLI do
2
2
  describe "#principles" do
3
3
  subject(:cli) { described_class.new }
4
+ principles = <<~PRINCIPLES
5
+ Our highest priority is to satisfy the customer
6
+ through early and continuous delivery
7
+ of valuable software.
8
+
9
+ Welcome changing requirements, even late in
10
+ development. Agile processes harness change for
11
+ the customer's competitive advantage.
12
+
13
+ Deliver working software frequently, from a
14
+ couple of weeks to a couple of months, with a
15
+ preference to the shorter timescale.
16
+
17
+ Business people and developers must work
18
+ together daily throughout the project.
19
+
20
+ Build projects around motivated individuals.
21
+
22
+ Give them the environment and support they need,
23
+ and trust them to get the job done.
24
+
25
+ The most efficient and effective method of
26
+ conveying information to and within a development
27
+ team is face-to-face conversation.
28
+
29
+ Working software is the primary measure of progress.
30
+
31
+ Agile processes promote sustainable development.
32
+
33
+ The sponsors, developers, and users should be able
34
+ to maintain a constant pace indefinitely.
35
+
36
+ Continuous attention to technical excellence
37
+ and good design enhances agility.
38
+
39
+ Simplicity--the art of maximizing the amount
40
+ of work not done--is essential.
41
+
42
+ The best architectures, requirements, and designs
43
+ emerge from self-organizing teams.
44
+
45
+ At regular intervals, the team reflects on how
46
+ to become more effective, then tunes and adjusts
47
+ its behavior accordingly.
48
+ PRINCIPLES
4
49
 
5
50
  before do
6
- allow(cli).to receive(:say).with(File.read("lib/agile/assets/agile_principles.txt"))
51
+ allow(cli).to receive(:say).with(Terminal::Table)
7
52
  end
8
53
 
9
- it "returns twelwe principles" do
10
- cli.principles
54
+ it "receive twelwe principles" do
55
+ expect(principles).to eq(File.read("#{Agile::GEM_PATH}/agile/assets/agile_principles.txt"))
56
+ end
11
57
 
12
- expect(cli).to have_received(:say).with(File.read("lib/agile/assets/agile_principles.txt"))
58
+ it "shows you table" do
59
+ cli.principles
60
+ expect(cli).to have_received(:say).with(Terminal::Table)
13
61
  end
14
62
  end
15
63
  end
@@ -1,14 +1,27 @@
1
1
  RSpec.describe Agile::CLI do
2
2
  describe "#values" do
3
3
  subject(:cli) { described_class.new }
4
+ values = <<~VALUES
5
+ Individuals and interactions over processes and tools
6
+
7
+ Working software over comprehensive documentation
8
+
9
+ Customer collaboration over contract negotiation
10
+
11
+ Responding to change over following a plan
12
+ VALUES
4
13
 
5
14
  before do
6
- allow(cli).to receive(:say).with(File.read("lib/agile/assets/agile_values.txt"))
15
+ allow(cli).to receive(:say).with(Terminal::Table)
16
+ end
17
+
18
+ it "receive agile values" do
19
+ expect(values).to eq(File.read("#{Agile::GEM_PATH}/agile/assets/agile_values.txt"))
7
20
  end
8
21
 
9
- it "returns agile values" do
22
+ it "shows you table" do
10
23
  cli.values
11
- expect(cli).to have_received(:say).with(File.read("lib/agile/assets/agile_values.txt"))
24
+ expect(cli).to have_received(:say).with(Terminal::Table)
12
25
  end
13
26
  end
14
27
  end
data/spec/spec_helper.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  require "bundler/setup"
2
- require "agile/constants"
2
+ require "agile"
3
+ require "terminal-table"
3
4
  require "simplecov"
4
5
  require "pry"
5
- SimpleCov.start
6
6
 
7
- require "agile"
7
+ SimpleCov.start
8
8
 
9
9
  RSpec.configure do |config|
10
10
  # Enable flags like --only-failures and --next-failure
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.9
4
+ version: 0.0.10
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-12 00:00:00.000000000 Z
11
+ date: 2019-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rest-client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.0.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.0.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: terminal-table
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.8.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.8.0
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: thor
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -185,15 +213,20 @@ files:
185
213
  - agile-cli.gemspec
186
214
  - bin/agile
187
215
  - bin/setup
216
+ - lib/.config.json
188
217
  - lib/agile.rb
189
218
  - lib/agile/assets/agile_principles.txt
190
219
  - lib/agile/assets/agile_values.txt
191
220
  - lib/agile/assets/definition_of_ready.txt
221
+ - lib/agile/assets/manifesto.txt
192
222
  - lib/agile/commands/dor.rb
193
223
  - lib/agile/commands/hello.rb
194
224
  - lib/agile/commands/help.rb
225
+ - lib/agile/commands/init.rb
195
226
  - lib/agile/commands/login.rb
227
+ - lib/agile/commands/manifesto.rb
196
228
  - lib/agile/commands/principles.rb
229
+ - lib/agile/commands/projects.rb
197
230
  - lib/agile/commands/values.rb
198
231
  - lib/agile/commands/version.rb
199
232
  - lib/agile/constants.rb