discourse/script/import_scripts/socialcast
Jarek Radosz 694b5f108b
DEV: Fix various rubocop lints (#24749)
These (21 + 3 from previous PRs) are soon to be enabled in rubocop-discourse:

Capybara/VisibilityMatcher
Lint/DeprecatedOpenSSLConstant
Lint/DisjunctiveAssignmentInConstructor
Lint/EmptyConditionalBody
Lint/EmptyEnsure
Lint/LiteralInInterpolation
Lint/NonLocalExitFromIterator
Lint/ParenthesesAsGroupedExpression
Lint/RedundantCopDisableDirective
Lint/RedundantRequireStatement
Lint/RedundantSafeNavigation
Lint/RedundantStringCoercion
Lint/RedundantWithIndex
Lint/RedundantWithObject
Lint/SafeNavigationChain
Lint/SafeNavigationConsistency
Lint/SelfAssignment
Lint/UnreachableCode
Lint/UselessMethodDefinition
Lint/Void

Previous PRs:
Lint/ShadowedArgument
Lint/DuplicateMethods
Lint/BooleanSymbol
RSpec/SpecFilePathSuffix
2023-12-06 23:25:00 +01:00
..
test
create_title.rb DEV: Correct Style/RedundantReturn rubocop issues (#23052) 2023-08-10 02:03:38 +02:00
export.rb
import.rb DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
README.md
socialcast_api.rb
socialcast_message.rb
socialcast_user.rb
title.rb DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00

To get started, copy the config.ex.yml to config.yml, and then update the properties for your Socialcast instance.

This importer uses the Socialcast API.

domain: 'my-socialcast-domain'
username: 'my-socialcast-username'
password: 'my-socialcast-password'

Create the directory for the json files to export: mkdir output
Then run bundle exec ruby export.rb /path/to/config.yml

If desired, edit the socialcast_message.rb file to set the category
and tags for each topic based on the name of the Socialcast group it was
originally posted to.

You must create categories with the same names first in your site.

All topics will get the DEFAULT_TAG at minimum.

Topics posted to a group that matches any group name in the TAGS_AND_CATEGORIES
map will get the associated category and tags.

Other topics will be tagged with the original groupname and placed in the
DEFAULT_CATEGORY.

To run the import, run bundle exec ruby import.rb

To run the import in a production, run RAILS_ENV=production bundle exec ruby import.rb