ajimi 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f13196aaa42aa1ee9ffa66c1cb2d981301913299
4
- data.tar.gz: edc36ca1ec66ad4ee23c3d0589c17e8b48aaef8e
3
+ metadata.gz: c20e66f0e522bdfea71dc7c47424c644ffb42269
4
+ data.tar.gz: 96dae09e80019ed4e77884d6a91dd5c10ea0157a
5
5
  SHA512:
6
- metadata.gz: afb2e37b084b8ac498f5d0b2326d06b238f92d0912b09e6d8b811e1281e304d581fb6a4e578dbbf000d64e0139155d361aa902b0492266bcc97e2e96d9095b2a
7
- data.tar.gz: e3d1c6e525954f974d5f382445aa1b26eece64c80ef63a6bf0dcecf3299d7262f88a683729b9099a2cddc41104217656ca88c34e409fbf3e9cbc47bf72a8e7ab
6
+ metadata.gz: a8512418e1ee00501b168639a3ac56bc78777632acc58447526af86395ab3d71f6dee53d4ccef47acb9fcb1d2664a7bb5fb875578edb7e3b74f772b22d5229d2
7
+ data.tar.gz: 91095049fc1566c3a931f6fd44b28b4b36b0647bcdd4dd94c0d65e329f26fb76a058236320008dafff33a22aae1e4ac68272f084a046739edcb77c244e631127
data/README.md CHANGED
@@ -33,7 +33,7 @@ And then edit Ajimifile:
33
33
 
34
34
  A sample configuration looks like the following:
35
35
 
36
- ```
36
+ ```ruby
37
37
  # Ajimi configuration file
38
38
 
39
39
  # source setting
@@ -94,25 +94,25 @@ The following arguments are supported in the Ajimifile:
94
94
  * `host` - String (Optional): SSH hostname, FQDN or IP address. Default is name of `source`.
95
95
  * `user` - String (Required): SSH username.
96
96
  * `key` - String (Required): Path to user's SSH secret key.
97
- * `enable_nice` - Boolean (Optional): If true, the find process is wrapped by nice and ionice to lower load. Default is false.
97
+ * `enable_nice` - Boolean (Optional): If true, the find process is wrapped by nice and ionice to lower load. Default is false.
98
98
  * `target` - String (Required): Target server's name and options. Options are the same as source.
99
99
  * `check_root_path` - String (Required): Root path to check. If "/", Ajimi checks in the whole filesystem.
100
- * `pruned_paths` - Array[String|Regexp] (Optional): List of the path which should be excluded in the find process. Note that `pruned_paths` is better performance than `ignored_paths`/`pending_paths`.
101
- * `ignored_paths` - Array[String|Regexp] (Optional): List of the path which should be ignored as known difference.
100
+ * `pruned_paths` - Array\[String|Regexp\] (Optional): List of the path which should be excluded in the find process. Note that `pruned_paths` is better performance than `ignored_paths`/`pending_paths`.
101
+ * `ignored_paths` - Array\[String|Regexp\] (Optional): List of the path which should be ignored as known difference.
102
102
  * `ignored_contents` - Hash{String => String|Regexp} (Optional): Hash of the path => pattern which should be ignored as known difference for each of the content.
103
- * `pending_paths`- Array[String|Regexp] (Optional): List of the path which should be resolved later but ignored temporarily as known difference.
103
+ * `pending_paths`- Array\[String|Regexp\] (Optional): List of the path which should be resolved later but ignored temporarily as known difference.
104
104
  * `pending_contents` - Hash{String => String|Regexp} (Optional): Hash of the path => pattern which should be resolved later but ignored temporarily as known difference for each of the content.
105
105
 
106
106
  ## Usage
107
107
 
108
108
  Ajimi is a single command-line application: `ajimi`.
109
- It takes a subcommand such as `check` or `exec`.
110
- To view a list of the available commands , just run `ajimi` with no arguments:
109
+ It takes a subcommand such as `dir` or `exec` (Default subcommnad is `check`).
110
+ To view a list of the available commands , just run `ajimi help` with no arguments:
111
111
 
112
- ```
113
- $ ajimi
112
+ ```bash
113
+ $ ajimi help
114
114
  Commands:
115
- ajimi check # Show differences between the source and the target server
115
+ ajimi [check] # (Default subcommand) Show differences between the source and the target server
116
116
  ajimi dir <path> # Show differences between the source and the target server in the specified directory
