yao-yrb 1.0.0 → 2.0.0

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: 36e495da2eb2d6c2c882c9d0065a1f5bcab42f5cc35d48dee76b6951ad994f85
4
- data.tar.gz: 4e3809381515358e448c5d929d98559d7332f90abe348a83c8a0a09bed4432c4
3
+ metadata.gz: 12bae1830b59ecc8a229ba917c8d9913333e16e88800f15a146d1578a4816288
4
+ data.tar.gz: 702c35dec8806feefdd2ca147364ad6d56e5cc178d4b9cf90b01d69ebdb45316
5
5
  SHA512:
6
- metadata.gz: ab3e8e03415bce0f980846e2fd153f1b0e1f16614ba0772fef5ef0e4cd685a074975894e725afe1242d5e90de35ed27f8079367aa664a3c303f5deb1fc35145e
7
- data.tar.gz: 508e281663f90064ae228db4783566b6f419a3a03bc94778d08e3de6f01bb360dd7b6a56ef435d831d177bc0f244145bd52adfe984e1980c2caeba4ec38f3be4
6
+ metadata.gz: 20214d09df4e381004ba367a7d8463394dd29c0950ba4ed8529c8883d4093828e8b2126c004c4003d97ca0bf7d287c5e7e7194e75b1d03e687731be055fad1c1
7
+ data.tar.gz: 97f81699ac8dd3f60a7f81e9266b94b98edcbcc323471b49f887c71cdf35fc40917802fae6f5df462da764aebab09c7e44fb6ae115e6f977f59a842bda4569f4
data/.gitignore CHANGED
@@ -6,3 +6,4 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /Gemfile.lock
data/exe/yrb CHANGED
@@ -3,4 +3,4 @@
3
3
  require 'rubygems'
4
4
  require 'yao/yrb'
5
5
 
6
- Yao::Yrb.run
6
+ Yao::Yrb::Cli.run
@@ -0,0 +1,59 @@
1
+ require 'irb'
2
+ require 'irb/completion'
3
+ require 'irb/ext/save-history'
4
+ require 'clamp'
5
+ require 'yao'
6
+
7
+ # [HACK] allow optional and multivalued parameters
8
+ original_verbosity = $VERBOSE
9
+ $VERBOSE = nil
10
+ Clamp::Parameter::Definition::ELLIPSIS_SUFFIX = / \.\.\.\]?$/
11
+ $VERBOSE = original_verbosity
12
+
13
+ module Yao::Yrb
14
+ class Cli < Clamp::Command
15
+ option '--version', :flag, 'Show version' do
16
+ puts Yao::Yrb::VERSION
17
+ exit(0)
18
+ end
19
+
20
+ parameter '[FILE ...]', 'Execute the contents of FILE. If unset, run in Interpreter mode.',
21
+ attribute_name: :script_mode
22
+
23
+ def execute
24
+ Yao.configure do
25
+ auth_url ENV['OS_AUTH_URL']
26
+ tenant_name ENV['OS_TENANT_NAME']
27
+ username ENV['OS_USERNAME']
28
+ password ENV['OS_PASSWORD']
29
+ client_cert ENV['OS_CERT']
30
+ client_key ENV['OS_KEY']
31
+ region_name ENV['OS_REGION_NAME']
32
+ identity_api_version ENV['OS_IDENTITY_API_VERSION']
33
+ user_domain_name ENV['OS_USER_DOMAIN_NAME']
34
+ project_domain_name ENV['OS_PROJECT_DOMAIN_NAME']
35
+ debug ENV['YAO_DEBUG']
36
+ debug_record_response ENV['YAO_DEBUG_RECORD_RESPONSE']
37
+ end
38
+
39
+ if script_mode
40
+ script_file = script_mode.first
41
+ load script_file
42
+ else
43
+ IRB.setup('yao')
44
+ IRB.conf[:PROMPT] = { :YAO => {
45
+ :PROMPT_I => 'yao(%m):%03n:%i> ',
46
+ :PROMPT_N => 'yao(%m):%03n:%i> ',
47
+ :PROMPT_S => 'yao(%m):%03n:%i%l ',
48
+ :PROMPT_C => 'yao(%m):%03n:%i* ',
49
+ :RETURN => "=> %s\n",
50
+ }}
51
+ IRB.conf[:PROMPT_MODE] = :YAO
52
+ IRB.conf[:SAVE_HISTORY] = 1000
53
+ IRB.conf[:HISTORY_FILE] = File.expand_path('~/.yrb_history')
54
+ IRB::Irb.new.run(IRB.conf)
55
+ end
56
+
57
+ end
58
+ end
59
+ end
@@ -1,5 +1,5 @@
1
1
  module Yao
