### Install Git using aptitude Source: https://github.com/otwcode/otwarchive/wiki/Linux-Setup Installs the Git version control system client using the aptitude package manager. This is a prerequisite for cloning the OTWArchive source code. ```Shell aptitude install git ``` -------------------------------- ### Starting the OTW Archive Server Source: https://github.com/otwcode/otwarchive/wiki/Linux-Setup This command starts the Rails development server for the OTW Archive. It also shows the expected output during server startup. ```bash rails server ``` ```text => Booting WEBrick => Rails 3.0.3 application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server [2010-12-30 12:48:50] INFO WEBrick 1.3.1 [2010-12-30 12:48:50] INFO ruby 1.9.2 (2010-08-18) [x86_64-linux] [2010-12-30 12:48:50] INFO WEBrick::HTTPServer#start: pid=3789 port=3000 ``` -------------------------------- ### Install required software packages Source: https://github.com/otwcode/otwarchive/wiki/Linux-Setup Installs essential software for running the OTWArchive, including Git, Ruby 3.1, Ruby development headers, MySQL server, MySQL client libraries, XML/XSLT development libraries, and Redis server. This command uses aptitude for package management. ```Shell aptitude install git ruby3.1 ruby3.1-dev mysql-server libmysqld-dev libmysqlclient-dev libxml2-dev libxslt-dev redis-server ``` -------------------------------- ### Install Ruby dependencies with Bundler Source: https://github.com/otwcode/otwarchive/wiki/Linux-Setup Navigates to the OTWArchive source directory and installs all the project's Ruby dependencies as defined in the Gemfile using Bundler. This command ensures all required gems are installed and available. ```Shell cd otwarchive-read-only bundle install ``` -------------------------------- ### Start OTWArchive Docker Containers Source: https://github.com/otwcode/otwarchive/wiki/Docker Starts the OTWArchive web container in detached mode. After starting, the application can be accessed at http://localhost:3000. ```sh docker compose up -d web ``` -------------------------------- ### Rebuild and Start Containers Source: https://github.com/otwcode/otwarchive/wiki/Docker Rebuilds the Docker containers and starts them, useful after changes to Dockerfile configurations like gem or Ruby updates. It forces recreation and skips dependencies for the web and test services. ```sh docker compose up --build --force-recreate --no-deps -d web test ``` -------------------------------- ### Creating Admin Account and Starting Redis Source: https://github.com/otwcode/otwarchive/wiki/Linux-Setup This section details how to create an administrator account using a Rails runner script and how to start the Redis server. It also mentions editing the Redis configuration file. ```bash rails runner script/create_admin.rb # If not using default Ruby version, edit script/create_admin.rb first: # #!/usr/bin/env ruby3.1.4 redis-server & ``` ```yaml # Edit config/redis.yml to point to localhost:[port] ``` -------------------------------- ### Installing ImageMagick and Loading Skins Source: https://github.com/otwcode/otwarchive/wiki/Linux-Setup This snippet shows how to install ImageMagick on Ubuntu and then load site and user skins using rake commands. It also provides instructions on handling existing skins. ```bash sudo apt install imagemagick ``` ```bash bundle exec rake skins:load_site_skins bundle exec rake skins:load_user_skins # Select 'N' for 'replace existing skins' ``` -------------------------------- ### Initialize Docker Compose and Application Source: https://github.com/otwcode/otwarchive/wiki/Docker Initializes the Docker Compose environment and the application by pulling and building Docker images, copying configuration files, and running initialization tasks. This script starts the Rails application. ```sh ./script/docker/init.sh ``` ```bat script\docker\init.cmd ``` -------------------------------- ### Get Shell Access to Container Source: https://github.com/otwcode/otwarchive/wiki/Docker Provides a bash shell inside the OTWArchive web container, enabling direct command execution within the container's environment. ```sh docker compose exec web bash ``` -------------------------------- ### Clone and Set Up Repository Source: https://github.com/otwcode/otwarchive/wiki/Docker Clones the otwarchive repository from GitHub and sets up the original repository as a remote. This is a prerequisite for local development. ```sh git clone git@github.com:YOURGITHUB/otwarchive.git git remote add upstream git@github.com:otwcode/otwarchive.git ``` -------------------------------- ### Install Rails and Bundler using gem Source: https://github.com/otwcode/otwarchive/wiki/Linux-Setup Installs the Rails framework and Bundler, Ruby's package management tools, using the `gem` command. This is necessary for managing Ruby dependencies for the OTWArchive. ```Ruby gem3.1 install rails bundler ``` -------------------------------- ### Basic CSS Syntax Example Source: https://github.com/otwcode/otwarchive/blob/master/public/help/skins-creating.html Provides a fundamental example of CSS syntax, showing a selector, property, and value. This illustrates how to target HTML elements and apply styles. ```CSS /* Basic CSS structure: selector { property: value; } */ body { font-size: 1.1em; } #header { background-color: purple; } .meta { font-style: blink; } ``` -------------------------------- ### Bookmark Search: Date Range Examples Source: https://github.com/otwcode/otwarchive/blob/master/public/help/bookmark-search-date-bookmarked-help.html Examples demonstrating how to specify date ranges for bookmark searches. These examples illustrate searching within the past, beyond a certain time, or between two time points. ```text < 3 days ago will find bookmarks that were created within the past three days ``` ```text > 3 years ago will find bookmarks that were created more than three years ago ``` ```text 3-9 months ago bookmarks that were created between 3 and 9 months ago ``` -------------------------------- ### Run Database Migrations (Test) Source: https://github.com/otwcode/otwarchive/wiki/Docker Executes database migrations for the test environment within the OTWArchive test container. ```sh docker compose run --rm test bundle exec rails db:migrate ``` -------------------------------- ### Run Database Migrations (Development) Source: https://github.com/otwcode/otwarchive/wiki/Docker Executes database migrations for the development environment within the OTWArchive web container. ```sh docker compose run --rm web bundle exec rails db:migrate ``` -------------------------------- ### Attach to Running Container Source: https://github.com/otwcode/otwarchive/wiki/Docker Attaches the current terminal session to the running OTWArchive web container. ```sh docker compose attach web ``` -------------------------------- ### HTML Formatting Rules and Examples Source: https://github.com/otwcode/otwarchive/blob/master/public/help/html-help.html Explains the automatic formatting rules applied to user-submitted HTML, such as paragraph and break tag insertion, tag closing, and handling of mis-nested tags. It also provides examples for headings and emphasis. ```HTML
> To quote a block of text``` ```HTML Use q to
To quote a phrase``` ```HTML Try cite to cite a phrase or title ``` -------------------------------- ### Run Specific Cucumber Test Source: https://github.com/otwcode/otwarchive/wiki/Docker Executes a specific Cucumber feature file within the OTWArchive project. Replace `features/tag_sets/tag_set.feature` with the actual path to the feature file. ```sh # To run the specific test file features/tag_sets/tag_set.feature docker compose run --rm test bundle exec cucumber features/tag_sets/tag_set.feature ``` -------------------------------- ### Run Specific RSpec Test Source: https://github.com/otwcode/otwarchive/wiki/Docker Executes a specific RSpec test file within the OTWArchive project. Replace `spec/models/unsorted_tag_spec.rb` with the actual path to the test file. ```sh # To run the specific test file spec/models/unsorted_tag_spec.rb docker compose run --rm test bundle exec rspec spec/models/unsorted_tag_spec.rb ``` -------------------------------- ### Access Rails Console Source: https://github.com/otwcode/otwarchive/wiki/Docker Executes a Rails console session within the running OTWArchive web container, allowing for direct interaction with the Rails application. ```sh docker compose exec web bundle exec rails c ``` -------------------------------- ### Add Pry Breakpoint Source: https://github.com/otwcode/otwarchive/wiki/Docker Inserts a breakpoint into the Ruby code using pry, allowing for interactive debugging when the code is executed within the container. ```ruby require 'pry'; binding.pry ``` -------------------------------- ### Database Configuration Source: https://github.com/otwcode/otwarchive/wiki/Linux-Setup This snippet shows how to configure the database connection by copying an example file and setting the MySQL root password. It also includes commands to create the database schema and perform migrations. ```bash cp config/database.example config/database.yml # Edit config/database.yml to set the password # Example: password: secret cp config/config.yml config/local.yml cp config/redis.example config/redis.yml # Edit config/redis.yml to change redis.ao3.org and dev.ao3.org to 0.0.0.0 ``` ```bash rake12.3.3 db:create:all # or # bundle exec rake db:create:all ``` ```bash rake db:schema:load rake db:migrate ``` -------------------------------- ### Set Up Development Environment and Code Conventions Source: https://github.com/otwcode/otwarchive/blob/master/CONTRIBUTING.md Information on setting up a local development environment and understanding the project's code conventions is available on the development wiki. ```Markdown https://github.com/otwcode/otwarchive/wiki ``` ```Markdown https://github.com/otwcode/otwarchive/wiki/Commit-policy ``` -------------------------------- ### Clone OTWArchive repository Source: https://github.com/otwcode/otwarchive/wiki/Linux-Setup Downloads the OTWArchive source code from GitHub using Git. This command clones the repository into a directory named 'otwarchive-read-only'. ```Shell git clone git://github.com/otwcode/otwarchive.git otwarchive-read-only ``` -------------------------------- ### Create symbolic links for Rails and Bundler Source: https://github.com/otwcode/otwarchive/wiki/Linux-Setup Creates symbolic links to the Rails and Bundler executables in a system-wide path (`/usr/bin/`). This allows running these commands from any directory. The paths to the gems should be adjusted based on the installed versions. ```Shell ln -s /var/lib/gems/3.1.4/gems/rails-3.0.3/bin/rails /usr/bin/rails ln -s /var/lib/gems/3.1.4/gems/bundler-1.17.3/bin/bundle /usr/bin/bundle ``` -------------------------------- ### Wildcard Search (*) Source: https://github.com/otwcode/otwarchive/blob/master/public/help/bookmark-search-text-help.html The asterisk (*) wildcard matches any sequence of characters. This is useful for finding variations of a word. ```Search Syntax book* ``` -------------------------------- ### OR Search (||) Source: https://github.com/otwcode/otwarchive/blob/master/public/help/bookmark-search-text-help.html The '||' operator functions as an OR, finding results that contain either of the specified terms. This broadens the search. ```Search Syntax Harry || Potter ``` -------------------------------- ### Update OTWArchive Source Code with Git Source: https://github.com/otwcode/otwarchive/wiki/Linux-Setup This snippet shows how to navigate to the OTWArchive source directory and pull the latest changes from the 'upstream master' branch using Git. ```shell cd otwarchive-read-only git pull upstream master ``` -------------------------------- ### AND Search (Space) Source: https://github.com/otwcode/otwarchive/blob/master/public/help/bookmark-search-text-help.html A space between words acts as an AND operator, requiring both terms to be present. This helps narrow down search results. ```Search Syntax Harry Potter ```