yao-yrb 1.0.0 → 2.1.2

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: 4a720b4d6853ea8cfd98afb7b383996a1a5db5401074d490d78fb1373da6271c
4
+ data.tar.gz: 5b0523ea50745e5a0926f2564b9888d01b1fedc9090ec99701f4c006af82328e
5
5
  SHA512:
6
- metadata.gz: ab3e8e03415bce0f980846e2fd153f1b0e1f16614ba0772fef5ef0e4cd685a074975894e725afe1242d5e90de35ed27f8079367aa664a3c303f5deb1fc35145e
7
- data.tar.gz: 508e281663f90064ae228db4783566b6f419a3a03bc94778d08e3de6f01bb360dd7b6a56ef435d831d177bc0f244145bd52adfe984e1980c2caeba4ec38f3be4
6
+ metadata.gz: 8344318d7101379339ac5aaa468c5758b2b1840ba14605eb8c835a17ac844ad0b0beb1d33a3121444eae47f627ab4f52b4c86d91ca7cb21037f3b5e9ba67e671
7
+ data.tar.gz: 67673022cea8038fa0d3381d643816cf5bcd72522c48b2e0025329e348456397fdd98d4c212b17314409ea2f71433cec0c4bfa9b6454276cbf68c9afa4b55eb0
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
@@ -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
@@ -0,0 +1,49 @@
1
+ require 'clamp'
2
+ require 'yao'
3
+ require 'pry'
4
+
5
+ # [HACK] allow optional and multivalued parameters
6
+ original_verbosity = $VERBOSE
7
+ $VERBOSE = nil
8
+ Clamp::Parameter::Definition::ELLIPSIS_SUFFIX = / \.\.\.\]?$/
9
+ $VERBOSE = original_verbosity
10
+
11
+ module Yao::Yrb
12
+ class Cli < Clamp::Command
13
+ option '--version', :flag, 'Show version' do
14
+ puts Yao::Yrb::VERSION
15
+ exit(0)
16
+ end
17
+
18
+ parameter '[FILE ...]', 'Execute the contents of FILE. If unset, run in Interpreter mode.',
19
+ attribute_name: :script_mode
20
+
21
+ def execute
22
+ Yao.configure do
23
+ auth_url ENV['OS_AUTH_URL']
24
+ tenant_name ENV['OS_TENANT_NAME']
25
+ username ENV['OS_USERNAME']
26
+ password ENV['OS_PASSWORD']
27
+ ca_cert ENV['OS_CACERT']
28
+ client_cert ENV['OS_CERT']
29
+ client_key ENV['OS_KEY']
30
+ region_name ENV['OS_REGION_NAME']
31
+ identity_api_version ENV['OS_IDENTITY_API_VERSION']
32
+ user_domain_name ENV['OS_USER_DOMAIN_NAME']
33
+ project_domain_name ENV['OS_PROJECT_DOMAIN_NAME']
34
+ debug ENV['YAO_DEBUG']
35
+ debug_record_response ENV['YAO_DEBUG_RECORD_RESPONSE']
36
+ end
37
+
38
+ if script_mode.size > 0
39
+ script_file = script_mode.first
40
+ load script_file
41
+ else
42
+ opts = Pry::CLI.parse_options([])
43
+ Pry.config.prompt_name = "yao"
44
+ Pry::CLI.start(opts)
45
+ end
46
+
47
+ end
48
+ end
49
+ end
@@ -1,5 +1,5 @@
1
1
  module Yao
2
2
  module Yrb
3
- VERSION = '1.0.0'
3
+ VERSION = '2.1.2'
4
4
  end
5
5
  end
@@ -35,6 +35,8 @@ 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'
39
+ spec.add_dependency 'pry', '~> 0.13.1'
38
40
 
39
41
  spec.add_development_dependency "bundler", "~> 2.0"
40
42
  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.1.2
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: 2020-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yao
@@ -24,6 +24,34 @@ 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
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.13.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.13.1
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: bundler
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -78,7 +106,6 @@ files:
78
106
  - ".travis.yml"
79
107
  - CODE_OF_CONDUCT.md
80
108
  - Gemfile
81
- - Gemfile.lock
82
109
  - LICENSE
83
110
  - README.md
84
111
  - Rakefile
@@ -86,6 +113,7 @@ files:
86
113
  - bin/setup
87
114
  - exe/yrb
88
115
  - lib/yao/yrb.rb
116
+ - lib/yao/yrb/cli.rb
89
117
  - lib/yao/yrb/version.rb
90
118
  - yao-yrb.gemspec
91
119
  homepage: https://github.com/buty4649/yao-yrb
@@ -109,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
137
  - !ruby/object:Gem::Version
110
138
  version: '0'
111
139
  requirements: []
112
- rubygems_version: 3.0.3
140
+ rubygems_version: 3.1.2
113
141
  signing_key:
114
142
  specification_version: 4
115
143
  summary: irb with yao
@@ -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