capx 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 90d9fadb5c34ec37b26166c249fd9200003df8ffc6d37ad609221ee41b35ae4e
4
+ data.tar.gz: 0616ad5d41083b59ae9986d0953fa440fa4461476953583f62ab46e25d9d1a69
5
+ SHA512:
6
+ metadata.gz: 4db1cc6b230c9a4a8cc7544380982b8ac253f91a73c7b01fb75cc0293794d33618b0cae08c17c8d6dfa64723e5dd977b2f95d6f39adea0b657573a3005feacd1
7
+ data.tar.gz: 4d99d65c10157faf1b275669e29d7d4a39c86e020ff933eddcd43aef39bd833b2254f6ef26e49fd54ea2a0d3a73d505a34c19afdb0ef3d179be49980feb2d45d
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Jan Kmet
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ $LOAD_PATH.unshift(File.dirname(File.realpath(__FILE__)) + '/../lib')
5
+
6
+ require 'capx'
7
+
8
+ def show_help
9
+ puts 'params: <stage> <switch>'
10
+ puts 'example: capx staging ssh'
11
+ end
12
+
13
+ if ARGV[0]
14
+ stage = ARGV[0]
15
+ param = ARGV[1]
16
+
17
+ runner = Capx::Runner.new(stage: stage, param: param)
18
+ runner.run
19
+ else
20
+ show_help
21
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+
3
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
4
+ require 'capx/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'capx'
8
+ spec.version = Capx::VERSION
9
+ spec.platform = Gem::Platform::RUBY
10
+ spec.required_ruby_version = '>= 2.2.0'
11
+ spec.authors = ['Jan Kmet']
12
+ spec.email = ['jan.kmet@gmail.com']
13
+ spec.summary = 'SSH shortcut using capistrano deploy configuration'
14
+ spec.description = <<-EOF
15
+ SSH shortcut using capistrano deploy configuration.
16
+ SSH username and host are parsed from capistrano deploy configuration
17
+ EOF
18
+ spec.homepage = 'https://github.com/jankmet/capx'
19
+
20
+ spec.files = `git ls-files`.split($RS)
21
+ spec.executables = ['capx']
22
+ spec.test_files = spec.files.grep(/^spec\//)
23
+ spec.require_paths = ['lib']
24
+ spec.licenses = ['MIT']
25
+ end
26
+
@@ -0,0 +1,6 @@
1
+ require 'capx/version'
2
+ require 'capx/runner'
3
+
4
+ # main module for capx
5
+ module Capx
6
+ end
@@ -0,0 +1,39 @@
1
+ module Capx
2
+ class Runner
3
+ PATTERN = /server:?\s+[\'\"]([\w\-\.]+)[\'\"],\s+user:?\s+[\'\"]([\w\-\.]+)[\'\"]/
4
+
5
+ def initialize(options)
6
+ @stage = options[:stage]
7
+ @switch = options[:switch]
8
+ @server = nil
9
+ @user = nil
10
+ end
11
+
12
+ def run
13
+ file = "config/deploy/#{@stage}.rb"
14
+ if File.exist?(file)
15
+ File.open(file).each do |line|
16
+ if match = PATTERN.match(line)
17
+ @server = match.captures[0]
18
+ @user = match.captures[1]
19
+ end
20
+ end
21
+
22
+ if @server.nil? || @user.nil?
23
+ puts "capistrano server/user not found"
24
+ else
25
+ if ARGV[1] == 'ssh'
26
+ # call ssh
27
+ cmd = "ssh #{@user}@#{@server}"
28
+ puts "executing #{cmd}"
29
+ exec(cmd)
30
+ else
31
+ puts "#{@user}@#{@server}"
32
+ end
33
+ end
34
+ else
35
+ puts "File #{file} not found"
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,5 @@
1
+ # main module for capx
2
+ module Capx
3
+ VERSION = '0.0.1'
4
+ end
5
+
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capx
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jan Kmet
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-07-06 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |2
14
+ SSH shortcut using capistrano deploy configuration.
15
+ SSH username and host are parsed from capistrano deploy configuration
16
+ email:
17
+ - jan.kmet@gmail.com
18
+ executables:
19
+ - capx
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - ".gitignore"
24
+ - LICENSE
25
+ - bin/capx
26
+ - capx.gemspec
27
+ - lib/capx.rb
28
+ - lib/capx/runner.rb
29
+ - lib/capx/version.rb
30
+ homepage: https://github.com/jankmet/capx
31
+ licenses:
32
+ - MIT
33
+ metadata: {}
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.2.0
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubyforge_project:
50
+ rubygems_version: 2.7.6
51
+ signing_key:
52
+ specification_version: 4
53
+ summary: SSH shortcut using capistrano deploy configuration
54
+ test_files: []