ps-voodoo 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,38 +1,138 @@
1
1
  VooDoo
2
2
  ===========
3
3
 
4
- VooDoo is a command line application to help automate some PeopleSoft administration activities. I originally wrote it as a way to automate migration of PeopleSoft projects between environments, but it has since been expanded to include additional functionality.
4
+ VooDoo is a command line application to help automate some PeopleSoft administration activities that are typically performed locally.
5
5
 
6
- Features
7
- --------
6
+ Why?
7
+ ----
8
+ PeopleSoft installation and administration is tedious. Migrating projects, generating compare reports, and running SQR's locally is a pain.
8
9
 
9
- * TODO
10
+ VooDoo alleviates some of this by providing a simple command line interface for interacting with your local PeopleTools installation using predefined settings for each of your environments. For example, migrating a project between two environments using VooDoo is as simple as issuing the following command:
10
11
 
11
- Commands
12
- --------
12
+ C:\> voodoo migrate TEST_PROJECT HRDEV HRTEST
13
13
 
14
- Requirements
14
+ **Features include:**
15
+
16
+ * Generate HTML compare reports for projects
17
+ * Migrate projects between databases
18
+ * Build project definitions
19
+ * Archive project to file
20
+ * Execute Application Engine programs locally
21
+ * Execute SQR's locally
22
+
23
+
24
+ Super. What are the requirements?
15
25
  ------------
16
26
 
17
- * Ruby 1.9.2
18
- * Working installation of PeopleSoft Application Designer, DataMover, SQR, Appengine
27
+ In order to run VooDoo, you'll first need the following:
28
+
29
+ * Ruby 1.9.2
30
+ * Local installation of PeopleSoft Application Designer, DataMover, SQR, Appengine (developed and tested using 8.49)
19
31
  * Windows XP or higher (Developed using Windows 7, tested on XP)
32
+ * PeopleSoft Environments running on Oracle Database
20
33
 
21
- Install
22
- -------
34
+ Ok, done. How do I use it?
35
+ --------------------------
23
36
 
24
- * TODO
37
+ VooDoo is packaged as a ruby gem, and can be installed via the following command:
25
38
 
26
- Miscellaneous
27
- -------------
39
+ C:\> gem install ps-voodoo
28
40
 
29
- * TODO
41
+ Once installed, you'll first need to setup the global configuration:
30
42
 
31
- Author
32
- ------
43
+ C:\>voodoo config
33
44
 
34
- Original author: JR Bing
45
+ ### Global Configuration Settings ###
46
+ Local tools directory: C:\psoft\pt84927 # Set to the root of your tools installation
47
+ Default output directory for migration data: X:\output # Base directory for output
48
+
49
+ Next you'll want to add a few environments:
50
+
51
+ C:\>voodoo add VDDEV
52
+
53
+ ### Appdesigner/Datamover/AppEngine Settings ###
54
+ Database type: |ORACLE| ORACLE # Default is Oracle; no other databases supported currently
55
+ Application username: VD1 # Specify the application username for use with Application Designer
56
+
57
+ Would you like to archive migration output files for this environment? (y/n) n
58
+
59
+ ### SQR Settings ###
60
+ Database username: |sysadm| sysadm # Username used when running SQR's; default is sysadm
61
+ PS_HOME directory: V:\VDDEV # Base directory to use when looking for the SQR bin
62
+
63
+ C:\>voodoo add VDTEST
64
+
65
+ ### Appdesigner/Datamover/AppEngine Settings ###
66
+ Database type: |ORACLE| ORACLE
67
+ Application username: VD1
68
+
69
+ Would you like to archive migration output files for this environment? (y/n) y
70
+ Archive destination: X:\archive # Setting this option allows you to copy migration output from
71
+ # the default output directory to an archive directory
72
+
73
+ ### SQR Settings ###
74
+ Database username: |sysadm|
75
+ PS_HOME directory: V:\VDTEST
76
+
77
+ To run a compare report:
78
+
79
+ C:\>voodoo compare COMPARE_TEST VDDEV VDTEST
80
+ Application password for VDDEV: **********
81
+ Application password for VDTEST: **********
82
+ Name for output folder: VOODOO_TEST
83
+ 07/18/2011 13:09:54: Creating compare reports for SCRIPTING_TEST between FNDEV and FNSPTB
84
+
85
+ If successful, the generated HTML output of the compare report will be opened in your default browser. To see what else you can do, run:
35
86
 
