itamae-specinfra-command 0.0.2 → 0.1.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: 1286fb5578f1428d4a0d7b38cbb74afd498073a72acc59561fde2d5be51f71f7
4
- data.tar.gz: 7e05f9e0e6fef7e4879842bc7b6676da713258e869a9a98ed0ac47d85beda332
3
+ metadata.gz: 5e1f07d5aa6231e755a34ee373e5075f25074fe2fe31aa3ca6edf7a7ddd320ac
4
+ data.tar.gz: 30f2ce58e164c506bfedcb673bd1e722311c2d7f4a603f28e5ff8c8f59d9f36e
5
5
  SHA512:
6
- metadata.gz: 7723888007e9007b5ccedeb47f76e4b7f628eb2674c58c5c5629899d8666ccf0b673a3891615e31ed9c0099eb0f38d5ae46421227e21bbcc29071b962390b0a6
7
- data.tar.gz: baf4c4b8eaad753326c0db02fefe84c02d957008c2aeafb2061e5da880d1f1070333d2e1e626319246c0748b20f672463f31eb5d3a5b8eef67013039f399ca5c
6
+ metadata.gz: ef73b824b26fb8c0171fe5d036b005f3818289c311359ec17d1f4705ce711fdd971d32a73e2d13c3710fa3a1f7e93ede57590af053521e83ad95b20d9abe3ec3
7
+ data.tar.gz: 443a49173f383a941501308120e4ef53c2a9e26d9a0001fc2b11444adc36fef3f2ea6c417a353d5e51b1ed5d55216388bf82ecbaba75468c1ef15da841aa9a17
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- itamae-specinfra-command (0.0.2)
4
+ itamae-specinfra-command (0.1.0)
5
5
  itamae
6
6
  specinfra
7
7
 
data/README.md CHANGED
@@ -1,2 +1,5 @@
1
1
  # itamae-specinfra-command
2
2
  Wrapper for using Specinfra Command in Itamae
3
+
4
+ ## Badge
5
+ * [![Gem Version](https://badge.fury.io/rb/itamae-specinfra-command.svg)](https://badge.fury.io/rb/itamae-specinfra-command)
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'itamae/specinfra/command/version'
4
+ require 'specinfra/command_runner/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'itamae-specinfra-command'
8
- spec.version = Itamae::Specinfra::Command::VERSION
8
+ spec.version = Specinfra::CommandRunner::VERSION
9
9
  spec.authors = ['ntrv']
10
10
  spec.email = ['hydrangea56@me.com']
11
11
  spec.summary = 'Wrapper for using Specinfra Command in Itamae'
@@ -1,15 +1,11 @@
1
- require 'itamae/specinfra/command/version'
1
+ require 'specinfra/command_runner/version'
2
2
  require 'itamae'
3
3
  require 'specinfra'
4
4
 
5
- module Itamae
6
- module Specinfra
7
- # itamaeのResourceの中でSpecInfraを使うためのクラス
8
- class Command
9
- # Itamae::NodeからItamae::Backend::*もしくはSpecinfra::Backend::*を取りだす。
10
- def initialize(node)
11
- # nodeオブジェクト内からインスタンス変数@backendを取りだす
12
- @backend = node.instance_variable_get(:@backend)
5
+ module Specinfra
6
+ module CommandRunner
7
+ class Base
8
+ def initialize
13
9
  end
14
10
 
15
11
  # typeを指定してspecinfraを呼び出すためのメソッド
@@ -33,15 +29,7 @@ module Itamae
33
29
 
34
30
  # Specinfraのコマンドを文字列で返す
35
31
  def specinfra_command(type, *args)
36
- # backendのクラスによって出し分けを行う
37
- case @backend.class.to_s
38
- when /^Itamae::Backend/
39
- @backend.get_command(type, *args)
40
- when /^Specinfra::Backend/
41
- @backend.command.get(type, *args)
42
- else
43
- raise 'Backend is not Itamae::Backend nor Specinfra::Backend'
44
- end
32
+ raise NoImplementedError
45
33
  end
46
34
 
47
35
  # backend上でコマンドの実行結果のステータスコードが0かどうかを返す
@@ -0,0 +1,18 @@
1
+ require 'specinfra/command_runner/base'
2
+
3
+ module Specinfra
4
+ module CommandRunner
5
+ class Itamae < Specinfra::CommandRunner::Base
6
+ # Itamae::NodeからItamae::Backend::*もしくはSpecinfra::Backend::*を取りだす。
7
+ def initialize(node)
8
+ super
9
+ # nodeオブジェクト内からインスタンス変数@backendを取りだす
10
+ @backend = node.instance_variable_get(:@backend)
11
+ end
12
+
13
+ def specinfra_command(type, *args)
14
+ @backend.get_command(type, *args)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ require 'specinfra/command_runner/base'
2
+
3
+ module Specinfra
4
+ module CommandRunner
5
+ class Serverspec < Specinfra::CommandRunner::Base
6
+ # Specinfra.backendを受け取る想定
7
+ def initialize(backend)
8
+ super
9
+ @backend = backend
10
+ end
11
+
12
+ def specinfra_command(type, *args)
13
+ @backend.command.get(type, *args)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ module Specinfra
2
+ class CommandRunner
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae-specinfra-command
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ntrv
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-04 00:00:00.000000000 Z
11
+ date: 2018-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,8 +80,10 @@ files:
80
80
  - README.md
81
81
  - Rakefile
82
82
  - itamae-specinfra-command.gemspec
83
- - lib/itamae/specinfra/command.rb
84
- - lib/itamae/specinfra/command/version.rb
83
+ - lib/specinfra/command_runner/base.rb
84
+ - lib/specinfra/command_runner/itamae.rb
85
+ - lib/specinfra/command_runner/serverspec.rb
86
+ - lib/specinfra/command_runner/version.rb
85
87
  homepage: https://github.com/ntrv/itamae-specinfra-command
86
88
  licenses:
87
89
  - Apache
@@ -1,7 +0,0 @@
1
- module Itamae
2
- module Specinfra
3
- class Command
4
- VERSION = '0.0.2'
5
- end
6
- end
7
- end