Class: RakeDotNet::SevenZipCmd
- Inherits:
-
Object
- Object
- RakeDotNet::SevenZipCmd
- Defined in:
- lib/rake_dotnet.rb
Instance Method Summary collapse
- #archive_name ⇒ Object
- #cmd_add ⇒ Object
- #cmd_extract ⇒ Object
- #exe ⇒ Object
- #file_names ⇒ Object
-
#initialize(archive_name, opts = {}) {|_self| ... } ⇒ SevenZipCmd
constructor
A new instance of SevenZipCmd.
- #out_dir ⇒ Object
- #run_add ⇒ Object
- #run_extract ⇒ Object
Constructor Details
#initialize(archive_name, opts = {}) {|_self| ... } ⇒ SevenZipCmd
Returns a new instance of SevenZipCmd.
1058 1059 1060 1061 1062 1063 1064 1065 1066 |
# File 'lib/rake_dotnet.rb', line 1058 def initialize(archive_name, opts={}) arch = ENV['PROCESSOR_ARCHITECTURE'] || 'AMD64' bin = arch == 'x86' ? '7za.exe' : '7z.exe' @exe = opts[:sevenzip] || File.(File.join(TOOLS_DIR, '7zip', arch, bin)) @archive_name = File.(archive_name) @params = opts yield self if block_given? end |
Instance Method Details
#archive_name ⇒ Object
1091 1092 1093 |
# File 'lib/rake_dotnet.rb', line 1091 def archive_name "\"#{@archive_name}\"" end |
#cmd_add ⇒ Object
1068 1069 1070 |
# File 'lib/rake_dotnet.rb', line 1068 def cmd_add "#{exe} a #{archive_name} #{file_names}" end |
#cmd_extract ⇒ Object
1077 1078 1079 |
# File 'lib/rake_dotnet.rb', line 1077 def cmd_extract "#{exe} x -y #{out_dir} #{archive_name} #{file_names}" end |
#exe ⇒ Object
1108 1109 1110 |
# File 'lib/rake_dotnet.rb', line 1108 def exe "\"#{@exe}\"" end |
#file_names ⇒ Object
1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 |
# File 'lib/rake_dotnet.rb', line 1095 def file_names fns = @params[:file_names] if fns.is_a? String "\"#{fns}\"" elsif fns.is_a? Array list = '' fns.each do |fn| list += "\"#{File.(fn)}\" " end list.chop end end |
#out_dir ⇒ Object
1086 1087 1088 1089 |
# File 'lib/rake_dotnet.rb', line 1086 def out_dir od = @params[:out_dir] "-o#{File.(od)}" unless @params[:out_dir].nil? end |
#run_add ⇒ Object
1072 1073 1074 1075 |
# File 'lib/rake_dotnet.rb', line 1072 def run_add puts cmd_add if VERBOSE sh cmd_add end |
#run_extract ⇒ Object
1081 1082 1083 1084 |
# File 'lib/rake_dotnet.rb', line 1081 def run_extract puts cmd_extract if VERBOSE sh cmd_extract end |