classroom

https://github.com/education/classroom

Ruby

GitHub Classroom automates repository creation and access control, making it easy for teachers to distribute starter code and collect assignments on GitHub.

DockerCompose::Parser.parse

Public: Parse the docker-compose output and get the services

output - The String output results from `docker-compose ps`

rubocop:disable Metrics/LineLength
Examples:

  output = `docker-compose ps`
  pp output

"         Name                        Command               State                         Ports                       \n" +
"---------------------------------------------------------------------------------------------------------------------\n" +
"classroom_elasticsearch   /docker-entrypoint.sh elas ...   Up      127.0.0.1:9227->9200/tcp, 127.0.0.1:9337->9300/tcp\n" +
"classroom_memcached       docker-entrypoint.sh memcached   Up      127.0.0.1:22322->11211/tcp                        \n" +
"classroom_postgresql      /docker-entrypoint.sh postgres   Up      127.0.0.1:2345->5432/tcp                          \n" +
"classroom_redis           docker-entrypoint.sh redis ...   Up      127.0.0.1:9736->6379/tcp                          \n"

  DockerCompose::Parser.parse(output)
  # => #<DockerCompose::Services:0x00007fddea842ef0
        @services=
         [#<DockerCompose::Service:0x00007fddea842c48
           @command="docker-entrypoint.sh postgres",
           @name="classroom_postgresql",
           @ports="127.0.0.1:2345->5432/tcp",
           @state="Up">]>

rubocop:enable Metrics/LineLength

Returns an instance of DockerCompose::Services.

Source | Google | Stack overflow

Edit

git clone [email protected]:education/classroom.git

cd classroom

open lib/docker_compose/parser.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-DockerCompose--Parser-parse-for-pr


# Commit to git

git add lib/docker_compose/parser.rbgit commit -m "better docs for DockerCompose::Parser.parse"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-DockerCompose--Parser-parse-for-pr

hub pull-request


# Celebrate!