87
+ C:\>voodoo help
88
+ NAME:
89
+
90
+ Voodoo
91
+
92
+ DESCRIPTION:
93
+
94
+ Black Magic Utility for PeopleSoft Administration
95
+
96
+ COMMANDS:
97
+
98
+ add adds an environment to the configuration file
99
+ archive copies a project to file from the specified environment
100
+ build builds a project definition in the specified environment
101
+ compare create a compare report for the specified project
102
+ config create global configuration settings
103
+ help Display global or [command] help documentation.
104
+ list Outputs a list of configured environments
105
+ migrate migrates a project between environments
106
+ remove removes an environment from the configuration file
107
+ run appengine runs an appengine against the specified environment
108
+ run sqr runs the specified sqr locally
109
+ show shows configuration details for an environment
110
+
111
+ GLOBAL OPTIONS:
112
+
113
+ -h, --help
114
+ Display help documentation
115
+
116
+ -v, --version
117
+ Display version information
118
+
119
+ -t, --trace
120
+ Display backtrace when an error occurs
121
+
122
+
123
+
124
+ Sounds too easy. How does it work?
125
+ ----------------------------------
126
+
127
+ It's actually pretty simple. Global and environment configuration data is stored in YAML files under the .voodoo folder in the user's HOME directory. When commands are issued to VooDoo, it uses the environment configuration information to pass command line arguments to the local executable.
128
+
129
+ In some situations the Windows registry is updated to set options that cannot be passed via the command line (project build output destinations, datamover output destinations).
130
+
131
+
132
+ Who wrote this thing?
133
+ ---------------------
134
+
135
+ Original author: JR Bing
36
136
 
37
137
  License
38
138
  -------
data/bin/voodoo CHANGED
@@ -78,72 +78,43 @@ command :build do |c|
78
78
  end
79
79
  end
80
80
 
81
+ command :archive do |c|
82
+ c.syntax = 'voodoo archive [project] [environment]'
83
+ c.summary = 'copies a project to file from the specified environment'
84
+ c.description = 'Copies a project from the specified environment to file in the output directory'
85
+ c.example 'Archive specified project', 'voodoo archive EXAMPLE_PROJECT VDTEST'
86
+ c.action do |args|
87
+ Voodoo::Commands.archive(args)
88
+ end
89
+ end
90
+
81
91
  command :migrate do |c|
82
92
  c.syntax = 'voodoo migrate [project] [source] [target]'
83
93
  c.summary = 'migrates a project between environments'
84
94
  c.description = 'Migrates a project between two environments after running a compare report and copying the objects to file'
85
- c.example 'Migrate project between environments', 'voodoo migrate EXAMPLE_PROJECT --source VDDEV --target VDTEST'
95
+ c.example 'Migrate project between environments', 'voodoo migrate EXAMPLE_PROJECT VDDEV VDTEST'
86
96
  c.action do |args|
87
97
  Voodoo::Commands.migrate(args)
88
98
  end
89
99
  end
90
100
 
91
- # command :'run sqr' do |c|
92
- # c.syntax = 'voodoo run sqr [sqr name] [environment]'
93
- # c.summary = 'runs the specified sqr locally'
94
- # c.description = 'Run the specified SQR locally using the sqr bin specified in the environment configuration.'
95
- # c.example 'Run SQR', 'voodoo run sqr SETSPACE.sqr VDDEV'
96
- # c.action do |args|
97
- # Voodoo::Commands.run_sqr(args)
98
- # end
99
- # end
100
-
101
- # command :'run appengine' do |c|
102
- # c.syntax = 'voodoo run appengine [appengine name] [environment]'
103
- # c.summary = 'runs the specified appengine locally'
104
- # c.description = 'Run the specified AppEngine locally.'
105
- # c.example 'Run AppEngine', 'voodoo run appengine XXXXX VDDEV'
106
- # c.action do |args|
107
- # Voodoo::Commands.run_appengine(args)
108
- # end
109
- # end
110
-
111
- # command :shell do |c|
112
- # c.syntax = 'voodoo shell'
113
- # c.summary = 'start Voodoo in and interactive console mode'
114
- # c.description = 'Starts Voodoo in a mode for entering multiple commands'
115
- # c.action do
116
- # loop do
117
- # choose("") do |menu|
118
- # menu.layout = ''
119
- # # menu.layout = :menu_only
120
- # menu.prompt = '>>> '
121
- # menu.shell = true
122
-
123
- # menu.choice(:list, "List configured environments") do |command, arguments|
124
- # Voodoo::Commands.list
125
- # end
126
-
127
- # menu.choice(:show, "Show environment details") do |command, arguments|
128
- # args = arguments.scan(/\w+/)
129
- # Voodoo::Commands.show(args)
130
- # end
131
-
132
- # menu.choice(:quit, "Exit voodoo") { exit }
133
-
134
- # end
135
- # end
136
- # end
137
- # end
101
+ command :'run appengine' do |c|
102
+ c.syntax = 'voodoo run appengine [ae_name] [environment]'
103
+ c.summary = 'runs an appengine against the specified environment'
104
+ c.description = 'Runs an appengine against the specified PeopleSoft environment'
105
+ c.example 'Run the VERSION appengine agains VDTEST', 'voodoo run appengine VERSION VDTEST'
106
+ c.action do |args|
107
+ Voodoo::Commands.run_appengine(args)
108
+ end
109
+ end
138
110
 
