[openstreetmap-website] Cleanup to prepare for test expansion (#135)

Reid Parham notifications at github.com
Tue Oct 16 16:46:37 GMT 2012


I’d like to improve the quality and maintainability of this codebase. The perspective I’m using is best practices from my role at an engineering-focused agency. This pull request is an invitation for discussion of these perspectives—I’m not trying to barge in here and declare this is how we should work.

My goals are to fix bugs, increase readability of the code, and improve the quality assurance and testing processes by decreasing the effort necessary to review code. I have a [feature branch to add more tests](https://github.com/parhamr/openstreetmap-website/commits/test-moar).

* Added [RVM](https://rvm.io/) environment file with improved garbage collection configuration (decreases overhead of GC with slight increase to memory overhead)
* Started implementation of a [standardized Ruby style](https://github.com/styleguide/ruby); fixing indentation of some files
* Added UTF-8 encoding declarations to all Ruby files; [necessary for Ruby 1.9.3](http://blog.grayproductions.net/articles/ruby_19s_three_default_encodings)
* Added the [Simplecov gem](http://www.tamingthemindmonkey.com/2011/09/27/ruby-code-coverage-using-simplecov) to facilitate test improvements (
* Started to expand tests; noting 4 empty tests
* DB structure from PostgreSQL 9.2 with required extensions

Please comment on this request and specific lines within it. I’m eager to collaborate.

You can merge this Pull Request by running:

  git pull https://github.com/parhamr/openstreetmap-website master

Or you can view, comment on it, or merge it online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/135

-- Commit Summary --

  * Code style standardization and cleanup, minor test improvement, RVM support, and UTF8 encoding declarations.

-- File Changes --

M .gitignore (2)
A .rvmrc (5)
M Gemfile (3)
M Gemfile.lock (35)
M app/controllers/amf_controller.rb (339)
M app/controllers/api_controller.rb (2)
M app/controllers/application_controller.rb (2)
M app/controllers/browse_controller.rb (2)
M app/controllers/changeset_controller.rb (2)
M app/controllers/diary_entry_controller.rb (2)
M app/controllers/export_controller.rb (2)
M app/controllers/friend_controller.rb (2)
M app/controllers/geocoder_controller.rb (2)
M app/controllers/message_controller.rb (2)
M app/controllers/node_controller.rb (2)
M app/controllers/oauth_clients_controller.rb (2)
M app/controllers/oauth_controller.rb (2)
M app/controllers/old_controller.rb (2)
M app/controllers/old_node_controller.rb (2)
M app/controllers/old_relation_controller.rb (2)
M app/controllers/old_relation_member_controller.rb (2)
M app/controllers/old_way_controller.rb (2)
M app/controllers/old_way_node_controller.rb (2)
M app/controllers/redactions_controller.rb (2)
M app/controllers/relation_controller.rb (2)
M app/controllers/relation_member_controller.rb (2)
M app/controllers/search_controller.rb (2)
M app/controllers/site_controller.rb (2)
M app/controllers/swf_controller.rb (2)
M app/controllers/trace_controller.rb (2)
M app/controllers/tracepoint_controller.rb (2)
M app/controllers/tracetag_controller.rb (2)
M app/controllers/user_blocks_controller.rb (2)
M app/controllers/user_controller.rb (2)
M app/controllers/user_preference_controller.rb (2)
M app/controllers/user_roles_controller.rb (2)
M app/controllers/way_controller.rb (2)
M app/controllers/way_node_controller.rb (2)
M app/helpers/application_helper.rb (2)
M app/helpers/browse_helper.rb (2)
M app/helpers/geocoder_helper.rb (2)
M app/helpers/trace_helper.rb (2)
M app/helpers/user_blocks_helper.rb (2)
M app/helpers/user_helper.rb (2)
M app/helpers/user_roles_helper.rb (2)
M app/models/access_token.rb (2)
M app/models/acl.rb (2)
M app/models/changeset.rb (2)
M app/models/changeset_tag.rb (2)
M app/models/client_application.rb (2)
M app/models/country.rb (2)
M app/models/diary_comment.rb (2)
M app/models/diary_entry.rb (2)
M app/models/diary_sweeper.rb (2)
M app/models/friend.rb (2)
M app/models/language.rb (2)
M app/models/message.rb (2)
M app/models/node.rb (2)
M app/models/node_tag.rb (2)
M app/models/notifier.rb (2)
M app/models/oauth2_token.rb (2)
M app/models/oauth2_verifier.rb (2)
M app/models/oauth_nonce.rb (2)
M app/models/oauth_token.rb (2)
M app/models/old_node.rb (2)
M app/models/old_node_tag.rb (2)
M app/models/old_relation.rb (2)
M app/models/old_relation_member.rb (2)
M app/models/old_relation_tag.rb (2)
M app/models/old_way.rb (2)
M app/models/old_way_node.rb (2)
M app/models/old_way_tag.rb (2)
M app/models/redaction.rb (2)
M app/models/relation.rb (2)
M app/models/relation_member.rb (2)
M app/models/relation_tag.rb (2)
M app/models/request_token.rb (2)
M app/models/session.rb (2)
M app/models/spam_observer.rb (2)
M app/models/trace.rb (2)
M app/models/trace_sweeper.rb (2)
M app/models/tracepoint.rb (2)
M app/models/tracetag.rb (2)
M app/models/tracetag_sweeper.rb (2)
M app/models/user.rb (2)
M app/models/user_block.rb (2)
M app/models/user_preference.rb (2)
M app/models/user_role.rb (2)
M app/models/user_sweeper.rb (2)
M app/models/user_token.rb (2)
M app/models/way.rb (2)
M app/models/way_node.rb (2)
M app/models/way_tag.rb (2)
M config/application.rb (2)
M config/boot.rb (2)
M config/environment.rb (2)
M config/environments/development.rb (2)
M config/environments/production.rb (2)
M config/environments/test.rb (2)
M config/initializers/abstract_adapter.rb (2)
M config/initializers/action_cache_path.rb (2)
M config/initializers/action_dispatch.rb (2)
M config/initializers/action_mailer.rb (2)
M config/initializers/backtrace_silencers.rb (2)
M config/initializers/buffered_logger.rb (2)
M config/initializers/classic_pagination.rb (2)
M config/initializers/http_accept_language.rb (2)
M config/initializers/i18n.rb (2)
M config/initializers/inflections.rb (2)
M config/initializers/libxml.rb (2)
M config/initializers/mail.rb (2)
M config/initializers/memory_limits.rb (2)
M config/initializers/mime_types.rb (2)
M config/initializers/oauth.rb (2)
M config/initializers/openid.rb (2)
M config/initializers/output_compression.rb (2)
M config/initializers/paperclip.rb (2)
M config/initializers/postgresql_adapter.rb (2)
M config/initializers/potlatch.rb (2)
M config/initializers/query_cache.rb (2)
M config/initializers/sanitize.rb (2)
M config/initializers/secret_token.rb (2)
M config/initializers/session_store.rb (2)
M config/initializers/streaming.rb (2)
M config/initializers/tempfile.rb (2)
M config/initializers/uri.rb (2)
M config/initializers/wiki_pages.rb (2)
M config/initializers/wrap_parameters.rb (2)
M config/preinitializer.rb (2)
M config/routes.rb (2)
M db/migrate/001_create_osm_db.rb (2)
M db/migrate/002_cleanup_osm_db.rb (2)
M db/migrate/003_sql_session_store_setup.rb (2)
M db/migrate/004_user_enhancements.rb (2)
M db/migrate/005_tile_tracepoints.rb (2)
M db/migrate/006_tile_nodes.rb (2)
M db/migrate/007_add_relations.rb (2)
M db/migrate/008_remove_segments.rb (2)
M db/migrate/009_way_nodes_node_idx.rb (2)
M db/migrate/010_diary_comments.rb (2)
M db/migrate/011_add_user_image.rb (2)
M db/migrate/012_add_admin_flag.rb (2)
M db/migrate/013_add_email_valid.rb (2)
M db/migrate/014_add_new_email.rb (2)
M db/migrate/015_add_user_visible.rb (2)
M db/migrate/016_add_creation_ip.rb (2)
M db/migrate/017_add_gpx_indexes.rb (2)
M db/migrate/018_create_acls.rb (2)
M db/migrate/019_add_timestamp_indexes.rb (2)
M db/migrate/020_populate_node_tags_and_remove.rb (2)
M db/migrate/021_move_to_innodb.rb (2)
M db/migrate/022_key_constraints.rb (2)
M db/migrate/023_add_changesets.rb (2)
M db/migrate/024_order_relation_members.rb (2)
M db/migrate/025_add_end_time_to_changesets.rb (2)
M db/migrate/026_add_changeset_user_index.rb (2)
M db/migrate/027_add_changeset_indexes.rb (2)
M db/migrate/028_add_more_changeset_indexes.rb (2)
M db/migrate/029_add_user_foreign_keys.rb (2)
M db/migrate/030_add_foreign_keys.rb (2)
M db/migrate/031_create_countries.rb (2)
M db/migrate/032_add_user_locale.rb (2)
M db/migrate/033_change_diary_entries_language.rb (2)
M db/migrate/034_create_languages.rb (2)
M db/migrate/035_change_user_locale.rb (2)
M db/migrate/036_add_visible_to_message.rb (2)
M db/migrate/037_add_sender_visible_to_message.rb (2)
M db/migrate/038_add_message_sender_index.rb (2)
M db/migrate/039_add_more_controls_to_gpx_files.rb (2)
M db/migrate/040_create_oauth_tables.rb (2)
M db/migrate/041_add_fine_o_auth_permissions.rb (2)
M db/migrate/042_add_foreign_keys_to_oauth_tables.rb (2)
M db/migrate/043_add_referer_to_user_token.rb (2)
M db/migrate/044_create_user_roles.rb (2)
M db/migrate/045_create_user_blocks.rb (2)
M db/migrate/046_alter_user_roles_and_blocks.rb (2)
M db/migrate/047_add_visible_to_diaries.rb (2)
M db/migrate/048_add_diary_creation_indexes.rb (2)
M db/migrate/049_improve_changeset_user_index.rb (2)
M db/migrate/050_add_user_index_to_diary_comments.rb (2)
M db/migrate/051_add_status_to_user.rb (2)
M db/migrate/052_add_contributor_terms_to_user.rb (2)
M db/migrate/20100513171259_add_user_date_index_to_changeset.rb (2)
M db/migrate/20100516124737_add_open_id.rb (2)
M db/migrate/20100910084426_add_callback_to_oauth_tokens.rb (2)
M db/migrate/20101114011429_add_editor_preference_to_user.rb (2)
M db/migrate/20110322001319_add_terms_seen_to_user.rb (2)
M db/migrate/20110925112722_rename_ids.rb (2)
M db/migrate/20111116184519_update_oauth.rb (2)
M db/migrate/20111212183945_add_lowercase_user_indexes.rb (2)
M db/migrate/20120123184321_switch_to_paperclip.rb (2)
M db/migrate/20120208122334_merge_acl_address_and_mask.rb (2)
M db/migrate/20120208194454_add_domain_to_acl.rb (2)
M db/migrate/20120214210114_add_text_format.rb (2)
M db/migrate/20120219161649_add_user_image_fingerprint.rb (2)
M db/migrate/20120318201948_create_redactions.rb (2)
M db/migrate/20120328090602_drop_session_table.rb (2)
M db/migrate/20120404205604_add_user_and_description_to_redaction.rb (2)
M db/migrate/20120808231205_add_counter_caches.rb (2)
M db/migrate/20121005195010_add_diary_entry_counter_caches.rb (2)
M db/structure.sql (51)
M lib/bounding_box.rb (2)
M lib/consistency_validations.rb (2)
M lib/diff_reader.rb (2)
M lib/editors.rb (2)
M lib/geo_record.rb (2)
M lib/gpx.rb (2)
M lib/mem_cache.rb (2)
M lib/memcache.rb (2)
M lib/migrate.rb (2)
M lib/not_redactable.rb (2)
M lib/object_finder.rb (2)
M lib/osm.rb (2)
M lib/potlatch.rb (235)
M lib/potlatch2.rb (2)
M lib/quad_tile.rb (2)
M lib/quova.rb (2)
M lib/redactable.rb (2)
M lib/rich_text.rb (2)
M lib/session_persistence.rb (2)
M lib/short_link.rb (2)
M lib/tasks/add_version_to_nodes.rake (2)
M lib/utf8.rb (2)
M lib/validators.rb (2)
M test/functional/amf_controller_test.rb (82)
M test/functional/api_controller_test.rb (2)
M test/functional/browse_controller_test.rb (2)
M test/functional/changeset_controller_test.rb (2)
M test/functional/changeset_tag_controller_test.rb (2)
M test/functional/diary_entry_controller_test.rb (2)
M test/functional/export_controller_test.rb (2)
M test/functional/friend_controller_test.rb (2)
M test/functional/geocoder_controller_test.rb (2)
M test/functional/message_controller_test.rb (2)
M test/functional/node_controller_test.rb (2)
M test/functional/oauth_clients_controller_test.rb (2)
M test/functional/oauth_controller_test.rb (2)
M test/functional/old_node_controller_test.rb (2)
M test/functional/old_relation_controller_test.rb (2)
M test/functional/old_way_controller_test.rb (2)
M test/functional/redactions_controller_test.rb (2)
M test/functional/relation_controller_test.rb (2)
M test/functional/search_controller_test.rb (2)
M test/functional/site_controller_test.rb (2)
M test/functional/swf_controller_test.rb (2)
M test/functional/trace_controller_test.rb (2)
M test/functional/user_blocks_controller_test.rb (2)
M test/functional/user_controller_test.rb (2)
M test/functional/user_preference_controller_test.rb (2)
M test/functional/user_roles_controller_test.rb (2)
M test/functional/way_controller_test.rb (2)
M test/integration/client_application_test.rb (2)
M test/integration/oauth_test.rb (2)
M test/integration/short_link_test.rb (2)
M test/integration/user_blocks_test.rb (2)
M test/integration/user_creation_test.rb (2)
M test/integration/user_diaries_test.rb (2)
M test/integration/user_login_test.rb (2)
M test/integration/user_roles_test.rb (2)
M test/integration/user_terms_seen_test.rb (2)
M test/performance/browsing_test.rb (2)
M test/test_helper.rb (20)
M test/unit/acl_test.rb (2)
M test/unit/bounding_box_test.rb (2)
M test/unit/changeset_tag_test.rb (2)
M test/unit/changeset_test.rb (2)
M test/unit/country_test.rb (2)
M test/unit/diary_comment_test.rb (2)
M test/unit/diary_entry_test.rb (2)
M test/unit/friend_test.rb (2)
M test/unit/i18n_test.rb (2)
M test/unit/language_test.rb (2)
M test/unit/message_test.rb (2)
M test/unit/node_tag_test.rb (2)
M test/unit/node_test.rb (2)
M test/unit/oauth_nonce_test.rb (2)
M test/unit/oauth_token_test.rb (2)
M test/unit/old_node_tag_test.rb (2)
M test/unit/old_node_test.rb (2)
M test/unit/old_relation_tag_test.rb (2)
M test/unit/old_way_tag_test.rb (2)
M test/unit/redaction_test.rb (2)
M test/unit/relation_member_test.rb (2)
M test/unit/relation_tag_test.rb (2)
M test/unit/relation_test.rb (2)
M test/unit/rich_text_test.rb (2)
M test/unit/short_link_test.rb (2)
M test/unit/trace_test.rb (2)
M test/unit/tracepoint_test.rb (2)
M test/unit/tracetag_test.rb (2)
M test/unit/user_preference_test.rb (2)
M test/unit/user_test.rb (2)
M test/unit/user_token_test.rb (2)
M test/unit/way_node_test.rb (2)
M test/unit/way_tag_test.rb (2)
M test/unit/way_test.rb (2)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/135.patch
https://github.com/openstreetmap/openstreetmap-website/pull/135.diff


---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/135
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20121016/f7c1fb50/attachment-0001.html>


More information about the rails-dev mailing list