prick 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -5
- data/Gemfile +4 -1
- data/TODO +3 -0
- data/doc/prick.txt +114 -0
- data/exe/prick +224 -370
- data/lib/ext/fileutils.rb +11 -0
- data/lib/ext/forward_method.rb +18 -0
- data/lib/ext/shortest_path.rb +44 -0
- data/lib/prick.rb +17 -9
- data/lib/prick/branch.rb +254 -0
- data/lib/prick/builder.rb +141 -0
- data/lib/prick/command.rb +19 -11
- data/lib/prick/constants.rb +42 -20
- data/lib/prick/database.rb +5 -3
- data/lib/prick/diff.rb +47 -0
- data/lib/prick/exceptions.rb +15 -3
- data/lib/prick/git.rb +46 -21
- data/lib/prick/migration.rb +165 -185
- data/lib/prick/program.rb +238 -0
- data/lib/prick/project.rb +266 -358
- data/lib/prick/rdbms.rb +2 -2
- data/lib/prick/schema.rb +19 -88
- data/lib/prick/share.rb +64 -0
- data/lib/prick/state.rb +137 -0
- data/lib/prick/version.rb +34 -14
- data/libexec/strip-comments +33 -0
- data/make_releases +48 -345
- data/make_schema +10 -0
- data/prick.gemspec +11 -22
- data/share/feature_migration/diff.sql +2 -0
- data/share/feature_migration/migrate.sql +2 -0
- data/share/release_migration/diff.sql +3 -0
- data/share/release_migration/features.yml +6 -0
- data/share/release_migration/migrate.sql +5 -0
- data/share/release_migration/migrate.yml +5 -0
- data/share/schema/build.yml +14 -0
- data/share/schema/schema.sql +5 -0
- data/share/schemas/build.yml +3 -0
- data/share/schemas/prick/build.yml +14 -0
- data/share/schemas/prick/data.sql +1 -2
- data/share/schemas/prick/schema.sql +0 -15
- data/share/schemas/prick/tables.sql +17 -0
- data/share/schemas/public/.keep +0 -0
- data/share/schemas/public/build.yml +14 -0
- data/share/schemas/public/schema.sql +3 -0
- data/test_assorted +192 -0
- data/test_feature +112 -0
- data/test_single_dev +83 -0
- metadata +34 -61
@@ -1,20 +1,5 @@
|
|
1
1
|
|
2
|
-
-- Controlled by prick(1). Don't touch
|
3
|
-
--
|
4
|
-
|
5
2
|
drop schema if exists prick cascade;
|
6
3
|
create schema prick;
|
7
4
|
|
8
5
|
set search_path to prick;
|
9
|
-
|
10
|
-
create table versions (
|
11
|
-
id integer generated by default as identity primary key,
|
12
|
-
custom varchar,
|
13
|
-
major integer not null,
|
14
|
-
minor integer not null,
|
15
|
-
patch integer not null,
|
16
|
-
pre varchar,
|
17
|
-
feature varchar,
|
18
|
-
version varchar not null
|
19
|
-
);
|
20
|
-
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
-- Controlled by prick(1). Don't touch
|
3
|
+
--
|
4
|
+
|
5
|
+
set search_path to prick;
|
6
|
+
|
7
|
+
create table versions (
|
8
|
+
id integer generated by default as identity primary key,
|
9
|
+
custom varchar,
|
10
|
+
major integer not null,
|
11
|
+
minor integer not null,
|
12
|
+
patch integer not null,
|
13
|
+
pre varchar,
|
14
|
+
feature varchar,
|
15
|
+
version varchar not null
|
16
|
+
);
|
17
|
+
|
File without changes
|
data/test_assorted
ADDED
@@ -0,0 +1,192 @@
|
|
1
|
+
#!/usr/bin/bash
|
2
|
+
|
3
|
+
function add_table() {
|
4
|
+
local name=$1
|
5
|
+
echo "create table $name (id integer);" >>schemas/public/tables.sql
|
6
|
+
git add schemas/public/tables.sql
|
7
|
+
git commit -m "Added table $name" >/dev/null
|
8
|
+
}
|
9
|
+
|
10
|
+
set -e
|
11
|
+
clear
|
12
|
+
|
13
|
+
rm -rf dir
|
14
|
+
prick --name prj init dir
|
15
|
+
echo
|
16
|
+
(
|
17
|
+
echo "*** DEVELOP ON UNNAMED RELEASES"
|
18
|
+
echo "***"
|
19
|
+
|
20
|
+
cd dir
|
21
|
+
echo "Prepare an unnamed release"
|
22
|
+
prick prepare release
|
23
|
+
echo
|
24
|
+
|
25
|
+
echo "Add table a"
|
26
|
+
add_table a
|
27
|
+
echo
|
28
|
+
|
29
|
+
echo "Bring current database up to date"
|
30
|
+
prick build
|
31
|
+
echo
|
32
|
+
|
33
|
+
echo "Prepare diff"
|
34
|
+
prick prepare diff
|
35
|
+
echo
|
36
|
+
|
37
|
+
echo "Commit diff"
|
38
|
+
git commit -am "Committed diff"
|
39
|
+
echo
|
40
|
+
|
41
|
+
echo "Update migrations"
|
42
|
+
echo "\\i diff.sql" >>releases/0.0.0/migrate.sql
|
43
|
+
git commit -am "Updated migrations.sql"
|
44
|
+
echo
|
45
|
+
|
46
|
+
echo "Create release 0.1.0"
|
47
|
+
prick create release 0.1.0
|
48
|
+
echo
|
49
|
+
|
50
|
+
echo "*** DEVELOP ON PRERELEASES"
|
51
|
+
echo "***"
|
52
|
+
|
53
|
+
echo "Create prerelease for 0.2.0"
|
54
|
+
prick create prerelease minor
|
55
|
+
echo
|
56
|
+
|
57
|
+
echo "Add table b"
|
58
|
+
add_table b
|
59
|
+
echo
|
60
|
+
|
61
|
+
echo "Bring current database up to date"
|
62
|
+
prick build
|
63
|
+
echo
|
64
|
+
|
65
|
+
echo "Prepare diff"
|
66
|
+
prick prepare diff
|
67
|
+
echo
|
68
|
+
|
69
|
+
echo "Commit diff"
|
70
|
+
git commit -am "Committed diff"
|
71
|
+
echo
|
72
|
+
|
73
|
+
echo "Update migrations"
|
74
|
+
echo "\\i diff.sql" >>releases/0.1.0/migrate.sql
|
75
|
+
git commit -am "Updated migrations.sql"
|
76
|
+
echo
|
77
|
+
|
78
|
+
echo "Create release 0.2.0"
|
79
|
+
prick create release
|
80
|
+
echo
|
81
|
+
|
82
|
+
echo "*** DEVELOP ON MIGRATIONS"
|
83
|
+
echo "***"
|
84
|
+
|
85
|
+
echo "Prepare 0.0.0 -> 0.2.0 migration"
|
86
|
+
prick prepare migration 0.0.0
|
87
|
+
echo
|
88
|
+
|
89
|
+
echo "Prepare diff"
|
90
|
+
prick prepare diff
|
91
|
+
echo
|
92
|
+
|
93
|
+
echo "Commit diff"
|
94
|
+
git commit -am "Committed diff"
|
95
|
+
echo
|
96
|
+
|
97
|
+
echo "Check migration"
|
98
|
+
prick check && echo ok || echo ej
|
99
|
+
echo
|
100
|
+
|
101
|
+
# echo "*** REBASING MIGRATIONS (bad idea)"
|
102
|
+
# echo "***"
|
103
|
+
#
|
104
|
+
# echo "Checkout 0.2.0"
|
105
|
+
# git checkout 0.2.0
|
106
|
+
#
|
107
|
+
# echo "Prepare an unnamed release"
|
108
|
+
# prick prepare release
|
109
|
+
# echo
|
110
|
+
#
|
111
|
+
# echo "Add table c"
|
112
|
+
# add_table c
|
113
|
+
# echo
|
114
|
+
#
|
115
|
+
# echo "Bring current database up to date"
|
116
|
+
# prick build
|
117
|
+
# echo
|
118
|
+
#
|
119
|
+
# echo "Prepare diff"
|
120
|
+
# prick prepare diff
|
121
|
+
# echo
|
122
|
+
#
|
123
|
+
# echo "Commit diff"
|
124
|
+
# git commit -am "Committed diff"
|
125
|
+
# echo
|
126
|
+
#
|
127
|
+
# echo "Update migrations"
|
128
|
+
# echo "\\i diff.sql" >>releases/0.2.0/migrate.sql
|
129
|
+
# git commit -am "Updated migrations.sql"
|
130
|
+
# echo
|
131
|
+
#
|
132
|
+
# echo "Create release 0.3.0"
|
133
|
+
# prick create release minor
|
134
|
+
# echo
|
135
|
+
#
|
136
|
+
# echo "Checkout 0.0.0_0.2.0"
|
137
|
+
# git checkout 0.0.0_0.2.0
|
138
|
+
#
|
139
|
+
# echo "Rebase migration"
|
140
|
+
# prick prepare migration 0.3.0
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
echo "Checkout 0.2.0"
|
147
|
+
git checkout 0.2.0
|
148
|
+
echo
|
149
|
+
|
150
|
+
echo "Create feature_a"
|
151
|
+
prick create feature feature_a
|
152
|
+
echo
|
153
|
+
exit
|
154
|
+
|
155
|
+
echo "Create prerelease 0.1.0.pre.1"
|
156
|
+
prick create prerelease minor
|
157
|
+
echo
|
158
|
+
|
159
|
+
echo "Increment prerelease"
|
160
|
+
prick create prerelease
|
161
|
+
echo
|
162
|
+
|
163
|
+
echo "Release (0.1.0)"
|
164
|
+
prick create release
|
165
|
+
echo
|
166
|
+
|
167
|
+
echo "Create release 0.2.0"
|
168
|
+
prick create release 0.2.0
|
169
|
+
echo
|
170
|
+
|
171
|
+
echo "Prepare migration"
|
172
|
+
prick prepare migration 0.0.0
|
173
|
+
echo
|
174
|
+
|
175
|
+
echo "Create migration"
|
176
|
+
prick create migration
|
177
|
+
echo
|
178
|
+
#
|
179
|
+
# echo "Create release 0.3.0"
|
180
|
+
# git checkout 0.2.0
|
181
|
+
# prick create release 0.3.0
|
182
|
+
# echo
|
183
|
+
#
|
184
|
+
# echo "Retarget 0.0.0 -> 0.3.0"
|
185
|
+
# git checkout 0.0.0_0.2.0
|
186
|
+
# prick retarget 0.3.0
|
187
|
+
# echo
|
188
|
+
|
189
|
+
tree -a -I .git
|
190
|
+
)
|
191
|
+
|
192
|
+
|
data/test_feature
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
#!/usr/bin/bash
|
2
|
+
|
3
|
+
function add_table() {
|
4
|
+
local name=$1
|
5
|
+
echo "create table $name (id integer);" >>schemas/public/tables.sql
|
6
|
+
git add schemas/public/tables.sql
|
7
|
+
git commit -m "Added table $name" >/dev/null
|
8
|
+
}
|
9
|
+
|
10
|
+
set -e
|
11
|
+
clear
|
12
|
+
|
13
|
+
rm -rf dir
|
14
|
+
prick --name prj init dir
|
15
|
+
echo
|
16
|
+
(
|
17
|
+
cd dir
|
18
|
+
|
19
|
+
echo "*** FEATURE"
|
20
|
+
echo "***"
|
21
|
+
|
22
|
+
echo "Create feature_a"
|
23
|
+
prick create feature feature_a
|
24
|
+
echo
|
25
|
+
|
26
|
+
echo "Add table a"
|
27
|
+
add_table a
|
28
|
+
echo
|
29
|
+
|
30
|
+
echo "Bring current database up to date"
|
31
|
+
prick build
|
32
|
+
echo
|
33
|
+
|
34
|
+
echo "Prepare diff"
|
35
|
+
prick prepare diff
|
36
|
+
echo
|
37
|
+
|
38
|
+
echo "Commit diff"
|
39
|
+
git commit -am "Committed diff"
|
40
|
+
echo
|
41
|
+
|
42
|
+
echo "Update migrate.sql"
|
43
|
+
echo "\\i diff.sql" >>releases/0.0.0/feature_a/migrate.sql
|
44
|
+
git commit -am "Updated migrate.sql"
|
45
|
+
echo
|
46
|
+
|
47
|
+
echo "Checkout 0.0.0"
|
48
|
+
git checkout 0.0.0
|
49
|
+
|
50
|
+
echo "Create prerelease 0.1.0.pre.1"
|
51
|
+
prick create prerelease minor
|
52
|
+
echo
|
53
|
+
|
54
|
+
echo "Include feature_a"
|
55
|
+
prick include feature 0.0.0_feature_a
|
56
|
+
|
57
|
+
echo "Add table b"
|
58
|
+
add_table b
|
59
|
+
echo
|
60
|
+
|
61
|
+
echo "Bring current database up to date"
|
62
|
+
prick build
|
63
|
+
echo
|
64
|
+
|
65
|
+
echo "Prepare diff"
|
66
|
+
prick prepare diff
|
67
|
+
echo
|
68
|
+
|
69
|
+
echo "Update migrate.sql"
|
70
|
+
echo "\\i diff.sql" >>releases/0.0.0/migrate.sql
|
71
|
+
git commit -am "Updated migrate.sql"
|
72
|
+
echo
|
73
|
+
|
74
|
+
echo "Release (0.1.0)"
|
75
|
+
prick create release
|
76
|
+
echo
|
77
|
+
|
78
|
+
echo "Build 0.0.0"
|
79
|
+
prick build 0.0.0
|
80
|
+
|
81
|
+
echo "Load 0.0.0 into project database"
|
82
|
+
prick load -d prj 0.0.0
|
83
|
+
|
84
|
+
echo "Upgrade"
|
85
|
+
prick upgrade
|
86
|
+
|
87
|
+
exit
|
88
|
+
|
89
|
+
# echo "Increment prerelease"
|
90
|
+
# prick create prerelease
|
91
|
+
# echo
|
92
|
+
#
|
93
|
+
# echo "Create release 0.2.0"
|
94
|
+
# prick create release 0.2.0
|
95
|
+
# echo
|
96
|
+
#
|
97
|
+
# echo "Prepare migration"
|
98
|
+
# prick prepare migration 0.0.0
|
99
|
+
# echo
|
100
|
+
#
|
101
|
+
# echo "Create migration"
|
102
|
+
# prick create migration
|
103
|
+
# echo
|
104
|
+
# echo "Prepare an unnamed release"
|
105
|
+
# prick prepare release
|
106
|
+
# echo
|
107
|
+
#
|
108
|
+
|
109
|
+
tree -a -I .git
|
110
|
+
)
|
111
|
+
|
112
|
+
|