139
- # command :test do |c|
140
- # c.syntax = 'voodoo setup [options]'
141
- # c.summary = ''
142
- # c.description = ''
143
- # c.example 'description', 'command example'
144
- # c.option '--some-switch', 'Some switch that does something'
145
- # c.action do |args, options|
146
- # c.when_called Voodoo::Commands.test(args, options)
147
- # end
148
- # end
111
+ command :'run sqr' do |c|
112
+ c.syntax = 'voodoo run sqr [sqr name] [environment]'
113
+ c.summary = 'runs the specified sqr locally'
114
+ c.description = 'Run the specified SQR locally using the sqr bin specified in the environment configuration.'
115
+ c.example 'Run SQR', 'voodoo run sqr SETSPACE.sqr VDDEV'
116
+ c.action do |args|
117
+ Voodoo::Commands.run_sqr(args)
118
+ end
119
+ end
149
120
 
data/lib/voodoo.rb CHANGED
@@ -9,9 +9,11 @@ module Voodoo
9
9
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
10
10
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
11
11
 
12
- # Log settings
13
12
  LOG = Logger.new(STDOUT)
14
- LOG.level = Logger::DEBUG
13
+ LOG.level = Logger::INFO
14
+ LOG.formatter = proc { |severity, datetime, progname, msg|
15
+ "#{Time.now.strftime("%m/%d/%Y %H:%M:%S")}: #{msg}\n"
16
+ }
15
17
 
16
18
  def self.libpath( *args )
17
19
  rv = args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
@@ -85,7 +87,7 @@ module Voodoo
85
87
 
86
88
  def write_env_file
87
89
  environment_file = File.open(Voodoo.env_file, 'w')
88
- LOG.info("Writing environment configuration file.")
90
+ LOG.debug("Writing environment configuration file.")
89
91
  environment_file.write(ENVIRONMENTS.to_yaml)
90
92
  end
91
93
 
@@ -8,7 +8,7 @@ module Voodoo
8
8
 
9
9
  def setup?
10
10
  if CONFIGURATION.ps_home == nil
11
- LOG.warnA("Global configuration not defined...use <voodoo config>")
11
+ puts "Global configuration not defined...use <voodoo config>"
12
12
  exit
13
13
  end
14
14
 
@@ -24,40 +24,52 @@ module Voodoo
24
24
  end
25
25
 
26
26
  def get_env(name)
27
- #TODO: fix this to throw an error message and exit if the environment isn't listed
28
- OpenStruct.new(ENVIRONMENTS[name])
27
+ if ENVIRONMENTS[name]
28
+ env = OpenStruct.new(ENVIRONMENTS[name])
29
+ env.name = name
30
+ env.app_password = get_app_password(name)
31
+ else
32
+ puts "#{name} is not listed in the configuration file"
33
+ exit
34
+ end
35
+ return env
29
36
  end
30
37
 
31
- def get_source
32
- choose("Environments") do |menu|
33
- menu.index = :letter
34
- menu.index_suffix = ") "
35
- menu.prompt = "Specify the source environment: "
36
- ENVIRONMENTS.keys.each do |x|
37
- menu.choice(x) do |i|
38
- env = OpenStruct.new(ENVIRONMENTS[i])
39
- env.name = i
40
- env.app_password = get_app_password(i)
41
- return env
42
- end
43
- end
38
+ def get_db_env(name)
39
+ if ENVIRONMENTS[name]
40
+ env = OpenStruct.new(ENVIRONMENTS[name])
41
+ env.name = name
42
+ env.db_password = get_db_password(name)
43
+ puts env.db_password
44
+ else
45
+ puts "#{name} is not listed in the configuration file"
46
+ exit
44
47
  end
