Module: Bizside

Defined in:
lib/bizside.rb,
lib/bizside/acl.rb,
lib/bizside/yes.rb,
lib/bizside/rsync.rb,
lib/bizside/config.rb,
lib/bizside/engine.rb,
lib/bizside/gengou.rb,
lib/bizside/mailer.rb,
lib/bizside/resque.rb,
lib/bizside/railtie.rb,
lib/bizside/version.rb,
lib/bizside/warning.rb,
lib/bizside/audit_log.rb,
lib/bizside/job_utils.rb,
lib/bizside/sql_utils.rb,
lib/bizside/string_io.rb,
lib/bizside/cache_util.rb,
lib/bizside/user_agent.rb,
lib/bizside/cache/entry.rb,
lib/bizside/cache/store.rb,
lib/bizside/carrierwave.rb,
lib/bizside/itamae_conf.rb,
lib/bizside/view_helper.rb,
lib/bizside/audit/logger.rb,
lib/bizside/hanaita_conf.rb,
lib/bizside/string_utils.rb,
lib/bizside/file_uploader.rb,
lib/bizside/implicit_ftps.rb,
lib/bizside/query_builder.rb,
lib/bizside/stdout_logger.rb,
lib/bizside/uploader/exif.rb,
lib/bizside/cron_validator.rb,
lib/bizside/file_converter.rb,
lib/bizside/coverage/launch.rb,
lib/bizside/show_exceptions.rb,
lib/bizside/audit/job_logger.rb,
lib/bizside/cache/file_store.rb,
lib/bizside/configurations/mail.rb,
lib/bizside/record_has_warnings.rb,
lib/bizside/acl/controller_helper.rb,
lib/bizside/configurations/prefix.rb,
lib/bizside/configurations/storage.rb,
lib/bizside/uploader/filename_validator.rb,
lib/bizside/uploader/extension_whitelist.rb,
lib/bizside/user_agent/controller_helper.rb,
lib/bizside/uploader/content_type_validator.rb

Defined Under Namespace

Modules: Acl, Audit, Cache, CacheUtil, Configurations, FileConverter, HanaitaConfAccessorMixin, ItamaeConfAccessorMixin, Mailer, Resque, Rsync, SafePty, Uploader, ViewHelper, Warning Classes: AuditLog, CacheUtils, CarrierwaveStringIO, Config, CoverageLaunch, CronValidator, Engine, FileUploader, Gengou, HanaitaConf, HanaitaConfSub, ImplicitFTPS, ItamaeConf, ItamaeConfSub, JobUtils, QueryBuilder, Railtie, RecordHasWarnings, ShibUtils, ShowExceptions, SqlUtils, StdoutLogger, StringIO, StringUtils, UserAgent, Yes

Constant Summary collapse

VERSION =
'3.0.1'
@@_version_info =
nil
@@_config =
nil

Class Method Summary collapse

Class Method Details

.configObject



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/bizside.rb', line 48

def self.config
  if @@_config
    return @@_config unless Bizside.env == 'development'
  end

  configfile = ENV['CONFIG_FILE'] || File.join('config', 'bizside.yml')
  if File.exist?(configfile)
    @@_config = Bizside::Config.new(YAML.load_file(configfile)[Bizside.env])
  else
    raise "設定ファイルの #{configfile} は必須です。"
  end
end

.envObject



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

def self.env
  rails_env || ENV['RAILS_ENV'] || 'development'
end

.loggerObject



61
62
63
64
65
66
67
# File 'lib/bizside.rb', line 61

def self.logger
  if defined?(Rails) && Rails.logger
    Rails.logger
  else
    @logger ||= ::Logger.new($stdout)
  end
end

.rails_envObject

Railsがロードできる場合はRails.envを返し、ロードできない場合はnilを返します。



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

def self.rails_env
  defined?(Rails) && Rails.env
end

.version_infoObject



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

def self.version_info
  if @@_version_info.nil?
    release_tag_file = "/var/#{Bizside.config.add_on_name}/shared/RELEASE_TAG"
    if File.exist?(release_tag_file)
      @@_version_info = File.read(release_tag_file).strip
    else
      if Dir.exist?('.git')
        info = `git describe`.strip.split('-')
        @@_version_info = info[0] ? "#{info[0]}-#{info[1]}" : '0.0.0-0'
        @@_version_info << "-p#{info[2]}" if info[2].to_i > 0
      else
        @@_version_info = '0.0.0-0'
      end
    end
  end

  @@_version_info
end