Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Do not use autoloading

Use of autoload is discouraged.
  • Loading branch information...
commit 0d3769cb03cc0ef72243bb7c44c3174518953341 1 parent fb97351
@koraktor authored
View
13 lib/metior.rb
@@ -6,6 +6,7 @@
require 'core_ext/object'
require 'metior/errors'
require 'metior/version'
+require 'metior/vcs'
# Metior is a source code history analyzer that provides various statistics
# about a source code repository and its change over time.
@@ -13,18 +14,6 @@
# @author Sebastian Staudt
module Metior
- autoload :Actor, 'metior/actor'
- autoload :Adapter, 'metior/adapter'
- autoload :ActorCollection, 'metior/collections/actor_collection'
- autoload :AutoIncludeAdapter, 'metior/auto_include_adapter'
- autoload :Collection, 'metior/collections/collection'
- autoload :Commit, 'metior/commit'
- autoload :CommitCollection, 'metior/collections/commit_collection'
- autoload :Registerable, 'metior/registerable'
- autoload :Report, 'metior/report'
- autoload :Repository, 'metior/repository'
- autoload :VCS, 'metior/vcs'
-
# This holds all available reports, i.e. their names and the corresponding
# class
@@reports = {}
View
3  lib/metior/actor.rb
@@ -3,6 +3,9 @@
#
# Copyright (c) 2011-2012, Sebastian Staudt
+require 'metior/auto_include_adapter'
+require 'metior/collections/commit_collection'
+
module Metior
# Represents an actor in a source code repository
View
8 lib/metior/adapter.rb
@@ -3,6 +3,8 @@
#
# Copyright (c) 2012, Sebastian Staudt
+require 'metior/registerable'
+
# @author Sebastian Staudt
module Metior::Adapter
@@ -28,9 +30,9 @@ def const_missing(const)
# adapter implementation.
def init
path = id.to_s
- autoload :Actor, "metior/adapter/#{path}/actor"
- autoload :Commit, "metior/adapter/#{path}/commit"
- autoload :Repository, "metior/adapter/#{path}/repository"
+ require "metior/adapter/#{path}/actor"
+ require "metior/adapter/#{path}/commit"
+ require "metior/adapter/#{path}/repository"
self
end
View
2  lib/metior/adapter/grit.rb
@@ -3,6 +3,8 @@
#
# Copyright (c) 2012, Sebastian Staudt
+require 'metior/adapter'
+
# The Metior implementation for Git using Grit
#
# @author Sebastian Staudt
View
2  lib/metior/adapter/grit/actor.rb
@@ -3,6 +3,8 @@
#
# Copyright (c) 2011-2012, Sebastian Staudt
+require 'metior/actor'
+
module Metior::Adapter::Grit
# Represents an actor in a Git source code repository, i.e. an author or
View
2  lib/metior/adapter/grit/commit.rb
@@ -3,6 +3,8 @@
#
# Copyright (c) 2011-2012, Sebastian Staudt
+require 'metior/commit'
+
module Metior::Adapter::Grit
# Represents a commit in a Git source code repository
View
2  lib/metior/adapter/grit/repository.rb
@@ -5,6 +5,8 @@
require 'grit'
+require 'metior/repository'
+
module Metior::Adapter::Grit
# Represents a Git source code repository
View
2  lib/metior/adapter/octokit.rb
@@ -3,6 +3,8 @@
#
# Copyright (c) 2012, Sebastian Staudt
+require 'metior/adapter'
+
# The Metior implementation for Git using GitHub's API via Octokit
#
# @author Sebastian Staudt
View
2  lib/metior/adapter/octokit/actor.rb
@@ -3,6 +3,8 @@
#
# Copyright (c) 2011-2012, Sebastian Staudt
+require 'metior/actor'
+
module Metior::Adapter::Octokit
# Represents an actor in a GitHub source code repository, i.e. an author or
View
2  lib/metior/adapter/octokit/commit.rb
@@ -5,6 +5,8 @@
require 'time'
+require 'metior/commit'
+
module Metior::Adapter::Octokit
# Represents a commit in a GitHub source code repository
View
2  lib/metior/adapter/octokit/repository.rb
@@ -5,6 +5,8 @@
require 'octokit'
+require 'metior/repository'
+
module Metior::Adapter::Octokit
# Represents a GitHub source code repository
View
5 lib/metior/collections/actor_collection.rb
@@ -1,7 +1,10 @@
# This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
-# Copyright (c) 2011, Sebastian Staudt
+# Copyright (c) 2011-2012, Sebastian Staudt
+
+require 'metior/collections/commit_collection'
+require 'metior/collections/collection'
module Metior
View
5 lib/metior/collections/commit_collection.rb
@@ -1,11 +1,14 @@
# This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
-# Copyright (c) 2011, Sebastian Staudt
+# Copyright (c) 2011-2012, Sebastian Staudt
require 'date'
require 'time'
+require 'metior/collections/actor_collection'
+require 'metior/collections/collection'
+
module Metior
# This class implements a collection of commits and provides functionality
View
2  lib/metior/commit.rb
@@ -3,6 +3,8 @@
#
# Copyright (c) 2011-2012, Sebastian Staudt
+require 'metior/auto_include_adapter'
+
module Metior
# This class represents a commit in a source code repository
View
1  lib/metior/report/view.rb
@@ -3,6 +3,7 @@
#
# Copyright (c) 2011-2012, Sebastian Staudt
+require 'metior/report'
require 'metior/report/view_helper'
module Metior::Report
View
3  lib/metior/repository.rb
@@ -3,6 +3,9 @@
#
# Copyright (c) 2011-2012, Sebastian Staudt
+require 'metior/auto_include_adapter'
+require 'metior/collections/commit_collection'
+
module Metior
# This class represents a source code repository.
View
1  lib/metior/vcs.rb
@@ -4,6 +4,7 @@
# Copyright (c) 2011-2012, Sebastian Staudt
require 'metior/errors'
+require 'metior/registerable'
module Metior
View
2  lib/metior/vcs/git.rb
@@ -3,6 +3,8 @@
#
# Copyright (c) 2012, Sebastian Staudt
+require 'metior/vcs'
+
# The VCS module for Git
#
# @author Sebastian Staudt
View
6 test/test_adapter.rb
@@ -34,9 +34,9 @@ module MockAdapter
end
should 'automatically try to load the VCS implementation files' do
- MockAdapter.expects(:autoload).with(:Actor, 'metior/adapter/mock/actor').once
- MockAdapter.expects(:autoload).with(:Commit, 'metior/adapter/mock/commit').once
- MockAdapter.expects(:autoload).with(:Repository, 'metior/adapter/mock/repository').once
+ MockAdapter.expects(:require).with('metior/adapter/mock/actor').once
+ MockAdapter.expects(:require).with('metior/adapter/mock/commit').once
+ MockAdapter.expects(:require).with('metior/adapter/mock/repository').once
begin
MockAdapter::Commit
View
1  test/test_grit.rb
@@ -4,6 +4,7 @@
# Copyright (c) 2011-2012, Sebastian Staudt
require 'helper'
+require 'metior/adapter/grit'
class TestGrit < Test::Unit::TestCase
View
2  test/test_octokit.rb
@@ -5,6 +5,8 @@
require 'helper'
+require 'metior/adapter/octokit'
+
class TestOctokit < Test::Unit::TestCase
context 'The Octokit adapter' do
View
2  test/test_report.rb
@@ -5,6 +5,8 @@
require 'helper'
+require 'metior/report'
+
class Dummy
include Report
View
5 test/test_repository.rb
@@ -1,15 +1,14 @@
# This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
-# Copyright (c) 2011, Sebastian Staudt
+# Copyright (c) 2011-2012, Sebastian Staudt
require 'helper'
+require 'metior/repository'
class TestRepository < Test::Unit::TestCase
def setup
- require 'metior/repository'
-
@repo = Metior::Repository.new('dummy')
end
Please sign in to comment.
Something went wrong with that request. Please try again.