48
+ return env
49
+ end
50
+
51
+ def get_source
52
+ source = ask("Source environment: ", ENVIRONMENTS.keys)
53
+ env = OpenStruct.new(ENVIRONMENTS[source])
54
+ env.name = source
55
+ env.app_password = get_app_password(source)
56
+ return env
45
57
  end
46
58
 
47
59
  def get_target
48
- choose("Environments") do |menu|
49
- menu.index = :letter
50
- menu.index_suffix = ") "
51
- menu.prompt = "Specify the target environment: "
52
- ENVIRONMENTS.keys.each do |x|
53
- menu.choice(x) do |i|
54
- env = OpenStruct.new(ENVIRONMENTS[i])
55
- env.name = i
56
- env.app_password = get_app_password(i)
57
- return env
58
- end
59
- end
60
- end
60
+ target = ask("Target environment: ", ENVIRONMENTS.keys)
61
+ env = OpenStruct.new(ENVIRONMENTS[target])
62
+ env.name = target
63
+ env.app_password = get_app_password(target)
64
+ return env
65
+ end
66
+
67
+ def get_database
68
+ name = ask("Database name: ", ENVIRONMENTS.keys)
69
+ env = OpenStruct.new(ENVIRONMENTS[name])
70
+ env.name = name
71
+ env.db_password = get_db_password(name)
72
+ return env
61
73
  end
62
74
 
63
75
  def get_migration
@@ -75,6 +87,7 @@ module Voodoo
75
87
  ask("Appengine name: ")
76
88
  end
77
89
 
90
+ #TODO: change this so that you can specify the root of a drive
78
91
  def get_path(prompt)
79
92
  ask("#{prompt}: ") do |q|
80
93
  q.validate = %r=^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*))=
@@ -86,10 +99,21 @@ module Voodoo
86
99
  Time.now.strftime("%m/%d/%Y %H:%M:%S") + " >>> "
87
100
  end
88
101
 
102
+ def validate_env(name)
103
+ unless ENVIRONMENTS[name]
104
+ puts "#{name} is not listed in the configuration file"
105
+ exit
106
+ end
107
+ end
108
+
89
109
  private
90
110
 
91
111
  def get_app_password(name)
92
- ask("Password for #{name}: ") { |q| q.echo = "*" }
112
+ ask("Application password for #{name}: ") { |q| q.echo = "*" }
113
+ end
114
+
115
+ def get_db_password(name)
116
+ ask("Database password for #{name}: ") { |q| q.echo = "*" }
93
117
  end
94
118
 
95
119
  end
@@ -5,17 +5,24 @@ module Voodoo
5
5
 
6
6
  def self.add(args=nil)
7
7
  settings = {}
8
+ puts "\n### Appdesigner/Datamover/AppEngine Settings ###"
8
9
  if args.first.nil?
9
10
  name = ask("Database name: ").upcase
10
11
  else
11
12
  name = args.first.upcase
12
13
  end
13
- settings['db_type'] = ask("Database type: ", %w{Oracle}) { |q| q.default = "Oracle" }
14
+ settings['db_type'] = ask("Database type: ", %w{ORACLE}) { |q| q.default = "ORACLE" }
14
15
  settings['app_username'] = ask("Application username: ")
16
+ if agree("\nWould you like to archive migration output files for this environment? (y/n) ") == true
17
+ settings['migration_archive'] = get_path("Archive destination")
18
+ end
19
+
20
+ puts "\n### SQR Settings ###"
15
21
  settings['db_username'] = ask("Database username: ") { |q| q.default = "sysadm" }
16
- settings['migration_archive'] = get_path("Archive destination")
22
+ settings['ps_home'] = get_path("PS_HOME directory")
23
+
17
24
  new_env = {name => settings}
18
- LOG.info("Adding #{name} to the list of configured environments")
25
+ LOG.debug("Adding #{name} to the list of configured environments")
19
26
  ENVIRONMENTS.merge!(new_env)
20
27
  Voodoo.write_env_file
21
28
  end
