Skip to content

Commit

Permalink
Merge pull request #2 from lgflorentino/lgf/dev
Browse files Browse the repository at this point in the history
merge lgf/dev
  • Loading branch information
lgflorentino authored Oct 13, 2024
2 parents d531bb6 + 9ba6007 commit e3e4e5d
Show file tree
Hide file tree
Showing 72 changed files with 1,630 additions and 221 deletions.
282 changes: 282 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
# This is a config synced from dry-rb/template-gem repo

require:
- rubocop-on-rbs

AllCops:
TargetRubyVersion: 3.0
NewCops: disable
SuggestExtensions: false
Exclude:
- "**/vendor/**/*" # For GitHub Actions, see rubocop/rubocop#9832
- benchmarks/*.rb
- spec/support/coverage.rb
- spec/support/warnings.rb
- spec/support/rspec_options.rb
- Gemfile.devtools
- "*.gemspec"

Layout/SpaceAroundMethodCallOperator:
Enabled: false

Layout/SpaceInLambdaLiteral:
Enabled: false

Layout/MultilineMethodCallIndentation:
Enabled: true
EnforcedStyle: indented

Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent

Layout/SpaceInsideHashLiteralBraces:
Enabled: true
EnforcedStyle: no_space
EnforcedStyleForEmptyBraces: no_space

Layout/LineLength:
Max: 100
Exclude:
- "spec/**/*.rb"

Lint/AmbiguousBlockAssociation:
Enabled: true
# because 'expect { foo }.to change { bar }' is fine
Exclude:
- "spec/**/*.rb"

Lint/BooleanSymbol:
Enabled: false

Lint/ConstantDefinitionInBlock:
Exclude:
- "spec/**/*.rb"

Lint/RaiseException:
Enabled: false

Lint/StructNewOverride:
Enabled: false

Lint/SuppressedException:
Exclude:
- "spec/spec_helper.rb"

Lint/LiteralAsCondition:
Exclude:
- "spec/**/*.rb"

Naming/PredicateName:
Enabled: false

Naming/FileName:
Exclude:
- "lib/*-*.rb"

Naming/MethodName:
Enabled: false

Naming/MethodParameterName:
Enabled: false

Naming/MemoizedInstanceVariableName:
Enabled: false

Metrics/MethodLength:
Enabled: false

Metrics/ClassLength:
Enabled: false

Metrics/BlockLength:
Enabled: false

Metrics/AbcSize:
Max: 25

Metrics/CyclomaticComplexity:
Enabled: true
Max: 12

Style/FrozenStringLiteralComment:
Exclude:
- "config/am.conf.rb"

Style/ExponentialNotation:
Enabled: false

Style/HashEachMethods:
Enabled: false

Style/HashTransformKeys:
Enabled: false

Style/HashTransformValues:
Enabled: false

Style/AccessModifierDeclarations:
Enabled: false

Style/Alias:
Enabled: true
EnforcedStyle: prefer_alias_method

Style/AsciiComments:
Enabled: false

Style/BlockDelimiters:
Enabled: false

Style/ClassAndModuleChildren:
Exclude:
- "spec/**/*.rb"

Style/ConditionalAssignment:
Enabled: false

Style/DateTime:
Enabled: false

Style/Documentation:
Enabled: false

Style/EachWithObject:
Enabled: false

Style/FormatString:
Enabled: false

Style/FormatStringToken:
Enabled: false

Style/GuardClause:
Enabled: false

Style/IfUnlessModifier:
Enabled: false

Style/Lambda:
Enabled: false

Style/LambdaCall:
Enabled: false

Style/ParallelAssignment:
Enabled: false

Style/RaiseArgs:
Enabled: false

Style/StabbyLambdaParentheses:
Enabled: false

Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes
ConsistentQuotesInMultiline: false

Style/StringLiteralsInInterpolation:
Enabled: true
EnforcedStyle: double_quotes

Style/SymbolArray:
Exclude:
- "spec/**/*.rb"

Style/TrailingUnderscoreVariable:
Enabled: false

Style/MultipleComparison:
Enabled: false

Style/Next:
Enabled: false

Style/AccessorGrouping:
Enabled: false

Style/EmptyLiteral:
Enabled: false

Style/Semicolon:
Exclude:
- "spec/**/*.rb"

Style/HashAsLastArrayItem:
Exclude:
- "spec/**/*.rb"

Style/CaseEquality:
Exclude:
- "lib/dry/monads/**/*.rb"
- "lib/dry/struct/**/*.rb"
- "lib/dry/types/**/*.rb"
- "spec/**/*.rb"

Style/ExplicitBlockArgument:
Exclude:
- "lib/dry/types/**/*.rb"

Style/CombinableLoops:
Enabled: false

