-
-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make sub classing flay work #67
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,13 +27,13 @@ class Location < Struct.new(:file, :line, :fuzzy) | |
end | ||
|
||
def self.run args = ARGV | ||
extensions = ["rb"] + Flay.load_plugins | ||
extensions = ["rb"] + load_plugins | ||
glob = "**/*.{#{extensions.join ","}}" | ||
|
||
expander = PathExpander.new args, glob | ||
files = expander.filter_files expander.process, DEFAULT_IGNORE | ||
|
||
flay = Flay.new Flay.parse_options args | ||
flay = new parse_options args | ||
flay.process(*files) | ||
flay | ||
end | ||
|
@@ -63,7 +63,7 @@ def self.parse_options args = ARGV | |
|
||
OptionParser.new do |opts| | ||
opts.banner = "flay [options] files_or_dirs" | ||
opts.version = Flay::VERSION | ||
opts.version = VERSION | ||
|
||
opts.separator "" | ||
opts.separator "Specific options:" | ||
|
@@ -113,7 +113,7 @@ def self.parse_options args = ARGV | |
options[:timeout] = t.to_i | ||
end | ||
|
||
extensions = ["rb"] + Flay.load_plugins | ||
extensions = ["rb"] + load_plugins | ||
|
||
opts.separator "" | ||
opts.separator "Known extensions: #{extensions.join(", ")}" | ||
|
@@ -170,7 +170,7 @@ def self.load_plugins | |
# Create a new instance of Flay with +option+s. | ||
|
||
def initialize option = nil | ||
@option = option || Flay.default_options | ||
@option = option || self.class.default_options | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto? Not sure There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if Fooflay overrides Flay and defines overrides default_options, then these options should be used and not the original Flay options ... atm it makes overriding do nothing |
||
@hashes = Hash.new { |h,k| h[k] = [] } | ||
|
||
self.identical = {} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I agree with that one... I guess it depends on what you're trying to achieve w/ the subclass?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I build a FooFlay and it has a FooFlay::VERSION, then using
fooflay -v
should show fooflays versionThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I get that... theoretically... but is Flay::VERSION no longer relevant? You are subclassing it so I figure you want to report it somewhere.
What does your subclass do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the subclass overwrites the default options and some methods ... does not need the VERSION, but it is theoretically wrong to hardcode the class so I'm removing all the hardcoded classes so nobody has to come back here and to make it consistent