sta 0.0.2.1 → 0.0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README +5 -0
  2. data/bin/scs +7 -0
  3. data/lib/SugarPkg.rb +59 -11
  4. metadata +6 -4
data/README CHANGED
@@ -15,6 +15,11 @@ b. command `sus` is for 'silent upgrade sugar'. go to the instance root director
15
15
  i. The version number of your current instance.
16
16
  ii. The flavor of you current instance.
17
17
  iii. The version number you want to upgrade to.
18
+ c. command `scs` is for 'silent convert sugar'. go to the instance root directory and run 'scs'.
19
+ We need you input 3 parameters to convert your sugar.
20
+ i. The version number of your instance.
21
+ ii. The falvor you want convert from.
22
+ iii. The flavor you want to convert to.
18
23
 
19
24
 
20
25
  3. Supported platform
data/bin/scs ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+
4
+ require 'SugarPkg'
5
+
6
+ SugarPkg.new.sltConvert
7
+ exit(0)
@@ -3,6 +3,48 @@
3
3
 
4
4
  class SugarPkg
5
5
 
6
+ # Define the silent convet process
7
+ def sltConvert
8
+ #Get current version of sugar instance
9
+ ver_dft = "6.4.0RC2"
10
+ ver_msg = <<MSG
11
+ Please enter your sugar instance version (6.4.0/6.3.0) by default #{ver_dft}:
12
+ MSG
13
+ version = getInfo(ver_msg, ver_dft)
14
+
15
+ #Get flavor convert from
16
+ from_flavor_dft = "CE"
17
+ from_flavor_msg = <<MSG
18
+ Please enter the flavor of your current instnce (CE/Pro/Corp/Ent/Ult), by default #{from_flavor_dft}:
19
+ MSG
20
+ from_flavor = getInfo(from_flavor_msg, from_flavor_dft)
21
+
22
+ #Get flavoe you want to convert to
23
+ to_flavor_dft = "Pro"
24
+ to_flavor_msg = <<MSG
25
+ Please enter the flavor you want to conver to (CE/Pro/Corp/Ent/Ult), by default #{to_flavor_dft}:
26
+ MSG
27
+ to_flavor = getInfo(to_flavor_msg, to_flavor_dft)
28
+
29
+ #Generate the package name
30
+ pkg_names = generateNames("convert", nil, version, from_flavor, to_flavor)
31
+
32
+ #Download packages
33
+ downloadPkg(pkg_names, version)
34
+
35
+ #Unzip the silent convert script
36
+ print "Unzip convert script... \n"
37
+ unzipPkg(pkg_names["script"])
38
+
39
+ #Send the silent convert requrest
40
+ print "Start convertting... \n"
41
+ `php -f silentUpgrade.php #{pkg_names["upgrade_package"]} upgrade.log ./ admin`
42
+
43
+ #Change the permission of files
44
+ `sudo chmod -R 777 ../`
45
+ end
46
+
47
+
6
48
  # Define the silent upgrade process
7
49
  def sltUpgrade
8
50
  #Get current versoin we want to upgrade from
@@ -27,13 +69,13 @@ MSG
27
69
  tgt_ver = getInfo(to_ver_message, to_ver_default.chomp)
28
70
 
29
71
  #Generate the package names we need during upgrade
30
- pkg_names = generateNames("upgrade", crt_ver, tgt_ver, flavor, nil)
72
+ pkg_names = generateNames("upgrade", crt_ver, tgt_ver, nil, flavor)
31
73
 
32
74
  #Download the packages we need
33
75
  downloadPkg(pkg_names, tgt_ver)
34
76
 
35
77
  #Unzip the silent ugrade script
36
- print "Unzip upgrade script..."
78
+ print "Unzip upgrade script... \n"
37
79
  unzipPkg(pkg_names["script"])
38
80
 
39
81
  #Sent the silnet upgrade request
@@ -41,7 +83,7 @@ MSG
41
83
  `php -f silentUpgrade.php #{pkg_names["upgrade_package"]} upgrade.log ./ admin`
42
84
 
43
85
  #change permission of the whole folder
44
- `chmod -R 777 ../`
86
+ `sudo chmod -R 777 ../`
45
87
  end
46
88
 
47
89
  def unzipPkg(pkg)
@@ -56,19 +98,25 @@ MSG
56
98
  end
57
99
 
58
100
  def generateNames(option, old_ver, new_ver, old_flavor, new_flavor)
101
+
102
+ #Set up script flavor
103
+ if (new_flavor== "CE")
104
+ script_flavor = "CE"
105
+ else
106
+ script_flavor = "PRO"
107
+ end
108
+
109
+ names = Hash.new
110
+
59
111
  case option
60
112
  when "upgrade"
61
- if (old_flavor == "CE")
62
- script_flavor = "CE"
63
- else
64
- script_flavor = "PRO"
65
- end
66
-
67
- names = Hash.new
68
113
  names["script"] = "silentUpgrade-#{script_flavor}-#{new_ver}.zip"
69
- names["upgrade_package"] = "Sugar#{old_flavor}-Upgrade-#{old_ver}.x-to-#{new_ver}.zip"
114
+ names["upgrade_package"] = "Sugar#{new_flavor}-Upgrade-#{old_ver}.x-to-#{new_ver}.zip"
70
115
 
71
116
  when "convert"
117
+ names["script"] = "silentUpgrade-#{script_flavor}-#{new_ver}.zip"
118
+ names["upgrade_package"] = "Sugar#{old_flavor}-to-Sugar#{new_flavor}-Conversion-#{new_ver}.zip"
119
+
72
120
  when "install"
73
121
  when "portal"
74
122
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sta
3
3
  version: !ruby/object:Gem::Version
4
- hash: 69
4
+ hash: 67
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- - 1
11
- version: 0.0.2.1
9
+ - 3
10
+ - 0
11
+ version: 0.0.3.0
12
12
  platform: ruby
13
13
  authors:
14
14
  - Yunpeng Li
@@ -24,12 +24,14 @@ email: rlee@sugarcrm.com
24
24
  executables:
25
25
  - is
26
26
  - sus
27
+ - scs
27
28
  extensions: []
28
29
 
29
30
  extra_rdoc_files: []
30
31
 
31
32
  files:
32
33
  - bin/is
34
+ - bin/scs
33
35
  - bin/sus
34
36
  - lib/SugarPkg.rb
35
37
  - README