Style/EmptyElse:
Enabled: false

Style/DoubleNegation:
Enabled: false

Style/MultilineBlockChain:
Enabled: false

Style/NumberedParametersLimit:
Max: 2

Lint/UnusedBlockArgument:
Exclude:
- "spec/**/*.rb"

Lint/UselessAssignment:
Exclude:
- "config/am.conf.rb"

Lint/Debugger:
Exclude:
- "bin/console"

Lint/BinaryOperatorWithIdenticalOperands:
Exclude:
- "spec/**/*.rb"

Metrics/ParameterLists:
Exclude:
- "spec/**/*.rb"

Lint/EmptyBlock:
Exclude:
- "spec/**/*.rb"

Lint/EmptyFile:
Exclude:
- "spec/**/*.rb"

Lint/UselessMethodDefinition:
Exclude:
- "spec/**/*.rb"

Lint/SelfAssignment:
Enabled: false

Lint/EmptyClass:
Enabled: false

Naming/ConstantName:
Exclude:
- "spec/**/*.rb"

Naming/VariableNumber:
Exclude:
- "spec/**/*.rb"

Naming/BinaryOperatorParameterName:
Enabled: false
9 changes: 7 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ source "https://rubygems.org"
# Specify your gem's dependencies in activity_monitor.gemspec
gemspec

gem "rake", "~> 13.0"

group :db_sqlite_backend do
gem "sqlite3", "~> 2.0"
end

group :db_pgsql_backend do
gem "pg", "~> 1.5"
gem "sequel_pg", "~> 1.17"
end

22 changes: 20 additions & 2 deletions NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,27 @@ Notes

To run the bundle commands in an isolated docker container
```zsh
./script/docker_dev_wrap.sh <cmd> <params> <go> <here>
./bin/docker <cmd> <params> <go> <here>
# E.g.
./script/docker_dev_wrap.sh bundle install
./bin/docker bundle install

```

# SQLite3 CLI Commands

# To insert some data using the test sqlite3 db
```sh
$ sqlite3 ./.data/am.db

sqlite> INSERT INTO services (name, url, created_at, updated_at) VALUES ('bitbucket', 'https://bitbucket.org', datetime(), datetime());
```
# Webhook payload structures
## Bitbucket
[https://support.atlassian.com/bitbucket-cloud/docs/event-payloads/](https://support.atlassian.com/bitbucket-cloud/docs/event-payloads/)
## Codeberg
[https://forgejo.org/docs/latest/user/webhooks/](https://forgejo.org/docs/latest/user/webhooks/)
## Github
[https://docs.github.com/en/webhooks/webhook-events-and-payloads](https://docs.github.com/en/webhooks/webhook-events-and-payloads)
## Gitlab
[https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#push-events](https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#push-events)
28 changes: 23 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ Features:
* Parse JSON that is received on the webhook endpoints
* Feature location: `lib/activity_monitor/json_parser`
- [ ] Feature implemented
* Provide parsing for a webhook which posts all data or a subset of data
* Provide parsing for webhook events
* Feature location `lib/activity_monitor/json_parser/{all,subset}`
- [ ] Feature implemented
- [ ] Push event implemented
- [ ] Pull Request event implemented
- [ ] Issue Created event implemented
- [ ] Comment event implemented
* Store parsed data in db or other
* Feature location: `lib/activity_monitor/persistance`
- [ ] Feature implemented
Expand All @@ -36,20 +39,35 @@ Anti-features:
Install the gem and add to the application's Gemfile by executing:
```sh
$ bundle add activity_monitor

```
If bundler is not being used to manage dependencies, install the gem by executing:
```sh
$ gem install activity_monitor
```

### Hanami Extended Installation
### Hanami Extended Installation **WIP
```sh
$ bundle exec hanami activity-monitor install
```

## Usage
## CLI Usage

The app comes a Command Line Interface (CLI) tool to help with some tasks. The documentation for the tool is provided by the tool when used in conjunction with the `--help` option.
Ex:
```sh
# List available rake tasks
bundle exec rake --tasks

TODO: Write usage instructions here
# Bundled activity monitor tool
bundle exec am --help

# bundle exec am COMMAND --help
bundle exec am run --help

# connect to the db to run some command
DATABASE_URL="sqlite://./.data/am.db" bundle exec rake db:clean
```

## Development

Expand Down
14 changes: 1 addition & 13 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "activity_monitor/rake_task"

RSpec::Core::RakeTask.new(:spec)

require "rubocop/rake_task"

RuboCop::RakeTask.new

task default: %i[spec rubocop]

task :docker_tests do
ruby "spec/docker/run_docker_tests.rb"
end
Loading

0 comments on commit e3e4e5d

Please sign in to comment.