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/.gitmodules b/.gitmodules index 2d1fd86..2420481 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 diff --git a/Gemfile b/Gemfile index f4ba4a1..ab72e47 100644 --- a/Gemfile +++ b/Gemfile @@ -2,28 +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 - -is_git=0 == `echo -n $(git rev-parse >/dev/null 2>&1; echo $?)`.to_i - -if is_git - 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" -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 -EOS - -system(script) +system(pwd + '/installer "' + pwd + '" "' + work_dir + '"') 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/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') diff --git a/installer b/installer new file mode 100755 index 0000000..9721866 --- /dev/null +++ b/installer @@ -0,0 +1,77 @@ +#!/bin/bash + +pwd=$1 +work_dir=$2 + +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 +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 + 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 + + if [ ! -f $checksums ] || [ ! `grep $repo_sfn $checksums` ]; then + echo `sha256sum /dev/null | awk '{print $1}'`" /tmp/$repo_sfn" >> $checksums + fi + + if ! `sha256sum --strict --status -c $checksums`; then + 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 + 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 +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 + +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 + 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 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; }