Skip to content

Commit c3a2e7c

Browse files
committed
Merge pull request #780 from mgreter/tool/todo-tests-helper
Add small tool to ease todo spec tests creation
2 parents 3367b33 + f902c3c commit c3a2e7c

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

tools/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/*.scss

tools/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## gen_libsass_todo
2+
3+
```bash
4+
$ gen_libsass_todo # [remote]
5+
$ gen_libsass_todo 2014 mgreter
6+
```
7+
8+
- create a new branch from master
9+
- read spec test from `$ISSUE.scss`
10+
- create folder and necessary files
11+
- call spec runner to nuke the test
12+
- add files to git and create commit
13+
- optionally push to the given remote

tools/gen_libsass_todo.cmd

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
@echo off
2+
3+
SETLOCAL
4+
5+
SET EXEC=%~0
6+
SET ISSUE=%1
7+
8+
REM split exec into parts
9+
For %%F IN ("%EXEC%") do (
10+
Set FOLDER=%%~dpF
11+
Set NAME=%%~nxF
12+
)
13+
14+
REM test if we have an issue nr
15+
if [%1] == [] GOTO :NoIssue
16+
SET SPECS=%FOLDER%..\sass-spec\spec
17+
18+
if not exist "%ISSUE%.scss" (
19+
echo input source not found: %ISSUE%.scss
20+
goto :End
21+
)
22+
23+
SET GITCMD=git -C "%FOLDER%..\sass-spec"
24+
25+
%GITCMD% fetch --all
26+
%GITCMD% checkout -f -B todo/issue_%ISSUE% master
27+
28+
if not exist "%SPECS%\libsass-todo-issues\issue_%ISSUE%" (
29+
mkdir "%SPECS%\libsass-todo-issues\issue_%ISSUE%"
30+
)
31+
32+
copy %ISSUE%.scss %SPECS%\libsass-todo-issues\issue_%ISSUE%\input.scss
33+
REM not sure why this is needed, but sass-spec did not create it otherwise
34+
copy %ISSUE%.scss %SPECS%\libsass-todo-issues\issue_%ISSUE%\expected_output.css
35+
36+
ruby %SPECS%\..\sass-spec.rb -g --run-todo --no-cache --root "%SPECS%\libsass-todo-issues\issue_%ISSUE%"
37+
38+
%GITCMD% add %SPECS%\libsass-todo-issues\issue_%ISSUE%\*
39+
%GITCMD% commit -m "Activate libsass todo test for issue %ISSUE%" ^
40+
-m "" -m "https://github.com/sass/libsass/issues/%ISSUE%"
41+
42+
echo You may push the branch to your reote repository now
43+
if [%2] == [] GOTO :End
44+
echo Going to push to remote %2
45+
%GITCMD% push %2 todo/issue_%ISSUE%
46+
47+
GOTO :End
48+
49+
:NoIssue
50+
51+
echo Please pass an issue number
52+
53+
GOTO :End
54+
55+
:End

0 commit comments

Comments
 (0)