117
117
  ajimi exec source|target <command> # Execute an arbitrary command on the source or the target server
118
118
  ajimi file <path> # Show differences between the source and the target server in the specified file
@@ -129,22 +129,22 @@ After setting your Ajimifle, Run the following command in order to verify the SS
129
129
 
130
130
  $ ajimi exec source hostname
131
131
  $ ajimi exec target hostname
132
-
133
- And then, first ajimi check with `--find-max-depth` option:
134
132
 
135
- $ ajimi check --find-max-depth=3 > ajimi.log
133
+ And then, run `ajimi` command with `-d` (or `--find-max-depth`) option:
134
+
135
+ $ ajimi -d 3 > ajimi.log
136
136
 
137
137
  Check the diffs report in ajimi.log, and add roughly unnecessary paths to `pruned_paths` in Ajimifile.
138
138
 
139
- Next, gradually increasing `find-max-depth=4, 5, ...`,
139
+ Next, gradually increasing the depth `4, 5, ...`,
140
140
 
141
- $ ajimi check --find-max-depth=4 > ajimi.log
141
+ $ ajimi -d 4 > ajimi.log
142
142
 
143
143
  Add known differences to `ignored_paths` or `pending_paths`.
144
144
 
145
- After checking the difference of paths, then check the contents of files where the difference has been reported:
145
+ After checking the difference of paths, then run `ajimi` command with `-c` (or `--enable-check-contents`) option to check the contents of files where the difference has been reported:
146
146
 
147
- $ ajimi check --enable-check-contents > ajimi.log
147
+ $ ajimi -c > ajimi.log
148
148
 
149
149
  Add known differences to `ignored_contents` or `pending_contents`,
150
150
  and repeat until the number of lines of diffs report becomes human-readable.
@@ -153,10 +153,10 @@ Finally, resolve issues and remove `pending_paths` or `pending_contents`.
153
153
 
154
154
  ## Command reference
155
155
 
156
- ```
157
- $ ajimi
156
+ ```bash
157
+ $ ajimi help
158
158
  Commands:
159
- ajimi check # Show differences between the source and the target server
159
+ ajimi [check] # (Default subcommand) Show differences between the source and the target server
160
160
  ajimi dir <path> # Show differences between the source and the target server in the specified directory
161
161
  ajimi exec source|target <command> # Execute an arbitrary command on the source or the target server
162
162
  ajimi file <path> # Show differences between the source and the target server in the specified file
@@ -169,43 +169,43 @@ Options:
169
169
  # Default: true
170
170
  ```
171
171
 
172
- ```
172
+ ```bash
173
173
  $ ajimi help check
174
174
  Usage:
175
- ajimi check
175
+ ajimi [check]
176
176
 
177
177
  Options:
178
- [--check-root-path=CHECK_ROOT_PATH]
179
- [--find-max-depth=N]
180
- [--enable-check-contents], [--no-enable-check-contents]
181
- [--limit-check-contents=N]
182
- # Default: 0
183
- [--ajimifile=AJIMIFILE] # Ajimifile path
184
- # Default: ./Ajimifile
185
- [--verbose], [--no-verbose]
186
- # Default: true
187
-
188
- Show differences between the source and the target server
178
+ -r, [--check-root-path=CHECK_ROOT_PATH]
179
+ -d, [--find-max-depth=N]
180
+ -c, [--enable-check-contents], [--no-enable-check-contents]
181
+ [--limit-check-contents=N]
182
+ # Default: 0
183
+ [--ajimifile=AJIMIFILE] # Ajimifile path
184
+ # Default: ./Ajimifile
185
+ [--verbose], [--no-verbose]
186
+ # Default: true
187
+
188
+ (Default subcommand) Show differences between the source and the target server
189
189
  ```
190
190
 
191
- ```
191
+ ```bash
192
192
  $ ajimi help dir
193
193
  Usage:
194
194
  ajimi dir <path>
195
195
 
196
196
  Options:
197
- [--find-max-depth=N]
198
- # Default: 1
199
- [--ignored-pattern=IGNORED_PATTERN]
200
- [--ajimifile=AJIMIFILE] # Ajimifile path
201
- # Default: ./Ajimifile
202
- [--verbose], [--no-verbose]
203
- # Default: true
197
+ -d, [--find-max-depth=N]
198
+ # Default: 1
199
+ [--ignored-pattern=IGNORED_PATTERN]
200
+ [--ajimifile=AJIMIFILE] # Ajimifile path
201
+ # Default: ./Ajimifile
202
+ [--verbose], [--no-verbose]
203
+ # Default: true
204
204
 
