Class: Eh::Settings
- Inherits:
-
Object
- Object
- Eh::Settings
- Defined in:
- lib/eh/settings.rb
Defined Under Namespace
Classes: Repository
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Class Method Summary collapse
Instance Method Summary collapse
- #deployment_dir ⇒ Object
- #deployment_management_files ⇒ Object
-
#initialize(file) ⇒ Settings
constructor
A new instance of Settings.
- #package_tmp_dir ⇒ Object
- #processor_template_repository_url ⇒ Object
- #processors_src_dir ⇒ Object
- #rails_release_dir ⇒ Object
- #rails_src_dir ⇒ Object
- #releases_dir(*extra_paths) ⇒ Object
- #repositories ⇒ Object
- #repository ⇒ Object
- #ruby_release_dir ⇒ Object
- #source_config_dir ⇒ Object
- #stages_dir ⇒ Object
- #template_tmp_dir ⇒ Object
- #write ⇒ Object
Constructor Details
#initialize(file) ⇒ Settings
Returns a new instance of Settings.
31 32 33 34 |
# File 'lib/eh/settings.rb', line 31 def initialize(file) @file = file @data = JSON.parse(File.read(file)) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/eh/settings.rb', line 3 def data @data end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
3 4 5 |
# File 'lib/eh/settings.rb', line 3 def file @file end |
Class Method Details
.current ⇒ Object
50 51 52 |
# File 'lib/eh/settings.rb', line 50 def self.current Thread.current[:eh_settings] end |
.current=(value) ⇒ Object
46 47 48 |
# File 'lib/eh/settings.rb', line 46 def self.current=(value) Thread.current[:eh_settings] = value end |
.load(file) ⇒ Object
36 37 38 |
# File 'lib/eh/settings.rb', line 36 def self.load(file) Eh::Settings.new(file) end |
Instance Method Details
#deployment_dir ⇒ Object
82 83 84 |
# File 'lib/eh/settings.rb', line 82 def deployment_dir File.join(repository.dir, 'src', 'deployment') end |
#deployment_management_files ⇒ Object
106 107 108 |
# File 'lib/eh/settings.rb', line 106 def deployment_management_files [ File.join(deployment_dir, 'management', 'launcher.rb') ] end |
#package_tmp_dir ⇒ Object
98 99 100 |
# File 'lib/eh/settings.rb', line 98 def package_tmp_dir './tmp' end |
#processor_template_repository_url ⇒ Object
94 95 96 |
# File 'lib/eh/settings.rb', line 94 def processor_template_repository_url 'https://github.com/thomis/eventhub-processor-template.git' end |
#processors_src_dir ⇒ Object
78 79 80 |
# File 'lib/eh/settings.rb', line 78 def processors_src_dir File.join(repository.dir, 'src', 'ruby') end |
#rails_release_dir ⇒ Object
70 71 72 |
# File 'lib/eh/settings.rb', line 70 def rails_release_dir releases_dir('rails') end |
#rails_src_dir ⇒ Object
86 87 88 |
# File 'lib/eh/settings.rb', line 86 def rails_src_dir File.join(repository.dir, 'src', 'rails', 'console') end |
#releases_dir(*extra_paths) ⇒ Object
66 67 68 |
# File 'lib/eh/settings.rb', line 66 def releases_dir(*extra_paths) File.join(repository.dir, 'releases', *extra_paths) end |
#repositories ⇒ Object
60 61 62 63 64 |
# File 'lib/eh/settings.rb', line 60 def repositories data["repositories"].map do |json| Eh::Settings::Repository.new(json) end if data["repositories"] end |
#repository ⇒ Object
54 55 56 57 58 |
# File 'lib/eh/settings.rb', line 54 def repository repositories.find do |repository| repository.current? end if repositories end |
#ruby_release_dir ⇒ Object
74 75 76 |
# File 'lib/eh/settings.rb', line 74 def ruby_release_dir releases_dir('ruby') end |
#source_config_dir ⇒ Object
90 91 92 |
# File 'lib/eh/settings.rb', line 90 def source_config_dir File.join(repository.dir, 'config') end |
#stages_dir ⇒ Object
110 111 112 |
# File 'lib/eh/settings.rb', line 110 def stages_dir File.join(repository.dir, 'config', 'stages') end |
#template_tmp_dir ⇒ Object
102 103 104 |
# File 'lib/eh/settings.rb', line 102 def template_tmp_dir '/tmp/eventhub-processor-template/' end |
#write ⇒ Object
40 41 42 43 44 |
# File 'lib/eh/settings.rb', line 40 def write File.open(file,"w") do |f| f.write(data.to_json) end end |