Here's the procedure followed for 0.16 iteration.
this procedure can be improved for sure. Operations are split and isolated in commits. Not sure if
git merge
algorithms prefer clean operation series (movement/rename then text remplacement) or aggregated ones (movement/rename/replace in the same commit).
For each steps, assume that you are replacing "Proposal" with "Question" ;) !
git clone https://github.com/decidim/decidim -b 0.16-stable decidim-questions
cd decidim-questions
- remove all directory except decidim-proposals
- remove all files at the root except .gitignore
--> see commit 5c80700
git mv decidim-proposals decidim-questions
--> see commit 295cfce
git ls-tree -dr HEAD --name-only | grep proposal
--> Use the list to generate commands like
mkdir -p <new-directory>
git ls-files | grep proposal
--> Use the list to generate commands like
git mv <source> <destination>
git ls-tree -dr HEAD --name-only | grep proposal
--> Use the lists to generate commands like
rm -rf <old-directory>
--> see the gist with full generated commands list
--> see commit ef330ab
with built Search / Replace All from text editor (
- "Proposal" --> "Question"
- "proposal" --> "question"
- "PROPOSAL" --> "QUESTION"
if anyone has the sed / awk command for that one 😉
--> see commit c47e068
We did have a few misfire ...
--> see commit d2cf521
--> see commit 65e1e8f
--> see commit 5ce20d5
--> see commit 0d41054
git mv decidim-questions/* ./
--> see commit 5e74e9b
We generated an external module from scratch to compare the Proposals module architecture with the generated one.
bundle exec decidim --component questions --external --destination_folder ../decidim-questions/
Important files to be tweaked for your needs are :
./Gemfile
./Rakefile
./decidim-questions.gemspec
./lib/tasks/decidim_tasks.rake
./config/i18n-tasks.yml
./.circleci/config.yml
--> see commit ff90b17
--> see commit fcb68c4
--> see commit 9756e00
--> see commit 6700707
--> see commit 22ad6b9
This step could have been done right after Step 1 to be part of the file renaming processes. Principles remains the same.
bundle exec rails test_app
⚠️ At this point, the app generation should crash around the seed part. But we only need to extract the DB schema for now.
- Locate the Proposals related tables in the generated
./spec/decidim_dummy_app/db/schema.rb
They should be in a single pack of code. - Copy the code
rm ./db/migrate/*
bundle exec rails generate migration CreateDecidimQuestions
--> Paste the copied code from 7.2
--> see generated migration --> see whole commit 106f56d
Recreate the test app and it to fix the last qwirks.
bundle exec rails test_app
bundle exec rails spec
At this point we did fix :
- Force class scope on
ParticipatoryTextsController
--> see commit 65dd28e - Add some helpers method
--> see commit 3f6b7be
--> see commit 1d6dd1b - Extends for
Amendable
commands to be able to manage other types thanProposals
--> see commit fea5cf6 - Extends for
CellsHelper
forQuestions
--> see commit d1b3d14 - Extends for
AuthorCell
forQuestions
--> see commit e0fb9c2
Push your fresh module to your favorite repository 🚀
git remote add questions https://github.com/OpenSourcePolitics/decidim-questions
git push --set-upstream questions 0.16-stable