specinfra 2.25.1 → 2.26.0

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.
@@ -1,4 +1,7 @@
1
- module Specinfra::Command; end
1
+ module Specinfra
2
+ module Command
3
+ end
4
+ end
2
5
 
3
6
  # Module
4
7
  require 'specinfra/command/module'
@@ -0,0 +1,18 @@
1
+ require 'specinfra/version'
2
+ require 'specinfra/ext'
3
+ require 'specinfra/helper'
4
+ require 'specinfra/command'
5
+ require 'specinfra/command_factory'
6
+ require 'specinfra/command_result'
7
+ require 'specinfra/backend'
8
+ require 'specinfra/configuration'
9
+ require 'specinfra/runner'
10
+ require 'specinfra/processor'
11
+
12
+ module Specinfra
13
+ class << self
14
+ def configuration
15
+ Specinfra::Configuration
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ class Class
2
+ def subclasses
3
+ result = []
4
+ ObjectSpace.each_object(Class) do |k|
5
+ result << k if k < self
6
+ end
7
+ result
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ class String
2
+ def to_snake_case
3
+ self.gsub(/::/, '/').
4
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
5
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
6
+ tr("-", "_").
7
+ downcase
8
+ end
9
+
10
+ def to_camel_case
11
+ return self if self !~ /_/ && self =~ /[A-Z]+.*/
12
+ split('_').map{|e| e.capitalize}.join
13
+ end
14
+ end
@@ -0,0 +1,2 @@
1
+ require 'specinfra/ext/class'
2
+ require 'specinfra/ext/string'
@@ -1,19 +1,21 @@
1
- module Specinfra::Helper
2
- class DetectOs
3
- def self.detect
4
- self.new(Specinfra.backend).detect
5
- end
1
+ module Specinfra
2
+ module Helper
3
+ class DetectOs
4
+ def self.detect
5
+ self.new(Specinfra.backend).detect
6
+ end
6
7
 
7
- def initialize(backend)
8
- @backend = backend
9
- end
8
+ def initialize(backend)
9
+ @backend = backend
10
+ end
10
11
 
11
- def run_command(cmd)
12
- @backend.run_command(cmd)
13
- end
12
+ def run_command(cmd)
13
+ @backend.run_command(cmd)
14
+ end
14
15
 
15
- def detect
16
- raise NotImplementedError
16
+ def detect
17
+ raise NotImplementedError
18
+ end
17
19
  end
18
20
  end
19
21
  end
@@ -1,23 +1,28 @@
1
1
  require 'specinfra/helper/detect_os'
2
2
 
3
- module Specinfra::Helper::Os
4
- def os
5
- property[:os] = {} if ! property[:os]
6
- if ! property[:os].include?(:family)
7
- property[:os] = detect_os
8
- end
9
- property[:os]
10
- end
3
+ module Specinfra
4
+ module Helper
5
+ module Os
6
+ def os
7
+ property[:os] = {} if ! property[:os]
8
+ if ! property[:os].include?(:family)
9
+ property[:os] = detect_os
10
+ end
11
+ property[:os]
12
+ end
11
13
 
12
- private
13
- def detect_os
14
- return Specinfra.configuration.os if Specinfra.configuration.os
15
- Specinfra::Helper::DetectOs.subclasses.each do |c|
16
- res = c.detect
17
- if res
18
- res[:arch] ||= Specinfra.backend.run_command('uname -m').stdout.strip
19
- return res
14
+ private
15
+ def detect_os
16
+ return Specinfra.configuration.os if Specinfra.configuration.os
17
+ Specinfra::Helper::DetectOs.subclasses.each do |c|
18
+ res = c.detect
19
+ if res
20
+ res[:arch] ||= Specinfra.backend.run_command('uname -m').stdout.strip
21
+ return res
22
+ end
23
+ end
20
24
  end
21
25
  end
22
26
  end
23
27
  end
28
+
@@ -1,5 +1,10 @@
1
- module Specinfra::Helper::Set
2
- def set(param, *value)
3
- Specinfra.configuration.send(param, *value)
1
+ module Specinfra
2
+ module Helper
3
+ module Set
4
+ def set(param, *value)
5
+ Specinfra.configuration.send(param, *value)
6
+ end
7
+ end
4
8
  end
5
9
  end
10
+
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.25.1"
2
+ VERSION = "2.26.0"
3
3
  end
data/lib/specinfra.rb CHANGED
@@ -1,21 +1,9 @@
1
- require 'specinfra/version'
2
- require 'specinfra/helper'
3
- require 'specinfra/backend'
4
- require 'specinfra/command'
5
- require 'specinfra/command_factory'
6
- require 'specinfra/command_result'
7
- require 'specinfra/configuration'
8
- require 'specinfra/runner'
9
- require 'specinfra/processor'
1
+ require 'specinfra/core'
10
2
 
11
3
  include Specinfra
12
4
 
13
5
  module Specinfra
14
6
  class << self
15
- def configuration
16
- Specinfra::Configuration
17
- end
18
-
19
7
  def command
20
8
  Specinfra::CommandFactory.instance
21
9
  end
@@ -52,28 +40,3 @@ if defined?(RSpec)
52
40
  end
53
41
  end
54
42
  end
55
-
56
- class Class
57
- def subclasses
58
- result = []
59
- ObjectSpace.each_object(Class) do |k|
60
- result << k if k < self
61
- end
62
- result
63
- end
64
- end
65
-
66
- class String
67
- def to_snake_case
68
- self.gsub(/::/, '/').
69
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
70
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
71
- tr("-", "_").
72
- downcase
73
- end
74
-
75
- def to_camel_case
76
- return self if self !~ /_/ && self =~ /[A-Z]+.*/
77
- split('_').map{|e| e.capitalize}.join
78
- end
79
- end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specinfra
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.25.1
4
+ version: 2.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -330,7 +330,11 @@ files:
330
330
  - lib/specinfra/command_factory.rb
331
331
  - lib/specinfra/command_result.rb
332
332
  - lib/specinfra/configuration.rb
333
+ - lib/specinfra/core.rb
333
334
  - lib/specinfra/ec2_metadata.rb
335
+ - lib/specinfra/ext.rb
336
+ - lib/specinfra/ext/class.rb
337
+ - lib/specinfra/ext/string.rb
334
338
  - lib/specinfra/helper.rb
335
339
  - lib/specinfra/helper/configuration.rb
336
340
  - lib/specinfra/helper/detect_os.rb