-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfigaro.env.sh
executable file
·110 lines (66 loc) · 2.17 KB
/
figaro.env.sh
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/env bash
echo ~----------~----------Startingd $HOSTNAME, pwd: `pwd`, dlr0: "$0", bashsource0: "${BASH_SOURCE[0]}", $(date +"%Y-%m-%d_%H.%M.%S")
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# read settings..
read appn sfil sfil2 mpwd parm0</tmp/"_brvar1202_${USER}".txt
echo $appn $sfil $sfil2 $mpwd $parm0
# timeout1=5 ; read -t "${timeout1}" -p "Press ENTER or wait $timeout1 seconds..." || true ; echo ;
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo '#' >> Gemfile
echo 'gem "figaro"' >> Gemfile
bundle
git add -A # Add all files and commit them
git commit -m "figaro environment gem"
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bundle exec figaro install
echo 'SECRET_KEY_BASE: f55c9f3b84be053f8ea74b84d' >> config/application.yml
echo 'DATABASE_USERNAME: username1' >> config/application.yml
echo 'DATABASE_PASSWORD: pass1' >> config/application.yml
git status
# git diff
git add -A
git commit -m "after figaro install"
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# change database gems..
# add text to end of line containing patrn...
#
filetarg='Gemfile'
r1tmp="/tmp/_temprubyrunner_${USER}.rb"
cat << 'HEREDOC' > $r1tmp
repl2 = 'not used here'
ARGF.each do |line|
if line =~ /gem.*sqlite3/
puts line.sub!(/sqlite3\'/, 'sqlite3\', group: :development')
else
puts line
end
end
HEREDOC
ruby $r1tmp $filetarg > $filetarg.tmp
cp $filetarg.tmp $filetarg; rm $filetarg.tmp
# add new lines of text after patrn...
#
filetarg='Gemfile'
r1tmp="/tmp/_temprubyrunner_${USER}.rb"
cat << 'HEREDOC' > $r1tmp
repl2 = %q{
gem 'mysql2', group: :development
# gem 'pg', group: :production
}
ARGF.each do |line|
puts line
puts repl2 if line =~ /gem.*sqlite3/
end
HEREDOC
ruby $r1tmp $filetarg > $filetarg.tmp
cp $filetarg.tmp $filetarg; rm $filetarg.tmp
bundle install
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function offline21() {
: <<'BLOCKCOMMENT'
BLOCKCOMMENT
}
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# git add -A # Add all files and commit them
# git commit -m "figaro setup"
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~