ansible_tools 0.0.4.1 → 0.0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/.travis.yml +8 -0
- data/ansible_tools.gemspec +1 -2
- data/lib/ansible_tools/version.rb +1 -1
- data/spec/commands_spec.rb +107 -0
- data/spec/spec_helper.rb +88 -5
- metadata +11 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94fb995baabedf8e996bba56a662b1da6ab184e3
|
4
|
+
data.tar.gz: ce1e98e939b665cfe5810af5cf80427eb2c328b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb099f0076cfa2b549c06815632ae6338bf4e7b81811d5b260dff5fd1d27f4d7981006a95d7e4f43f91cabd61c78264d32625afa059dd309d1fcc2250a40e488
|
7
|
+
data.tar.gz: debb812b52f074a31dad66457ee84abfb8ed9406cff3dae774f2ab25c3a49cf823804b0096f74684f6e82cab753d8a3da19b10c393617af331387b7de06a07ad
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/ansible_tools.gemspec
CHANGED
@@ -20,8 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
-
spec.add_development_dependency "
|
24
|
-
spec.add_development_dependency "ruport", "~> 1.6.3"
|
23
|
+
spec.add_development_dependency "rspec"
|
25
24
|
|
26
25
|
spec.add_runtime_dependency "thor", "~> 0.18.1"
|
27
26
|
spec.add_runtime_dependency "ruport", "~> 1.6.3"
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'ansible_tools'
|
3
|
+
|
4
|
+
test_dir = "tmp"
|
5
|
+
|
6
|
+
describe "テスト" do
|
7
|
+
before(:all) do
|
8
|
+
$stdout = File.open("/dev/null", "w") #テスト実行中は標準出力は/dev/nullにする。
|
9
|
+
end
|
10
|
+
|
11
|
+
after(:all) do
|
12
|
+
$stdout =STDOUT # テスト実行後は元に戻す
|
13
|
+
end
|
14
|
+
|
15
|
+
# テスト実行前
|
16
|
+
before(:each) do
|
17
|
+
FileUtils.mkdir_p(test_dir) unless FileTest.exist?(test_dir)
|
18
|
+
Dir.chdir(test_dir) #tmp/に移動
|
19
|
+
end
|
20
|
+
|
21
|
+
# テスト実行後
|
22
|
+
after(:each) do
|
23
|
+
Dir.chdir("../")
|
24
|
+
FileUtils.rm_rf(test_dir, :secure => true)
|
25
|
+
end
|
26
|
+
|
27
|
+
# ディレクトリの存在をチェックする。
|
28
|
+
def expect_dir_exist(array)
|
29
|
+
array["created_dir"].each{|d|
|
30
|
+
expect(File.directory?(d)).to be_truthy
|
31
|
+
}
|
32
|
+
end
|
33
|
+
# ファイルの存在をチェックする。
|
34
|
+
def expect_file_exist(array)
|
35
|
+
array["created_file"].each{|f|
|
36
|
+
expect(FileTest.exist?(f)).to be_truthy
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
it "init(yml-only = false)" do
|
41
|
+
AnsibleTools.init(false)
|
42
|
+
array = init_false
|
43
|
+
expect_file_exist(array)
|
44
|
+
expect_dir_exist(array)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "init(yml-only = true)" do
|
48
|
+
AnsibleTools.init(true)
|
49
|
+
array = init_true
|
50
|
+
expect_file_exist(array)
|
51
|
+
expect_dir_exist(array)
|
52
|
+
end
|
53
|
+
|
54
|
+
def init_false
|
55
|
+
res = Hash.new
|
56
|
+
res["created_file"] = [
|
57
|
+
"group_vars",
|
58
|
+
"host_vars",
|
59
|
+
"site.yml",
|
60
|
+
"roles/common/tasks/main.yml",
|
61
|
+
"roles/common/handlers/main.yml",
|
62
|
+
"roles/common/templates/foo.conf.j2",
|
63
|
+
"roles/common/vars/main.yml",
|
64
|
+
"roles/common/files/bar.txt",
|
65
|
+
"production",
|
66
|
+
"stage",
|
67
|
+
"group_vars/group1",
|
68
|
+
"group_vars/group2",
|
69
|
+
"host_vars/hostname1",
|
70
|
+
"host_vars/hostname2"
|
71
|
+
]
|
72
|
+
res["created_dir"] = [
|
73
|
+
"roles",
|
74
|
+
"roles/common",
|
75
|
+
"roles/common/tasks",
|
76
|
+
"roles/common/handlers",
|
77
|
+
"roles/common/templates",
|
78
|
+
"roles/common/vars",
|
79
|
+
"roles/common/files",
|
80
|
+
"group_vars",
|
81
|
+
"host_vars",
|
82
|
+
]
|
83
|
+
return res
|
84
|
+
end
|
85
|
+
|
86
|
+
def init_true
|
87
|
+
res = Hash.new
|
88
|
+
res["created_file"] = [
|
89
|
+
"group_vars",
|
90
|
+
"host_vars",
|
91
|
+
"site.yml",
|
92
|
+
"roles/common/tasks/main.yml",
|
93
|
+
"roles/common/handlers/main.yml",
|
94
|
+
"roles/common/vars/main.yml",
|
95
|
+
]
|
96
|
+
res["created_dir"] = [
|
97
|
+
"roles",
|
98
|
+
"roles/common",
|
99
|
+
"roles/common/tasks",
|
100
|
+
"roles/common/handlers",
|
101
|
+
"roles/common/templates",
|
102
|
+
"roles/common/vars",
|
103
|
+
"roles/common/files",
|
104
|
+
]
|
105
|
+
return res
|
106
|
+
end
|
107
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,89 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
require
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
+
#
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
10
|
+
# a separate helper file that requires the additional dependencies and performs
|
11
|
+
# the additional setup, and require it from the spec files that actually need it.
|
12
|
+
#
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
+
# users commonly want.
|
15
|
+
#
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
|
+
RSpec.configure do |config|
|
18
|
+
# rspec-expectations config goes here. You can use an alternate
|
19
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
20
|
+
# assertions if you prefer.
|
21
|
+
config.expect_with :rspec do |expectations|
|
22
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
23
|
+
# and `failure_message` of custom matchers include text for helper methods
|
24
|
+
# defined using `chain`, e.g.:
|
25
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
26
|
+
# # => "be bigger than 2 and smaller than 4"
|
27
|
+
# ...rather than:
|
28
|
+
# # => "be bigger than 2"
|
29
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
30
|
+
end
|
4
31
|
|
5
|
-
|
6
|
-
|
32
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
33
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
34
|
+
config.mock_with :rspec do |mocks|
|
35
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
36
|
+
# a real object. This is generally recommended, and will default to
|
37
|
+
# `true` in RSpec 4.
|
38
|
+
mocks.verify_partial_doubles = true
|
39
|
+
end
|
40
|
+
|
41
|
+
# The settings below are suggested to provide a good initial experience
|
42
|
+
# with RSpec, but feel free to customize to your heart's content.
|
43
|
+
=begin
|
44
|
+
# These two settings work together to allow you to limit a spec run
|
45
|
+
# to individual examples or groups you care about by tagging them with
|
46
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
47
|
+
# get run.
|
48
|
+
config.filter_run :focus
|
49
|
+
config.run_all_when_everything_filtered = true
|
50
|
+
|
51
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
52
|
+
# For more details, see:
|
53
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
54
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
55
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
56
|
+
config.disable_monkey_patching!
|
57
|
+
|
58
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
59
|
+
# be too noisy due to issues in dependencies.
|
60
|
+
config.warnings = true
|
61
|
+
|
62
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
63
|
+
# file, and it's useful to allow more verbose output when running an
|
64
|
+
# individual spec file.
|
65
|
+
if config.files_to_run.one?
|
66
|
+
# Use the documentation formatter for detailed output,
|
67
|
+
# unless a formatter has already been configured
|
68
|
+
# (e.g. via a command-line flag).
|
69
|
+
config.default_formatter = 'doc'
|
70
|
+
end
|
71
|
+
|
72
|
+
# Print the 10 slowest examples and example groups at the
|
73
|
+
# end of the spec run, to help surface which specs are running
|
74
|
+
# particularly slow.
|
75
|
+
config.profile_examples = 10
|
76
|
+
|
77
|
+
# Run specs in random order to surface order dependencies. If you find an
|
78
|
+
# order dependency and want to debug it, you can fix the order by providing
|
79
|
+
# the seed, which is printed after each run.
|
80
|
+
# --seed 1234
|
81
|
+
config.order = :random
|
82
|
+
|
83
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
84
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
85
|
+
# test failures related to randomization by passing the same `--seed` value
|
86
|
+
# as the one that triggered the failure.
|
87
|
+
Kernel.srand config.seed
|
88
|
+
=end
|
89
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ansible_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.4.
|
4
|
+
version: 0.0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- volanja
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -39,33 +39,19 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 0.18.1
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.18.1
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: ruport
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
45
|
+
- - '>='
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
47
|
+
version: '0'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
|
-
- -
|
52
|
+
- - '>='
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
54
|
+
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: thor
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,6 +90,8 @@ extra_rdoc_files: []
|
|
104
90
|
files:
|
105
91
|
- .coveralls.yml
|
106
92
|
- .gitignore
|
93
|
+
- .rspec
|
94
|
+
- .travis.yml
|
107
95
|
- Gemfile
|
108
96
|
- LICENSE.txt
|
109
97
|
- README.md
|
@@ -112,6 +100,7 @@ files:
|
|
112
100
|
- bin/ansible-tools
|
113
101
|
- lib/ansible_tools.rb
|
114
102
|
- lib/ansible_tools/version.rb
|
103
|
+
- spec/commands_spec.rb
|
115
104
|
- spec/spec_helper.rb
|
116
105
|
homepage: https://github.com/volanja
|
117
106
|
licenses:
|
@@ -138,4 +127,5 @@ signing_key:
|
|
138
127
|
specification_version: 4
|
139
128
|
summary: Ansible Tools e.g. Create directory by BestPractice
|
140
129
|
test_files:
|
130
|
+
- spec/commands_spec.rb
|
141
131
|
- spec/spec_helper.rb
|