205
205
  Show differences between the source and the target server in the specified directory
206
206
  ```
207
207
 
208
- ```
208
+ ```bash
209
209
  $ ajimi help file
210
210
  Usage:
211
211
  ajimi file <path>
@@ -220,7 +220,7 @@ Options:
220
220
  Show differences between the source and the target server in the specified file
221
221
  ```
222
222
 
223
- ```
223
+ ```bash
224
224
  $ ajimi help exec
225
225
  Usage:
226
226
  ajimi exec source|target <command>
@@ -253,4 +253,3 @@ Execute an arbitrary command on the source or the target server
253
253
  ## License
254
254
 
255
255
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
256
-
@@ -2,7 +2,8 @@ require 'diff/lcs'
2
2
 
3
3
  module Ajimi
4
4
  class Checker
5
- attr_accessor :diffs, :result, :source, :target, :diff_contents_cache, :enable_check_contents
5
+ attr_accessor :diffs, :result, :source, :target, :diff_contents_cache, :enable_check_contents,
6
+ :ignored_by_path, :pending_by_path, :ignored_by_content, :pending_by_content
6
7
 
7
8
  def initialize(config)
8
9
  @config = config
@@ -4,6 +4,7 @@ module Ajimi
4
4
  class Client < Thor
5
5
  attr_accessor :checker, :reporter
6
6
 
7
+ default_command :check
7
8
  class_option :ajimifile, :default => './Ajimifile', :desc => "Ajimifile path"
8
9
  class_option :verbose, :type => :boolean, :default => true
9
10
 
@@ -13,10 +14,10 @@ module Ajimi
13
14
  @config[:verbose] = options[:verbose] unless options[:verbose].nil?
14
15
  end
15
16
 
16
- desc "check", "Show differences between the source and the target server"
17
- option :check_root_path, :type => :string
18
- option :find_max_depth, :type => :numeric
19
- option :enable_check_contents, :type => :boolean, :default => false
17
+ desc "[check]", "(Default subcommand) Show differences between the source and the target server"
18
+ option :check_root_path, :aliases => "-r", :type => :string
19
+ option :find_max_depth, :aliases => "-d", :type => :numeric
20
+ option :enable_check_contents, :aliases => "-c", :type => :boolean, :default => false
20
21
  option :limit_check_contents, :type => :numeric, :default => 0
21
22
  def check
22
23
  @config.merge!( {
@@ -29,7 +30,7 @@ module Ajimi
29
30
  end
30
31
 
31
32
  desc "dir <path>", "Show differences between the source and the target server in the specified directory"
32
- option :find_max_depth, :type => :numeric, :default => 1
33
+ option :find_max_depth, :aliases => "-d", :type => :numeric, :default => 1
33
34
  option :ignored_pattern, :type => :string
34
35
  def dir(path)
35
36
  @config.merge!( {
@@ -53,10 +54,10 @@ module Ajimi
53
54
 
54
55
  _check
55
56
  end
56
-
57
+
57
58
  desc "exec source|target <command>", "Execute an arbitrary command on the source or the target server"
58
59
  def exec(server, command)
59
- raise ArgumentError, "server option must be source or target" unless %w(source target).include? server
60
+ raise ArgumentError, "server option must be source or target" unless %w(source target).include? server
60
61
 
61
62
  @server = @config[server.to_sym]
62
63
  puts "Execute command at #{server}_host: #{@server.host}\n"
@@ -66,7 +67,7 @@ module Ajimi
66
67
  end
67
68
 
68
69
  private
69
-
70
+
70
71
  def _check
71
72
  @checker ||= Checker.new(@config)
72
73
  result = @checker.check
@@ -75,7 +76,7 @@ module Ajimi
75
76
  @reporter.report
76
77
  result
77
78
  end
78
-
79
+
79
80
  end
80
81
 
81
82
  end
@@ -1,3 +1,3 @@
1
1
  module Ajimi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ajimi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masayuki Morita
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-29 00:00:00.000000000 Z
11
+ date: 2015-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -178,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
178
  version: '0'
179
179
  requirements: []
180
180
  rubyforge_project:
181
- rubygems_version: 2.2.2
181
+ rubygems_version: 2.4.5
182
182
  signing_key:
183
183
  specification_version: 4
184
184
  summary: server diff tool