txpadmin 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/bin/txpadmin +3 -0
  2. data/lib/txp_admin.rb +10 -6
  3. data/txpadmin.gemspec +1 -1
  4. metadata +1 -1
@@ -66,6 +66,9 @@ rescue TxpAdmin::ConfigNotFound => e
66
66
  puts "Config file not found"
67
67
  rescue TxpAdmin::RestoreFileNotFound => e
68
68
  puts "Restore file not found"
69
+ rescue OptionParser::InvalidOption => e
70
+ puts "Invalid argument"
71
+ op.parse!(["-h"])
69
72
  rescue OptionParser::MissingArgument => e
70
73
  puts "Missing argument"
71
74
  op.parse!(["-h"])
@@ -33,7 +33,6 @@ module TxpAdmin
33
33
 
34
34
  def self.restore(filename)
35
35
  raise RestoreFileNotFound unless File.exists?(filename)
36
- # "Restoring file #{filename}. Continue? [Y/n] "
37
36
  command = "gunzip -c #{filename} | #{self.commandline}"
38
37
  exec(command)
39
38
  end
@@ -69,12 +68,17 @@ module TxpAdmin
69
68
  def self.parse_config_file(path=".")
70
69
  config_file = "#{path}/textpattern/config.php"
71
70
  raise TxpAdmin::ConfigNotFound unless File.exists?(config_file)
72
- config = `cat #{config_file}`
71
+
72
+ config_lines = File.readlines(config_file)
73
+ config_to_eval = String.new
74
+
75
+ config_lines.each do |line|
76
+ config_to_eval << line if (line.include? "$txpcfg" and !line.include? "define")
77
+ end
78
+
79
+ config_to_eval.gsub!("$txpcfg", "txpcfg")
73
80
  txpcfg = {}
74
- config.gsub!("<?php", "")
75
- config.gsub!("?>", "")
76
- config.gsub!("$txpcfg", "txpcfg")
77
- eval(config)
81
+ eval(config_to_eval)
78
82
  txpcfg.each do |key,value|
79
83
  txpcfg[key.to_sym] = value
80
84
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{txpadmin}
5
- s.version = "0.0.3"
5
+ s.version = "0.0.4"
6
6
  s.required_rubygems_version = Gem::Requirement.new(">= 1.3") if s.respond_to? :required_rubygems_version=
7
7
  s.authors = ["Fabrizio Regini"]
8
8
  s.date = %q{2009-12-26}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: txpadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabrizio Regini