cli-imdb 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/imdb +44 -0
  3. data/lib/ruby-cli.rb +44 -0
  4. metadata +86 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5e66a70024c2d0b0b2993e47a7dc65ff6235d26a
4
+ data.tar.gz: 1e5141c66cbebfd690d8c42d30290af1ca7dccf7
5
+ SHA512:
6
+ metadata.gz: 859ac028b787bd8ad3e1a082dd4ff5ebefe3f3e2c41b176d32933ad6ebd906c0555a4e88868d760837041f60cea678100852a5ba2c3a07e1bd0cc0d28631a082
7
+ data.tar.gz: fc784329da72d1a0369444591641464124308d62a4c16d37e4f58470bf12a6aa9dbc3228215fa57f7717d803936beb1a263d48ca287fa0223567528e4652188d
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'bundler/setup'
5
+ require 'commander/import'
6
+ require 'net/http'
7
+ require 'json'
8
+ require 'terminal-table/import'
9
+ require 'pry'
10
+
11
+ program :name, "CLI IMDB"
12
+ program :version, '1.0.0'
13
+ program :description, 'A simple cli that get details IMDB'
14
+
15
+ command :run do |c|
16
+ $title = ask("Title your film:")
17
+ url = "http://www.omdbapi.com/?t=#{$title}&y=&plot=short&r=json"
18
+ uri = URI(url)
19
+ response = Net::HTTP.get(uri)
20
+ output = JSON.parse(response)
21
+ rows = []
22
+ output.each_with_index do |k, index|
23
+ rows << [output.keys[index],output.values[index]]
24
+ end
25
+
26
+ unless response.nil?
27
+ say_ok "This Result for #{$title }"
28
+ say table(nil, *rows)
29
+ else
30
+ say_error "are you fuc^@ng id*&t!!"
31
+ end
32
+ end
33
+
34
+ program :help, 'Author', 'zainalmustofa <zainalmustof@gmail.com>'
35
+
36
+ command :con do |c|
37
+ c.option '--interval SECONDS', Integer, 'Interval in seconds'
38
+ c.option '--timeout SECONDS', Integer, 'Timeout in seconds'
39
+ c.action do |args, options|
40
+ options.default \
41
+ :interval => 2,
42
+ :timeout => 60
43
+ end
44
+ end
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'bundler/setup'
5
+ require 'commander/import'
6
+ require 'net/http'
7
+ require 'json'
8
+ require 'terminal-table/import'
9
+ require 'pry'
10
+
11
+ program :name, "CLI IMDB"
12
+ program :version, '1.0.0'
13
+ program :description, 'A simple cli that get details IMDB'
14
+
15
+ command :run do |c|
16
+ $title = ask("Title your film:")
17
+ url = "http://www.omdbapi.com/?t=#{$title}&y=&plot=short&r=json"
18
+ uri = URI(url)
19
+ response = Net::HTTP.get(uri)
20
+ output = JSON.parse(response)
21
+ rows = []
22
+ output.each_with_index do |k, index|
23
+ rows << [output.keys[index],output.values[index]]
24
+ end
25
+
26
+ unless response.nil?
27
+ say_ok "This Result for #{$title }"
28
+ say table(nil, *rows)
29
+ else
30
+ say_error "are you fuc^@ng id*&t!!"
31
+ end
32
+ end
33
+
34
+ program :help, 'Author', 'zainalmustofa <zainalmustof@gmail.com>'
35
+
36
+ command :con do |c|
37
+ c.option '--interval SECONDS', Integer, 'Interval in seconds'
38
+ c.option '--timeout SECONDS', Integer, 'Timeout in seconds'
39
+ c.action do |args, options|
40
+ options.default \
41
+ :interval => 2,
42
+ :timeout => 60
43
+ end
44
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cli-imdb
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - zainal mustofa
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-07-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: commander
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.4'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 4.4.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '4.4'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 4.4.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: terminal-table
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.6'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.6.0
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.6'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.6.0
53
+ description: Our very very simple CLI get IMDB JSON on console
54
+ email: zainalmustof@gmail.com
55
+ executables:
56
+ - imdb
57
+ extensions: []
58
+ extra_rdoc_files: []
59
+ files:
60
+ - bin/imdb
61
+ - lib/ruby-cli.rb
62
+ homepage: http://rubygems.org/gems/cli-imdb
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.4.8
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: Our simple CLI
86
+ test_files: []