fluent_command_builder 0.8.5 → 0.8.6
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.
- data/lib/fluent_command_builder.rb +2 -0
- data/lib/fluent_command_builder/command_builders/fastlinkchecker.rb +24 -0
- data/lib/fluent_command_builder/command_builders/fastlinkchecker_21.rb +275 -0
- data/lib/fluent_command_builder/execution_context.rb +16 -8
- data/lib/fluent_command_builder/printer.rb +10 -0
- metadata +8 -6
@@ -17,6 +17,8 @@ require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/comma
|
|
17
17
|
require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/dotcover_11.rb')
|
18
18
|
require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/dotcover_12.rb')
|
19
19
|
require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/dotcover_20.rb')
|
20
|
+
require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/fastlinkchecker.rb')
|
21
|
+
require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/fastlinkchecker_21.rb')
|
20
22
|
require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/installutil.rb')
|
21
23
|
require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/installutil_11.rb')
|
22
24
|
require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/installutil_20.rb')
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Generated code. Do not modify.
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../underlying_builder')
|
4
|
+
|
5
|
+
module FluentCommandBuilder
|
6
|
+
def fastlinkchecker(&block)
|
7
|
+
FastLinkChecker.create &block
|
8
|
+
end
|
9
|
+
module FastLinkChecker
|
10
|
+
COMMAND_NAME = 'conlinkchecker'
|
11
|
+
def self.version_detector
|
12
|
+
@version_detector ||= DefaultVersionDetector.new COMMAND_NAME
|
13
|
+
end
|
14
|
+
def self.version_detector=(value)
|
15
|
+
@version_detector = value
|
16
|
+
end
|
17
|
+
def self.version(path=nil)
|
18
|
+
self.version_detector.version path
|
19
|
+
end
|
20
|
+
def self.create(&block)
|
21
|
+
version_module(FastLinkChecker).create &block
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,275 @@
|
|
1
|
+
# Generated code. Do not modify.
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../command_base')
|
4
|
+
require File.expand_path(File.dirname(__FILE__) + '/../printer')
|
5
|
+
require File.expand_path(File.dirname(__FILE__) + '/../underlying_builder')
|
6
|
+
|
7
|
+
module FluentCommandBuilder
|
8
|
+
def fastlinkchecker_21
|
9
|
+
FluentCommandBuilder::FastLinkChecker::V21.create { |b| yield b if block_given? }
|
10
|
+
end
|
11
|
+
module FastLinkChecker
|
12
|
+
module V21
|
13
|
+
VERSION = '2.1'
|
14
|
+
def self.default_path
|
15
|
+
@default_path ||= nil
|
16
|
+
end
|
17
|
+
def self.default_path=(value)
|
18
|
+
printer = FluentCommandBuilder::Printer.new
|
19
|
+
begin
|
20
|
+
printer.print_warning %Q[Default Path for command "#{FluentCommandBuilder::FastLinkChecker::COMMAND_NAME} #{VERSION}" does not exist. Path: #{value}] unless File.exist? value
|
21
|
+
rescue
|
22
|
+
printer.print_warning %Q[Failed to determine whether Default Path for command "#{FluentCommandBuilder::FastLinkChecker::COMMAND_NAME} #{VERSION}" exists. An internal error occurred.]
|
23
|
+
end
|
24
|
+
@default_path = value
|
25
|
+
end
|
26
|
+
def self.create
|
27
|
+
b = UnderlyingBuilder.new FluentCommandBuilder::FastLinkChecker::COMMAND_NAME
|
28
|
+
b.path = self.default_path
|
29
|
+
c = FastLinkChecker.new(b)
|
30
|
+
yield b if block_given?
|
31
|
+
c
|
32
|
+
end
|
33
|
+
def fastlinkchecker
|
34
|
+
FluentCommandBuilder::FastLinkChecker::V21.create { |b| yield b if block_given? }
|
35
|
+
end
|
36
|
+
class FastLinkChecker < CommandBase
|
37
|
+
def initialize(underlying_builder)
|
38
|
+
super underlying_builder
|
39
|
+
end
|
40
|
+
def site(url)
|
41
|
+
@b.append " --site #{@b.format url}"
|
42
|
+
yield @b if block_given?
|
43
|
+
self
|
44
|
+
end
|
45
|
+
def check_hyperlinks
|
46
|
+
@b.append ' -checkHyperlinks'
|
47
|
+
yield @b if block_given?
|
48
|
+
self
|
49
|
+
end
|
50
|
+
def check_images
|
51
|
+
@b.append ' -checkImages'
|
52
|
+
yield @b if block_given?
|
53
|
+
self
|
54
|
+
end
|
55
|
+
def check_others
|
56
|
+
@b.append ' -checkOthers'
|
57
|
+
yield @b if block_given?
|
58
|
+
self
|
59
|
+
end
|
60
|
+
def recheck_bad(recheck_times)
|
61
|
+
@b.append " -recheckBad #{@b.format recheck_times}"
|
62
|
+
yield @b if block_given?
|
63
|
+
self
|
64
|
+
end
|
65
|
+
def disp(server_name)
|
66
|
+
@b.append " -disp #{@b.format server_name}"
|
67
|
+
yield @b if block_given?
|
68
|
+
self
|
69
|
+
end
|
70
|
+
def auth(auth_type)
|
71
|
+
@b.append " -auth #{@b.format auth_type}"
|
72
|
+
yield @b if block_given?
|
73
|
+
self
|
74
|
+
end
|
75
|
+
def username(username)
|
76
|
+
@b.append " -user #{@b.format username}"
|
77
|
+
yield @b if block_given?
|
78
|
+
self
|
79
|
+
end
|
80
|
+
def password(password)
|
81
|
+
@b.append " -pwd #{@b.format_password password}"
|
82
|
+
yield @b if block_given?
|
83
|
+
self
|
84
|
+
end
|
85
|
+
def ignore_robots_txt
|
86
|
+
@b.append ' -ignoreRobotsTxt'
|
87
|
+
yield @b if block_given?
|
88
|
+
self
|
89
|
+
end
|
90
|
+
def check_first_only
|
91
|
+
@b.append ' -checkFirstOnly'
|
92
|
+
yield @b if block_given?
|
93
|
+
self
|
94
|
+
end
|
95
|
+
def check_no_extern
|
96
|
+
@b.append ' -checkNoExtern'
|
97
|
+
yield @b if block_given?
|
98
|
+
self
|
99
|
+
end
|
100
|
+
def check_ignore_case
|
101
|
+
@b.append ' -checkIgnoreCase'
|
102
|
+
yield @b if block_given?
|
103
|
+
self
|
104
|
+
end
|
105
|
+
def ignore_cookies
|
106
|
+
@b.append ' -ignoreCookies'
|
107
|
+
yield @b if block_given?
|
108
|
+
self
|
109
|
+
end
|
110
|
+
def not_ignore_www
|
111
|
+
@b.append ' -notIgnoreWww'
|
112
|
+
yield @b if block_given?
|
113
|
+
self
|
114
|
+
end
|
115
|
+
def check_parent_dir
|
116
|
+
@b.append ' -checkParentDir'
|
117
|
+
yield @b if block_given?
|
118
|
+
self
|
119
|
+
end
|
120
|
+
def ignore_relative
|
121
|
+
@b.append ' -ignoreRelative'
|
122
|
+
yield @b if block_given?
|
123
|
+
self
|
124
|
+
end
|
125
|
+
def get_after_head_fail
|
126
|
+
@b.append ' -getAfterHeadFail'
|
127
|
+
yield @b if block_given?
|
128
|
+
self
|
129
|
+
end
|
130
|
+
def check_restrict(check_level)
|
131
|
+
@b.append " -checkRestrict #{@b.format check_level}"
|
132
|
+
yield @b if block_given?
|
133
|
+
self
|
134
|
+
end
|
135
|
+
def size_limit_above
|
136
|
+
@b.append ' -sizeLimitAbove'
|
137
|
+
yield @b if block_given?
|
138
|
+
self
|
139
|
+
end
|
140
|
+
def size_limit_below(size_limit_k_b)
|
141
|
+
@b.append " -sizeLimitBelow #{@b.format size_limit_k_b}"
|
142
|
+
yield @b if block_given?
|
143
|
+
self
|
144
|
+
end
|
145
|
+
def limit_links(link_type, n)
|
146
|
+
@b.append " -limitLinks #{@b.format link_type} #{@b.format n}"
|
147
|
+
yield @b if block_given?
|
148
|
+
self
|
149
|
+
end
|
150
|
+
def skip_slow_links
|
151
|
+
@b.append ' -skipSlowLinks'
|
152
|
+
yield @b if block_given?
|
153
|
+
self
|
154
|
+
end
|
155
|
+
def check_only(wildcards)
|
156
|
+
@b.append " -checkOnly #{@b.format wildcards}"
|
157
|
+
yield @b if block_given?
|
158
|
+
self
|
159
|
+
end
|
160
|
+
def skip_files(wildcards)
|
161
|
+
@b.append " -skipFiles #{@b.format wildcards}"
|
162
|
+
yield @b if block_given?
|
163
|
+
self
|
164
|
+
end
|
165
|
+
def skip_domains(domain_list)
|
166
|
+
@b.append " -skipDomains #{@b.format domain_list}"
|
167
|
+
yield @b if block_given?
|
168
|
+
self
|
169
|
+
end
|
170
|
+
def skip_bookmarks(bookmarkslist)
|
171
|
+
@b.append " -skipBookmarks #{@b.format bookmarkslist}"
|
172
|
+
yield @b if block_given?
|
173
|
+
self
|
174
|
+
end
|
175
|
+
def ignore_form_tag
|
176
|
+
@b.append ' -ignoreFormTag'
|
177
|
+
yield @b if block_given?
|
178
|
+
self
|
179
|
+
end
|
180
|
+
def not_ignore_spaces
|
181
|
+
@b.append ' -notIgnoreSpaces'
|
182
|
+
yield @b if block_given?
|
183
|
+
self
|
184
|
+
end
|
185
|
+
def ini(ini_file)
|
186
|
+
@b.append " --ini #{@b.format ini_file}"
|
187
|
+
yield @b if block_given?
|
188
|
+
self
|
189
|
+
end
|
190
|
+
def flc(flc_file)
|
191
|
+
@b.append " --flc #{@b.format flc_file}"
|
192
|
+
yield @b if block_given?
|
193
|
+
self
|
194
|
+
end
|
195
|
+
def cache
|
196
|
+
@b.append ' --cache'
|
197
|
+
yield @b if block_given?
|
198
|
+
self
|
199
|
+
end
|
200
|
+
def verbosely
|
201
|
+
@b.append ' --verbosely'
|
202
|
+
yield @b if block_given?
|
203
|
+
self
|
204
|
+
end
|
205
|
+
def print_broken
|
206
|
+
@b.append ' --printBroken'
|
207
|
+
yield @b if block_given?
|
208
|
+
self
|
209
|
+
end
|
210
|
+
def user_agent(agent_name)
|
211
|
+
@b.append " --userAgent #{@b.format agent_name}"
|
212
|
+
yield @b if block_given?
|
213
|
+
self
|
214
|
+
end
|
215
|
+
def report(report_type)
|
216
|
+
@b.append " --report #{@b.format report_type}"
|
217
|
+
yield @b if block_given?
|
218
|
+
self
|
219
|
+
end
|
220
|
+
def from(address)
|
221
|
+
@b.append " -from #{@b.format address}"
|
222
|
+
yield @b if block_given?
|
223
|
+
self
|
224
|
+
end
|
225
|
+
def subject(subject)
|
226
|
+
@b.append " -subject #{@b.format subject}"
|
227
|
+
yield @b if block_given?
|
228
|
+
self
|
229
|
+
end
|
230
|
+
def attach
|
231
|
+
@b.append ' -attach'
|
232
|
+
yield @b if block_given?
|
233
|
+
self
|
234
|
+
end
|
235
|
+
def start_tls
|
236
|
+
@b.append ' -startTls'
|
237
|
+
yield @b if block_given?
|
238
|
+
self
|
239
|
+
end
|
240
|
+
def columns(columns)
|
241
|
+
@b.append " -columns #{@b.format columns}"
|
242
|
+
yield @b if block_given?
|
243
|
+
self
|
244
|
+
end
|
245
|
+
def sort(sort_columns)
|
246
|
+
@b.append " -sort #{@b.format sort_columns}"
|
247
|
+
yield @b if block_given?
|
248
|
+
self
|
249
|
+
end
|
250
|
+
def unprocessed
|
251
|
+
@b.append ' -unprocessed'
|
252
|
+
yield @b if block_given?
|
253
|
+
self
|
254
|
+
end
|
255
|
+
def filename(filename)
|
256
|
+
@b.append " #{@b.format filename}"
|
257
|
+
yield @b if block_given?
|
258
|
+
self
|
259
|
+
end
|
260
|
+
def email(email, port=nil, username=nil, password=nil)
|
261
|
+
@b.append " #{@b.format email}"
|
262
|
+
@b.append " smtpserver:#{@b.format port} #{@b.format username} #{@b.format_password password}" unless port.nil? or username.nil? or password.nil?
|
263
|
+
yield @b if block_given?
|
264
|
+
self
|
265
|
+
end
|
266
|
+
def help
|
267
|
+
@b.append ' -h'
|
268
|
+
yield @b if block_given?
|
269
|
+
self
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
end
|
274
|
+
end
|
275
|
+
end
|
@@ -1,10 +1,9 @@
|
|
1
|
-
require '
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/printer')
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + '/command_executors/system_executor')
|
3
3
|
require File.expand_path(File.dirname(__FILE__) + '/command_formatters/null_formatter')
|
4
4
|
|
5
5
|
module FluentCommandBuilder
|
6
6
|
class ExecutionContext
|
7
|
-
include Term::ANSIColor
|
8
7
|
|
9
8
|
attr_accessor :executor, :formatter, :should_print_on_execute, :should_fail_on_error
|
10
9
|
|
@@ -13,13 +12,15 @@ module FluentCommandBuilder
|
|
13
12
|
@formatter = NullFormatter.new
|
14
13
|
@should_print_on_execute = true
|
15
14
|
@should_fail_on_error = true
|
15
|
+
@printer = FluentCommandBuilder::Printer.new
|
16
16
|
end
|
17
17
|
|
18
18
|
def execute(underlying_builder)
|
19
19
|
validate_should_print_on_execute
|
20
20
|
validate_should_fail_on_error
|
21
|
+
validate_path underlying_builder
|
21
22
|
visible_command = @formatter.format underlying_builder
|
22
|
-
|
23
|
+
print_command visible_command
|
23
24
|
@executor.execute(underlying_builder) do |status|
|
24
25
|
raise "Command failed with status (#{status.exitstatus}): [#{visible_command}]" if @should_fail_on_error && !status.success?
|
25
26
|
end
|
@@ -27,11 +28,6 @@ module FluentCommandBuilder
|
|
27
28
|
|
28
29
|
private
|
29
30
|
|
30
|
-
def print_command_on_execute(visible_command)
|
31
|
-
print magenta, visible_command, reset, "\n" if @should_print_on_execute && !@executor.will_print_on_execute?
|
32
|
-
STDOUT.flush
|
33
|
-
end
|
34
|
-
|
35
31
|
def validate_should_print_on_execute
|
36
32
|
raise "should_print_on_execute must be true for #{@executor}." if !@should_print_on_execute && @executor.will_print_on_execute?
|
37
33
|
end
|
@@ -40,6 +36,18 @@ module FluentCommandBuilder
|
|
40
36
|
raise "should_fail_on_error must be true for #{@executor}." if !@should_fail_on_error && @executor.will_fail_on_error?
|
41
37
|
end
|
42
38
|
|
39
|
+
def validate_path(underlying_builder)
|
40
|
+
return unless underlying_builder.path
|
41
|
+
return if File.exist? underlying_builder.path
|
42
|
+
message = %Q[Path for command "#{underlying_builder.command_name}" does not exist. Path: #{underlying_builder.path}]
|
43
|
+
@printer.print_error message
|
44
|
+
raise message
|
45
|
+
end
|
46
|
+
|
47
|
+
def print_command(visible_command)
|
48
|
+
@printer.print_command visible_command if @should_print_on_execute && !@executor.will_print_on_execute?
|
49
|
+
end
|
50
|
+
|
43
51
|
end
|
44
52
|
end
|
45
53
|
|
@@ -9,5 +9,15 @@ module FluentCommandBuilder
|
|
9
9
|
STDOUT.flush
|
10
10
|
end
|
11
11
|
|
12
|
+
def print_error(message)
|
13
|
+
print red, 'ERROR: ', message, reset, "\n"
|
14
|
+
STDOUT.flush
|
15
|
+
end
|
16
|
+
|
17
|
+
def print_command(command)
|
18
|
+
print magenta, command, reset, "\n"
|
19
|
+
STDOUT.flush
|
20
|
+
end
|
21
|
+
|
12
22
|
end
|
13
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent_command_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70309445754720 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70309445754720
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: term-ansicolor
|
27
|
-
requirement: &
|
27
|
+
requirement: &70309445754280 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70309445754280
|
36
36
|
description: Fluent Command Builder makes building command lines easy and clean.
|
37
37
|
email: matthew-github@matthewriley.name
|
38
38
|
executables: []
|
@@ -59,6 +59,8 @@ files:
|
|
59
59
|
- lib/fluent_command_builder/command_builders/dotcover_11.rb
|
60
60
|
- lib/fluent_command_builder/command_builders/dotcover_12.rb
|
61
61
|
- lib/fluent_command_builder/command_builders/dotcover_20.rb
|
62
|
+
- lib/fluent_command_builder/command_builders/fastlinkchecker.rb
|
63
|
+
- lib/fluent_command_builder/command_builders/fastlinkchecker_21.rb
|
62
64
|
- lib/fluent_command_builder/command_builders/installutil.rb
|
63
65
|
- lib/fluent_command_builder/command_builders/installutil_11.rb
|
64
66
|
- lib/fluent_command_builder/command_builders/installutil_20.rb
|