@@ -0,0 +1,31 @@
1
+
2
+ module Voodoo
3
+
4
+ module Commands
5
+ extend self
6
+
7
+ def archive(args=nil)
8
+ setup?
9
+
10
+ if args[0].nil?
11
+ project = get_project
12
+ else
13
+ project = args.first
14
+ end
15
+
16
+ if args[1].nil?
17
+ source = get_source
18
+ else
19
+ source = get_env(args[1].upcase)
20
+ end
21
+
22
+ migration = get_migration
23
+
24
+ ad = Voodoo::AppDesigner.new
25
+
26
+ ad.copy_to_file(project, migration, source)
27
+ end
28
+
29
+ end
30
+
31
+ end
@@ -5,13 +5,20 @@ module Voodoo
5
5
  extend self
6
6
 
7
7
  def build(args=nil)
8
- if args.first.nil?
8
+ setup?
9
+
10
+ if args[0].nil?
9
11
  project = get_project
10
12
  else
11
13
  project = args.first
12
14
  end
13
15
 
14
- source = get_source
16
+ if args[1].nil?
17
+ source = get_source
18
+ else
19
+ source = get_env(args[1].upcase)
20
+ end
21
+
15
22
  migration = get_migration
16
23
 
17
24
  ad = Voodoo::AppDesigner.new
@@ -7,7 +7,7 @@ module Voodoo
7
7
  def compare(args=nil)
8
8
  setup?
9
9
 
10
- if args.first.nil?
10
+ if args[0].nil?
11
11
  project = get_project
12
12
  else
13
13
  project = args.first
@@ -16,13 +16,13 @@ module Voodoo
16
16
  if args[1].nil?
17
17
  source = get_source
18
18
  else
19
- source = args[1].upcase
19
+ source = get_env(args[1].upcase)
20
20
  end
21
21
 
22
22
  if args[2].nil?
23
23
  target = get_target
24
24
  else
25
- target = args[2].upcase
25
+ target = get_env(args[2].upcase)
26
26
  end
27
27
 
28
28
  migration = get_migration
@@ -5,8 +5,9 @@ module Voodoo
5
5
 
6
6
  def self.config
7
7
  settings = {}
8
- settings[:ps_home] = get_path("Local tools installation directory")
9
- settings[:migration_output_dir] = get_path("Output directory for migration data")
8
+ puts "\n### Global Configuration Settings ###"
9
+ settings[:ps_home] = get_path("Local tools directory")
10
+ settings[:migration_output_dir] = get_path("Default output directory for migration data")
10
11
  Voodoo.write_config_file(settings)
11
12
  end
12
13
 
@@ -2,10 +2,10 @@ module Voodoo
2
2
 
3
3
  module Commands
4
4
 
5
- # TODO: add an error message if there are no environments configured
6
5
  def self.list
6
+ setup?
7
7
  env_table = table
8
- env_table.headings = ['Configured Environments']
8
+ env_table.headings = ['ENVIRONMENTS']
9
9
  Voodoo.environments.keys.each do |env|
10
10
  env_table << [env]
11
11
  end
@@ -7,7 +7,7 @@ module Voodoo
7
7
  def migrate(args=nil)
8
8
  setup?
9
9
 
10
- if args.first.nil?
10
+ if args[0].nil?
11
11
  project = get_project
12
12
  else
13
13
  project = args.first
@@ -16,13 +16,13 @@ module Voodoo
16
16
  if args[1].nil?
17
17
  source = get_source
18
18
  else
19
- source = args[1].upcase
19
+ source = get_env(args[1].upcase)
20
20
  end
21
21
 
22
22
  if args[2].nil?
23
23
  target = get_target
24
24
  else
25
- target = args[2].upcase
25
+ target = get_env(args[2].upcase)
26
26
  end
27
27
 
28
28
  # Check for source and target being the same
@@ -5,12 +5,12 @@ module Voodoo
5
5
 
6
6
  def self.remove(args=nil)
7
7
  if args[0].nil?
8
- source = get_source
8
+ env = ask("Environment to remove?: ", ENVIRONMENTS.keys)
9
9
  else
10
- source = args[0].upcase
10
+ env = args[0].upcase
11
11
  end
12
- LOG.info("Removing #{source} from the list of configured environments")
13
- ENVIRONMENTS.delete(source)
12
+ LOG.debug("Removing #{env} from the list of configured environments")
13
+ ENVIRONMENTS.delete(env)
14
14
  Voodoo.write_env_file
