prick 0.17.0 → 0.20.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +10 -4
  3. data/README.md +7 -7
  4. data/Rakefile +3 -1
  5. data/TODO +13 -11
  6. data/bin/console +2 -1
  7. data/doc/build-yml.txt +14 -0
  8. data/exe/prick +264 -28
  9. data/lib/builder/batch.rb +147 -0
  10. data/lib/builder/builder.rb +122 -0
  11. data/lib/builder/node.rb +189 -0
  12. data/lib/builder/node_pool.rb +105 -0
  13. data/lib/builder/parser.rb +120 -0
  14. data/lib/local/command.rb +193 -0
  15. data/lib/{prick → local}/git.rb +148 -22
  16. data/lib/local/timer.rb +98 -0
  17. data/lib/prick/constants.rb +54 -66
  18. data/lib/prick/diff.rb +28 -18
  19. data/lib/prick/prick_version.rb +161 -0
  20. data/lib/prick/state.rb +80 -165
  21. data/lib/prick/version.rb +2 -163
  22. data/lib/prick.rb +43 -27
  23. data/lib/share/init/.gitignore +10 -0
  24. data/lib/share/init/.prick-context +2 -0
  25. data/lib/share/init/.rspec +3 -0
  26. data/{share/schema/schema/public → lib/share/init/migration}/.keep +0 -0
  27. data/lib/share/init/prick.yml +6 -0
  28. data/lib/share/init/schema/.keep +0 -0
  29. data/lib/share/init/schema/build.yml +2 -0
  30. data/lib/share/init/schema/prick/.keep +0 -0
  31. data/lib/share/init/schema/prick/build.yml +5 -0
  32. data/lib/share/init/schema/prick/data.sql +6 -0
  33. data/{share/schema → lib/share/init}/schema/prick/tables.sql +2 -3
  34. data/lib/share/init/schema/public/.keep +0 -0
  35. data/lib/share/init/spec/prick_helper.rb +1 -0
  36. data/lib/share/init/spec/prick_spec.rb +6 -0
  37. data/lib/share/init/spec/spec_helper.rb +50 -0
  38. data/lib/share/migrate/migration/build.yml +4 -0
  39. data/lib/share/migrate/migration/diff.after-tables.sql +0 -0
  40. data/lib/share/migrate/migration/diff.before-tables.sql +0 -0
  41. data/lib/share/migrate/migration/diff.tables.sql +0 -0
  42. data/lib/subcommand/prick-build.rb +55 -0
  43. data/lib/subcommand/prick-create.rb +78 -0
  44. data/lib/subcommand/prick-drop.rb +25 -0
  45. data/lib/subcommand/prick-fox.rb +62 -0
  46. data/lib/subcommand/prick-init.rb +46 -0
  47. data/lib/subcommand/prick-make.rb +202 -0
  48. data/lib/subcommand/prick-migrate.rb +37 -0
  49. data/lib/subcommand/prick-release.rb +23 -0
  50. data/lib/subcommand/prick-setup.rb +20 -0
  51. data/lib/subcommand/prick-teardown.rb +18 -0
  52. data/prick.gemspec +43 -16
  53. metadata +161 -72
  54. data/.gitignore +0 -29
  55. data/.travis.yml +0 -7
  56. data/doc/create_release.txt +0 -17
  57. data/doc/flow.txt +0 -98
  58. data/doc/migra +0 -1
  59. data/doc/migrations.txt +0 -172
  60. data/doc/notes.txt +0 -116
  61. data/doc/prick.txt +0 -114
  62. data/doc/sh.prick +0 -316
  63. data/lib/ext/algorithm.rb +0 -14
  64. data/lib/ext/fileutils.rb +0 -26
  65. data/lib/ext/forward_method.rb +0 -18
  66. data/lib/ext/pg.rb +0 -18
  67. data/lib/ext/shortest_path.rb +0 -44
  68. data/lib/prick/archive.rb +0 -124
  69. data/lib/prick/branch.rb +0 -254
  70. data/lib/prick/builder.rb +0 -202
  71. data/lib/prick/cache.rb +0 -34
  72. data/lib/prick/command.rb +0 -93
  73. data/lib/prick/database.rb +0 -82
  74. data/lib/prick/dsort.rb +0 -151
  75. data/lib/prick/ensure.rb +0 -119
  76. data/lib/prick/exceptions.rb +0 -25
  77. data/lib/prick/head.rb +0 -183
  78. data/lib/prick/migration.rb +0 -70
  79. data/lib/prick/program.rb +0 -506
  80. data/lib/prick/project.rb +0 -626
  81. data/lib/prick/rdbms.rb +0 -137
  82. data/lib/prick/schema.rb +0 -27
  83. data/lib/prick/share.rb +0 -64
  84. data/libexec/strip-comments +0 -33
  85. data/make_releases +0 -72
  86. data/make_schema +0 -10
  87. data/share/diff/diff.after-tables.sql +0 -4
  88. data/share/diff/diff.before-tables.sql +0 -4
  89. data/share/diff/diff.tables.sql +0 -8
  90. data/share/features/diff.sql +0 -2
  91. data/share/features/feature/diff.sql +0 -2
  92. data/share/features/feature/migrate.sql +0 -2
  93. data/share/features/features.sql +0 -2
  94. data/share/features/features.yml +0 -2
  95. data/share/features/migrations.sql +0 -4
  96. data/share/gitignore +0 -2
  97. data/share/migration/diff.tables.sql +0 -8
  98. data/share/migration/features.yml +0 -6
  99. data/share/migration/migrate.sql +0 -3
  100. data/share/migration/migrate.yml +0 -8
  101. data/share/migration/tables.sql +0 -3
  102. data/share/schema/build.yml +0 -14
  103. data/share/schema/schema/build.yml +0 -3
  104. data/share/schema/schema/prick/build.yml +0 -14
  105. data/share/schema/schema/prick/data.sql +0 -7
  106. data/share/schema/schema/prick/schema.sql +0 -3
  107. data/share/schema/schema/public/build.yml +0 -13
  108. data/share/schema/schema.sql +0 -3
  109. data/test_assorted +0 -192
  110. data/test_feature +0 -112
  111. data/test_refactor +0 -34
  112. data/test_single_dev +0 -83
