knife-cookbook-readme 0.2.0 → 0.2.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.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/CHANGELOG.md +11 -0
- data/README.md +0 -2
- data/lib/chef/knife/cookbook_readme_from.rb +2 -13
- data/lib/knife_cookbook_readme.rb +3 -0
- data/lib/knife_cookbook_readme/readme.rb +2 -3
- data/lib/knife_cookbook_readme/version.rb +1 -1
- data/spec/fixtures/README.md +1 -0
- data/spec/fixtures/apache2-README.md +371 -0
- data/spec/fixtures/apache2-metadata.rb +213 -0
- data/spec/fixtures/git-README.md +42 -0
- data/spec/fixtures/git-metadata.rb +14 -0
- data/spec/fixtures/mysql-README.md +206 -0
- data/spec/fixtures/mysql-metadata.rb +140 -0
- data/spec/metadata_spec.rb +22 -5
- data/spec/readme_spec.rb +67 -72
- data/spec/template_spec.rb +1 -1
- metadata +18 -3
@@ -0,0 +1,140 @@
|
|
1
|
+
name "mysql"
|
2
|
+
maintainer "Opscode, Inc."
|
3
|
+
maintainer_email "cookbooks@opscode.com"
|
4
|
+
license "Apache 2.0"
|
5
|
+
description "Installs and configures mysql for client or server"
|
6
|
+
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
7
|
+
version "3.0.5"
|
8
|
+
recipe "mysql", "Includes the client recipe to configure a client"
|
9
|
+
recipe "mysql::client", "Installs packages required for mysql clients using run_action magic"
|
10
|
+
recipe "mysql::server", "Installs packages required for mysql servers w/o manual intervention"
|
11
|
+
recipe "mysql::server_ec2", "Performs EC2-specific mountpoint manipulation"
|
12
|
+
|
13
|
+
%w{ debian ubuntu centos suse fedora redhat scientific amazon freebsd windows mac_os_x }.each do |os|
|
14
|
+
supports os
|
15
|
+
end
|
16
|
+
|
17
|
+
depends "openssl"
|
18
|
+
depends "build-essential", "> 1.1.0"
|
19
|
+
suggests "homebrew"
|
20
|
+
suggests "windows"
|
21
|
+
|
22
|
+
attribute "mysql/server_root_password",
|
23
|
+
:display_name => "MySQL Server Root Password",
|
24
|
+
:description => "Randomly generated password for the mysqld root user",
|
25
|
+
:default => "randomly generated"
|
26
|
+
|
27
|
+
attribute "mysql/bind_address",
|
28
|
+
:display_name => "MySQL Bind Address",
|
29
|
+
:description => "Address that mysqld should listen on",
|
30
|
+
:default => "ipaddress"
|
31
|
+
|
32
|
+
attribute "mysql/data_dir",
|
33
|
+
:display_name => "MySQL Data Directory",
|
34
|
+
:description => "Location of mysql databases",
|
35
|
+
:default => "/var/lib/mysql"
|
36
|
+
|
37
|
+
attribute "mysql/conf_dir",
|
38
|
+
:display_name => "MySQL Conf Directory",
|
39
|
+
:description => "Location of mysql conf files",
|
40
|
+
:default => "/etc/mysql"
|
41
|
+
|
42
|
+
attribute "mysql/ec2_path",
|
43
|
+
:display_name => "MySQL EC2 Path",
|
44
|
+
:description => "Location of mysql directory on EC2 instance EBS volumes",
|
45
|
+
:default => "/mnt/mysql"
|
46
|
+
|
47
|
+
attribute "mysql/reload_action",
|
48
|
+
:display_name => "MySQL conf file reload action",
|
49
|
+
:description => "Action to take when mysql conf files are modified",
|
50
|
+
:default => "reload"
|
51
|
+
|
52
|
+
attribute "mysql/tunable",
|
53
|
+
:display_name => "MySQL Tunables",
|
54
|
+
:description => "Hash of MySQL tunable attributes",
|
55
|
+
:type => "hash"
|
56
|
+
|
57
|
+
attribute "mysql/tunable/key_buffer",
|
58
|
+
:display_name => "MySQL Tuntable Key Buffer",
|
59
|
+
:default => "250M"
|
60
|
+
|
61
|
+
attribute "mysql/tunable/max_connections",
|
62
|
+
:display_name => "MySQL Tunable Max Connections",
|
63
|
+
:default => "800"
|
64
|
+
|
65
|
+
attribute "mysql/tunable/wait_timeout",
|
66
|
+
:display_name => "MySQL Tunable Wait Timeout",
|
67
|
+
:default => "180"
|
68
|
+
|
69
|
+
attribute "mysql/tunable/net_read_timeout",
|
70
|
+
:display_name => "MySQL Tunable Net Read Timeout",
|
71
|
+
:default => "30"
|
72
|
+
|
73
|
+
attribute "mysql/tunable/net_write_timeout",
|
74
|
+
:display_name => "MySQL Tunable Net Write Timeout",
|
75
|
+
:default => "30"
|
76
|
+
|
77
|
+
attribute "mysql/tunable/back_log",
|
78
|
+
:display_name => "MySQL Tunable Back Log",
|
79
|
+
:default => "128"
|
80
|
+
|
81
|
+
attribute "mysql/tunable/table_cache",
|
82
|
+
:display_name => "MySQL Tunable Table Cache for MySQL < 5.1.3",
|
83
|
+
:default => "128"
|
84
|
+
|
85
|
+
attribute "mysql/tunable/table_open_cache",
|
86
|
+
:display_name => "MySQL Tunable Table Cache for MySQL >= 5.1.3",
|
87
|
+
:default => "128"
|
88
|
+
|
89
|
+
attribute "mysql/tunable/max_heap_table_size",
|
90
|
+
:display_name => "MySQL Tunable Max Heap Table Size",
|
91
|
+
:default => "32M"
|
92
|
+
|
93
|
+
attribute "mysql/tunable/expire_logs_days",
|
94
|
+
:display_name => "MySQL Exipre Log Days",
|
95
|
+
:default => "10"
|
96
|
+
|
97
|
+
attribute "mysql/tunable/max_binlog_size",
|
98
|
+
:display_name => "MySQL Max Binlog Size",
|
99
|
+
:default => "100M"
|
100
|
+
|
101
|
+
attribute "mysql/client",
|
102
|
+
:display_name => "MySQL Connector/C Client",
|
103
|
+
:description => "Hash of MySQL client attributes",
|
104
|
+
:type => "hash"
|
105
|
+
|
106
|
+
attribute "mysql/client/version",
|
107
|
+
:display_name => "MySQL Connector/C Version",
|
108
|
+
:default => "6.0.2"
|
109
|
+
|
110
|
+
attribute "mysql/client/arch",
|
111
|
+
:display_name => "MySQL Connector/C Architecture",
|
112
|
+
:default => "win32"
|
113
|
+
|
114
|
+
attribute "mysql/client/package_file",
|
115
|
+
:display_name => "MySQL Connector/C Package File Name",
|
116
|
+
:default => "mysql-connector-c-6.0.2-win32.msi"
|
117
|
+
|
118
|
+
attribute "mysql/client/url",
|
119
|
+
:display_name => "MySQL Connector/C Download URL",
|
120
|
+
:default => "http://www.mysql.com/get/Downloads/Connector-C/mysql-connector-c-6.0.2-win32.msi/from/http://mysql.mirrors.pair.com/"
|
121
|
+
|
122
|
+
attribute "mysql/client/package_name",
|
123
|
+
:display_name => "MySQL Connector/C Registry DisplayName",
|
124
|
+
:default => "MySQL Connector C 6.0.2"
|
125
|
+
|
126
|
+
attribute "mysql/client/basedir",
|
127
|
+
:display_name => "MySQL Connector/C Base Install Directory",
|
128
|
+
:default => "C:\\Program Files (x86)\\MySQL\\Connector C 6.0.2"
|
129
|
+
|
130
|
+
attribute "mysql/client/lib_dir",
|
131
|
+
:display_name => "MySQL Connector/C Library Directory (containing libmysql.dll)",
|
132
|
+
:default => "C:\\Program Files (x86)\\MySQL\\Connector C 6.0.2\\lib\\opt"
|
133
|
+
|
134
|
+
attribute "mysql/client/bin_dir",
|
135
|
+
:display_name => "MySQL Connector/C Executable Directory",
|
136
|
+
:default => "C:\\Program Files (x86)\\MySQL\\Connector C 6.0.2\\bin"
|
137
|
+
|
138
|
+
attribute "mysql/client/ruby_dir",
|
139
|
+
:display_name => "Ruby Executable Directory which should gain MySQL support",
|
140
|
+
:default => "system ruby"
|
data/spec/metadata_spec.rb
CHANGED
@@ -1,11 +1,28 @@
|
|
1
|
-
|
1
|
+
require_relative "../lib/knife_cookbook_readme/metadata"
|
2
2
|
|
3
3
|
module KnifeCookbookReadme
|
4
4
|
describe "Metadata.from_file" do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
let(:fixtures_path) { File.expand_path("../fixtures", __FILE__) }
|
6
|
+
|
7
|
+
it "reads metadata.rb of apache2 cookbook" do
|
8
|
+
file = File.join(fixtures_path, "apache2-metadata.rb")
|
9
|
+
metadata = Metadata.from_file(file)
|
10
|
+
metadata.name.should == "apache2"
|
11
|
+
metadata.platforms.should include "redhat"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "reads metadata.rb of git cookbook" do
|
15
|
+
file = File.join(fixtures_path, "git-metadata.rb")
|
16
|
+
metadata = Metadata.from_file(file)
|
17
|
+
metadata.name.should == "git"
|
18
|
+
metadata.dependencies.should include "build-essential"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "reads metadata.rb of mysql cookbook" do
|
22
|
+
file = File.join(fixtures_path, "mysql-metadata.rb")
|
23
|
+
metadata = Metadata.from_file(file)
|
24
|
+
metadata.name.should == "mysql"
|
25
|
+
metadata.attributes["mysql/data_dir"][:default].should == "/var/lib/mysql"
|
9
26
|
end
|
10
27
|
end
|
11
28
|
end
|
data/spec/readme_spec.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class Template; end
|
1
|
+
require_relative "../lib/knife_cookbook_readme"
|
4
2
|
|
5
3
|
module KnifeCookbookReadme
|
6
4
|
describe Readme do
|
@@ -18,11 +16,18 @@ module KnifeCookbookReadme
|
|
18
16
|
readme.description.should == description
|
19
17
|
end
|
20
18
|
|
21
|
-
it "generates
|
22
|
-
|
23
|
-
metadata = double(:metadata, :
|
19
|
+
it "generates supported platforms" do
|
20
|
+
platforms = { "debian" => "= 7", "ubuntu" => ">= 10.04" }
|
21
|
+
metadata = double(:metadata, :platforms => platforms)
|
24
22
|
readme = Readme.new(metadata)
|
25
|
-
readme.
|
23
|
+
readme.platforms.should == ["Debian (= 7)", "Ubuntu (>= 10.04)"]
|
24
|
+
end
|
25
|
+
|
26
|
+
it "generates cookbook dependencies" do
|
27
|
+
dependencies = { "cats" => "< 1.0", "dogs" => DEFAULT_CONSTRAINT }
|
28
|
+
metadata = double(:metadata, :dependencies => dependencies)
|
29
|
+
readme = Readme.new(metadata)
|
30
|
+
readme.dependencies.should == ["cats (< 1.0)", "dogs"]
|
26
31
|
end
|
27
32
|
|
28
33
|
it "generates cookbook attributes" do
|
@@ -38,88 +43,78 @@ module KnifeCookbookReadme
|
|
38
43
|
}
|
39
44
|
metadata = double(:metadata, :attributes => attributes)
|
40
45
|
readme = Readme.new(metadata)
|
41
|
-
readme.attributes.
|
46
|
+
readme.attributes.should == [
|
42
47
|
["node['pets']['cat']['name']", "The name of your cat", "Kitty"],
|
43
48
|
["node['pets']['dog']['name']", "The name of your dog", "Barf"],
|
44
49
|
]
|
45
50
|
end
|
46
51
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
it "generates platforms with version constraints" do
|
54
|
-
constraints = true
|
55
|
-
readme = Readme.new(metadata, constraints)
|
56
|
-
readme.platforms.sort.should == ["Debian (= 7)", "Ubuntu (>= 10.04)"]
|
57
|
-
end
|
52
|
+
it "generates recipes" do
|
53
|
+
recipes = double
|
54
|
+
metadata = double(:metadata, :recipes => recipes)
|
55
|
+
readme = Readme.new(metadata)
|
56
|
+
readme.recipes.should == recipes
|
57
|
+
end
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
59
|
+
it "generates author from maintainer name" do
|
60
|
+
maintainer = double
|
61
|
+
metadata = double(:metadata, :maintainer => maintainer)
|
62
|
+
readme = Readme.new(metadata)
|
63
|
+
readme.author.should == maintainer
|
64
64
|
end
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
66
|
+
it "generates author email from maintainer email" do
|
67
|
+
maintainer_email = double
|
68
|
+
metadata = double(:metadata, :maintainer_email => maintainer_email)
|
69
|
+
readme = Readme.new(metadata)
|
70
|
+
readme.author_email.should == maintainer_email
|
71
|
+
end
|
71
72
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
73
|
+
it "generates copyright year from current year" do
|
74
|
+
time_now = Time.mktime(2013, 1, 1)
|
75
|
+
Time.stub(:now).and_return(time_now)
|
76
|
+
metadata = double
|
77
|
+
readme = Readme.new(metadata)
|
78
|
+
readme.copyright_year.should == time_now.year
|
79
|
+
end
|
77
80
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
81
|
+
it "generates license name" do
|
82
|
+
license = double
|
83
|
+
metadata = double(:metadata, :license => license)
|
84
|
+
readme = Readme.new(metadata)
|
85
|
+
readme.license.should == license
|
83
86
|
end
|
84
87
|
|
85
|
-
context "
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
readme = Readme.new(metadata)
|
90
|
-
readme.author.should == maintainer
|
91
|
-
end
|
88
|
+
context "#render" do
|
89
|
+
let(:template_file) { File.expand_path("../../template/README.md.erb", __FILE__) }
|
90
|
+
let(:template) { File.read(template_file) }
|
91
|
+
let(:fixtures_path) { File.expand_path("../fixtures", __FILE__) }
|
92
92
|
|
93
|
-
it "
|
94
|
-
|
95
|
-
|
96
|
-
readme = Readme.new(metadata)
|
97
|
-
readme.author_email.should == maintainer_email
|
98
|
-
end
|
93
|
+
it "renders README.md for apache2 cookbook" do
|
94
|
+
metadata_file = File.join(fixtures_path, "apache2-metadata.rb")
|
95
|
+
readme_file = File.join(fixtures_path, "apache2-README.md")
|
99
96
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
metadata = double
|
104
|
-
readme = Readme.new(metadata)
|
105
|
-
readme.copyright_year.should == time_now.year
|
97
|
+
metadata = Metadata.from_file(metadata_file)
|
98
|
+
output = Readme.new(metadata).render(template)
|
99
|
+
output.should == File.read(readme_file)
|
106
100
|
end
|
107
|
-
|
108
|
-
it "
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
101
|
+
|
102
|
+
it "renders README.md for git cookbook" do
|
103
|
+
metadata_file = File.join(fixtures_path, "git-metadata.rb")
|
104
|
+
readme_file = File.join(fixtures_path, "git-README.md")
|
105
|
+
|
106
|
+
metadata = Metadata.from_file(metadata_file)
|
107
|
+
output = Readme.new(metadata).render(template)
|
108
|
+
output.should == File.read(readme_file)
|
113
109
|
end
|
114
|
-
end
|
115
110
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
metadata =
|
121
|
-
|
122
|
-
|
111
|
+
it "renders README.md for mysql cookbook" do
|
112
|
+
metadata_file = File.join(fixtures_path, "mysql-metadata.rb")
|
113
|
+
readme_file = File.join(fixtures_path, "mysql-README.md")
|
114
|
+
|
115
|
+
metadata = Metadata.from_file(metadata_file)
|
116
|
+
output = Readme.new(metadata).render(template)
|
117
|
+
output.should == File.read(readme_file)
|
123
118
|
end
|
124
119
|
end
|
125
120
|
end
|
data/spec/template_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-cookbook-readme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Lafeldt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef
|
@@ -82,10 +82,18 @@ files:
|
|
82
82
|
- Rakefile
|
83
83
|
- knife_cookbook_readme.gemspec
|
84
84
|
- lib/chef/knife/cookbook_readme_from.rb
|
85
|
+
- lib/knife_cookbook_readme.rb
|
85
86
|
- lib/knife_cookbook_readme/metadata.rb
|
86
87
|
- lib/knife_cookbook_readme/readme.rb
|
87
88
|
- lib/knife_cookbook_readme/template.rb
|
88
89
|
- lib/knife_cookbook_readme/version.rb
|
90
|
+
- spec/fixtures/README.md
|
91
|
+
- spec/fixtures/apache2-README.md
|
92
|
+
- spec/fixtures/apache2-metadata.rb
|
93
|
+
- spec/fixtures/git-README.md
|
94
|
+
- spec/fixtures/git-metadata.rb
|
95
|
+
- spec/fixtures/mysql-README.md
|
96
|
+
- spec/fixtures/mysql-metadata.rb
|
89
97
|
- spec/metadata_spec.rb
|
90
98
|
- spec/readme_spec.rb
|
91
99
|
- spec/template_spec.rb
|
@@ -110,11 +118,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
118
|
version: '0'
|
111
119
|
requirements: []
|
112
120
|
rubyforge_project:
|
113
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.1.4
|
114
122
|
signing_key:
|
115
123
|
specification_version: 4
|
116
124
|
summary: Knife plugin to generate README.md from metadata.rb
|
117
125
|
test_files:
|
126
|
+
- spec/fixtures/README.md
|
127
|
+
- spec/fixtures/apache2-README.md
|
128
|
+
- spec/fixtures/apache2-metadata.rb
|
129
|
+
- spec/fixtures/git-README.md
|
130
|
+
- spec/fixtures/git-metadata.rb
|
131
|
+
- spec/fixtures/mysql-README.md
|
132
|
+
- spec/fixtures/mysql-metadata.rb
|
118
133
|
- spec/metadata_spec.rb
|
119
134
|
- spec/readme_spec.rb
|
120
135
|
- spec/template_spec.rb
|