15
15
  end
16
16
 
@@ -3,28 +3,43 @@ module Voodoo
3
3
  module Commands
4
4
  extend self
5
5
 
6
- def run_sqr(sqr_name=nil)
7
- if sqr_name.nil?
6
+ def run_sqr(args=nil)
7
+ setup?
8
+
9
+ if args[0].nil?
8
10
  sqr_name = get_sqr
11
+ else
12
+ sqr_name = args.first
13
+ end
14
+
15
+ if args[1].nil?
16
+ target = get_database
17
+ else
18
+ target = get_db_env(args[1].upcase)
9
19
  end
10
20
 
11
- target = get_target
12
21
  migration = get_migration
13
22
 
14
23
  instance = Voodoo::Sqr.new
15
- instance.run(migration, target)
24
+ instance.run(migration, target, sqr_name)
16
25
  end
17
26
 
18
- def run_appengine(ae_name=nil)
19
- if ae_name.nil?
27
+ def run_appengine(args=nil)
28
+
29
+ if args[0].nil?
20
30
  ae_name = get_appengine
31
+ else
32
+ ae_name = args[0].upcase
21
33
  end
22
34
 
23
- target = get_target
24
- migration = get_migration
35
+ if args[1].nil?
36
+ target = get_target
37
+ else
38
+ target = get_env(args[1].upcase)
39
+ end
25
40
 
26
41
  instance = Voodoo::AppEngine.new
27
- instance.run(migration, target)
42
+ instance.run(ae_name, target)
28
43
  end
29
44
 
30
45
  end
@@ -4,11 +4,15 @@ module Voodoo
4
4
  module Commands
5
5
 
6
6
  def self.show(args=nil)
7
+ setup?
7
8
  if args[0].nil?
8
- source = ask("Environment name: ").upcase
9
+ source = ask("Environment name: ", ENVIRONMENTS.keys).upcase
9
10
  else
10
11
  source = args[0].upcase
11
12
  end
13
+
14
+ validate_env(source)
15
+
12
16
  env = Voodoo.environments[source]
13
17
  user_table = table
14
18
  user_table.headings = source.upcase, ' '
@@ -8,23 +8,23 @@ module Voodoo
8
8
  end
9
9
 
10
10
  def log_folder
11
- @log_folder = create_folder(File.join(@migration_folder, 'logs'))
11
+ @log_folder = create_folder(File.join(@migration_folder, 'logs').gsub!(File::SEPARATOR, File::ALT_SEPARATOR))
12
12
  end
13
13
 
14
14
  def archive_folder
15
- @archive_folder = create_folder(File.join(@migration_folder, 'archive'))
15
+ @archive_folder = create_folder(File.join(@migration_folder, 'archive').gsub!(File::SEPARATOR, File::ALT_SEPARATOR))
16
16
  end
17
17
 
18
18
  def sql_folder
19
- @sql_folder = create_folder(File.join(@migration_folder, 'sql'))
19
+ @sql_folder = create_folder(File.join(@migration_folder, 'sql').gsub!(File::SEPARATOR, File::ALT_SEPARATOR))
20
20
  end
21
21
 
22
22
  def compare_folder(source, target)
23
- create_folder(File.join(compare_base_folder, "#{source}_to_#{target}"))
23
+ create_folder(File.join(compare_base_folder, "#{source}_to_#{target}").gsub!(File::SEPARATOR, File::ALT_SEPARATOR))
24
24
  end
25
25
 
26
26
  def export_folder(source)
27
- create_folder(File.join(project_folder, source))
27
+ create_folder(File.join(project_folder, source).gsub!(File::SEPARATOR, File::ALT_SEPARATOR))
28
28
  end
29
29
 
30
30
  def continue?
@@ -40,11 +40,11 @@ module Voodoo
40
40
  private
41
41
 
42
42
  def project_folder
43
- @project_folder = create_folder(File.join(@migration_folder, 'project'))
43
+ @project_folder = create_folder(File.join(@migration_folder, 'project').gsub!(File::SEPARATOR, File::ALT_SEPARATOR))
44
44
  end
45
45
 
46
46
  def compare_base_folder
47
- @compare_base_folder = create_folder(File.join(@migration_folder, 'compares'))
47
+ @compare_base_folder = create_folder(File.join(@migration_folder, 'compares').gsub!(File::SEPARATOR, File::ALT_SEPARATOR))
48
48
  end
