Newbie note: you must run the generator in the Discourse source directory (that’s /src if you use Docker). Otherwise you’ll just get confusing error/help messages about how the parameters are incorrect for rails new.
There seems to be a mismatch between the plugin generator and this post. Specifically, the Beginner’s Guide suggests to create the javascript initializer with the following directory and naming structure:
plugins/basic-plugin/assets/javascripts/discourse/initializers/alert.js.es6
However, the plugin creates the javascript initializer at
plugins/discourse-racoon/assets/javascripts/initializers/discourse-racoon.es6
Personally, I was having issues with the javascript loading after using this plugin until I changed the directory and naming structure to match the Beginner’s guide. Should the package be updated?
Yes would be better indeed.
Yes I had to rename the JavaScript extensions but the structure worked for me.
Cant help you, you give me no context. What did you type? where did you type it? clean or exisisting state?
I followed this tutorial https://meta.discourse.org/t/beginners-guide-to-creating-discourse-plugins-part-1/30515. Just installed and worked so guess its clean.
I typed:
bundle exec rails g plugin cidian
EDIT: Capitalization matters in ruby. The name of the plugin created by this generator gets to be a ruby class so that’s why a lower case argument supplied to this generator will lead to a broken plugin.
No it’s not clean as you have followed this tutorial to create a plugin, and the error is likely in what you typed while following the tutorial.
The error is very clear to me: mount ::cidian::Engine, at: "/cidian" is invalid. You should fix this in your code.
First of all: I dont know ruby (yet) as I will start from the front end.
this code was produced by this plugin generator. so its not my fault. Its the generators fault. I typed nothing while following the tutorial. I just followed the development environment setup guide for ubuntu. Before running the generator the local discourse instance worked fine.
https://github.com/discourse/discourse/blob/master/lib/generators/plugin/templates/plugin.rb.erb
to be very clear: I am just at the first page of this tutorial. specifically the part that links to this plugin generator.
لقد قمت للتو بإجراء تحديث ضخم على هذا.
المزيد قادم: مولدات محددة، أي إضافة وحدة تحكم واحدة على سبيل المثال، وإضافات الإدارة.
واو! يبدو رائعًا من خلال الاختلافات (لشخص لا يعرف الكثير عن كتابة الإضافات). لا أستطيع الانتظار لتجربته (لكنني على الأرجح سأنتظر حتى أصل إلى المكتب يوم الاثنين
)
مرحبًا، @j.jaffeux، لقد جربته للتو (وقمت بسحب git مرة أخرى وأنشأت بعض الإضافات الإضافية بعد أن فشل في المرة الأولى) وأنا أحصل على:
/home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/routing/mapper.rb:314:in `block (2 levels) in check_controller_and_action': 'one_two/one-two' ليس اسم وحدة تحكم مدعومًا. قد يؤدي هذا إلى مشاكل محتملة في التوجيه. راجع http://guides.rubyonrails.org/routing.html#specifying-a-controller-to-use (ArgumentError)
أشعر بالحزن لأن لدي إضافة بدأت بهذا وقمت بإضافة الكثير من الكود إليها قبل تشغيلها. هل يمكنك إخباري بكيفية إصلاح ذلك؟ المعلومات الموجودة في ذلك الدليل وما وجدته على StackOverflow لا تساعدني.
شكرًا لك.
أجل، لقد اعترضتُ هذا الأمر الآخر ولم أتمكن من إصلاحه بعد.
أعتقد أنه يجب أن يكون controllers/one_two/one_two_controller.rb، لكنني لست متأكدًا لأنك لم تزوّدني بجميع البيانات.
يبدو أنني وجدتها! المشكلة تكمن في config/routes.rb. قمت بتغيير
get "/" => "three-four#index", constraints: ThreeFourConstraint.new
إلى
get “/” => “three_four#index”, constraints: ThreeFourConstraint.new
والآن كل شيء على ما يرام، على الأقل من وجهة نظري البسيطة.
كيف يجب أن أتعامل مع هذا؟
أحاول استخدام هذا في بيئة Deb الجديدة الخاصة بـ Windows Subsystem
يعمل Discourse الخاص بي ويعمل، لكن عند محاولة تشغيل
rails g plugin --help
أحصل على
/var/lib/gems/2.5.0/gems/railties-6.0.0/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /home/jose/.rbenv/shims in PATH, mode 040777
Could not find actionview_precompiler-0.2.1 in any of the sources
Run `bundle install` to install missing gems.
تشغيل bundle install لا يفعل شيئًا (جديد) والمُجمّع مسبقًا موجود في قائمة الـ gems.
أي أفكار؟
هل يعمل خادم Discourse الخاص بك داخل حاوية Docker؟ إذا كان الأمر كذلك، فيجب عليك تشغيل bundle install داخل الحاوية.
لا، لا أعتقد ذلك. إنها بيئة تطوير، وقد تم نسخها مباشرة عبر git clone.
هذا عمل بشكل مثالي جاهز من الصندوق.
شكرًا لك على هذا.
لقد شغلت مولد Rails هذا للتو وأنشأت البنية الأساسية لإضافة جديدة، ثم رفعتها إلى Git، وأضفتها إلى ملف YAML، وأعدت بناء التطبيق، فتم تثبيتها بسلاسة تامة جاهزة من الصندوق.
زرت تبويب الإضافات، وهناك كانت متاحة بالكامل ومجهزة بإعدادات تمكين/تعطيل جاهزة من الصندوق. ![]()
شكرًا جزيلاً لك يا @j.jaffeux على هذا المولد السهل الاستخدام والمفيد.
التغيير الوحيد الذي قمت به هو حذف مجلد .git المرفق باستخدام الأمر rm -rf ثم إعادة تهيئة Git باستخدام ``re-initحتى أتمكن من دفعها إلى حسابي؛ لكن هذا على الأرجح لأنني لست ماهرًا جدًا فيgitوغالبًا ما يضطرني أن أضربأوامر git``` بالمطرقة لكي تعمل كما أعتقد أنها يجب أن تعمل.
مولد خالٍ من الأخطاء. شكرًا مرة أخرى يا @j.jaffeux
يسعدني أنها نجحت معك. وبصراحة، يجب أن أخصص وقتًا لها، فهناك العديد من الأمور التي لا تعمل بشكل صحيح.
