tweek 0.9.6 → 0.9.7

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
  SHA1:
3
- metadata.gz: bbdc274f7328ea05184d341f5dee88f93cd65c25
4
- data.tar.gz: f7e7207890f05c03e86a8652270d74ba40fbd593
3
+ metadata.gz: f8a1c3d0861a2205884049ffbe0ed958cf76595f
4
+ data.tar.gz: 5f160e90b0d80b153653befacc767eccde42cdfe
5
5
  SHA512:
6
- metadata.gz: b352de37782b1728db1928e5986cd0d506188fd2b867d38770112a82d13478119339af50020c9f8540824d08820182d2b58c3e48946a6b2d0d3cb84475850e98
7
- data.tar.gz: 565b7e18709429bd70f0a037de8266325aed810c692c268b8bf816c44e3f495aba689b5708ebeae58836312e02edc083f9e7a9c5dc046db4e4a0d66ba9f9530c
6
+ metadata.gz: 2e7bb10c67867e1e8d5612f6b14ca50d2db6b7399927d9f11ee1fb49ae8fccf17f9e88b7d39e6805389d905a0d8e95594a1891ebd71152021fcc3550ffd6905e
7
+ data.tar.gz: 17cd1c8d386f9d78cda50497b9e2614b98860f77fd730a7eaccc43ae686fc59fe3ac64f05423be29dd29eaedd56b853577c0f8db07f2d63230f989cde347f8eb
data/README.md CHANGED
@@ -1,38 +1,158 @@
1
1
  # Tweek
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/tweek`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Tweek is a command line utility that allows multiple aspects of a Linux configuration to
4
+ be recorded and checked against a file of settings. Think of it as a series of
5
+ configuration tests that can be executed, with the results being presented as a number of
6
+ passes and failures. The number of failures is returned as the exit code of the process
7
+ which allows it's use in scripts. This is particularly useful when checking multiple
8
+ machines via a utility like `pssh` or `mush`.
9
+
10
+ Although existing configuration management systems such as Puppet, Chef or Ansible can
11
+ perform the same checks, they tend to require a high level of support infrastructure to be
12
+ useful. The purpose of Tweek is to check that after these more sophisticated systems have
13
+ done their thing, that the performance-important settings are actually correct.
14
+
15
+ Another benefit is that the configuration test syntax is extremely simple text, and by
16
+ abstracting the actual commands used, it is much easier for a relatively unsophisticated
17
+ user to check obscure settings without actually knowing the commands needed.
18
+
19
+ One of the objectives of the Tweek GitHub repository is to serve as a repository for sets
20
+ of configuration parameters that have been found by the community to be useful in
21
+ maximizing performance for certain machines and workloads. It is hoped people will submit
22
+ pull requests to add settings files to the `settings` subdirectory of this project.
6
23
 
7
24
  ## Installation
8
25
 
9
- Add this line to your application's Gemfile:
26
+ Tweek has been written to use Ruby 1.8.7 or above which is available on all Linux systems
27
+ within the last five years or so. It also requires `rubygems`.
28
+
29
+ ### Do I need to be the 'root' user?
30
+
31
+ The utility will work fine as a non-root user, although some settings may not be
32
+ accessible, and so the tests will fail.
33
+
34
+ ### Installing Ruby
35
+
36
+ Depending on your distribution issuing the following commands:
37
+
38
+ * On Debian (eg. Ubuntu) systems run: `apt-get install ruby rubygems`
39
+ * On RPM (eg. RedHat, CentOS) systems run: `yum install ruby rubygems`
40
+
41
+ Then to install the Tweek gem run this command:
10
42
 
11
43
  ```ruby