data/test_assorted DELETED
@@ -1,192 +0,0 @@
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 DELETED
@@ -1,112 +0,0 @@
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
-
data/test_refactor DELETED
@@ -1,34 +0,0 @@
1
- #!/usr/bin/bash
2
-
3
- function add_table() {
4
- local name=$1
5
- echo "Creating table $name"
6
- echo "create table $name (id integer);" >>schema/public/tables.sql
7
- git add schema/public/tables.sql
8
- git commit -m "Added table $name" >/dev/null
9
- }
10
-
11
- function add_migration() {
12
- echo "Creating migration"
13
- cp schema/public/tables.sql migration/diff.sql
14
- echo '\i diff.sql' >migration/migrate.sql
15
- git commit -am "Added migration"
16
- }
17
-
18
- set -e
19
- clear
20
-
21
- if [ -d dir ]; then
22
- find dir -type f -delete
23
- else
24
- mkdir dir
25
- fi
26
-
27
- cd dir
28
- prick --name prj init "."
29
-
30
- prick prepare release
31
- add_table a
32
- add_migration
33
- prick create release 0.1.0
34
-
data/test_single_dev DELETED
@@ -1,83 +0,0 @@
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 "Prepare an unnamed release"
51
- prick prepare release
52
- echo
53
-
54
- echo "Add table b"
55
- add_table b
56
- echo
57
-
58
- echo "Bring current database up to date"
59
- prick build
60
- echo
61
-
62
- echo "Prepare diff"
63
- prick prepare diff
64
- echo
65
-
66
- echo "Commit diff"
67
- git commit -am "Committed diff"
68
- echo
69
-
70
- echo "Update migrations"
71
- echo "\\i diff.sql" >>releases/0.1.0/migrate.sql
72
- git commit -am "Updated migrations.sql"
73
- echo
74
-
75
- echo "Create release 0.2.0"
76
- prick create release 0.2.0
77
- echo
78
-
79
-
80
- tree -a -I .git
81
- )
82
-
83
-