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.



1048
1049
1050
1051
# File 'lib/sisu/hub_actions.rb', line 1048

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

Instance Method Details

#cgiObject

-F



1079
1080
1081
1082
# File 'lib/sisu/hub_actions.rb', line 1079

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

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



1100
1101
1102
# File 'lib/sisu/hub_actions.rb', line 1100

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



1052
1053
1054
# File 'lib/sisu/hub_actions.rb', line 1052

def counter
  @@n_do=0
end

#not_foundObject



1097
1098
1099
# File 'lib/sisu/hub_actions.rb', line 1097

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

#not_recognisedObject



1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
# File 'lib/sisu/hub_actions.rb', line 1103

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



1067
1068
1069
1070
1071
1072
# File 'lib/sisu/hub_actions.rb', line 1067

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



1073
1074
1075
1076
1077
1078
# File 'lib/sisu/hub_actions.rb', line 1073

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



1055
1056
1057
1058
1059
1060
# File 'lib/sisu/hub_actions.rb', line 1055

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



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

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



1083
1084
1085
1086
1087
1088
1089
1090
# File 'lib/sisu/hub_actions.rb', line 1083

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



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

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