sta 0.0.1.1 → 0.0.2.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 +7 -1
  2. data/bin/sus +7 -0
  3. data/lib/SugarPkg.rb +94 -0
  4. metadata +7 -4
data/README CHANGED
@@ -6,10 +6,16 @@ This gem is only for Sugar Team Member to assistent their daily testing work.
6
6
  Run `gem install sta` command in Ruby evironment.
7
7
 
8
8
  2. Usage
9
- a. command `is` is for 'install sugar'.
9
+ a. command `is` is for 'install sugar'. go to the directory you want to insall sugar and run 'is'.
10
10
  We need you input two paramaters to install your sugar instance automatically.
11
11
  i. The version of sugar build.
12
12
  ii. The falvor of sugar build.
13
+ b. command `sus` is for 'silent upgrade sugar'. go to the instance root directory and run 'sus'.
14
+ We need you input 3 paramters to upgrade your sugar.
15
+ i. The version number of your current instance.
16
+ ii. The flavor of you current instance.
17
+ iii. The version number you want to upgrade to.
18
+
13
19
 
14
20
  3. Supported platform
15
21
  We only support linux now.
data/bin/sus ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+
4
+ require 'SugarPkg'
5
+
6
+ SugarPkg.new.sltUpgrade
7
+ exit(0)
@@ -0,0 +1,94 @@
1
+ #!/use/bin/env ruby
2
+ #
3
+
4
+ class SugarPkg
5
+
6
+ # Define the silent upgrade process
7
+ def sltUpgrade
8
+ #Get current versoin we want to upgrade from
9
+ from_ver_dft = "6.3"
10
+ from_ver_msg = <<MSG
11
+ Plesae enter your current version number (6.2/6.3/6.4), bu default: #{from_ver_dft}
12
+ MSG
13
+ crt_ver = getInfo(from_ver_msg, from_ver_dft.chomp)
14
+
15
+ #Get falvor of the instance
16
+ flavor_default = "Ult"
17
+ flavor_massage = <<MSG
18
+ Plese enter the flavor of current instance (CE/Pro/Corp/Ent/Ult), by default: #{flavor_default}
19
+ MSG
20
+ flavor = getInfo(flavor_massage, flavor_default.chomp)
21
+
22
+ #Get target versoin we wan to upgrade to
23
+ to_ver_default = "6.4.0RC2"
24
+ to_ver_message = <<MSG
25
+ Please enter hte version you want to upgrae to (6.2.4/6.3.0/6.4.0), by default: #{to_ver_default}
26
+ MSG
27
+ tgt_ver = getInfo(to_ver_message, to_ver_default.chomp)
28
+
29
+ #Generate the package names we need during upgrade
30
+ pkg_names = generateNames("upgrade", crt_ver, tgt_ver, flavor, nil)
31
+
32
+ #Download the packages we need
33
+ downloadPkg(pkg_names, tgt_ver)
34
+
35
+ #Unzip the silent ugrade script
36
+ print "Unzip upgrade script..."
37
+ unzipPkg(pkg_names["script"])
38
+
39
+ #Sent the silnet upgrade request
40
+ print "Start upgrade...\n"
41
+ `php -f silentUpgrade.php #{pkg_names["upgrade_package"]} upgrade.log ./ admin`
42
+
43
+ #change permission of the whole folder
44
+ `chmod -R 777 ../`
45
+ end
46
+
47
+ def unzipPkg(pkg)
48
+ `unzip #{pkg}`
49
+ end
50
+
51
+
52
+ def downloadPkg(names, new_version)
53
+ names.each do |name, pname|
54
+ `curl -O http://honey-b/builds/#{new_version}/latest/#{pname}`
55
+ end
56
+ end
57
+
58
+ def generateNames(option, old_ver, new_ver, old_flavor, new_flavor)
59
+ case option
60
+ 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
+ names["script"] = "silentUpgrade-#{script_flavor}-#{new_ver}.zip"
69
+ names["upgrade_package"] = "Sugar#{old_flavor}-Upgrade-#{old_ver}.x-to-#{new_ver}.zip"
70
+
71
+ when "convert"
72
+ when "install"
73
+ when "portal"
74
+ end
75
+
76
+ return names
77
+ end
78
+
79
+
80
+ def getInfo(msg, dft)
81
+ print msg
82
+
83
+ g = gets.chomp
84
+
85
+ if (g == "")
86
+ bld_information= dft
87
+ else
88
+ bld_information= g
89
+ end
90
+
91
+ print "#{bld_information}\n"
92
+ return bld_information
93
+ end
94
+ 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: 73
4
+ hash: 71
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- - 1
11
- version: 0.0.1.1
9
+ - 2
10
+ - 0
11
+ version: 0.0.2.0
12
12
  platform: ruby
13
13
  authors:
14
14
  - Yunpeng Li
@@ -23,12 +23,15 @@ description: STA can install Sugar instance, install Sugar portal, do silent upg
23
23
  email: rlee@sugarcrm.com
24
24
  executables:
25
25
  - is
26
+ - sus
26
27
  extensions: []
27
28
 
28
29
  extra_rdoc_files: []
29
30
 
30
31
  files:
31
32
  - bin/is
33
+ - bin/sus
34
+ - lib/SugarPkg.rb
32
35
  - README
33
36
  homepage: https://github.com/RandyLee/Primitive
34
37
  licenses: []