-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcocoon1.sh
More file actions
executable file
·130 lines (71 loc) · 3.12 KB
/
cocoon1.sh
File metadata and controls
executable file
·130 lines (71 loc) · 3.12 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env bash
echo ~----------~----------Startingd $HOSTNAME, pwd: `pwd`, dlr0: "$0", bashsource0: "${BASH_SOURCE[0]}", $(date +"%Y-%m-%d_%H.%M.%S")
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function purpose1() {
echo tmp1
exit 999
: <<'BLOCKCOMMENT'
Purpose: https://github.com/nathanvda/cocoon
BLOCKCOMMENT
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 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 "gem 'cocoon'" >> Gemfile
bundle
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# add new lines of text after patrn...
filetarg='app/assets/javascripts/application.js'
r1tmp="/tmp/_temprubyrunner_${USER}.rb"
cat << 'HEREDOC' > $r1tmp
repl2 = %Q{//= require cocoon}
ARGF.each do |line|
puts line
puts repl2 if line =~ /tree/
end
HEREDOC
ruby $r1tmp $filetarg > $filetarg.tmp
cp $filetarg.tmp $filetarg; rm $filetarg.tmp
cat $filetarg
git add -A # Add all files and commit them
git commit -m "cocoon1"
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rails generate scaffold Lpa_answer body:text user:references lpa_question:references issue_description:text action_taken:text -f
rails generate scaffold Lpa_question title:string lpa_survey:references question_type:integer sort:integer active_status:integer -f
rails generate scaffold Lpa_survey title:string user:references sort:integer active_status:integer -f
# --no-migration
# _____________
# rails generate scaffold Survey name:string sort:integer active_status:integer --no-migration
# rails generate scaffold Question name:string qtype:integer survey:references sort:integer active_status:integer --no-migration
# rails generate scaffold Choice name:string question:references sort:integer active_status:integer --no-migration
# rails generate scaffold Answer body:text choice:references question:references response:references issue:string action:text --no-migration
# rails generate scaffold Response name:string survey:references user:references ip:string --no-migration
rake db:migrate
git add -A # Add all files and commit them
git commit -m "cocoon - scaffold survey"
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function notes1() {
exit 999
: <<'BLOCKCOMMENT'
Your models are associated like this:
class Project < ActiveRecord::Base
has_many :tasks, inverse_of: :project
accepts_nested_attributes_for :tasks, reject_if: :all_blank, allow_destroy: true
end
class Task < ActiveRecord::Base
belongs_to :project
end
# controller..
def project_params
params.require(:project).permit(:name, :description, tasks_attributes: [:id, :description, :done, :_destroy])
end
BLOCKCOMMENT
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~