12
- gem 'tweek'
44
+ gem install tweek
13
45
  ```
14
46
 
15
- And then execute:
47
+ Depending on the setup of the system's Ruby, you may need to run `sudo` for this to be
48
+ successful. You should now be able to type `tweek -?` to see the available options.
16
49
 
17
- $ bundle
50
+ ## Usage
18
51
 
19
- Or install it yourself as:
52
+ Tweek can be used in the following modes:
20
53
 
21
- $ gem install tweek
54
+ * To check a default configuration
55
+ * To create a sample settings file that you can edit manually
56
+ * To generate a settings file based on the current machine settings
57
+ * To check the current configuration against a file of settings.
22
58
 
23
- ## Usage
59
+ In the first case Tweek uses a built-in set of defaults. To check using these simply run:
60
+
61
+ ```
62
+ tweek
63
+ ```
64
+
65
+ Tweek will read the sample settings from the default file `settings/sample.set` and check
66
+ that. The output is self-explanatory.
67
+
68
+ All the other uses involve the settings file. Documentation is contained within the
69
+ sample settings and you should read that for a full understanding of what is possible.
70
+
71
+ ## Settings File Format
72
+
73
+ The file is a plain-text file that may contain UTF-8 if you are running Ruby 2.0 and
74
+ above, or US-ASCII otherwise.
75
+
76
+ The overall syntax of the file was designed to be Ruby-like so enabling syntax
77
+ highlighting using Ruby as the language makes it very readable.
78
+
79
+ ### Comments
80
+
81
+ Comments are of two sorts:
82
+ * Inline: after the first # on any line
83
+ * Block: Following the Ruby convention these are begun with `=begin` and end with `=end`
24
84
 
25
- TODO: Write usage instructions here
85
+ ### Sections
86
+
87
+ The file is split into sections, each of which starts with one of several predefined keywords
88
+ (in capitals) followed by an optional parameter narrowing the scope of the keyword. The
89
+ keywords are:
90
+ * BLKDEV - Lists block devices and their configuration parameters. This must be followed
91
+ by a block device name, which may be a wildcard.
92
+ * CLOCKSOURCE - Establishes the desired clocksource. No parameter is required.
93
+ * KERNEL - Parameters passed to the Kernel at boot time (usually using Grub). No
94
+ parameter required.
95
+ * SYSCTL - Various system settings. No parameter required.
96
+ * NET - Settings appropriate to a particular network device. This must be followed by a
97
+ network device name eg. `eth0`. Wildcards are allowed.
98
+ * EXT4 - Settings for EXT4 filesystems. This must be followed by a parameter containing
99
+ either a block device or filesystem path corresponding to a mounted `ext4` filesystem.
100
+ Wildcards are allowed.
101
+ * XFS - Settings for XFS filesystems. This must be followed by a parameter containing
102
+ either a block device or filesystem path corresponding to a mounted `ext4` filesystem.
103
+ Wildcards are allowed.
104
+
105
+ ### Parameters
106
+
107
+ After a section all lines up to the next section (or end of file) are interpreted as
108
+ parameter lines. These take the form:
109
+
110
+ ```
111
+ parameter_name = parameter_value [if condition[,condition...]]
112
+ ```
113
+
114
+ For a discussion of which parameters are supported please see the sample settings file.
115
+
116
+ ### Conditionals
117
+
118
+ Parameter lines can be suffixed by the word `if` and one or more conditions. These are
119
+ used to limit the scope of the parameter check to those systems where the conditions hold
120
+ true. The list of conditions is and'ed together. A condition takes the form:
121
+
122
+ ```
123
+ [k|d|v] op value
124
+ ```
125
+
126
+ Where:
127
+ * `k` is the Kernel Version, `d` is the Distro name, and `v` is the Distro version.
128
+ * The operator `op` can be equality '==', regex equality '=~'or a version comparator as
129
+ per the [Rubygems](http://ruby-doc.org/stdlib-2.0.0/libdoc/rubygems/rdoc/Gem/Version.html) specification.
130
+ * The value is one of a plain string in quotes (for equality), a regex between /
131
+ delimiters, or a plain version string.
26
132
 
27
133
  ## Development
28
134
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
135
+ Tweek was developed using the gem `bundler`. Ensure you have both this and `rake` installed using:
136
+
137
+ ```
138
+ gem install bundler rake
139
+ ```
140
+
141
+ After checking out the repo, run `bundle install` to install dependencies. Make your code
142
+ changes, then run `bundle exec rake test` to run the tests. When ready to test on a machine use the
143
+ built-in Rake tasks. For a list of these type `rake -T`.
144
+
145
+ To install this gem onto your local machine, run `bundle exec rake install`.
146
+
147
+ To release a new version to the public gem repository, contact the author.
30
148
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
149
+ The author will update the version number in `version.rb`, and then run `bundle exec rake
150
+ release`, which will create a git tag for the version, push git commits and tags, and push
151
+ the `.gem` file to [rubygems.org](https://rubygems.org).
32
152
 
33
153
  ## Contributing
34
154
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/tweek. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
155
+ Bug reports and pull requests are welcome on GitHub at https://github.com/townsen/tweek. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
156
 
37
157
  ## License
38
158
 
@@ -40,4 +160,4 @@ The gem is available as open source under the terms of the [MIT License](http://
40
160
 
41
161
  ## Code of Conduct
42
162
 
43
- Everyone interacting in the Tweek project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/tweek/blob/master/CODE_OF_CONDUCT.md).
163
+ Everyone interacting in the Tweek project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/townsen/tweek/blob/master/CODE_OF_CONDUCT.md).
data/bin/tweek CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
3
  # A script to check a variety of Linux system settings
4
- # See doc/sample.file for a description of these.
4
+ # See settings/sample.set for a description of these.
5
5
  # By Nick Townsend, June 2017
6
6
  #
7
7
  require 'rubygems'
@@ -83,7 +83,7 @@ if kernel_ver.nil?
83
83
  end
84
84
  cs = Tweek::App.new(gflag, true, distro, distro_ver, kernel_ver)
85
85
  if ARGV.empty?
86
- fh = File.open(File.expand_path('../../sample.set',__FILE__))
86
+ fh = File.open(File.expand_path('../../settings/sample.set',__FILE__))
87
87
  else
88
88
  fh = ARGF
89
89
  end
data/lib/tweek/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tweek
2
- VERSION = "0.9.6"
2
+ VERSION = "0.9.7"
3
3
  end
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tweek
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Townsend
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-16 00:00:00.000000000 Z
11
+ date: 2017-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -60,23 +60,16 @@ executables:
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - ".gitignore"
64
- - ".travis.yml"
65
63
  - CODE_OF_CONDUCT.md
66
- - Gemfile
67
64
  - LICENSE.txt
68
65
  - README.md
69
- - Rakefile
70
- - bin/console
71
- - bin/setup
72
66
  - bin/tweek
73
67
  - lib/tweek.rb
74
68
  - lib/tweek/app.rb
75
69
  - lib/tweek/section.rb
76
70
  - lib/tweek/version.rb
77
- - sample.set
78
- - tweek.gemspec
79
- homepage:
71
+ - settings/sample.set
72
+ homepage: https://github.com/townsen/tweek
80
73
  licenses:
81
74
  - MIT
82
75
  metadata:
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.4.1
5
- before_install: gem install bundler -v 1.15.0
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in tweek.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
8
- end
9
-
10
- task :default => :test
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "tweek"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
data/tweek.gemspec DELETED
@@ -1,32 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "tweek/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "tweek"
8
- spec.version = Tweek::VERSION
9
- spec.authors = ["Nick Townsend"]
10
- spec.email = ["nick.townsend@mac.com"]
11
-
12
- spec.summary = %q{Read and compare Linux parameters for performance tweaking}
13
- spec.license = "MIT"
14
-
15
- if spec.respond_to?(:metadata)
16
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
17
- else
18
- raise "RubyGems 2.0 or newer is required to protect against " \
19
- "public gem pushes."
20
- end
21
-
22
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
23
- f.match(%r{^(test|spec|features)/})
24
- end
25
- spec.bindir = "bin"
26
- spec.executables = ['tweek']
27
- spec.require_paths = ["lib"]
28
-
29
- spec.add_development_dependency "bundler", "~> 1.15"
30
- spec.add_development_dependency "rake", "~> 10.0"
31
- spec.add_development_dependency "minitest", "~> 5.0"
32
- end