azdeploy 1.0.30 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/azdeploy.gemspec +2 -2
- data/lib/azdeploy.rb +6 -4
- data/lib/install.rb +142 -143
- data/lib/semantic_versioning.rb +280 -0
- data/lib/transform.rb +389 -389
- data/lib/update.rb +83 -83
- metadata +3 -2
data/lib/update.rb
CHANGED
@@ -1,101 +1,101 @@
|
|
1
1
|
class Update
|
2
|
-
|
3
|
-
attr_accessor :dry_run
|
4
|
-
attr_accessor :env
|
5
|
-
attr_accessor :settings
|
6
|
-
attr_accessor :svc
|
7
|
-
attr_accessor :table
|
8
|
-
|
9
|
-
def initialize(env, settings, dry_run = nil)
|
10
|
-
@env = env || 'noenv'
|
11
|
-
@settings = settings
|
12
|
-
@dry_run = dry_run
|
13
|
-
end
|
14
|
-
|
15
|
-
def update
|
16
|
-
if @env == 'noenv'
|
17
|
-
puts 'Environment name required to update settings.'
|
18
|
-
return false
|
19
|
-
end
|
20
|
-
|
21
|
-
# error thrown by azure gem if these are bad
|
22
|
-
Azure.config.storage_account_name = ENV['StorageAccount']
|
23
|
-
Azure.config.storage_access_key = ENV['StorageAccountKey']
|
24
|
-
@table = ENV['ConfigSettingsTable']
|
25
|
-
|
26
|
-
puts
|
27
|
-
puts 'Updating config table...'
|
28
|
-
puts
|
29
|
-
|
30
|
-
@svc = create_table_if_not_exists
|
31
|
-
|
32
|
-
upsert_all(@settings)
|
33
|
-
end
|
34
2
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
3
|
+
attr_accessor :dry_run
|
4
|
+
attr_accessor :env
|
5
|
+
attr_accessor :settings
|
6
|
+
attr_accessor :svc
|
7
|
+
attr_accessor :table
|
8
|
+
|
9
|
+
def initialize env, settings, dry_run = nil
|
10
|
+
@env = env || 'noenv'
|
11
|
+
@settings = settings
|
12
|
+
@dry_run = dry_run
|
13
|
+
end
|
14
|
+
|
15
|
+
def update
|
16
|
+
if @env == 'noenv'
|
17
|
+
puts 'Environment name required to update settings.'
|
18
|
+
return false
|
45
19
|
end
|
46
20
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
}
|
52
|
-
end
|
21
|
+
# error thrown by azure gem if these are bad
|
22
|
+
Azure.config.storage_account_name = ENV['StorageAccount']
|
23
|
+
Azure.config.storage_access_key = ENV['StorageAccountKey']
|
24
|
+
@table = ENV['ConfigSettingsTable']
|
53
25
|
|
54
|
-
|
26
|
+
puts
|
27
|
+
puts 'Updating config table...'
|
28
|
+
puts
|
55
29
|
|
56
|
-
|
57
|
-
result = get(key)
|
30
|
+
@svc = create_table_if_not_exists
|
58
31
|
|
59
|
-
|
60
|
-
|
61
|
-
:PartitionKey => @env,
|
62
|
-
:RowKey => key
|
63
|
-
}
|
32
|
+
upsert_all @settings
|
33
|
+
end
|
64
34
|
|
65
|
-
|
35
|
+
def create_table_if_not_exists
|
36
|
+
azure_table_service = Azure::TableService.new
|
37
|
+
begin
|
38
|
+
azure_table_service.create_table(@table)
|
39
|
+
rescue
|
40
|
+
puts $!
|
41
|
+
puts "table : #{@table}"
|
42
|
+
puts
|
43
|
+
end
|
44
|
+
azure_table_service
|
45
|
+
end
|
46
|
+
|
47
|
+
def upsert_all settings
|
48
|
+
settings.map {|k,v|
|
49
|
+
upsert(k, v)
|
50
|
+
#echo(k)
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
def upsert key, value
|
55
|
+
|
56
|
+
# check if setting exists
|
57
|
+
result = get key
|
58
|
+
|
59
|
+
entity = {
|
60
|
+
"setting" => value,
|
61
|
+
:PartitionKey => @env,
|
62
|
+
:RowKey => key
|
63
|
+
}
|
64
|
+
|
65
|
+
if result.nil?
|
66
|
+
@svc.insert_entity @table, entity if @dry_run.nil?
|
67
|
+
puts ">>>>> inserted entity key: #{key} value: #{value}"
|
68
|
+
else
|
69
|
+
# don't reinsert same value
|
70
|
+
if result.properties['setting'] != value
|
71
|
+
@svc.delete_entity(@table, @env, key) if @dry_run.nil?
|
66
72
|
@svc.insert_entity(@table, entity) if @dry_run.nil?
|
67
|
-
puts ">>>>>
|
73
|
+
puts ">>>>> Updated entity - key: #{key} value: #{value}"
|
68
74
|
else
|
69
|
-
|
70
|
-
if (result.properties['setting'] != value)
|
71
|
-
@svc.delete_entity(@table, @env, key) if @dry_run.nil?
|
72
|
-
@svc.insert_entity(@table, entity) if @dry_run.nil?
|
73
|
-
puts ">>>>> Updated entity - key: #{key} value: #{value}"
|
74
|
-
else
|
75
|
-
puts "Same value: #{value} found for key: #{key}" if @dry_run.nil?
|
76
|
-
end
|
75
|
+
puts "Same value: #{value} found for key: #{key}" if @dry_run.nil?
|
77
76
|
end
|
78
|
-
|
79
77
|
end
|
80
78
|
|
81
|
-
|
79
|
+
end
|
82
80
|
|
83
|
-
|
84
|
-
result = @svc.get_entity(@table, @env, key)
|
85
|
-
rescue
|
86
|
-
puts $!
|
87
|
-
puts "key : #{key}"
|
88
|
-
puts
|
89
|
-
end
|
81
|
+
def get key
|
90
82
|
|
91
|
-
|
83
|
+
begin
|
84
|
+
result = @svc.get_entity @table, @env, key
|
85
|
+
rescue
|
86
|
+
puts $!
|
87
|
+
puts "key : #{key}"
|
88
|
+
puts
|
92
89
|
end
|
93
90
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
91
|
+
result
|
92
|
+
end
|
93
|
+
|
94
|
+
def echo key
|
95
|
+
entity = get key
|
96
|
+
if !entity.nil?
|
97
|
+
puts "echo: "
|
98
|
+
p entity.properties
|
100
99
|
end
|
101
|
-
end
|
100
|
+
end
|
101
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: azdeploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Suresh Batta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Azure Deployment Gem. Provides easy setup and deployment scripting support
|
14
14
|
for .Net project builds
|
@@ -22,6 +22,7 @@ files:
|
|
22
22
|
- lib/build.rb
|
23
23
|
- lib/dependency.rb
|
24
24
|
- lib/install.rb
|
25
|
+
- lib/semantic_versioning.rb
|
25
26
|
- lib/transform.rb
|
26
27
|
- lib/update.rb
|
27
28
|
- azdeploy.gemspec
|