Module: DCA

Defined in:
lib/dca.rb,
lib/dca/cli.rb,
lib/dca/jobs/job.rb,
lib/dca/commands/area.rb,
lib/dca/models/binder.rb,
lib/dca/helpers/logger.rb,
lib/dca/models/position.rb,
lib/dca/storage/storage.rb,
lib/dca/jobs/analyzer_job.rb,
lib/dca/models/base_model.rb,
lib/dca/notifier/notifier.rb,
lib/dca/net/browser_helper.rb,
lib/dca/models/binder_helper.rb,
lib/dca/storage/mongo_storage.rb,
lib/dca/models/nokogiri_binder.rb,
lib/dca/notifier/redis/notifier.rb,
lib/dca/notifier/redis_notifier.rb,
lib/dca/notifier/redis/models/session.rb,
lib/dca/storage/elasticsearch_storage.rb,
lib/dca/notifier/redis/models/fetch_notify.rb,
lib/dca/notifier/redis/models/analyze_notify.rb,
lib/dca/notifier/redis/models/failure_notify.rb

Defined Under Namespace

Modules: Commands, Helpers, Jobs, Models, Net, Redis, Storage Classes: ApplicationError, CLI, ElasticSearchStorage, MongoStorage, Notifier, RedisNotifier

Class Method Summary collapse

Class Method Details

.project_fileObject



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

def self.project_file
  @project_path ||= project_path + '.rb'
end

.project_nameObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/dca.rb', line 27

def self.project_name
  return @project if @project.present?

  gemspec = Dir[File.join self.root, '*.gemspec'].first
  raise 'Generate gemspec file' if gemspec.blank?

  gem = Gem::Specification.load gemspec
  raise 'Set gem name in gemspec'  if gem.name.blank?

  @project = gem.name.camelize
  if @project.safe_constantize.nil?
    @project = (Object.constants.detect { |const|
      const.to_s.downcase == @project.downcase}).to_s
    raise "Unknown project name" if @project.nil?
  end

  @project
end

.project_pathObject



46
47
48
# File 'lib/dca.rb', line 46

def self.project_path
  @project_path ||= File.join(DCA.root, 'lib', File.basename(DCA.root))
end

.rootObject



19
20
21
# File 'lib/dca.rb', line 19

def self.root
  Dir.pwd
end

.used?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/dca.rb', line 23

def self.used?
  File.basename(self.root).downcase != 'dca'
end