Skip to content
This repository has been archived by the owner on Jan 10, 2019. It is now read-only.

Commit

Permalink
removed untested spike code from gizmo executable
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Cunningham committed Apr 8, 2010
1 parent 6c407ca commit 96282a9
Showing 1 changed file with 3 additions and 40 deletions.
43 changes: 3 additions & 40 deletions bin/gizmo
Expand Up @@ -7,46 +7,11 @@ require 'active_support'
$LOAD_PATH << File.dirname(__FILE__) + '/../lib'
require 'gizmo'

@current_mixin = nil

def puts_list methods
return puts "[]" if methods.empty?
puts methods.sort.join(', ')
end

opts = OptionParser.new do |opts|

opts.on("-v", "--version", "what's the frequency kenneth?") do
puts "gizmo version: 0.0.0"
end

opts.on("-g", "--generate-mixin [NAME]", "generate a new page mixin") do |mixin_name|
File.open("#{Gizmo::Config.mixin_path}/page_with_#{mixin_name}.rb", "w") do |file|
content = <<-EOS
module PageWith#{mixin_name.camelize}
# def valid
# has_selector?('my-container')
# end
end
EOS
file.write(content.strip)
end
end

opts.on("-p", "--with-page [NAME]") do |mixin_name|
Gizmo.load_mixins! File.join(Dir.pwd, Gizmo::Config.mixin_path)
mixin = Object.const_get("PageWith" + mixin_name.camelize)
@current_mixin = { :name => mixin_name, :obj => Gizmo::Page.new({}, '', {}).extend(mixin) }
end

opts.on('-m', '--list-methods', 'list all the methods for a mixin') do
puts "---- methods for #{@current_mixin[:name]} ----"
puts_list @current_mixin[:obj].methods
end

opts.on('-f', '--filter-methods [QUERY]', 'filter methods for a mixin') do |query|
puts "---- methods for #{@current_mixin[:name]} matching #{query} ----"
puts_list @current_mixin[:obj].methods.select { |m| m =~ /#{query}/ }
opts.on("-v", "--version") do
puts "gizmo #{IO.readlines(File.join(File.dirname(__FILE__), '..', 'VERSION'))}"
end

end
Expand All @@ -57,6 +22,4 @@ if ARGV.size == 0
exit 1
end

opts.parse!

@current_mixin = nil
opts.parse!

0 comments on commit 96282a9

Please sign in to comment.