conoha 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: 3c3bff62b16038c252d30ce45c736c1061c1719d
4
- data.tar.gz: 727b5598db464f6df0087808eeaf68b19fe0914b
3
+ metadata.gz: 31ec5261016745ae27ce4804e4935aa00c00e299
4
+ data.tar.gz: d255da18a9a141611113e9e83753e15682da58a6
5
5
  SHA512:
6
- metadata.gz: 4f5a6784681c0674acea5195059ef3fa4efee3baca61df7919c145f701b19d2e63b4efea9fd702521cbcc0fa09352ffaca7c8cefc98749dc3f0f48f5924a273e
7
- data.tar.gz: 639d502c22ee9d090f66a0dfb68f252752ec06cd3dedcf9c12ec2c3491d089ae2daa8e58739ec43b317273b434e0a9c6043c96401a6635f569f4a4dcee2d10d3
6
+ metadata.gz: fb9540ec00d4c6e0936949c6e228b3876255aff6539a9512d2e0451f7aeb7beaf41f3d8956e5501477441f93408c662f88c081f35edcf1948bd812127b16b5dc
7
+ data.tar.gz: 9a3e44b50304c391b69eae9d99ed3f33d7e997ab818888dab00844c04cb1816514013f5ea8472dd9503c30d0d87c501109c2a7c37cbc812c0d5a2147f2dbd9e0
data/README.md CHANGED
@@ -84,6 +84,18 @@ conoha imagedelete fedcba98-7654-3210-fedc-ba9876543210
84
84
 
85
85
  # Create a VPS from a saved image
86
86
  conoha createfromimage fedcba98-7654-3210-fedc-ba9876543210 g-1gb
87
+
88
+ # SSH
89
+ conoha ssh 01234567-89ab-cdef-0123-456789abcdef root # ssh root@ipaddress
90
+ conoha ssh 01234567-89ab-cdef-0123-456789abcdef yourname # ssh yourname@ipaddress
91
+ conoha ssh 01234567-89ab-cdef-0123-456789abcdef # ssh ipaddress
92
+
93
+ # Mosh
94
+ conoha mosh 01234567-89ab-cdef-0123-456789abcdef root # mosh root@ipaddress
95
+
96
+ # Launch Web browser
97
+ conoha browse 01234567-89ab-cdef-0123-456789abcdef # xdg-open http://ipaddress
98
+ conoha browse 01234567-89ab-cdef-0123-456789abcdef 3000 # xdg-open http://ipaddress:3000
87
99
  ```
88
100
 
89
101
  ## Development
@@ -115,6 +127,9 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/kaosf/
115
127
  - [x] delete image
116
128
  - [ ] public keys
117
129
  - [x] make as a gem
130
+ - [ ] remove `curl` command from authenticate
131
+ - [ ] help message
132
+ - [ ] subcommand help messages
118
133
 
119
134
  ### Code
120
135
 
data/Rakefile CHANGED
@@ -1 +1,10 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << "test"
6
+ t.test_files = Dir["test/**/test_*.rb"]
7
+ t.verbose = true
8
+ end
9
+
10
+ task default: :test
data/exe/conoha CHANGED
@@ -2,6 +2,7 @@
2
2
  # vim: filetype=ruby
3
3
 
4
4
  require 'conoha'
5
+ require 'conoha/util'
5
6
  require 'pp'
6
7
 
7
8
  subcommand = ARGV.shift
@@ -53,20 +54,20 @@ when 'createfromimage'
53
54
  puts Conoha.create_from_image image_ref, ram
54
55
  when 'ssh'
55
56
  exit 1 if ARGV.size < 1 || 2 < ARGV.size
56
- ipaddress = Conoha.ip_address_of(server_id(ARGV.first))[1]
57
+ ipaddress = ipv4(Conoha.ip_address_of(server_id(ARGV.first)))
57
58
  user = ARGV[1].nil? ? '' : "#{ARGV[1]}@"
58
59
  command = "ssh -oStrictHostKeyChecking=no #{user}#{ipaddress}"
59
60
  puts command
60
61
  system command
61
62
  when 'mosh'
62
63
  exit 1 if ARGV.size != 1
63
- ipaddress = Conoha.ip_address_of(server_id(ARGV.first))[1]
64
+ ipaddress = ipv4(Conoha.ip_address_of(server_id(ARGV.first)))
64
65
  command = "mosh #{ipaddress}"
65
66
  puts command
66
67
  system command
67
68
  when 'browse'
68
69
  exit 1 if ARGV.size < 1 || 2 < ARGV.size
69
- ipaddress = Conoha.ip_address_of(server_id(ARGV.first))[1]
70
+ ipaddress = ipv4(Conoha.ip_address_of(server_id(ARGV.first)))
70
71
  port = ARGV[1].nil? ? '' : ":#{ARGV[1]}"
71
72
  command = "xdg-open http://#{ipaddress}#{port}"
72
73
  puts command
@@ -0,0 +1,13 @@
1
+ # @params [Array<String>]
2
+ # The return value of `ip_address_of` method. It is either
3
+ #
4
+ # ["111.111.111.111", "1111:1111:1111:1111:1111:1111:1111:1111"]
5
+ #
6
+ # or
7
+ #
8
+ # ["1111:1111:1111:1111:1111:1111:1111:1111", "111.111.111.111"]
9
+ #
10
+ # @return [String] IPv4 address (e.g. "111.111.111.111")
11
+ def ipv4(ip_address)
12
+ ip_address.select { |e| e =~ /\d+\.\d+\.\d+\.\d+/ }.first
13
+ end
@@ -1,3 +1,3 @@
1
1
  module ConohaVersion
2
- ITSELF = "0.0.3"
2
+ ITSELF = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conoha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-06 00:00:00.000000000 Z
11
+ date: 2015-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -57,6 +57,7 @@ files:
57
57
  - conoha.gemspec
58
58
  - exe/conoha
59
59
  - lib/conoha.rb
60
+ - lib/conoha/util.rb
60
61
  - lib/conoha/version.rb
61
62
  homepage: https://github.com/kaosf/conoha
62
63
  licenses: