firebase-cloning-tool 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/firebase/cloning/tool.rb +49 -35
- data/lib/firebase/cloning/tool/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: c94e5a8557c8f074c072221a47e03c80578e6cfa
|
4
|
+
data.tar.gz: 22a9b246ad25898b382207604c545c95ed763fa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df2acbfdb03495216fa9948ea6d75c019b54ab37adb8710994a4e1272b3cb16431a8d411de791184cf18ead59d1992099123333d3028976db3e382fc688cddb9
|
7
|
+
data.tar.gz: 6d607fcaca48762700e8a0178d1dcbf4d3c99826ef984ec5f5e26bfec939f6e22e568c1babb708e3331367ae121a03caf1435e59b521d17dfd7b835310222724
|
@@ -8,76 +8,86 @@ module Firebase
|
|
8
8
|
module Cloning
|
9
9
|
module Tool
|
10
10
|
|
11
|
-
def self.
|
11
|
+
def self.wait_until_selector_present(selector, wait=10)
|
12
12
|
wait.times do
|
13
|
-
break if Capybara.
|
14
|
-
puts 'Waiting for
|
13
|
+
break if Capybara.all(selector).any?
|
14
|
+
puts 'Waiting for selector: ' + selector + '...'
|
15
15
|
sleep 1
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def self.
|
19
|
+
def self.wait_until_xpath_present(xpath, wait=10)
|
20
20
|
wait.times do
|
21
|
-
break if Capybara.
|
22
|
-
puts 'Waiting
|
21
|
+
break if Capybara.all(:xpath, xpath).any?
|
22
|
+
puts 'Waiting for xpath: ' + xpath + '...'
|
23
23
|
sleep 1
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.do_login(email, password)
|
28
28
|
puts 'Trying sign in for ' + email + '...'
|
29
|
+
wait_until_selector_present('#Email')
|
29
30
|
Capybara.fill_in('Email', with: email)
|
31
|
+
wait_until_selector_present('#next')
|
30
32
|
Capybara.find('#next').click
|
33
|
+
wait_until_selector_present('#Passwd')
|
31
34
|
Capybara.fill_in('Passwd', with: password)
|
35
|
+
wait_until_selector_present('#signIn')
|
32
36
|
Capybara.find('#signIn').click
|
33
|
-
|
37
|
+
wait_until_selector_present('div.c5e-landing-welcome-existing-projects-title')
|
34
38
|
puts 'Sign in completed.'
|
35
39
|
end
|
36
40
|
|
37
41
|
def self.go_to_settings
|
38
42
|
puts 'Going to project settings...'
|
39
43
|
Capybara.find('.md-button.md-gmp-blue-theme.md-ink-ripple.md-icon-button').click
|
40
|
-
Capybara.find(
|
41
|
-
|
44
|
+
Capybara.find(:xpath, '//button[@ng-click="controller.navEntryClick(controller.settings)"]').click
|
45
|
+
wait_until_xpath_present('//span[@ng-if="::controller.webApiKey"]')
|
42
46
|
puts 'Project settings loaded.'
|
43
47
|
end
|
44
48
|
|
45
49
|
def self.update_web_api_key(remoteConfigValues)
|
50
|
+
if !remoteConfigValues.key?('firebase_web_api_key')
|
51
|
+
return
|
52
|
+
end
|
46
53
|
puts 'Updating web api key...'
|
47
|
-
web_api_key = Capybara.find(
|
54
|
+
web_api_key = Capybara.find(:xpath, '//span[@ng-if="::controller.webApiKey"]').text
|
48
55
|
remoteConfigValues['firebase_web_api_key'] = web_api_key
|
49
56
|
puts 'Web api key updated.'
|
50
57
|
end
|
51
58
|
|
52
59
|
def self.create_new_project(project_name)
|
53
60
|
puts 'Creating new project: ' + project_name + '...'
|
54
|
-
Capybara.find(
|
55
|
-
Capybara.find(:xpath, '//input[@
|
56
|
-
Capybara.find(
|
57
|
-
|
61
|
+
Capybara.find(:xpath, '//button[@ng-click="controller.showCreateProjectDialog()"]').click
|
62
|
+
Capybara.find(:xpath, '//input[@name="projectName"]').set project_name
|
63
|
+
Capybara.find(:xpath, '//button[@ng-click="controller.createProject()"]').click
|
64
|
+
wait_until_xpath_present('//button[@ng-click="controller.closeCreateProjectDialog()"]')
|
58
65
|
puts 'Project ' + project_name + ' created.'
|
59
|
-
|
66
|
+
wait_until_selector_present('div.fb-featurebar-title')
|
60
67
|
puts 'Project ' + project_name + ' loaded.'
|
61
68
|
end
|
62
69
|
|
63
70
|
def self.go_to_project(project_name)
|
64
71
|
puts 'Opening ' + project_name + ' project...'
|
65
72
|
Capybara.find('md-card', :text => project_name).click
|
66
|
-
|
73
|
+
wait_until_selector_present('div.fb-featurebar-title')
|
67
74
|
puts 'Project ' + project_name + ' loaded.'
|
68
75
|
end
|
69
76
|
|
70
|
-
def self.go_to_remote_config(
|
77
|
+
def self.go_to_remote_config()
|
71
78
|
puts 'Going to remote config...'
|
72
79
|
Capybara.find('.c5e-entry-displayname', :text => 'Remote Config').first(:xpath,".//..").click
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
else
|
80
|
+
|
81
|
+
wait_until_selector_present('div.fb-featurebar-title')
|
82
|
+
|
83
|
+
if Capybara.all('img.fb-zero-state-image').any?
|
78
84
|
puts 'Waiting to add new remote config data...'
|
79
|
-
|
80
|
-
Capybara.find(
|
85
|
+
wait_until_xpath_present('//button[@ng-click="fbButtonCtaClick($event)"]')
|
86
|
+
Capybara.find(:xpath, '//button[@ng-click="fbButtonCtaClick($event)"]').click
|
87
|
+
else
|
88
|
+
puts 'Waiting for remote config data...'
|
89
|
+
wait_until_xpath_present('//button[@ng-click="controller.addParameter($event)"]')
|
90
|
+
Capybara.find(:xpath, '//button[@ng-click="controller.addParameter($event)"]').click
|
81
91
|
end
|
82
92
|
puts 'Remote config loaded.'
|
83
93
|
end
|
@@ -97,19 +107,23 @@ module Firebase
|
|
97
107
|
puts 'Pasting remote config from memory...'
|
98
108
|
remoteConfigValues.each do | key, value |
|
99
109
|
Capybara.find(:xpath, '//input[@name="paramKey"]').set key
|
100
|
-
Capybara.find(:xpath, '//input[@
|
101
|
-
Capybara.
|
102
|
-
|
110
|
+
Capybara.find(:xpath, '//input[@ng-model="property:controller.valueOption.value"]').set value
|
111
|
+
if Capybara.all(:xpath, '//button[@ng-click="controller.addParameter($event)"]').any?
|
112
|
+
Capybara.find(:xpath, '//button[@ng-click="controller.addParameter($event)"]').click
|
113
|
+
else
|
114
|
+
Capybara.find(:xpath, '//button[@ng-click="pe.onSubmitHandler()"]').click
|
115
|
+
end
|
116
|
+
Capybara.find(:xpath, '//button[@ng-click="controller.addParameter($event)"]').click
|
103
117
|
end
|
104
|
-
Capybara.find(
|
118
|
+
Capybara.find(:xpath, '//button[@ng-click="pe.onCancel()"]').click
|
105
119
|
puts 'Remote config pasted.'
|
106
120
|
end
|
107
121
|
|
108
122
|
def self.publish_changes
|
109
123
|
puts 'Publishing remote config...'
|
110
|
-
Capybara.find('button.
|
111
|
-
Capybara.find('button.
|
112
|
-
|
124
|
+
Capybara.find(:xpath, '//button[@ng-click="featureBar.primaryButton.buttonAction()"]').click
|
125
|
+
Capybara.find(:xpath, '//button[@ng-click="$ctrl.continue()"]').click
|
126
|
+
wait_until_selector_present('div.md-toast-content')
|
113
127
|
puts 'Remote config published.'
|
114
128
|
end
|
115
129
|
|
@@ -119,9 +133,9 @@ module Firebase
|
|
119
133
|
print 'Password: '
|
120
134
|
password = STDIN.noecho(&:gets).chomp
|
121
135
|
puts
|
122
|
-
print 'Source(Project Name): '
|
136
|
+
print 'Source(Project Name, Case sensitive): '
|
123
137
|
source_project = gets.chomp
|
124
|
-
print 'Destination(New Project Name): '
|
138
|
+
print 'Destination(New Project Name, Case sensitive, Only letters, numbers, spaces, and these characters: -!\'") : '
|
125
139
|
destination_project = gets.chomp
|
126
140
|
|
127
141
|
# overrides selenium's driver to use chrome browser
|
@@ -136,11 +150,11 @@ module Firebase
|
|
136
150
|
do_login(email, password)
|
137
151
|
|
138
152
|
go_to_project(source_project)
|
139
|
-
go_to_remote_config(
|
153
|
+
go_to_remote_config()
|
140
154
|
|
141
155
|
remoteConfigValues = copy_remote_config()
|
142
156
|
Capybara.visit 'https://console.firebase.google.com/'
|
143
|
-
|
157
|
+
wait_until_selector_present('div.c5e-landing-welcome-existing-projects-title')
|
144
158
|
|
145
159
|
if !Capybara.has_text? destination_project
|
146
160
|
create_new_project(destination_project)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firebase-cloning-tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- epool
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|