49
49
 
50
50
  def create_folder(folder_path)
@@ -1,5 +1,6 @@
1
1
  require 'fileutils'
2
2
  require 'win32/registry'
3
+ require 'open3'
3
4
 
4
5
  module Voodoo
5
6
 
@@ -63,9 +64,11 @@ module Voodoo
63
64
  def call_executable
64
65
  LOG.debug("Executable is set to #{@executable}")
65
66
  LOG.debug("Command line options are set to #{@command_line_options.join(" ")}")
67
+
66
68
  f = IO.popen(@executable + " " + @command_line_options.join(" "))
67
- f.readlines.each { |line| LOG.info("#{line}")}
69
+ f.readlines.each { |line| LOG.info("#{line.chomp}")}
68
70
  f.close
71
+
69
72
  @command_line_options.clear
70
73
  set_base_parameters
71
74
  end
@@ -8,13 +8,13 @@ module Voodoo
8
8
  @executable = File.join(@tools_bin, %w{psae.exe})
9
9
  end
10
10
 
11
- def run(target, appengine_name)
11
+ def run(ae_name, target)
12
12
  append(:db_type => target.db_type)
13
13
  append(:env_name => target.name)
14
14
  append(:env_username => target.app_username)
15
15
  append(:env_password => target.app_password)
16
16
  append(:r => '1')
17
- append(:ae_name => appengine_name)
17
+ append(:ae_name => ae_name)
18
18
  call_executable
19
19
  end
20
20
 
@@ -3,91 +3,51 @@ module Voodoo
3
3
 
4
4
  class Sqr
5
5
 
6
+ attr_accessor :command_line_options, :executable
7
+
6
8
  def initialize
7
9
  @sqr_bin = File.join(Voodoo.configuration[:ps_home], %w{bin sqr ORA BINW}).gsub!(File::SEPARATOR, File::ALT_SEPARATOR)
8
- @executable = File.join(@tools_bin, %w{sqrw.exe})
10
+ @executable = File.join(@sqr_bin, %w{sqrw.exe})
11
+ @command_line_options = []
9
12
  end
10
13
 
11
- def run(target, sqr_name)
12
- append(:db_type => target.db_type)
13
- append(:env_name => target.name)
14
- append(:env_username => target.app_username)
15
- append(:env_password => target.app_password)
16
- append(:r => '1')
17
- append(:sqr_name => sqr_name)
14
+ def run(migration, target, sqr_name)
15
+ append(:sqr => File.join(target.ps_home, 'sqr', sqr_name).gsub!(File::SEPARATOR, File::ALT_SEPARATOR))
16
+ append(:db_login => target.db_username + '/' + target.db_password + '@' + target.name)
17
+ append(:input => File.join(target.ps_home, 'sqr').gsub!(File::SEPARATOR, File::ALT_SEPARATOR))
18
+ append(:output => migration.log_folder)
19
+ append(:log_file => File.join(migration.log_folder, 'sqr.log').gsub!(File::SEPARATOR, File::ALT_SEPARATOR))
20
+ append(:zif => File.join(target.ps_home, 'sqr', 'pssqr.ini').gsub!(File::SEPARATOR, File::ALT_SEPARATOR))
21
+ append(:print => true)
22
+ append(:xmb=> true)
23
+ append(:xcb=> true)
24
+ append(:debug=> true)
18
25
  call_executable
19
26
  end
20
27
 
21
- # def run_sqr(executable_path, sqrbin_path, sqr_name, db_username, db_password, db_name, output_directory)
22
- # executable = 'sqrw.exe'
23
-
24
- # if File.exists?(sqrbin_path + sqr_name)
25
- # s.run_sqr(SQR_BIN, database["ps_home"] + "\\sqr\\isc\\", sqr_name, database["db_username"], database["db_password"], db, BASE_DIRECTORY + "\\" + output_directory)
26
- # elsif File.exists?(database["ps_home"] + "\\sqr\\" + sqr_name)
27
- # s.run_sqr(SQR_BIN, database["ps_home"] + "\\sqr\\", sqr_name, database["db_username"], database["db_password"], db, BASE_DIRECTORY + "\\" + output_directory)
28
- # else
29
- # say("SQR not found...")
30
- # end
31
- # arguments = Array.new
32
- # arguments << executable_path + executable
33
- # arguments << sqrbin_path + sqr_name
34
- # arguments << db_username + '/' + db_password + '@' + db_name
35
- # arguments << '-I' + sqrbin_path
36
- # arguments << '-F' + output_directory
37
- # arguments << '-ZIF' + sqrbin_path + 'pssqr.ini'
38
- # arguments << '-PRINTER:PD'
39
- # Dir.mkdir(output_directory) unless File.exists?(output_directory)
40
- # executable_string = arguments.join(" ")
41
- # puts executable_string
42
- # # `#{executable_string}`
43
- # f = IO.popen(executable_string)
44
- # f.readlines.each { |line| print "#{line}"}
45
- # f.close
46
- # end
47
-
48
28
  def append(args)
