Top Level Namespace
Defined Under Namespace
Modules: Grit, TransparentGit
Classes: Object, POChange, RepoFile, String
Instance Method Summary
collapse
Instance Method Details
#each_tree_file(tree, prefix = nil, &b) ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
|
# 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) ⇒ Object
1
2
3
4
5
6
7
8
9
10
11
12
|
# 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
|
#run_all_specs!(ops = {}) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# 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) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# 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)
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
elsif f
run_files[[f]]
end
end
|
#with_chdir(dir) ⇒ Object
14
15
16
17
18
19
20
21
|
# 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
|