File tree Expand file tree Collapse file tree 7 files changed +17
-18
lines changed
test_data/expected_output Expand file tree Collapse file tree 7 files changed +17
-18
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ typings/
59
59
60
60
# test output for diffs
61
61
test_data /test_output.json
62
+ output.txt
62
63
63
64
# package-lock is dumb and not at all worth it here
64
65
package-lock.json
Original file line number Diff line number Diff line change
1
+ 12345deadbeef|It's a message, for testing
2
+ 8badf00d|Also a message for testing
3
+ bada55|It's a message, for testing
4
+ feedface9876|Also a message for testing
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- curl -L -w " \n" --user $SECRET_USER :$SECRET_PWD -X PUT -H " Content-Type: application/json" --data " {\" comment\" : \" It's a message, for testing\" }" $1 12345deadbeef
3
- curl -L -w " \n" --user $SECRET_USER :$SECRET_PWD -X PUT -H " Content-Type: application/json" --data " {\" comment\" : \" Also a message for testing\" }" $1 8badf00d
4
- curl -L -w " \n" --user $SECRET_USER :$SECRET_PWD -X PUT -H " Content-Type: application/json" --data " {\" comment\" : \" It's a message, for testing\" }" $1 bada55
5
- curl -L -w " \n" --user $SECRET_USER :$SECRET_PWD -X PUT -H " Content-Type: application/json" --data " {\" comment\" : \" Also a message for testing\" }" $1 feedface9876
2
+ while IFS=' |' read -r string_hash string_comment; do
3
+ curl -L -w " \n" --user $SECRET_USER :$SECRET_PWD -X PUT -H " Content-Type: application/json" --data " {\" comment\" : \" $string_comment \" }" $1 $string_hash
4
+ done < bash_scripts/hashed_data.txt
Original file line number Diff line number Diff line change @@ -23,16 +23,12 @@ inData.forEach((message) => {
23
23
if ( process . argv [ 3 ] === "--comments" ) {
24
24
process . stdout . write ( "generating bash scripts...\n" ) ;
25
25
var messageInfo = JSON . parse ( fs . readFileSync ( __dirname + "/bash_scripts/hashmap.json" ) ) ;
26
- var scriptPath = __dirname + "/bash_scripts/put_comments.sh " ;
27
- fs . writeFileSync ( scriptPath , "#!/bin/bash\n " ) ;
26
+ var dataPath = __dirname + "/bash_scripts/hashed_data.txt " ;
27
+ fs . writeFileSync ( dataPath , "" ) ;
28
28
inData . forEach ( ( message ) => {
29
29
var info = messageInfo . find ( mi => mi . key == message . id ) ;
30
30
if ( info ) {
31
- var header = " -H \"Content-Type: application/json\"" ;
32
- var escapedDescription = message . description . replace ( / ( [ " ] ) / g, "\\\\\\$1" ) ;
33
- var data = " --data \"{\\\"comment\\\": \\\"" + escapedDescription + "\\\"}\"" ;
34
- var url = " $1" + info . string_hash ;
35
- fs . appendFileSync ( scriptPath , "curl -L -w \"\\n\" --user $SECRET_USER:$SECRET_PWD -X PUT" + header + data + url + "\n" ) ;
31
+ fs . appendFileSync ( dataPath , info . string_hash + "|" + message . description + "\n" ) ;
36
32
} else {
37
33
process . stdout . write ( "string " + message . id + " does not yet exist on transifex!\n" ) ;
38
34
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " reactifex" ,
3
- "version" : " 1.0.1 " ,
3
+ "version" : " 1.0.2 " ,
4
4
"description" : " A helper for moving react-intl messages to transifex and back" ,
5
5
"bin" : " ./main.js" ,
6
6
"scripts" : {
7
7
"lint" : " eslint ." ,
8
8
"test_compile" : " node main.js test_data/input/ test_data/test_output.json && diff test_data/test_output.json test_data/expected_output/messages.json" ,
9
- "test_comments" : " node main.js test_data/input/ --comments && diff bash_scripts/put_comments.sh test_data/expected_output/put_comments.sh "
9
+ "test_comments" : " node main.js test_data/input/ --comments && SECRET_USER=uname SECRET_PWD=password bash -x ./ bash_scripts/put_comments.sh http://totally_real.notfake.com/api/ 2>&1 | grep PUT > output.txt && diff -w output.txt test_data/expected_output/test_curl.txt "
10
10
},
11
11
"repository" : {
12
12
"type" : " git" ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ + curl -L -w '\n' --user uname:password -X PUT -H 'Content-Type: application/json' --data '{"comment": "It'\''s a message, for testing"}' http://totally_real.notfake.com/api/12345deadbeef
2
+ + curl -L -w '\n' --user uname:password -X PUT -H 'Content-Type: application/json' --data '{"comment": "Also a message for testing"}' http://totally_real.notfake.com/api/8badf00d
3
+ + curl -L -w '\n' --user uname:password -X PUT -H 'Content-Type: application/json' --data '{"comment": "It'\''s a message, for testing"}' http://totally_real.notfake.com/api/bada55
4
+ + curl -L -w '\n' --user uname:password -X PUT -H 'Content-Type: application/json' --data '{"comment": "Also a message for testing"}' http://totally_real.notfake.com/api/feedface9876
You can’t perform that action at this time.
0 commit comments