From be053f156ad7d873506d7f2c646a51d84e8ea578 Mon Sep 17 00:00:00 2001 From: Pouyan Heyratpour Date: Wed, 4 Nov 2015 01:08:20 +0330 Subject: [PATCH 01/14] Installation also when git is unavailable Custom Logo also in LTR view --- Gemfile | 41 +++++++++++++++++++++++++++++++++---- fonts/vazir | 2 +- stylesheets/application.css | 2 +- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index f4ba4a1..71dba6b 100644 --- a/Gemfile +++ b/Gemfile @@ -4,26 +4,59 @@ work_dir = File.absolute_path(pwd + '/../../public/themes/fedmine') p "Installing Fedmine Theme" script = <<-EOS + cd #{pwd} mkdir -p #{work_dir} EOS -is_git=0 == `echo -n $(git rev-parse >/dev/null 2>&1; echo $?)`.to_i - -if is_git +if 0 == `echo -n $(which git >/dev/null 2>&1; echo $?)`.to_i && + 0 == `echo -n $(git rev-parse >/dev/null 2>&1; echo $?)`.to_i script << <<-EOS git submodule update --init git submodule update --remote GIT_WORK_TREE=#{work_dir} git checkout -f HEAD EOS else - script << "cp -r . #{work_dir}\n" + script << <<-EOS + if [ `which curl` ]; then + DLAPP=`which curl`" -L -o __OUT__ __URL__" + elif [ `which wget` ]; then + DLAPP=`which wget`" --progress=dot -O __OUT__ __URL__" + else + exit 1 + fi + + IFS=$'\n' + for module in $(cat .gitmodules | tr -d '\n' | sed -e "/\[submodule \"[^\"]\+\"\]\s\+/{s//\n/g}" | sed -e "/\(\s*url = \)\?\(.*\?\)\t*path = \([^\t]\+\)\t*\(url = \)\?\(.*\)/{s//\3\t\2\5/g}" | awk '{$1=$1};1') + do + IFS=' ' read -ra repo <<< $module + path=${repo[0]} + url=${repo[1]}"/archive/master.zip" + + download=${DLAPP/__OUT__/$path.zip} + download=${download/__URL__/$url} + + mkdir -p $path + eval $download + unzip -o $path.zip -d $path + mv $path/*/* $path + rm $path.zip + done + cp -r . #{work_dir} +EOS end script << <<-EOS if [ ! -f #{work_dir}/images/custom-logo.png ]; then cp #{work_dir}/images/logo.png #{work_dir}/images/custom-logo.png fi + +rm -rf #{work_dir}/app +rm -rf #{work_dir}/config +rm -rf #{work_dir}/.git +rm -rf #{work_dir}/Gemfile +rm -rf #{work_dir}/lib +rm -rf #{work_dir}/init.rb EOS system(script) diff --git a/fonts/vazir b/fonts/vazir index d58053e..aa363ca 160000 --- a/fonts/vazir +++ b/fonts/vazir @@ -1 +1 @@ -Subproject commit d58053e9a94e55a85a583fcc5752902c92b1aefd +Subproject commit aa363caae3830b4c00e09ed4bcdbdf67e250b74a diff --git a/stylesheets/application.css b/stylesheets/application.css index e2bdabe..dabd9c9 100644 --- a/stylesheets/application.css +++ b/stylesheets/application.css @@ -35,7 +35,7 @@ h1, h2, h3, h4, h5, h6, h7 { font-family: "Open Sans", Verdana, sans-serif; font #main { background: transparent; margin: 15px 15px 0px 15px; background-color: #fff; } -#top-menu { font-size: 14px; padding: 0px 0px 0px 220px; height: 40px; background: #000 url(../images/logo.png) 10px 5px no-repeat;} +#top-menu { font-size: 14px; padding: 0px 0px 0px 220px; height: 40px; background: #000 url(../images/custom-logo.png) 10px 5px no-repeat;} #top-menu #loggedas { display: none; color: #FFF; padding: 11px 0 11px 5px; margin: 0; background-color: #E02222; border-left: 2px solid #DD4814; } #top-menu #account ul li a { background-color: #d84a38; margin-right: 8px; padding: 5px; font-size: 13px; } #top-menu #account ul li a:hover { background-color: #bb2413 !important; } From 3bb6113f81a00ff7b36fd32a5cd8a2188d9c027d Mon Sep 17 00:00:00 2001 From: Pouyan Heyratpour Date: Wed, 4 Nov 2015 12:05:11 +0330 Subject: [PATCH 02/14] The Installer Script Signed-off-by: Pouyan Heyratpour --- Gemfile | 59 +------------------------------------------------------ installer | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 58 deletions(-) create mode 100755 installer diff --git a/Gemfile b/Gemfile index 71dba6b..ab72e47 100644 --- a/Gemfile +++ b/Gemfile @@ -2,61 +2,4 @@ pwd = File.dirname(__FILE__) work_dir = File.absolute_path(pwd + '/../../public/themes/fedmine') p "Installing Fedmine Theme" - -script = <<-EOS - -cd #{pwd} -mkdir -p #{work_dir} -EOS - -if 0 == `echo -n $(which git >/dev/null 2>&1; echo $?)`.to_i && - 0 == `echo -n $(git rev-parse >/dev/null 2>&1; echo $?)`.to_i - script << <<-EOS -git submodule update --init -git submodule update --remote -GIT_WORK_TREE=#{work_dir} git checkout -f HEAD -EOS -else - script << <<-EOS - if [ `which curl` ]; then - DLAPP=`which curl`" -L -o __OUT__ __URL__" - elif [ `which wget` ]; then - DLAPP=`which wget`" --progress=dot -O __OUT__ __URL__" - else - exit 1 - fi - - IFS=$'\n' - for module in $(cat .gitmodules | tr -d '\n' | sed -e "/\[submodule \"[^\"]\+\"\]\s\+/{s//\n/g}" | sed -e "/\(\s*url = \)\?\(.*\?\)\t*path = \([^\t]\+\)\t*\(url = \)\?\(.*\)/{s//\3\t\2\5/g}" | awk '{$1=$1};1') - do - IFS=' ' read -ra repo <<< $module - path=${repo[0]} - url=${repo[1]}"/archive/master.zip" - - download=${DLAPP/__OUT__/$path.zip} - download=${download/__URL__/$url} - - mkdir -p $path - eval $download - unzip -o $path.zip -d $path - mv $path/*/* $path - rm $path.zip - done - cp -r . #{work_dir} -EOS -end - -script << <<-EOS -if [ ! -f #{work_dir}/images/custom-logo.png ]; then - cp #{work_dir}/images/logo.png #{work_dir}/images/custom-logo.png -fi - -rm -rf #{work_dir}/app -rm -rf #{work_dir}/config -rm -rf #{work_dir}/.git -rm -rf #{work_dir}/Gemfile -rm -rf #{work_dir}/lib -rm -rf #{work_dir}/init.rb -EOS - -system(script) +system(pwd + '/installer "' + pwd + '" "' + work_dir + '"') diff --git a/installer b/installer new file mode 100755 index 0000000..db1d761 --- /dev/null +++ b/installer @@ -0,0 +1,56 @@ +#!/bin/bash + +pwd=$1 +work_dir=$2 + +cd $pwd + +if [ `which git` ] && [ `git rev-parse` ]; +then + git submodule update --init + git submodule update --remote + GIT_WORK_TREE=$work_dir git checkout -f HEAD +else + if [ `which curl` ]; then + DLAPP=`which curl`" -L -o __OUT__ __URL__" + elif [ `which wget` ]; then + DLAPP=`which wget`" --progress=dot -O __OUT__ __URL__" + else + exit 1 + fi + + modules=$(cat .gitmodules | tr -d '\n' | sed -e "/\[submodule \"[^\"]\+\"\]\s\+/{s//\n/g}" | sed -e "/\(\s*url = \)\?\(.*\?\)\t*path = \([^\t]\+\)\t*\(url = \)\?\(.*\)/{s//\3\t\2\5/g}" | awk '{$1=$1};1') + + IFS=$'\n' + for module in $modules; + do + IFS=' ' read -ra repo <<< $module + path=$work_dir/${repo[0]} + url=${repo[1]}"/archive/master.zip" + + mkdir -p $path + + download=${DLAPP/__OUT__/$path.zip} + download=${download/__URL__/$url} + + mkdir -p $path + eval $download + unzip -o $path.zip -d $path + mv $path/*/* $path + rm $path.zip + done + cp -r . $work_dir +fi + +if [ ! -f $work_dir/images/custom-logo.png ]; then + cp $work_dir/images/logo.png $work_dir/images/custom-logo.png +fi + +rm -rf $work_dir/app +rm -rf $work_dir/config +rm -rf $work_dir/.git +rm -rf $work_dir/Gemfile +rm -rf $work_dir/installer +rm -rf $work_dir/lib +rm -rf $work_dir/init.rb + From b7d3767740ce47e4739447f6e846b6f3b549ea2e Mon Sep 17 00:00:00 2001 From: Pouyan Heyratpour Date: Sat, 28 Nov 2015 19:10:43 +0330 Subject: [PATCH 03/14] More Intellijent Installer Signed-off-by: Pouyan Heyratpour --- .gitignore | 1 + installer | 39 +++++++++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 3720537..93e185a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .sass-cache .DS_Store /images/custom-logo.png +SHA256SUMS diff --git a/installer b/installer index db1d761..d49598e 100755 --- a/installer +++ b/installer @@ -25,19 +25,38 @@ else for module in $modules; do IFS=' ' read -ra repo <<< $module - path=$work_dir/${repo[0]} - url=${repo[1]}"/archive/master.zip" + api_url=${repo[1]/https:\/\/github.com/https:\/\/api.github.com\/repos}"/commits" + repo_sfn=${repo[0]/\//_}.commits + checksums=$pwd/SHA256SUMS + api=${DLAPP/__OUT__/\/tmp\/$repo_sfn} + api=${api/__URL__/$api_url} + eval $api - mkdir -p $path + if [ ! -f $checksums ] || [ ! `grep $repo_sfn $checksums` ]; then + echo `sha256sum /dev/null | awk '{print $1}'`" /tmp/$repo_sfn" >> $checksums + fi - download=${DLAPP/__OUT__/$path.zip} - download=${download/__URL__/$url} + if ! `sha256sum --strict --status -c $checksums`; + then + path=$work_dir/${repo[0]} + url=${repo[1]}"/archive/master.zip" - mkdir -p $path - eval $download - unzip -o $path.zip -d $path - mv $path/*/* $path - rm $path.zip + mkdir -p $path + + download=${DLAPP/__OUT__/$path.zip} + download=${download/__URL__/$url} + + mkdir -p $path + eval $download + unzip -o $path.zip -d $path + mv $path/*/* $path + rm $path.zip + fi + + old_checksum=`grep $repo_sfn $checksums | awk '{print $1}'` + new_checksum=`sha256sum /tmp/$repo_sfn | awk '{print $1}'` + sed -i "s/$old_checksum/$new_checksum/" $checksums + rm /tmp/$repo_sfn done cp -r . $work_dir fi From cd8f8e725bf667466d257f5654e00d616e18f043 Mon Sep 17 00:00:00 2001 From: Pouyan Heyratpour Date: Mon, 17 Sep 2018 10:49:25 +0430 Subject: [PATCH 04/14] Fixed an ancient bug Signed-off-by: Pouyan Heyratpour --- installer | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/installer b/installer index d49598e..d975891 100755 --- a/installer +++ b/installer @@ -3,17 +3,20 @@ pwd=$1 work_dir=$2 +mkdir -p $work_dir cd $pwd -if [ `which git` ] && [ `git rev-parse` ]; +if [ `which git` ] && [ `git rev-parse HEAD` ]; then git submodule update --init git submodule update --remote GIT_WORK_TREE=$work_dir git checkout -f HEAD else - if [ `which curl` ]; then + if [ `which curl` ]; + then DLAPP=`which curl`" -L -o __OUT__ __URL__" - elif [ `which wget` ]; then + elif [ `which wget` ]; + then DLAPP=`which wget`" --progress=dot -O __OUT__ __URL__" else exit 1 @@ -58,7 +61,7 @@ else sed -i "s/$old_checksum/$new_checksum/" $checksums rm /tmp/$repo_sfn done - cp -r . $work_dir + cp -r . $work_dir/ fi if [ ! -f $work_dir/images/custom-logo.png ]; then From 5123c12d79e3f0f6e61ddabace21734a0017ab43 Mon Sep 17 00:00:00 2001 From: Pouyan Heyratpour Date: Mon, 17 Sep 2018 15:54:57 +0430 Subject: [PATCH 05/14] Checkout submodules Signed-off-by: Pouyan Heyratpour --- installer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer b/installer index d975891..faa2001 100755 --- a/installer +++ b/installer @@ -10,7 +10,7 @@ if [ `which git` ] && [ `git rev-parse HEAD` ]; then git submodule update --init git submodule update --remote - GIT_WORK_TREE=$work_dir git checkout -f HEAD + GIT_WORK_TREE=$work_dir git checkout -f --recurse-submodules HEAD else if [ `which curl` ]; then From 3f5e8eb44035303bc41031f7e52577ed21e22095 Mon Sep 17 00:00:00 2001 From: Pouyan Heyratpour Date: Sun, 26 May 2019 15:00:53 +0430 Subject: [PATCH 06/14] Let fonts/vazir to track master branch Signed-off-by: Pouyan Heyratpour --- .gitmodules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 2d1fd86..5228c0c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "fonts/vazir"] path = fonts/vazir - url = https://github.com/rastikerdar/vazir-font + url = https://github.com/rastikerdar/vazir-font + branch = master From 9661459a4f28a9116373142cd82121ea251c7fcf Mon Sep 17 00:00:00 2001 From: Pouyan Heyratpour Date: Sun, 26 May 2019 15:05:58 +0430 Subject: [PATCH 07/14] Installer: submodule update to latest commits Signed-off-by: Pouyan Heyratpour --- installer | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installer b/installer index faa2001..de6d2a8 100755 --- a/installer +++ b/installer @@ -8,8 +8,8 @@ cd $pwd if [ `which git` ] && [ `git rev-parse HEAD` ]; then - git submodule update --init - git submodule update --remote + git submodule deinit --all --force + git submodule update --init --remote --recursive --force GIT_WORK_TREE=$work_dir git checkout -f --recurse-submodules HEAD else if [ `which curl` ]; From 6508ad4429438c91095362d74b98eaffe27980f2 Mon Sep 17 00:00:00 2001 From: Pouyan Heyratpour Date: Sun, 26 May 2019 15:10:59 +0430 Subject: [PATCH 08/14] Just nothing Signed-off-by: Pouyan Heyratpour --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 5228c0c..2420481 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "fonts/vazir"] path = fonts/vazir url = https://github.com/rastikerdar/vazir-font - branch = master + branch = master From 74a1d7294a6f2a27cc4af5ce963d28eefb24d442 Mon Sep 17 00:00:00 2001 From: Pouyan Heyratpour Date: Sun, 26 May 2019 15:50:54 +0430 Subject: [PATCH 09/14] Installer: Update submodules manually Signed-off-by: Pouyan Heyratpour --- installer | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/installer b/installer index de6d2a8..9987b30 100755 --- a/installer +++ b/installer @@ -9,7 +9,10 @@ cd $pwd if [ `which git` ] && [ `git rev-parse HEAD` ]; then git submodule deinit --all --force - git submodule update --init --remote --recursive --force + git submodule sync + git submodule update --init + git submodule foreach git checkout master + git submodule foreach git pull origin master GIT_WORK_TREE=$work_dir git checkout -f --recurse-submodules HEAD else if [ `which curl` ]; From d6ac8c5deeb2769e1297e42b339c2319b9ac7dd0 Mon Sep 17 00:00:00 2001 From: Pouyan Heyratpour Date: Sun, 26 May 2019 16:18:44 +0430 Subject: [PATCH 10/14] Installer: Fetch submodules Signed-off-by: Pouyan Heyratpour --- installer | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/installer b/installer index 9987b30..0df4a5c 100755 --- a/installer +++ b/installer @@ -6,20 +6,18 @@ work_dir=$2 mkdir -p $work_dir cd $pwd -if [ `which git` ] && [ `git rev-parse HEAD` ]; -then +if [ `which git` ] && [ `git rev-parse HEAD` ]; then git submodule deinit --all --force git submodule sync git submodule update --init git submodule foreach git checkout master git submodule foreach git pull origin master - GIT_WORK_TREE=$work_dir git checkout -f --recurse-submodules HEAD + #git --work-tree=$work_dir checkout -f --recurse-submodules HEAD + git --work-tree=$work_dir checkout -f --recurse-submodules else - if [ `which curl` ]; - then + if [ `which curl` ]; then DLAPP=`which curl`" -L -o __OUT__ __URL__" - elif [ `which wget` ]; - then + elif [ `which wget` ]; then DLAPP=`which wget`" --progress=dot -O __OUT__ __URL__" else exit 1 @@ -42,8 +40,7 @@ else echo `sha256sum /dev/null | awk '{print $1}'`" /tmp/$repo_sfn" >> $checksums fi - if ! `sha256sum --strict --status -c $checksums`; - then + if ! `sha256sum --strict --status -c $checksums`; then path=$work_dir/${repo[0]} url=${repo[1]}"/archive/master.zip" From 2874750e8a7030c85fed83635b63b54afd105ee4 Mon Sep 17 00:00:00 2001 From: Pouyan Heyratpour Date: Sun, 26 May 2019 16:55:04 +0430 Subject: [PATCH 11/14] Installer: Use cp instead of git checkout Signed-off-by: Pouyan Heyratpour --- installer | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/installer b/installer index 0df4a5c..bc76fc7 100755 --- a/installer +++ b/installer @@ -12,8 +12,6 @@ if [ `which git` ] && [ `git rev-parse HEAD` ]; then git submodule update --init git submodule foreach git checkout master git submodule foreach git pull origin master - #git --work-tree=$work_dir checkout -f --recurse-submodules HEAD - git --work-tree=$work_dir checkout -f --recurse-submodules else if [ `which curl` ]; then DLAPP=`which curl`" -L -o __OUT__ __URL__" @@ -61,9 +59,10 @@ else sed -i "s/$old_checksum/$new_checksum/" $checksums rm /tmp/$repo_sfn done - cp -r . $work_dir/ fi +cp -r . $work_dir/ + if [ ! -f $work_dir/images/custom-logo.png ]; then cp $work_dir/images/logo.png $work_dir/images/custom-logo.png fi From 145be51b39a81ec80f9836d10be500670bf3f842 Mon Sep 17 00:00:00 2001 From: Pouyan Heyratpour Date: Sun, 26 May 2019 17:13:22 +0430 Subject: [PATCH 12/14] replace before_filter with before_action before_filter is deprecated Signed-off-by: Pouyan Heyratpour --- lib/fedmine/settings_controller_patch.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fedmine/settings_controller_patch.rb b/lib/fedmine/settings_controller_patch.rb index cbd7a2c..bfb15b1 100644 --- a/lib/fedmine/settings_controller_patch.rb +++ b/lib/fedmine/settings_controller_patch.rb @@ -1,7 +1,7 @@ module Fedmine module SettingsControllerPatch def self.included(base) - base.send(:before_filter, :upload_logo, :only => :plugin) + base.send(:before_action, :upload_logo, :only => :plugin) end def upload_logo @@ -18,4 +18,4 @@ def upload_logo end end end -end \ No newline at end of file +end From cb32f5585c53f6f43ae14814eeed1cafe942b188 Mon Sep 17 00:00:00 2001 From: Pouyan Heyratpour Date: Sun, 26 May 2019 18:30:43 +0430 Subject: [PATCH 13/14] Reformat Signed-off-by: Pouyan Heyratpour --- installer | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/installer b/installer index bc76fc7..9721866 100755 --- a/installer +++ b/installer @@ -7,11 +7,11 @@ mkdir -p $work_dir cd $pwd if [ `which git` ] && [ `git rev-parse HEAD` ]; then - git submodule deinit --all --force - git submodule sync - git submodule update --init - git submodule foreach git checkout master - git submodule foreach git pull origin master + git submodule deinit --all --force + git submodule sync + git submodule update --init + git submodule foreach git checkout master + git submodule foreach git pull origin master else if [ `which curl` ]; then DLAPP=`which curl`" -L -o __OUT__ __URL__" From b731b7fce111d67ce83242fab85f5b07043cde4f Mon Sep 17 00:00:00 2001 From: Pouyan Heyratpour Date: Wed, 29 May 2019 18:40:34 +0430 Subject: [PATCH 14/14] Change repo url Signed-off-by: Pouyan Heyratpour --- init.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.rb b/init.rb index c89e3b8..719d2a8 100644 --- a/init.rb +++ b/init.rb @@ -10,7 +10,7 @@ description 'Fedmine flat theme with rtl support' version '1.0.0' requires_redmine :version_or_higher => '3.0.0' - url 'https://github.com/ghasedak/fedmine' + url 'https://github.com/pattack/fedmine' author_url 'https://github.com/pouyanh' settings(:partial => 'settings/fedmine')