forked from csscomb/csscomb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
89 lines (77 loc) · 4.8 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
MAJOR_VERSION = 2
MINOR_VERSION = 11
BUILD_TIMESTAMP = $(shell basename `date "+%y%m%d%H%M"`)
LAST_COMMIT_HASH = $(shell git log -1 --pretty=format:"%h")
PATH_TO_CORE = src/csscomb.php
PATH_TO_PLUGINS = src/plugins
PATH_TO_CODA_PLUGIN = $(PATH_TO_PLUGINS)/csscomb.codaplugin
PATH_TO_CODA_2_PLUGIN = $(PATH_TO_PLUGINS)/csscomb_for_coda_2.codaplugin
PATH_TO_CODA_PLUGIN_CORE = $(PATH_TO_CODA_PLUGIN)/Contents/Resources/55543892-82DE-4679-9ADE-11CA109E2C68
PATH_TO_CODA_2_PLUGIN_CORE = $(PATH_TO_CODA_2_PLUGIN)/Contents/Resources/55543892-82DE-4679-9ADE-11CA109E2C68
PATH_TO_TEXTMATE_PLUGIN = $(PATH_TO_PLUGINS)/csscomb.tmbundle
PATH_TO_NOTEPAD_P_P_PLUGIN = $(PATH_TO_PLUGINS)/csscomb.notepad_plus_plus
PATH_TO_INTELLIJ_PLUGIN = $(PATH_TO_PLUGINS)/csscomb.webstorm_pycharm_idea
PATH_TO_SUBLIME_PLUGIN = $(PATH_TO_PLUGINS)/csscomb.sublime_text_2
PATH_TO_ESPRESSO_PLUGIN = $(PATH_TO_PLUGINS)/csscomb.sugar
buildAll: buildCli copyCore buildPlugins buildWww
@echo 'Successfully done.'
all: updateVersion buildCli copyCore buildPlugins buildWww
@echo 'Successfully done.'
updateVersion:
@echo 'Updating version...'
@sed -i '' 's/[0-9].[0-9]\{2\} (build [a-z0-9]\{7\}-[0-9]\{10\})/$(MAJOR_VERSION).$(MINOR_VERSION) \(build $(LAST_COMMIT_HASH)-$(BUILD_TIMESTAMP)\)/' $(PATH_TO_CORE) src/cli.php $(PATH_TO_CODA_2_PLUGIN_CORE)/csscomb.php $(PATH_TO_CODA_PLUGIN_CORE)/csscomb.php $(PATH_TO_TEXTMATE_PLUGIN)/Commands/CSScomb.tmCommand $(PATH_TO_ESPRESSO_PLUGIN)/Scripts/inline-csscomb.php
buildCli:
@echo 'Building CLI...'
@mkdir -p build/cli
@cp $(PATH_TO_CORE) build/cli/csscomb.php
@sed '1d' < src/cli.php >> build/cli/csscomb.php
copyCore:
@echo 'Copying CLI...'
@mkdir -p www/src
@echo 'Copying core to web app...'
@cp $(PATH_TO_CORE) www/$(PATH_TO_CORE)
@echo 'Copying core to plugins...'
@mkdir -p $(PATH_TO_CODA_PLUGIN_CORE)/Support\ Files
@mkdir -p $(PATH_TO_CODA_2_PLUGIN_CORE)/Support\ Files
@mkdir -p $(PATH_TO_TEXTMATE_PLUGIN)/Support/lib
@mkdir -p $(PATH_TO_ESPRESSO_PLUGIN)/ScriptLibraries
@cp $(PATH_TO_CORE) $(PATH_TO_CODA_PLUGIN_CORE)/Support\ Files/csscomb.php
@cp $(PATH_TO_CORE) $(PATH_TO_CODA_2_PLUGIN_CORE)/Support\ Files/csscomb.php
@cp $(PATH_TO_CORE) $(PATH_TO_TEXTMATE_PLUGIN)/Support/lib/csscomb.php
@cp $(PATH_TO_CORE) $(PATH_TO_SUBLIME_PLUGIN)/csscomb/libs/csscomb.php
@cp $(PATH_TO_CORE) $(PATH_TO_ESPRESSO_PLUGIN)/ScriptLibraries/csscomb.php
buildPlugins: buildNotepadPlugin buildIntellijPlugin
@echo 'Making plugin archives...'
@mkdir -p build
@zip -9 -y -r -q build/csscomb_for_coda_$(MAJOR_VERSION)-$(MINOR_VERSION)-$(BUILD_TIMESTAMP) $(PATH_TO_CODA_PLUGIN)
@zip -9 -y -r -q build/csscomb_for_coda-2_$(MAJOR_VERSION)-$(MINOR_VERSION)-$(BUILD_TIMESTAMP) $(PATH_TO_CODA_2_PLUGIN)
@zip -9 -y -r -q build/csscomb_for_textmate_$(MAJOR_VERSION)-$(MINOR_VERSION)-$(BUILD_TIMESTAMP) $(PATH_TO_TEXTMATE_PLUGIN)
@zip -9 -y -r -q build/csscomb_for_sublime-text-2_$(MAJOR_VERSION)-$(MINOR_VERSION)-$(BUILD_TIMESTAMP) $(PATH_TO_SUBLIME_PLUGIN)
@zip -9 -y -r -q build/csscomb_for_notepad-plus-plus_$(MAJOR_VERSION)-$(MINOR_VERSION)-$(BUILD_TIMESTAMP) $(PATH_TO_NOTEPAD_P_P_PLUGIN)
@zip -9 -y -r -q build/csscomb_for_webstorm-pycharm-idea_$(MAJOR_VERSION)-$(MINOR_VERSION)-$(BUILD_TIMESTAMP) $(PATH_TO_INTELLIJ_PLUGIN)
@zip -9 -y -r -q build/csscomb_for_espresso-2_$(MAJOR_VERSION)-$(MINOR_VERSION)-$(BUILD_TIMESTAMP) $(PATH_TO_ESPRESSO_PLUGIN)
buildNotepadPlugin:
@echo 'Building plugin for Notepad++...'
@cp $(PATH_TO_CORE) $(PATH_TO_NOTEPAD_P_P_PLUGIN)/csscomb.php
@sed '1d' < $(PATH_TO_NOTEPAD_P_P_PLUGIN)/call.php >> $(PATH_TO_NOTEPAD_P_P_PLUGIN)/csscomb.php
buildIntellijPlugin:
@echo 'Building plugins for IntelliJ IDEA / PyStorm / WebStorm...'
@cp $(PATH_TO_CORE) $(PATH_TO_INTELLIJ_PLUGIN)/csscomb.php
@sed '1d' < $(PATH_TO_INTELLIJ_PLUGIN)/call.php >> $(PATH_TO_INTELLIJ_PLUGIN)/csscomb.php
buildWww: useCsscomb
# YUI Compressor required
# http://yuilibrary.com/download/yuicompressor/
@echo 'Minifying CSS & JS...'
@mkdir -p www/static/_css
@java -jar yuicompressor-2.4.7.jar www/static/css/style.css > www/static/_css/style.css
@java -jar yuicompressor-2.4.7.jar www/static/css/tests.css > www/static/_css/tests.css
@java -jar yuicompressor-2.4.7.jar www/static/js/online.js > www/static/_js/online.js
@java -jar yuicompressor-2.4.7.jar www/static/js/tests.js > www/static/_js/tests.js
@java -jar yuicompressor-2.4.7.jar www/static/js/jquery.textarea.js > www/static/_js/jquery.textarea.js
@java -jar yuicompressor-2.4.7.jar www/static/js/jquery.freeze.js > www/static/_js/jquery.freeze.js
@echo 'Concatenating CSS & JS to bundle...'
@cat www/static/_css/style.css www/static/_css/tests.css > www/static/_css/csscomb.css
@cat www/static/_js/jquery.shortcuts.min.js www/static/_js/jquery.textarea.js > www/static/_js/csscomb.js
useCsscomb:
@echo 'Using CSScomb for CSScomb web site...'
@php build/cli/csscomb.php -i www/static/css