Class: SiSU_Hub_Actions::Operations

Inherits:
Object
  • Object
show all
Defined in:
lib/sisu/hub_actions.rb

Constant Summary collapse

@@n_do =
0

Instance Method Summary collapse

Constructor Details

#initialize(opt = '') ⇒ Operations

Returns a new instance of Operations.



1062
1063
1064
1065
# File 'lib/sisu/hub_actions.rb', line 1062

def initialize(opt='')
  @opt=opt
  @cX=SiSU_Screen::Ansi.new(@opt).cX
end

Instance Method Details

#cgiObject

-F



1093
1094
1095
1096
# File 'lib/sisu/hub_actions.rb', line 1093

def cgi                                              # -F
  require_relative 'cgi'                             # cgi.rb
  SiSU_CGI::SearchSQL.new(@opt).read
end

#convert_name_message(fns, type, i, o, rune) ⇒ Object



1114
1115
1116
# File 'lib/sisu/hub_actions.rb', line 1114

def convert_name_message(fns,type,i,o,rune)
  %{\nIn filename: "#{@cX.fuchsia}#{fns}#{@cX.off}" << #{type} >> #{@cX.fuchsia}is apre 0.36 markup filename.#{@cX.off} #{@cX.brown}Please rename your file.#{@cX.off}\n\tAs of sisu-0.37, SiSU markup files with #{@cX.brown}the extensions #{i} should be re-named #{o}#{@cX.off}\n\tif you have the program called 'rename' installed, the following rune should do the trick:\n\t\t#{rune}\n\talternatively try:\n\t\tsisu --convert --36to37 #{fns}\n\trequested #{@opt.selections.str} processing skipped\n}
end

#counterObject



1066
1067
1068
# File 'lib/sisu/hub_actions.rb', line 1066

def counter
  @@n_do=0
end

#not_foundObject



1111
1112
1113
# File 'lib/sisu/hub_actions.rb', line 1111

def not_found
  puts "\n#{@cX.fuchsia}FILE NOT FOUND:#{@cX.off} << #{@opt.fns} >> - requested #{@opt.selections.str} processing skipped\n"
end

#not_recognisedObject



1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
# File 'lib/sisu/hub_actions.rb', line 1117

def not_recognised
  case @opt.fns
  when /(\.s[123])$/
    type=@opt.fns.gsub(/\S+?(#{$1})/,'\1')
    rune=%q{rename 's/\.s[123]$/\.sst/' *.s{1,2,3}}
    puts convert_name_message(@opt.fns,type,'.s1 .s2 and .s3','.sst',rune)
  when /(\.r[123])$/
    type=@opt.fns.gsub(/\S+?(#{$1})/,'\1')
    rune=%q{rename 's/\.r[123]$/\.ssm/' *.r{1,2,3}}
    puts convert_name_message(@opt.fns,type,'.r1 .r2 and .r3','.sst',rune)
    puts %{\n\tNote also that you will need to change the names of the files called/required\n\twithin the document text to build the composite document\n\t\t.s1 .s2 .s3 should be .sst \n\t\t.si should be .ssi\n\trequested #{@opt.selections.str} processing skipped\n}
  when /(\.ssi)$/
    puts "\n#{@cX.fuchsia}component filetype:#{@cX.off} << #{@opt.fns} >> - is not a processed filetype, (it may be used as a component of a .ssm markup file)\n\trequested #{@opt.selections.str} processing skipped\n"
  else
    puts "\n#{@cX.fuchsia}FILETYPE NOT RECOGNISED:#{@cX.off} << #{@opt.fns} >> - is not a recognized filetype,\n\trequested #{@opt.selections.str} processing skipped\n"
  end
end

#remote_put_base_siteObject

-Cr



1081
1082
1083
1084
1085
1086
# File 'lib/sisu/hub_actions.rb', line 1081

def remote_put_base_site                             # -Cr
  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \
    if @opt.act[:maintenance][:set] ==:on
  require_relative 'remote'                          # remote.rb
  SiSU_Remote::Put.new(@opt).scp_base
end

#remote_put_base_site_allObject

-CCr



1087
1088
1089
1090
1091
1092
# File 'lib/sisu/hub_actions.rb', line 1087

def remote_put_base_site_all                         # -CCr
  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \
    if @opt.act[:maintenance][:set] ==:on
  require_relative 'remote'                          # remote.rb
  SiSU_Remote::Put.new(@opt).scp_base_all
end

#remote_put_base_site_rsyncObject

-CR



1069
1070
1071
1072
1073
1074
# File 'lib/sisu/hub_actions.rb', line 1069

def remote_put_base_site_rsync                       # -CR
  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \
    if @opt.act[:maintenance][:set] ==:on
  require_relative 'remote'                          # remote.rb
  SiSU_Remote::Put.new(@opt).rsync_base
end

#remote_put_base_site_rsync_matchObject

-CCRZ



1075
1076
1077
1078
1079
1080
# File 'lib/sisu/hub_actions.rb', line 1075

def remote_put_base_site_rsync_match                 # -CCRZ
  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \
    if @opt.act[:maintenance][:set] ==:on
  require_relative 'remote'                          # remote.rb
  SiSU_Remote::Put.new(@opt).rsync_base_sync
end

#termsheetObject

-t



1097
1098
1099
1100
1101
1102
1103
1104
# File 'lib/sisu/hub_actions.rb', line 1097

def termsheet                                        # -t
  system("sisu_termsheet #{@opt.selections.str} #{@opt.fns}\n")
  @@n_do=@@n_do+1
  SiSU_Screen::Ansi.new(
    @opt.selections.str,@@n_do,
    'Termsheet(s) processed'
  ).term_sheet_title unless @opt.act[:quiet][:set] ==:on
end

#webrickObject

-W



1105
1106
1107
1108
1109
1110
# File 'lib/sisu/hub_actions.rb', line 1105

def webrick                                          # -W
  prt=SiSU_Env::InfoEnv.new(@fns).port.webrick_port
  puts %{#{@cX.blue}<<#{@cX.off}#{@cX.green}Start Webrick web server on port: #{prt}#{@cX.off}#{@cX.blue}>> #{@cX.off*2} }
  require_relative 'webrick'
  SiSU_Webserv::WebrickStart.new
end