Changeset 828fba4 in adblock2privoxy


Ignore:
Timestamp:
Jan 1, 2015 7:05:45 PM (5 years ago)
Author:
zubr <a@…>
Branches:
master
Children:
b4685e7
Parents:
6bfb8d3
Message:

New PRM spec generation

Files:
5 added
2 deleted
10 edited
4 moved

Legend:

Unmodified
Added
Removed
  • adblock2privoxy-utils/adblock2privoxy-utils.cabal

    r6bfb8d3 r828fba4  
    11name:                adblock2privoxy-utils 
    22version:             1.0.0 
    3 cabal-version:       >= 1.6 
     3cabal-version:       >= 1.10 
    44build-type:          Simple 
     5tested-with:         GHC==7.8.3 
    56author:              Alexey Zubritsky <adblock2privoxy@zubr.me> 
    67homepage:            https://projects.zubr.me/wiki/adblock2privoxy 
    78category:            Web 
     9license:             GPL-3 
     10license-file:        LICENSE 
    811synopsis:            Helper utilities and scripts for adblock2privoxy project 
    912description:          
     
    1922  hs-source-dirs:  src 
    2023  main-is:         Main.hs 
    21   build-depends:   base >= 4  
    2224  ghc-options:     -Wall 
     25  default-language: Haskell2010 
     26  default-extensions: 
     27                   FlexibleInstances 
    2328  build-depends:    
    2429                   base >= 4 && < 5, 
  • adblock2privoxy-utils/automation/make_rpm.sh

    r6bfb8d3 r828fba4  
    44echo "make build env" 
    55./resolve_cabal_variables.sh rpmbuild/SPECS/template.spec > rpmbuild/SPECS/adblock2privoxy.spec 
     6 
     7echo "get source code" 
     8wget -P rpmbuild/SOURCES/ "$(./resolve_cabal_variables.sh rpmbuild/SOURCES/download-source.url)" 
     9 
    610 
    711echo "install build tools and dependencies" 
     
    1115sudo yum-builddep -y rpmbuild/SPECS/adblock2privoxy.spec 
    1216 
    13 echo "get source code" 
    14 wget -P rpmbuild/SOURCES/ "$(./resolve_cabal_variables.sh rpmbuild/SOURCES/download-source.url)" 
    15  
    1617echo "build" 
    1718rpmbuild --define "_topdir `pwd`/rpmbuild" -ba rpmbuild/SPECS/adblock2privoxy.spec 
  • adblock2privoxy-utils/launches/adblock2privoxy-utils.launch

    r6bfb8d3 r828fba4  
    11<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
    22<launchConfiguration type="net.sf.eclipsefp.haskell.debug.core.internal.launch.ExecutableHaskellLaunchDelegate"> 
     3<stringAttribute key="EXTRA_ARGUMENTS" value="--verbose"/> 
    34<stringAttribute key="PROJECT_NAME" value="adblock2privoxy-utils"/> 
    45<stringAttribute key="STANZA" value="adblock2privoxy-utils"/> 
  • adblock2privoxy-utils/src/Main.hs

    r6bfb8d3 r828fba4  
    11module Main where 
    2 import Text.Pandoc 
    3 import qualified Text.Pandoc.UTF8 as UTF8 
    4 import Data.Char (toUpper) 
    5 import Control.Monad 
    6 import System.FilePath 
    72import System.Environment (getArgs) 
    8 import System.Directory 
    93import Distribution.PackageDescription.Parse 
    104import Distribution.Verbosity (normal) 
     5import Control.Monad 
    116import Distribution.PackageDescription 
    12 import Text.Pandoc.Builder 
    13 import Distribution.Package 
    14 import Data.Time.Clock  
    15 import Data.Time 
    16 import System.Locale 
    17 import Distribution.Version (versionBranch) 
    18 import Data.List (intercalate) 
     7import ManPage 
     8import RpmSpec 
    199 
    2010-- It is helper executable updating documentation 
     
    2616    verbose <- liftM (elem "--verbose") getArgs 
    2717    cabalMeta <- liftM packageDescription $ readPackageDescription normal "adblock2privoxy.cabal" 
    28     createManPage verbose cabalMeta                                      
     18    createManPage verbose cabalMeta      
     19    createRpmSpec verbose cabalMeta                                
    2920 
    30 createManPage:: Bool -> PackageDescription -> IO () 
    31 createManPage verbose cabalMeta = do  
    32     pandoc <- liftM (readRST def) $ UTF8.readFile "README.rst" 
    33     now <- getCurrentTime 
    34     let PackageIdentifier (PackageName name) version = package cabalMeta 
    35     let versionText = intercalate "." $ map show $ versionBranch version  
    36     let pandoc' = setTitle (text $ map toUpper name) .  
    37                   setAuthors [text $ author cabalMeta] .  
    38                   setDate (text $ formatTime defaultTimeLocale (iso8601DateFormat Nothing) now) . 
    39                   setMeta "section" (text "1") . 
    40                   setMeta "header" (text "General Commands Manual") . 
    41                   setMeta "footer" (text $ name ++ " " ++ versionText) 
    42                   $ pandoc  
    43     createDirectoryIfMissing True ("man" </> "man1") 
    44     writeManPage verbose ("man" </> "man1" </> "adblock2privoxy.1") pandoc' 
    45  
    46 writeManPage :: Bool -> FilePath -> Pandoc -> IO () 
    47 writeManPage verbose page pandoc = do 
    48   template <- getDefaultTemplate Nothing "man" 
    49   case template of 
    50         Left ex -> print ex 
    51         Right template' -> do 
    52           let opts = def{ writerStandalone = True,  
    53                           writerTemplate = template'} 
    54           let manPage = writeMan opts $ 
    55                             bottomUp capitalizeHeaders pandoc 
    56           UTF8.writeFile page manPage 
    57           when verbose $ putStrLn $ "Created " ++ page 
    58  
    59 capitalizeHeaders :: Block -> Block 
    60 capitalizeHeaders (Header 1 attr xs) = Header 1 attr $ bottomUp capitalize xs 
    61 capitalizeHeaders x = x 
    62  
    63 capitalize :: Inline -> Inline 
    64 capitalize (Str xs) = Str $ map toUpper xs 
    65 capitalize x = x 
  • adblock2privoxy/README.rst

    r6bfb8d3 r828fba4  
    95951. Install privoxy. Optionally setup it as transparent proxy 
    9696 
    97 2. Change privoxy config file: Add following lines 
     972. Change privoxy config file. Add following lines:: 
    9898 
    9999    actionsfile ab2p.system.action 
  • adblock2privoxy/adblock2privoxy.cabal

    r6bfb8d3 r828fba4  
    11name:                adblock2privoxy 
    22version:             1.3.0 
    3 cabal-version:       >= 1.6 
     3cabal-version:       >= 1.10 
    44build-type:          Simple 
     5tested-with:         GHC==7.8.3 
    56author:              Alexey Zubritsky <adblock2privoxy@zubr.me> 
    67data-files:           
     
    4849  hs-source-dirs:  src 
    4950  main-is:         Main.hs 
     51  default-language: Haskell2010 
     52  default-extensions: 
     53                   RankNTypes,  
     54                   ScopedTypeVariables,  
     55                   FlexibleInstances, 
     56                   GeneralizedNewtypeDeriving 
    5057  build-depends:    
    5158                   base >= 4 && < 5, 
  • adblock2privoxy/man/man1/adblock2privoxy.1

    r6bfb8d3 r828fba4  
    1 .TH "ADBLOCK2PRIVOXY" "1" "2014\-12\-31" "adblock2privoxy 1.3.0" "General Commands Manual" 
     1.TH "ADBLOCK2PRIVOXY" "1" "2015\-01\-01" "adblock2privoxy 1.3.0" "General Commands Manual" 
    22.SH ADBLOCK2PRIVOXY 
    33.PP 
     
    140140Optionally setup it as transparent proxy 
    141141.IP "2." 3 
    142 Change privoxy config file: Add following lines 
     142Change privoxy config file. 
     143Add following lines: 
    143144.RS 4 
    144 .RS 
    145 .PP 
    146 actionsfile ab2p.system.action actionsfile ab2p.action filterfile 
    147 ab2p.system.filter filterfile ab2p.filter 
    148 .RE 
     145.IP 
     146.nf 
     147\f[C] 
     148actionsfile\ ab2p.system.action 
     149actionsfile\ ab2p.action 
     150filterfile\ ab2p.system.filter 
     151filterfile\ ab2p.filter 
     152\f[] 
     153.fi 
    149154.RE 
    150155.IP "3." 3 
  • adblock2privoxy/src/Main.hs

    r6bfb8d3 r828fba4  
    7070 
    7171getResponse :: String -> IO String 
    72 getResponse url = withSocketsDo $ unpack . decodeUtf8 <$> simpleHttp url 
     72getResponse url = do 
     73        putStrLn $ "load " ++ url ++ "..." 
     74        withSocketsDo $ unpack . decodeUtf8 <$> simpleHttp url 
    7375 
    7476processSources :: String -> String -> String -> [SourceInfo]-> IO () 
     
    8183        urlBlock privoxyDir infoText parsed' 
    8284        writeTemplateFiles privoxyDir 
     85        putStrLn $ "Run 'adblock2privoxy " ++ taskFile ++ "' every 1-2 days to process data updates" 
    8386        where  
    8487        parseSource sourceInfo = do 
     
    8689                url = _url sourceInfo 
    8790                loader = if isURI url then getResponse else readFile 
    88             putStrLn $ "parse " ++ url 
     91            putStrLn $ "process " ++ url 
    8992            text <- loader url 
    9093            now <- getCurrentTime 
     
    104107        (Options printVersion privoxyDir webDir taskFile forced, urls) <- parseOptions args 
    105108        let acton 
    106                 | printVersion = putStrLn $ "adblock2privoxy version " ++ (showVersion version) 
     109                | printVersion = putStrLn $ "adblock2privoxy version " ++ showVersion version 
    107110                | not . null $ urls  
    108111                   =    processSources privoxyDir webDir taskFile (makeInfo <$> urls) 
  • adblock2privoxy/src/ParsecExt.hs

    r6bfb8d3 r828fba4  
    1 {-# LANGUAGE RankNTypes, ScopedTypeVariables, FlexibleInstances #-} 
    21module ParsecExt ( 
    32    CasesParser, 
     
    7170                            (mapRWST.mapStateT) lookAhead $ casesParser acc' next 
    7271                            lift (put st) 
    73                 when (not.null $ input) $ casesParser acc' parsers                                       
     72                unless (null input) $ casesParser acc' parsers                                       
    7473                                         
    7574------------------------------------------------------------------------------------------------ 
  • adblock2privoxy/src/Statistics.hs

    r6bfb8d3 r828fba4  
    1 {-# LANGUAGE OverloadedStrings #-} 
    21module Statistics ( 
    32        collectStat 
  • adblock2privoxy/src/Utils.hs

    r6bfb8d3 r828fba4  
    1 {-# LANGUAGE GeneralizedNewtypeDeriving #-} 
    21module Utils ( 
    32Struct2 (..), 
Note: See TracChangeset for help on using the changeset viewer.