Skip to content

Commit

Permalink
Merge pull request #3 from DataDog/tonycthsu/yard-documentation
Browse files Browse the repository at this point in the history
Add yard and chores (appraisal gemfiles, require_relative for specs)
  • Loading branch information
anmarchenko authored Aug 16, 2023
2 parents 095ece7 + 00079a7 commit 3b2da63
Show file tree
Hide file tree
Showing 153 changed files with 2,426 additions and 1,904 deletions.
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DD_AGENT_HOST=localhost
DD_API_KEY=00000000000000000000000000000000
DD_METRIC_AGENT_PORT=8125
DD_TRACE_AGENT_PORT=8126
TEST_DDAGENT_VAR_RUN=/var/run/datadog
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
Gemfile.lock
Gemfile-*.lock
.envrc
.ruby-version
.DS_Store
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

3 changes: 3 additions & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--readme README.md
--files LICENSE
-e ./yard/extensions.rb
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "appraisal"
gem "standard", "<= 1.24.3" if RUBY_VERSION >= "2.2.0"

gem "yard"
gem "webrick"
67 changes: 52 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,62 @@
# Datadog::Ci
# Datadog::CI

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/datadog/ci`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem
Datadog's Ruby Library for instrumenting your test and continuous integration pipeline. Checkout to learn more at our [official website](https://docs.datadoghq.com/continuous_integration/tests/ruby/?tab=azurepipelines).

## Installation

Install the gem and add to the application's Gemfile by executing:
Add to your Gemfile.
```
group :test do
gem "datadog-ci"
end
```

## Usage

$ bundle add datadog-ci
#### Cucumber

If bundler is not being used to manage dependencies, install the gem by executing:
Activate `Cucumber` integration with configuration

$ gem install datadog-ci
```
Datadog.configure do |c|
# Only activates test instrumentation on CI
c.tracing.enabled = (ENV["DD_ENV"] == "ci")
## Usage
# Configures the tracer to ensure results delivery
c.ci.enabled = true
# The name of the service or library under test
c.service = 'my-ruby-app'
# Enables the Cucumber instrumentation
c.ci.instrument :cucumber
end
```

#### RSpec

TODO: Write usage instructions here
To activate `RSpec` integration, add this to the `spec_helper.rb` file:

```
require 'rspec'
require 'datadog/ci'
Datadog.configure do |c|
# Only activates test instrumentation on CI
c.tracing.enabled = (ENV["DD_ENV"] == "ci")
# Configures the tracer to ensure results delivery
c.ci.enabled = true
# The name of the service or library under test
c.service = 'my-ruby-app'
# Enables the RSpec instrumentation
c.ci.instrument :rspec
end
```

## Development

Expand All @@ -26,12 +66,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/datadog-ci. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/datadog-ci/blob/main/CODE_OF_CONDUCT.md).

## License
Bug reports and pull requests are welcome on GitHub at https://github.com/Datadog/datadog-ci. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/Datadog/datadog-ci/blob/main/CODE_OF_CONDUCT.md).

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

## Code of Conduct

Everyone interacting in the Datadog::Ci project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/datadog-ci/blob/main/CODE_OF_CONDUCT.md).
Everyone interacting in the `Datadog::CI` project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Datadog/datadog-ci/blob/main/CODE_OF_CONDUCT.md).
13 changes: 13 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,24 @@

require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "datadog/ci/version"
require "yard"

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

Dir.glob("tasks/*.rake").each { |r| import r }

YARD::Rake::YardocTask.new(:docs) do |t|
# Options defined in `.yardopts` are read first, then merged with
# options defined here.
#
# It's recommended to define options in `.yardopts` instead of here,
# as `.yardopts` can be read by external YARD tools, like the
# hot-reload YARD server `yard server --reload`.

t.options += ["--title", "datadog-ci #{Datadog::CI::VERSION} documentation"]
end

desc "Run RSpec"
# rubocop:disable Metrics/BlockLength
namespace :spec do
Expand Down
5 changes: 3 additions & 2 deletions gemfiles/jruby_9.2.21.0_cucumber_3.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ gem "os"
gem "climate_control"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "rubocop", require: false
gem "standard"
gem "appraisal"
gem "standard", "<= 1.24.3"
gem "yard"
gem "webrick"
gem "cucumber", "~> 3"

group :check do
Expand Down
47 changes: 26 additions & 21 deletions gemfiles/jruby_9.2.21.0_cucumber_3.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ PATH
GEM
remote: https://rubygems.org/
specs:
appraisal (2.4.1)
appraisal (2.5.0)
bundler
rake
thor (>= 0.14.0)
ast (2.4.2)
backports (3.24.0)
backports (3.24.1)
builder (3.2.4)
climate_control (1.2.0)
coderay (1.1.3)
Expand All @@ -32,49 +32,51 @@ GEM
cucumber-expressions (6.0.1)
cucumber-tag_expressions (1.1.1)
cucumber-wire (0.0.1)
ddtrace (1.10.1)
debase-ruby_core_source (>= 0.10.16, <= 3.2.0)
libdatadog (~> 2.0.0.1.0)
libddwaf (~> 1.6.2.0.0)
ddtrace (1.13.1)
debase-ruby_core_source (= 3.2.1)
libdatadog (~> 3.0.0.1.0)
libddwaf (~> 1.9.0.0.0)
msgpack
debase-ruby_core_source (3.2.0)
debase-ruby_core_source (3.2.1)
diff-lcs (1.5.0)
ffi (1.15.5-java)
gherkin (5.1.0)
libdatadog (2.0.0.1.0)
libddwaf (1.6.2.0.0-java)
libdatadog (3.0.0.1.0)
libddwaf (1.9.0.0.1-java)
ffi (~> 1.0)
method_source (1.0.0)
msgpack (1.6.1-java)
msgpack (1.7.2-java)
multi_json (1.15.0)
multi_test (1.1.0)
os (1.1.4)
parallel (1.22.1)
parser (3.2.1.1)
parallel (1.23.0)
parser (3.2.2.3)
ast (~> 2.4.1)
racc
pry (0.14.2-java)
coderay (~> 1.1)
method_source (~> 1.0)
spoon (~> 0.0)
racc (1.7.1-java)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.7.0)
rexml (3.2.5)
regexp_parser (2.8.1)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-collection_matchers (1.2.0)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (3.12.1)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.2)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.4)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rspec-support (3.12.1)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.25.0)
Expand All @@ -97,8 +99,10 @@ GEM
standard (1.7.0)
rubocop (= 1.25.0)
rubocop-performance (= 1.13.2)
thor (1.2.1)
thor (1.2.2)
unicode-display_width (2.4.2)
webrick (1.8.1)
yard (0.9.34)

PLATFORMS
universal-java-1.8
Expand All @@ -114,8 +118,9 @@ DEPENDENCIES
rspec
rspec-collection_matchers
rspec_junit_formatter
rubocop
standard
standard (<= 1.24.3)
webrick
yard

BUNDLED WITH
2.3.26
5 changes: 3 additions & 2 deletions gemfiles/jruby_9.2.21.0_cucumber_4.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ gem "os"
gem "climate_control"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "rubocop", require: false
gem "standard"
gem "appraisal"
gem "standard", "<= 1.24.3"
gem "yard"
gem "webrick"
gem "cucumber", "~> 4"

group :check do
Expand Down
53 changes: 29 additions & 24 deletions gemfiles/jruby_9.2.21.0_cucumber_4.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activesupport (6.1.7.3)
activesupport (6.1.7.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
appraisal (2.4.1)
appraisal (2.5.0)
bundler
rake
thor (>= 0.14.0)
Expand Down Expand Up @@ -53,28 +53,29 @@ GEM
cucumber-core (~> 7.1, >= 7.1.0)
cucumber-cucumber-expressions (~> 10.1, >= 10.1.0)
cucumber-messages (~> 12.2, >= 12.2.0)
ddtrace (1.10.1)
debase-ruby_core_source (>= 0.10.16, <= 3.2.0)
libdatadog (~> 2.0.0.1.0)
libddwaf (~> 1.6.2.0.0)
ddtrace (1.13.1)
debase-ruby_core_source (= 3.2.1)
libdatadog (~> 3.0.0.1.0)
libddwaf (~> 1.9.0.0.0)
msgpack
debase-ruby_core_source (3.2.0)
debase-ruby_core_source (3.2.1)
diff-lcs (1.3)
ffi (1.15.5-java)
i18n (1.12.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
libdatadog (2.0.0.1.0)
libddwaf (1.6.2.0.0-java)
libdatadog (3.0.0.1.0)
libddwaf (1.9.0.0.1-java)
ffi (~> 1.0)
method_source (1.0.0)
middleware (0.1.0)
minitest (5.15.0)
msgpack (1.6.1-java)
msgpack (1.7.2-java)
multi_test (0.1.2)
os (1.1.4)
parallel (1.22.1)
parser (3.2.1.1)
parallel (1.23.0)
parser (3.2.2.3)
ast (~> 2.4.1)
racc
protobuf-cucumber (3.10.8)
activesupport (>= 3.2)
middleware
Expand All @@ -84,25 +85,26 @@ GEM
coderay (~> 1.1)
method_source (~> 1.0)
spoon (~> 0.0)
racc (1.7.1-java)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.7.0)
rexml (3.2.5)
regexp_parser (2.8.1)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-collection_matchers (1.2.0)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (3.12.1)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.2)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.4)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rspec-support (3.12.1)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.25.0)
Expand All @@ -125,14 +127,16 @@ GEM
standard (1.7.0)
rubocop (= 1.25.0)
rubocop-performance (= 1.13.2)
sys-uname (1.2.2)
sys-uname (1.2.3)
ffi (~> 1.1)
thor (1.2.1)
thor (1.2.2)
thread_safe (0.3.6-java)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)
zeitwerk (2.6.7)
webrick (1.8.1)
yard (0.9.34)
zeitwerk (2.6.11)

PLATFORMS
universal-java-1.8
Expand All @@ -148,8 +152,9 @@ DEPENDENCIES
rspec
rspec-collection_matchers
rspec_junit_formatter
rubocop
standard
standard (<= 1.24.3)
webrick
yard

BUNDLED WITH
2.3.26
Loading

0 comments on commit 3b2da63

Please sign in to comment.