snow_sync 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/snow_sync/sync_util.rb +24 -29
- data/lib/snow_sync/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a63114b35a309a5bdc3714391dc51d33ce00ea45
|
4
|
+
data.tar.gz: df6af2460173980d80e7ed4424d7decdde326339
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d090c298a497186d93292956a31eb63adcc8aca067cf7b5f40ee2657256b6d9a447ef2eaf3a7ce33d6ae48b6f43410b071c11dfe88d60cfee8bc9b06f46e6d4
|
7
|
+
data.tar.gz: 68c8c45c05758e7b5dfbb9ebd61e5d6150fd6ddb0021c41277718ee226f84cdadba0036f2bfe35007199fcd8d1a1a5da127ac0f8a4ee8d970ba7954e34e8056f
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# SnowSync
|
2
2
|
|
3
|
+
[![Gem Version](https://img.shields.io/badge/gem-v2.0.4-blue.svg)](https://rubygems.org/gems/snow_sync) [![Dependency Status](https://img.shields.io/badge/dependencies-up--to--date-orange.svg)](https://rubygems.org/gems/snow_sync) [![Downloads](https://img.shields.io/badge/downloads-3k%2B-brightgreen.svg)](https://rubygems.org/gems/snow_sync)
|
4
|
+
|
3
5
|
SnowSync is a file sync utility tool and API which provides a bridge for off platform ServiceNow development using an IDE or text editor locally.
|
4
6
|
|
5
7
|
SnowSync syncronizes configured fields (scripts) for a ServiceNow instance locally, then watches for file changes and syncs back changes to the corresponding record.
|
data/lib/snow_sync/sync_util.rb
CHANGED
@@ -11,9 +11,8 @@ module SnowSync
|
|
11
11
|
|
12
12
|
attr_accessor :cf, :configs, :logger
|
13
13
|
|
14
|
-
#
|
15
|
-
#
|
16
|
-
# opts {string}: optional configuration
|
14
|
+
# Creates a utility object & sets the encapsulated config data
|
15
|
+
# @param [String] opts Optional configuration
|
17
16
|
|
18
17
|
def initialize(opts = nil)
|
19
18
|
opts.nil? ? @cf = "configs.yml" : @cf = "test_configs.yml"
|
@@ -21,9 +20,9 @@ module SnowSync
|
|
21
20
|
@logger = Logger.new(STDERR)
|
22
21
|
end
|
23
22
|
|
24
|
-
#
|
25
|
-
# name
|
26
|
-
# &block
|
23
|
+
# Creates a directory if no directory exists
|
24
|
+
# @param [String] name Required directory name
|
25
|
+
# @param [Object] &block Optional directory path
|
27
26
|
|
28
27
|
def create_directory(name, &block)
|
29
28
|
yield block if block_given?
|
@@ -33,11 +32,10 @@ module SnowSync
|
|
33
32
|
end
|
34
33
|
end
|
35
34
|
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
# &block {object}: optional file path
|
35
|
+
# Creates a JS file & logs the file creation
|
36
|
+
# @param [String] name Required file name
|
37
|
+
# @param [Object] json Required json object
|
38
|
+
# @param [Object] &block Optional file path
|
41
39
|
|
42
40
|
def create_file(name, json, &block)
|
43
41
|
yield if block_given?
|
@@ -47,8 +45,8 @@ module SnowSync
|
|
47
45
|
end
|
48
46
|
end
|
49
47
|
|
50
|
-
#
|
51
|
-
#
|
48
|
+
# Checks required configurations
|
49
|
+
# @raise [ExceptionClass] Raises exception if configs are not found
|
52
50
|
|
53
51
|
def check_required_configs
|
54
52
|
missing_path = @configs["conf_path"].nil?
|
@@ -64,7 +62,7 @@ module SnowSync
|
|
64
62
|
end
|
65
63
|
end
|
66
64
|
|
67
|
-
#
|
65
|
+
# Encrypts config credentials based on previous sync
|
68
66
|
|
69
67
|
def encrypt_credentials
|
70
68
|
previous_sync = File.directory?("sync")
|
@@ -83,7 +81,7 @@ module SnowSync
|
|
83
81
|
end
|
84
82
|
end
|
85
83
|
|
86
|
-
#
|
84
|
+
# Requests, retrieves, sets up the JS script file locally
|
87
85
|
|
88
86
|
def setup_sync_directories
|
89
87
|
@configs["table_map"].each do |key, value|
|
@@ -112,8 +110,8 @@ module SnowSync
|
|
112
110
|
end
|
113
111
|
end
|
114
112
|
|
115
|
-
#
|
116
|
-
# file
|
113
|
+
# Classifies a JS file by name
|
114
|
+
# @param [String] file JS file path
|
117
115
|
|
118
116
|
def classify(file)
|
119
117
|
file = file.split("/").last.split(".").first.camelcase
|
@@ -121,8 +119,9 @@ module SnowSync
|
|
121
119
|
file
|
122
120
|
end
|
123
121
|
|
124
|
-
# returns the configured
|
125
|
-
# file
|
122
|
+
# Lookup returns the configured servicenow table hash
|
123
|
+
# @param [String] file JS file path
|
124
|
+
# @return configured servicenow table hash
|
126
125
|
|
127
126
|
def table_lookup(file)
|
128
127
|
@configs["table_map"].select do |key, value|
|
@@ -132,10 +131,9 @@ module SnowSync
|
|
132
131
|
end
|
133
132
|
end
|
134
133
|
|
135
|
-
#
|
136
|
-
#
|
137
|
-
#
|
138
|
-
# table_hash {hash}: configured SN table hash
|
134
|
+
# Merges JS file changes with the encapsulated table response value
|
135
|
+
# @param [String] file JS file path
|
136
|
+
# @param [Hash] table_hash Configured servicenow table hash
|
139
137
|
|
140
138
|
def merge_update(file, table_hash)
|
141
139
|
FileUtils.cd(file.split("/")[0..1].join("/"))
|
@@ -144,9 +142,7 @@ module SnowSync
|
|
144
142
|
FileUtils.cd("../..")
|
145
143
|
end
|
146
144
|
|
147
|
-
#
|
148
|
-
# encrypt configured credentials
|
149
|
-
# retrieve, set up the script file locally
|
145
|
+
# Completes a sync based on the configurations
|
150
146
|
|
151
147
|
def start_sync
|
152
148
|
check_required_configs
|
@@ -154,9 +150,8 @@ module SnowSync
|
|
154
150
|
setup_sync_directories
|
155
151
|
end
|
156
152
|
|
157
|
-
#
|
158
|
-
#
|
159
|
-
# files {array}: array of js file paths
|
153
|
+
# Merges all JS file changes & pushes to the configured servicenow instance
|
154
|
+
# @param [Array] files JS file paths
|
160
155
|
|
161
156
|
def push_modifications(files)
|
162
157
|
files.each do |file|
|
data/lib/snow_sync/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snow_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Wallace
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|