Commit Graph

26 Commits

Author SHA1 Message Date
Gabriel Grubba
fe4e2a17cb
FEATURE: Create rake for db migration in plugins (#29163)
* FEATURE: Create rake for db migration in plugins

before the dev-xp was clunky, we had to create a migration file in core and
move it to the plugin.

Now we automated this process, we still create the migration file in core
but the rake task will move it to the plugin.

the usage is:

```
rake plugin:generate_migration[plugin_name,migration_name,migration_args]

rake plugin:generate_migration[discourse-automation,add_group_id_to_automation_rule,"group_id:integer"]
```

* DEV: change rake to be a generator for plugin migrations

* DEV: trying to add extra class option to migration generator

* DEV: revert to have only `plugin_migration_generator`

* DEV: remove rake task for plugin migration creation

* DEV: remove migration_generator.rb

* DEV: remove if because options with `plugin_name` will always be true
2024-10-18 11:43:45 -03:00
Martin Brennan
74fd883a89
DEV: Improve site setting rename generator (#25354)
We need to be able to generate these migrations
for plugin settings as well. Also, we can use the
type supervisor to get the enum data in a nicer way.
2024-01-25 10:45:46 +10:00
Krzysztof Kotlarek
4c8bc34475
DEV: Custom generator for move setting from tl to groups (#24912)
Ability to automatically generate migration when site setting is changed from trust level to groups.

Example usage:

rails generate site_setting_move_to_groups_migration min_trust_to_create_topic create_topic_allowed_groups
2023-12-19 10:52:28 +11:00
Krzysztof Kotlarek
5055e431a8
DEV: Custom generator for rename site setting migration (#24841)
Ability to automatically generate migration when site setting name is changed.
Example usage: `rails generate site_setting_rename_migration site_description contact_email`
2023-12-13 09:58:45 +11:00
Joffrey JAFFEUX
efbc2481d8
DEV: removes plugin generator (#14101)
I don't have the time to maintain this and https://github.com/discourse/discourse-plugin-skeleton is doing 80% of the job very easily.
2021-08-20 11:29:06 +02:00
Michael Brown
5f7e60d9dc discourse/discourse change from 'master' to 'main' 2021-07-19 11:46:15 -04:00
Robin Ward
23f24bfb51 REFACTOR: Move javascript tests inside discourse app
This is where they should be as far as ember is concerned. Note this is
a huge commit and we should be really careful everything continues to
work properly.
2020-10-02 11:29:36 -04:00
spirobel
41ee7cad0e
FIX plugin generator: mobile, desktop stylesheets registering (#9039)
After adding styles in the mobile scss they will also be applied to desktop without this change.

https://meta.discourse.org/t/registering-assets-for-mobile-and-desktop-making-site-responsive/65041/2
2020-02-25 11:43:17 +01:00
Robin Ward
6287eccb35 REFACTOR: Remove Ember.Controller in favor of import 2019-10-23 13:06:54 -04:00
Mark VanLandingham
e5311ab645 DEV: Import DiscourseRoute rather than Discourse.Route (#8225)
* DEV: Discourse.Route -> DiscourseRoute with import

* ran prettier on all routes

* prettiered one more file
2019-10-22 09:46:10 -04:00
Joffrey JAFFEUX
8f51445e9f
FIX: fixes plugin generator with zeitwerk (#8220) 2019-10-21 09:24:14 +02:00
Robin Ward
a404cab509 The generated plugin should also freeze strings 2019-10-03 11:43:36 -04:00
Robin Ward
32a11a93ac Update the template for plugin generator to be rubocop compliant 2019-10-03 11:41:53 -04:00
Krzysztof Kotlarek
427d54b2b0 DEV: Upgrading Discourse to Zeitwerk (#8098)
Zeitwerk simplifies working with dependencies in dev and makes it easier reloading class chains. 

We no longer need to use Rails "require_dependency" anywhere and instead can just use standard 
Ruby patterns to require files.

This is a far reaching change and we expect some followups here.
2019-10-02 14:01:53 +10:00
Joffrey JAFFEUX
dbb410697e
FIX: generated controller should be in an underscored folder (#7975) 2019-08-06 10:40:38 +02:00
Joffrey JAFFEUX
d83f99fc2e
DEV: improves rails plugin generator (#7949)
Fixes bugs, simplifies code, more default files. General idea, more is more here as it's easier to just delete things than reading and passing all the options.
2019-07-27 18:21:44 +02:00
Sam Saffron
30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00
Robin Ward
fa5a158683 REFACTOR: Move queue_jobs out of SiteSetting
It is not a setting, and only relevant in specs. The new API is:

```
Jobs.run_later!        # jobs will be thrown on the queue
Jobs.run_immediately!  # jobs will run right away, avoid the queue
```
2019-03-14 10:47:38 -04:00
Robin Ward
d1d9a4f128 Add new run_jobs_synchronously! helper for tests
Previously if you wanted to have jobs execute in test mode, you'd have
to do `SiteSetting.queue_jobs = false`, because the opposite of queue
is to execute.

I found this very confusing, so I created a test helper called
`run_jobs_synchronously!` which is much more clear about what it does.
2019-03-11 16:58:35 -04:00
Guo Xiang Tan
40fa96777d
FEATURE: Post deployment migrations. (#6406)
This moves us away from the delayed drops pattern which
was problematic on two counts. First, it uses a hardcoded "delay for"
duration which may be too short for certain deployment strategies.
Second, delayed drop doesn't ensure that it only runs after
the latest application code has been deployed. If the migration runs
and the application code fails to deploy, running the migration after
"delay for" has been met will cause the application to blow up.

The new strategy allows post deployment migrations to be skipped if the
env `SKIP_POST_DEPLOYMENT_MIGRATIONS` is provided.

```
SKIP_POST_DEPLOYMENT_MIGRATIONS=1 rake db:migrate
-> deploy app servers
SKIP_POST_DEPLOYMENT_MIGRATIONS=0 rake db:migrate
```

To aid with the generation of a post deployment migration, a generator
has been added. Simply run `rails generate post_migration`.
2018-10-08 15:47:38 +08:00
Joffrey JAFFEUX
2dfb097dd9
DEV: plugin generator support for spec/test/controller/routes (#6344) 2018-08-30 16:38:25 +02:00
Joffrey JAFFEUX
90e67b671b
DEV: support for settings/locales in plugin generator (#6341) 2018-08-30 14:12:06 +02:00
Joffrey JAFFEUX
d40d241e72
DEV: adds --help --no-help options to plugin generator (#6338)
help will add helpful comments in the various generated files
2018-08-30 12:16:37 +02:00
Joffrey JAFFEUX
acc96abe1a
DEV: plugin generator will now ask for github username (#6337) 2018-08-30 12:03:30 +02:00
Joffrey JAFFEUX
06f18b0e9f
typo 2018-08-29 13:51:16 +02:00
Joffrey JAFFEUX
ef36fdfb64
DEV: rails generator to create plugin skeleton (#6332)
rails g plugin --help
rails g plugin DiscourseRacoon --author joffrey
2018-08-29 13:32:41 +02:00