2
2
  module Yrb
3
- VERSION = '1.0.0'
3
+ VERSION = '2.0.0'
4
4
  end
5
5
  end
data/lib/yao/yrb.rb CHANGED
@@ -1,39 +1,6 @@
1
- require 'irb'
2
- require 'irb/completion'
3
- require 'irb/ext/save-history'
4
-
5
- require 'yao'
1
+ require 'yao/yrb/cli'
6
2
 
7
3
  module Yao
8
4
  module Yrb
9
- def self.run
10
- Yao.configure do
11
- auth_url ENV['OS_AUTH_URL']
12
- tenant_name ENV['OS_TENANT_NAME']
13
- username ENV['OS_USERNAME']
14
- password ENV['OS_PASSWORD']
15
- client_cert ENV['OS_CERT']
16
- client_key ENV['OS_KEY']
17
- region_name ENV['OS_REGION_NAME']
18
- identity_api_version ENV['OS_IDENTITY_API_VERSION']
19
- user_domain_name ENV['OS_USER_DOMAIN_NAME']
20
- project_domain_name ENV['OS_PROJECT_DOMAIN_NAME']
21
- debug ENV['YAO_DEBUG']
22
- debug_record_response ENV['YAO_DEBUG_RECORD_RESPONSE']
23
- end
24
-
25
- IRB.setup('yao')
26
- IRB.conf[:PROMPT] = { :YAO => {
27
- :PROMPT_I => 'yao(%m):%03n:%i> ',
28
- :PROMPT_N => 'yao(%m):%03n:%i> ',
29
- :PROMPT_S => 'yao(%m):%03n:%i%l ',
30
- :PROMPT_C => 'yao(%m):%03n:%i* ',
31
- :RETURN => "=> %s\n",
32
- }}
33
- IRB.conf[:PROMPT_MODE] = :YAO
34
- IRB.conf[:SAVE_HISTORY] = 1000
35
- IRB.conf[:HISTORY_FILE] = File.expand_path('~/.yrb_history')
36
- IRB::Irb.new.run(IRB.conf)
37
- end
38
5
  end
39
6
  end
data/yao-yrb.gemspec CHANGED
@@ -35,6 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.require_paths = ["lib"]
36
36
 
37
37
  spec.add_dependency 'yao'
38
+ spec.add_dependency 'clamp', '~> 1.3.1'
38
39
 
39
40
  spec.add_development_dependency "bundler", "~> 2.0"
40
41
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yao-yrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Koya
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-07 00:00:00.000000000 Z
11
+ date: 2019-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yao
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: clamp
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.3.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.3.1
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -78,7 +92,6 @@ files:
78
92
  - ".travis.yml"
79
93
  - CODE_OF_CONDUCT.md
80
94
  - Gemfile
81
- - Gemfile.lock
82
95
  - LICENSE
83
96
  - README.md
84
97
  - Rakefile
@@ -86,6 +99,7 @@ files:
86
99
  - bin/setup
87
100
  - exe/yrb
88
101
  - lib/yao/yrb.rb
102
+ - lib/yao/yrb/cli.rb
89
103
  - lib/yao/yrb/version.rb
90
104
  - yao-yrb.gemspec
91
105
  homepage: https://github.com/buty4649/yao-yrb
data/Gemfile.lock DELETED
@@ -1,33 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- yao-yrb (0.1.0)
5
- yao
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- faraday (0.15.4)
11
- multipart-post (>= 1.2, < 3)
12
- faraday_middleware (0.13.1)
13
- faraday (>= 0.7.4, < 1.0)
14
- json (2.2.0)
15
- minitest (5.11.3)
16
- multipart-post (2.1.1)
17
- rake (10.5.0)
18
- yao (0.6.3)
19
- faraday
20
- faraday_middleware
21
- json
22
-
23
- PLATFORMS
24
- ruby
25
-
26
- DEPENDENCIES
27
- bundler (~> 2.0)
28
- minitest (~> 5.0)
29
- rake (~> 10.0)
30
- yao-yrb!
31
-
32
- BUNDLED WITH
33
- 2.0.2