arkaan 0.10.15 → 0.10.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de38403b1504d551ce57770c8dc956c458e927be
4
- data.tar.gz: dfbc6bc886ea63284bbf3b5908cf81a80edd7180
3
+ metadata.gz: e79f8f91720927f6d5e89c21ef13292b86b39095
4
+ data.tar.gz: 490d49bc35bd86a9a322da429dfb58871ebe7b76
5
5
  SHA512:
6
- metadata.gz: 885736ed87ab48156a0ef432ca289bdcc539d3dc6c969a8031174157e63b0f6b8c51fded8da63af71c0b03ccf64f174925bd5c81dd8fec30554e84e91e5dba43
7
- data.tar.gz: 48fbfb28810f278a667f804d554301de3d85ba7834dbd4dac8c5851fb2fe3de5471f14086f0734571e3b953f6d56ad3090f333ca6415e00d4f7d5204d717854c
6
+ metadata.gz: fed3f2a4d029df3d2f0b8d2e54b9abd34b9c97f167790c9815de4763b448b07e56ee233b228078404677db037b081d1085ec4a3d9352d98ec851cdde6959bc6c
7
+ data.tar.gz: 3b5458837bc6be617436d4ff47642bece33dd2e5b084aebecc5fa8964b4b1ba64f056f484bd0da765b71ae78ef3ada5b155a357d0780b6f17027b9dbf7c557cc
@@ -16,7 +16,10 @@ module Arkaan
16
16
  field :running, type: Boolean, default: false
17
17
  # @!attribute [rw] type
18
18
  # @return [Symbol] the type of the instance, determining its way of being deployed, restarted, etc.
19
- enum_field :type, [:heroku], default: :heroku
19
+ enum_field :type, [:heroku, :local], default: :heroku
20
+ # @!attribute [rw] data
21
+ # @return [Hash] the additional datas for this instance (for example for an Heroku instance it's all the data provided by the API)
22
+ field :data, type: Hash, default: {}
20
23
 
21
24
  scope :running , ->{ where(running: true) }
22
25
 
@@ -17,11 +17,16 @@ module Arkaan
17
17
  # @!attribute [r] instance
18
18
  # @return [Arkaan::Monitoring::Instance] the instance of the service currently deployed.
19
19
  attr_reader :instance
20
+ # @!attribute [r] type
21
+ # @return [Symbol] the type of instance the application is declaring
22
+ attr_reader :type
20
23
 
21
24
  def initialize
22
25
  @location = false
23
26
  @service = false
27
+ @instance = false
24
28
  @name = false
29
+ @type = ENV['INSTANCE_TYPE'] || :heroku
25
30
  end
26
31
 
27
32
  # Determines if the application can be loaded (all the parameters have been correctly set)
@@ -107,6 +112,7 @@ module Arkaan
107
112
  @service = Arkaan::Monitoring::Service.where(key: @name).first
108
113
  register_service if @service.nil?
109
114
  register_instance
115
+ get_heroku_infos if type == :heroku && !test_mode
110
116
  if service
111
117
  load_standard_files
112
118
  load_test_files if test_mode
@@ -115,6 +121,19 @@ module Arkaan
115
121
  return self
116
122
  end
117
123
 
124
+ def get_heroku_infos
125
+ if !ENV['OAUTH_TOKEN'].nil? && instance != false && instance.persisted?
126
+ heroku = PlatformAPI.connect_oauth(ENV['OAUTH_TOKEN'])
127
+ regex = /\Ahttps?:\/\/([a-z\-]+).herokuapp.com\/?\z/
128
+ if instance.url.match(regex)
129
+ app_name = instance.url.scan(regex).first.first
130
+ instance.update_attribute(:data, heroku.app.info(app_name))
131
+ puts instance.data
132
+ end
133
+ end
134
+ return self
135
+ end
136
+
118
137
  def load_mongoid_configuration
119
138
  Mongoid.load!(File.join(location, 'config', 'mongoid.yml'))
120
139
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arkaan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.15
4
+ version: 0.10.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Courtois