8 – How do I manage a custom module for development but a repository module for production?

There is a module for which I often post patches and use the latest development version. I have created a composer.json that contains the following:

"repositories": (
    "type": "path",
    "url": "web/modules/custom/*"
... and later ...
"require": {
  "drupal/THEMODULE": "*",

The Git repository for THEMODULE is located at web / modules / custom / THEMODULE. I manage the repository on site, press, pull and create patches. For production, I then press the production server and a Git post receive hook copies the code into the same directory on the server.

But now I want to stop using git to push for production, instead use Composer to indicate a specific version / release / commit, and use Cweagan / Composer patches to indicate the patches I used for production would like to have.

I have set both composer.json and composer.lock for git so that I can submit the specifications I want for production and then only run "composer install" (instead of composer update) on the server. This recreates the environment that I use in development. I want to avoid running "Composer Update" on the server because I fear that there will be a regression that I have not tested in dev or staging.

I know that you can use require-dev to add additional resources, but I really want my custom module repository (for my custom module) to be retained, but NOT the custom module repository for production, but the packages are used. drupal.org repo. And for local developers I want the opposite: use the local modules / custom repo and not packages.drupal.org

What do other people do for modules that you keep locally in Git but want to have them made available for production by official repos?

unix – bash code to install bootstrap in a Ruby on Rails repository

Wrote a code to install Bootstrap (the latest) in a newly created Rails application.

Update: Typo fixed

yarn add bootstrap jquery popper.js expose-loader
yarn install --check-files
perl -pi.bak -e "s/extract_css: false/extract_css: true/" config/webpacker.yml
s1=$'nnimport "bootstrap/dist/js/bootstrap";'
echo "$s1" >> app/javascript/packs/application.js
echo '@import "~bootstrap/scss/bootstrap";' > app/javascript/packs/styles.scss
(gsed $'/module.exports = environment/{e cat expose-loader.txtn}' config/webpack/environment.js) > config/webpack/environment.js.new
mv config/webpack/environment.js.new config/webpack/environment.js
(gsed $'/javascript_pack_tag .application/{e cat stylesheet_pack_tag.txtn}' app/views/layouts/application.html.erb) > app/views/layouts/application.html.erb.new
mv app/views/layouts/application.html.erb.new app/views/layouts/application.html.erb

Programming practices – ethics / legality of inserting code from the repository of proprietary software into a personal repository?

As you question the practice, you seem to recognize that there may be a problem.

Legal matters do not fall within the scope here. Let's look at that from a technical perspective:

  • The literal copying of a small piece of code is not a real engineering of a solution: others have developed it, you believe that it works for your own problem, you take it. Making photocopies of a blueprint doesn't make you an architect either.
  • In your case, it's worse: you didn't understand the complex solution because you can't reproduce it yourself. If you have not understood it, how can you be sure that it will meet your new requirements? If it's a mission-critical system, you can put lives at risk! This is professional misconduct.

So that's a very bad software development practice. Misconduct too.

Now you can improve your workout and invest some time to at least figure out how it works and come to the conclusion that it works best. You didn't invent anything new, but you used a reliable approach to get a reliable part of your solution. However, if you find that it fits, you may not necessarily be able to implement this solution. Good professional practice requires compliance with the law,

Then we come to the complex issue of intellectual property. I'm not a lawyer, but you seem to be in danger:

  • steal your employer's intellectual property when you copy and paste (copyright infringement),
  • Protection of your employer's intellectual property if you write from scratch (a non-literal copy also violates copyright law)
  • Business secret abuse,
  • even violate some patents in some countries,
  • Abuse of paid hours to keep track of your own personal projects.

Legal matters are out of the question here, but this seems to me to be a lot of reasons for your employer to fire you and sue you.

Conclusion: No, not

Additional note: Be careful when writing software in your free time, especially if it competes with the interests of your employer

sort magento2 repository by more than one attribute

I want to sort a repository by more than one attribute. Any ideas on how this can be achieved?

What I have so far is this:

public function getLatestPosts()
  return $this->postRepository

private function buildSearchCriteriaForLatestPosts()
  return $this->searchCriteriaBuilder->create();

private function prepareSearchCriteriaBuilder()

   /** @var MagentoFrameworkApiSortOrder $publishDateOrder */
   $publishDateOrder = $this->sortOrderBuilder

   /** @var MagentoFrameworkApiSortOrder $isFeaturedOrder */
   $isFeaturedOrder = $this->sortOrderBuilder

   $this->searchCriteriaBuilder->setSortOrders(($publishDateOrder, $isFeaturedOrder));

I don't know why it doesn't work properly; What I want to achieve is the list of posts sorted by is_featured and created_at in DESC. Even if there are two or more posts, the newest is shown at the top

Any help is appreciated!
Thank you very much

Is it acceptable to discard the repository pattern in a layered architecture?

My app uses this type of layer architecture:

Controller > Service > Repository > Data Mapper > Persistence

I often find that my service methods only call repository methods directly, without doing anything else. For example,

Class UserRepo
    // ...

    public function getUser($id)
        return $this->dataMapper->findOne($id);

class UserService
    // ...

    public function getUser($id)
        return $this->userRepo->getUser($id);

I find that this type of scenario is common across the app, where the service method does nothing special and just calls the repository method. However, there are still cases where the service method actually executes business logic before calling the repo.

Now I thought I could override the repository pattern for some time and just paste the data mapper directory into the service classes. For example,

class UserService
    // ...

    public function getUser($id)
        return $this->dataMapper->findOne($id);

My question is, is it acceptable to dig the trench repository Pattern and just use the data mapper right in the service Great?

kotlin – The Maven Publish plugin is not published in the local repository

I have the following gradle 6 file for a project with Kotlin that uses the new Maven Publish plugin (with the old versions of gradle this was not necessary when I installed gradle, I already installed the jar in my local Maven ):

buildscript {
    ext {
        kotlinVersion = '1.3.61'
        validationApiVersion = '2.0.1.Final'
        cleanArchitectureVersion = '0.0.1-SNAPSHOT'
        sl4jVersion = '1.7.25'
        testLoggerVersion = '1.6.0'
        artifactVersion = '1.0.0'
    repositories {
        maven { url "https://plugins.gradle.org/m2/" }
    dependencies {

apply plugin: 'maven-publish'
apply plugin: 'java-library'
apply plugin: 'groovy'
apply plugin: 'kotlin'
apply plugin: 'jacoco'
apply plugin: 'idea'
apply plugin: 'com.adarshr.test-logger'

group = 'com.oesia.mako'
rootProject.archivesBaseName = 'rrhh-domain'
version = "${artifactVersion}"
sourceCompatibility = 1.8

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"

repositories {
    maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/milestone" }

sourceSets {
    main {
        kotlin {
            srcDir 'src/main/kotlin'
            srcDir 'src/main/customized/kotlin'
            srcDir 'src/main/generated/kotlin'
    test {
        groovy {
            srcDir 'src/test/groovy'

dependencies {
    // mandatory dependencies for using Spock
    testImplementation "org.codehaus.groovy:groovy-all:2.4.13"
    testImplementation "org.spockframework:spock-core:1.1-groovy-2.4"
    // optional dependencies for using Spock
    implementation "org.hamcrest:hamcrest-core:1.3" // only necessary if Hamcrest matchers are used
    testImplementation "net.bytebuddy:byte-buddy:1.9.1"          // allows mocking of classes (in addition to interfaces)
    testImplementation "org.objenesis:objenesis:2.6"    // allows mocking of classes without default constructor (together with CGLIB)

publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java

testlogger {
    // pick a theme - mocha, standard, plain, mocha-parallel, standard-parallel or plain-parallel
    theme 'mocha'
    // set to false to disable detailed failure logs
    showExceptions true
    // set threshold in milliseconds to highlight slow tests
    slowThreshold 2000
    // displays a breakdown of passes, failures and skips along with total duration
    showSummary true
    // set to false to hide passed tests
    showPassed true
    // set to false to hide skipped tests
    showSkipped true
    // set to false to hide failed tests
    showFailed true
    // enable to see standard out and error streams inline with the test results
    showStandardStreams false
    // set to false to hide passed standard out and error streams
    showPassedStandardStreams true
    // set to false to hide skipped standard out and error streams
    showSkippedStandardStreams true
    // set to false to hide failed standard out and error streams
    showFailedStandardStreams true

jacoco {
    toolVersion = "0.8.3"
    reportsDir = file("$buildDir/customJacocoReportDir")

jacocoTestReport {
    reports {
        xml.enabled false
        csv.enabled false
        html.destination file("${buildDir}/jacocoHtml")

When I execute the command (with Gradle 6):
gradle publishToMavenLocal

I see that the glass was made on the track (/ build / libs),
Enter image description here

The output you enter on the command line is:

❯ gradle publishToMavenLocal
Configuration on demand is an incubating feature.

6 actionable tasks: 4 executed, 2 up-to-date

However, it was not copied to my local Maven repository.

Enter image description here

An alternative would be to manually open the jar using the maven command to install it in my local repository. In the past, however, this worked in gradle without the need to add a specific plugin or to specify other things.
Any ideas about this?
Thank you in advance and best regards.

Clean architecture and repository patterns

I am working on a new project and am trying to use the clean architecture approach with the repository pattern. I use .net Core 3, C #, Automapper, MediatR and Dapper.

I have these layers:

Domain (in the middle the core of everything): here I have the business entities, aggregations and value objects with their validation rules and exceptions;

Application (it is the domain): Here I use CQRS patterns and have my commands, queries and interfaces;

Persistence: here I have the implementations of the repository interfaces.

I know that a repository should be responsible for all CRUD operations on a table in the database. I want to know how to implement the repositories for an ENTITY that is an AGGREGATION ENTITY. Should I create an AGGREGATION REPOSITORY that extracts data from different tables? Or should I have a repository for each table and a SERVICE that creates AGGREGATION with more than one repository?

Thank you very much

repository – problems starting with git

I am new to this repository and although I have seen videos and searched the internet, I have many doubts and inconveniences. I'm trying to work together in a gitlab repository since i installed git a long time ago so i made a git clone, basically i was wrong so i did it with the command: git clone:

Git clone http://gitlab.com/large-repository – depth 1

And it worked. Then I tried the branches with & # 39; git checkout & # 39; and it gave me a mistake, I switched to the directory where I cloned the repository and & # 39; git init & # 39; I did & # 39; git checkout & # 39; executed and it gives me (master) back in brackets, but in the repository there are 2 other branches in addition to master that are not shown here I have the command & # 39; git branch -a & # 39; tried it and he gives me the same thing back. Finally I have & # 39; git fetch & # 39; tried it and it doesn't matter, it doesn't show a mistake, but it doesn't show anything either, I really don't know what else to try, I don't know what's going on If someone could help me, I would be very grateful. Thanks in advance. greetings

Block appointment

centos7 – Gitlab package repository cannot be added and installed

Goal: Install gitlab on my Centos7.
Instructions: https://about.gitlab.com/install/#centos-7

(root@enlabsapp067 deployer)# curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash 
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- 0:00:05 --:--:-- 0curl: (7) Failed connect to packages.gitlab.com:443; Connection refused

Your kind support is greatly appreciated.

Debugging check

  • CentOS Linux version 7.6.1810 (core)
  • sshd – active (running)
  • firewalld – active (running)
  • postfix – active (running)

laravel – Do authorization checks belong to the controller or to the repository / persistor?

I have a Laravel project in which the controllers (all derived from one of two base controllers) use repository and persistor classes to communicate with Eloquent models. The authorization logic is implemented in policy classes, but the actual check must be carried out either in the basic controllers or in the repository and in the persistors. I mean by check:

    $user = $this->controller->resloveCurrentUser();
    if ($user->can($this->undeletePolicyFunction, $resource)) {

        // Data retrieval or setting logic

At the moment I think it would be a better idea to do the checks in the controller, but I first implemented some of the checks in my base persistor, so this was not my first instinct.

I'm not entirely sure why I did this, except because the functions of my base persistor are only a line or two long and it seemed wasteful to instantiate a whole new class just so that their methods literally linked their parameters to Eloquent to hand over.

Could there be something I miss? Is there a good argument for authorization within repository / persistor classes instead of the controller?