class Object
Public Instance Methods
blank?()
click to toggle source
# File lib/transparent_git/ext.rb, line 24 def blank? to_s.strip == '' end
each_tree_file(tree,prefix=nil) { |name,obj| ... }
click to toggle source
# File lib/transparent_git/repo.rb, line 63 def each_tree_file(tree,prefix=nil,&b) tree.contents.each do |obj| if obj.respond_to?(:contents) new_prefix = [prefix,obj.name].select { |x| x }.join("/") each_tree_file(obj,new_prefix,&b) else name = [prefix,obj.name].select { |x| x }.join("/") yield(name,obj) end end end
git(*args)
click to toggle source
# File lib/transparent_git/ext.rb, line 1 def git(*args) exe = "c:/progra~1/git/bin/git" if args.empty? exe else str = args.join(" ") cmd = "#{exe} #{str}" res = ec cmd raise "cmd: #{cmd}\nres: #{res}" if res =~ /(error|fatal)/i || $?.exitstatus != 0 res end end
klass()
click to toggle source
# File lib/transparent_git/ext.rb, line 40 def klass self.class end
present?()
click to toggle source
# File lib/transparent_git/ext.rb, line 27 def present? !blank? end
run_all_specs!(ops={})
click to toggle source
# File lib/run_specs.rb, line 35 def run_all_specs!(ops={}) return unless ops[:force] run_files = lambda do |fs| RSpec.instance_eval { @configuration = RSpec::Core::Configuration.new } RSpec::world.instance_eval { @example_groups = [] } fs.each { |f| load f } RSpec::Core::Runner.run([], $stderr, $stdout) end all = Dir["spec/**/*_spec.rb"] run_files[all] end
run_specs!(f=nil)
click to toggle source
# File lib/run_specs.rb, line 3 def run_specs!(f=nil) return unless f =~ /_spec\.rb/ orig_f = f run_files = lambda do |fs| RSpec.instance_eval { @configuration = RSpec::Core::Configuration.new } RSpec::world.instance_eval { @example_groups = [] } fs.each { |f| load f } RSpec::Core::Runner.run([], $stderr, $stdout) end if f && !(f =~ /spec/i) b = File.basename(f).split(".").first f = "spec/#{b}_spec.rb" if FileTest.exists?(f) # nothing elsif orig_f =~ /field_defs/ f = "spec/field_defs_spec.rb" else f = nil end end all = Dir["spec/*_spec.rb"] if $run_all_specs_each_time #run_files[all] elsif f run_files[[f]] end end
with_chdir(dir) { || ... }
click to toggle source
# File lib/transparent_git/ext.rb, line 14 def with_chdir(dir) puts "chdir to #{dir}" old = Dir.getwd Dir.chdir(dir) yield ensure Dir.chdir(old) end