Local Environment Setup
Relevant source files
The following files were used as context for generating this wiki page:
The Actionmap local environment setup involves configuring a Ruby on Rails application integrated with a modern JavaScript pipeline via Webpacker. The environment is designed to support the development of a representative tracking and news aggregation platform, requiring specific versions of Node.js and Yarn for asset management, and SQLite3 for local data storage.
This setup ensures that developers can run the server, manage geographical data through specialized task helpers, and execute a comprehensive suite of RSpec and Cucumber tests.
Sources: package.json:1-15, config/application.rb:1-35, README.md:1-10
Prerequisites and Engine Requirements
The project specifies strict engine versions for the JavaScript runtime and package manager to ensure compatibility with dependencies like Webpacker and D3.js.
| Engine | Version Requirement | Description |
|---|---|---|
| Node.js | 12.x or 14.x | Required for Webpack compilation and Mapshaper utilities. |
| Yarn | 1.22.x | Primary package manager for JavaScript dependencies. |
Sources: package.json:7-10
Database Configuration
For local development and testing, Actionmap utilizes SQLite3. The production environment is configured to use PostgreSQL.
- Development: Uses
db/development.sqlite3. - Test: Uses
db/test.sqlite3. This database is erased and re-generated from the development schema during test execution. - Connection Pooling: Local environments are configured with a pool size of 5 and a timeout of 5000ms.
Sources: config/database.yml:32-48
JavaScript and Asset Pipeline
The application uses Webpacker to manage modern JavaScript features. The setup involves Babel for transpilation and PostCSS for CSS processing.
Development Server
The development environment includes a Webpack Dev Server configured to run on localhost:3035. It supports features like HMR (Hot Module Replacement) and compression.
Key Dependencies
- Visualization:
d3andtopojsonfor rendering maps. - UI Framework:
bootstrap,bootswatch, andjquery. - Utilities:
select2,timeago, andfontawesome. - Geography:
mapshaperfor processing shapefiles into TopoJSON.
Sources: package.json:11-35, config/webpacker.yml:46-65, app/javascript/packs/application.js:20-30
Geographical Data Setup
Actionmap requires TopoJSON files to render national and state-level maps. A suite of task helpers is provided to fetch and convert US Census shapefiles.
TopoJSON Generation Flow
The setup uses a Node-based utility located at node_modules/.bin/mapshaper to process geographic data.
Testing Environment
The environment is configured for both unit testing (RSpec) and acceptance testing (Cucumber).
Test Configuration
- Database Cleaner: Configured to use
truncationfor JavaScript-enabled tests andtransactionfor standard tests to ensure a clean state. - SimpleCov: Automatically starts to track code coverage (excluding the
libdirectory) during test runs. - Environment Variables:
RAILS_ENVmust be set totest.
# From spec/rails_helper.rb
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.use_transactional_fixtures = true
end
Sources: spec/rails_helper.rb:5-60, features/support/env.rb:10-50
Development Scripts
The package.json file provides scripts for maintaining code quality in the local environment:
yarn lint: Runs ESLint onapp/**/*.jsandconfig/**/*.js.yarn lint_fix: Automatically fixes linting errors where possible.
Sources: package.json:36-39
Summary
Setting up the Actionmap local environment requires aligning Ruby on Rails with a specific Node.js toolchain. Developers must ensure the database is migrated via SQLite3 and that geography-specific TopoJSON assets are generated using the provided Mapshaper-based task helpers before the application is fully functional for map-based interactions.