You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# This script should be run from the root of the project with the command:
5
+
# This script should be run from the root of the project with the command:
6
6
# python script.py
7
7
#
8
8
# It will check operation constants, provided below, for information regarding what to erase or where to copy
9
9
# That information must be filles before running the script
10
10
#
11
11
# Versions
12
-
# 0.1
12
+
# 0.1
13
13
# - can remove files if relative path to the script is provided
14
14
# - can copy files if file and copy directory information is provided
15
+
# 0.2
16
+
# - can modify files
15
17
16
18
# OPERATION CONSTANTS
17
-
FILES_TO_ERASE= ['../android/src/main/java/ly/count/dart/countly_flutter/CountlyMessagingService.java', '../ios/countly_flutter.podspec', '../ios/Classes/CountlyFLPushNotifications.h', '../ios/Classes/CountlyFLPushNotifications.m'] # array of string values. Relative path to the files. Something like: 'android/sth/sth.txt'
18
-
FILES_TO_MOVE= [['no-push-files/AndroidManifest.xml','../android/src/main/AndroidManifest.xml'],['no-push-files/build.gradle','../android/build.gradle'],['no-push-files/pubspec.yaml','../pubspec.yaml'],['no-push-files/countly_flutter_np.podspec','../ios/countly_flutter_np.podspec'],['no-push-files/settings.gradle','../android/settings.gradle'],['no-push-files/README.md','../README.md']] # array of, arrays of string tuples. Relative path to the file and the relative path to the copy directory. Something like ['android/sth/sth.txt','android2/folder']
19
-
# fileToModify = [] # write the file name to modify, currently expecting 1 file
] # array of string values. Relative path to the files. Something like: 'android/sth/sth.txt'
25
+
FILES_TO_MOVE= [
26
+
[
27
+
'no-push-files/AndroidManifest.xml',
28
+
'../android/src/main/AndroidManifest.xml'
29
+
],
30
+
[
31
+
'no-push-files/build.gradle',
32
+
'../android/build.gradle'
33
+
],
34
+
[
35
+
'no-push-files/pubspec.yaml',
36
+
'../pubspec.yaml'
37
+
],
38
+
[
39
+
'no-push-files/countly_flutter_np.podspec',
40
+
'../ios/countly_flutter_np.podspec'
41
+
],
42
+
[
43
+
'no-push-files/settings.gradle',
44
+
'../android/settings.gradle'
45
+
],
46
+
[
47
+
'no-push-files/README.md',
48
+
'../README.md'
49
+
]
50
+
] # array of, arrays of string tuples. Relative path to the file and the relative path to the copy directory. Something like ['android/sth/sth.txt','android2/folder']
} # 'modifications' is a map with keys are the lines to remove or modify. 'consecutiveOmits' are a block of lines to remove.
22
95
23
-
# walks through all files in the project and writes down the paths of the ones you are looking for. Can only work for unique files.
96
+
# walks through all files in the project and writes down the paths of the ones you are looking for. Can only work for unique files.
24
97
# TODO: Refactor so that it checks only the specified folder and files, like ['android-app', 'gradle']. Makes it easy to find files without the need of relative path information.
98
+
99
+
25
100
deffindFilesTo(src, array):
26
101
paths= []
27
102
forroot, dirs, filesinos.walk(src):
@@ -33,6 +108,8 @@ def findFilesTo(src, array):
33
108
returnpaths
34
109
35
110
# loops through the provided array of relative paths and erases each file that exists
111
+
112
+
36
113
defremoveFiles(paths, cwd):
37
114
forpathinpaths:
38
115
path=os.path.join(cwd, path)
@@ -41,49 +118,78 @@ def removeFiles(paths, cwd):
41
118
os.remove(path)
42
119
43
120
# loops through the provided array of relative paths and copies each file that exists
121
+
122
+
44
123
defcopyFiles(arrays, cwd):
45
124
fortupleinarrays:
46
125
file=os.path.join(cwd, tuple[0])
47
126
folder=os.path.join(cwd, tuple[1])
48
-
shutil.copy(file,folder)
127
+
shutil.copy(file, folder)
128
+
129
+
# Modifies a given document
130
+
# (String) filePath - relative path to the file to modify
131
+
# (Obj) modificationInfo - object that contains file path as keys and modification and omittance info as values
132
+
# (String) modificationType - 'bloc' for block removal, 'mod' for modification
49
133
50
-
# Modifies a line in a given document
51
-
# TODO: Make it so that it can modify multiple lines
0 commit comments