Module: Rzero

Defined in:
lib/rzero.rb,
lib/rzero/version.rb

Defined Under Namespace

Modules: VERSION

Instance Method Summary collapse

Instance Method Details

#missing_filesObject



9
10
11
# File 'lib/rzero.rb', line 9

def missing_files
  production_files - test_files
end

#production_filesObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rzero.rb', line 13

def production_files
  
  @app_controllers = File.join(@pwd, "app/controllers")
  @app_models = File.join(@pwd, "app/models")
  @app_helpers = File.join(@pwd, "app/helpers")

  @production_files = Array.new

  [@app_controllers, @app_models, @app_helpers].each do |dir|
    Find.find dir do |path|
      Find.prune if File.basename(path)[0] == ?.
      @production_files << File.basename(path, ".rb") unless FileTest.directory? path
    end
  end
  
  @production_files
end

#push_application_controller_testObject



50
51
52
# File 'lib/rzero.rb', line 50

def push_application_controller_test
  @test_files.select { |file| file.replace "application" if file == "application_controller" }
end

#test_filesObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rzero.rb', line 31

def test_files
  @test_unit = File.join(@pwd, "test/unit")
  @test_functional = File.join(@pwd, "test/functional")

  @test_files = Array.new
  
  [@test_unit, @test_functional].each do |dir|
    Find.find dir do |path|
      Find.prune if File.basename(path)[0] == ?.
      next unless path =~ /.rb/
      @test_files << File.basename(path, "_test.rb") unless FileTest.directory? path
    end
  end
  
  push_application_controller_test
  
  @test_files
end