49
29
  args.each_pair do |k, v|
50
30
  @command_line_options.push case
51
- when k == :db_type
52
- '-CT ' + v
53
- when k == :env_name
54
- '-CD ' + v
55
- when k == :env_username
56
- '-CO ' + v
57
- when k == :env_password
58
- '-CP ' + v
59
- when k == :compare_project
60
- '-PJM ' + v
61
- when k == :archive_project
62
- '-PJTF ' + v
63
- when k == :copy_project
64
- '-PJC ' + v
65
- when k == :build_project
66
- '-PJB ' + v
67
- when k == :target_name
68
- '-TD ' + v
69
- when k == :target_username
70
- '-TO ' + v
71
- when k == :target_password
72
- '-TP ' + v
31
+ when k == :db_login
32
+ v
33
+ when k == :sqr
34
+ v
35
+ when k == :input
36
+ '-I' + v + '\\'
37
+ when k == :output
38
+ '-F' + v + '\\'
73
39
  when k == :log_file
74
- '-LF ' + v
75
- when k == :tgt
76
- '-TGT ' + v
77
- when k == :cmxml
78
- '-CMXML ' + v
79
- when k == :compare_folder
80
- '-ROD ' + v
81
- when k == :exp
82
- '-EXP ' + v
83
- when k == :obj
84
- '-OBJ ' + v
85
- when k == :r
86
- '-R ' + v
87
- when k == :ae_name
88
- '-AI ' + v
89
- when k == :output_folder
90
- '-FP ' + v
40
+ '-O' + v
41
+ when k == :zif
42
+ '-ZIF' + v
43
+ when k == :print
44
+ '-PRINTER:PD'
45
+ when k == :xmb
46
+ '-XMB'
47
+ when k == :xcb
48
+ '-XCB'
49
+ when k == :debug
50
+ '-DEBUGX'
91
51
  end
92
52
  end
93
53
  end
@@ -95,18 +55,14 @@ module Voodoo
95
55
  def call_executable
96
56
  LOG.debug("Executable is set to #{@executable}")
97
57
  LOG.debug("Command line options are set to #{@command_line_options.join(" ")}")
58
+
98
59
  f = IO.popen(@executable + " " + @command_line_options.join(" "))
99
- f.readlines.each { |line| LOG.info("#{line}")}
60
+ f.readlines.each { |line| LOG.info("#{line.chomp}")}
100
61
  f.close
62
+
101
63
  @command_line_options.clear
102
- set_base_parameters
103
64
  end
104
65
 
105
- private
106
-
107
- def set_base_parameters
108
- @command_line_options = [].push("-HIDE -QUIET -SS NO")
109
- end
110
66
  end
111
67
 
112
68
  end
@@ -1,3 +1,3 @@
1
1
  module Voodoo
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ps-voodoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-13 00:00:00.000000000Z
12
+ date: 2011-07-18 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: commander
16
- requirement: &15634116 !ruby/object:Gem::Requirement
16
+ requirement: &21806580 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 4.0.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *15634116
24
+ version_requirements: *21806580
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: terminal-table
27
- requirement: &15633804 !ruby/object:Gem::Requirement
27
+ requirement: &21806256 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 1.4.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *15633804
35
+ version_requirements: *21806256
36
36
  description: A small command line utility for helping with PeopleSoft administration
37
37
  email:
38
38
  - jrbing@gmail.com
@@ -51,6 +51,7 @@ files:
51
51
  - lib/voodoo.rb
52
52
  - lib/voodoo/commands.rb
53
53
  - lib/voodoo/commands/add.rb
54
+ - lib/voodoo/commands/archive.rb
54
55
  - lib/voodoo/commands/build.rb
55
56
  - lib/voodoo/commands/compare.rb
56
57
  - lib/voodoo/commands/config.rb