Skip to content

Commit 974b5ae

Browse files
committed
Initial commit
0 parents  commit 974b5ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1776
-0
lines changed

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/.bundle/
2+
/.yardoc
3+
/_yardoc/
4+
/coverage/
5+
/doc/
6+
/pkg/
7+
/spec/reports/
8+
/tmp/
9+
client_secrets.json
10+
tokens.yaml
11+
.byebug_history

.rubocop.yml

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
require: rubocop-minitest
2+
3+
AllCops:
4+
Exclude:
5+
- bin/*
6+
NewCops: enable
7+
SuggestExtensions: false
8+
9+
Layout/LineLength:
10+
Max: 120
11+
12+
Layout/MultilineMethodCallIndentation:
13+
EnforcedStyle: indented_relative_to_receiver
14+
15+
Lint/AmbiguousBlockAssociation:
16+
Enabled: false
17+
18+
Lint/MissingSuper:
19+
Exclude:
20+
- "lib/metadocs/source_map.rb"
21+
22+
Metrics:
23+
Enabled: false
24+
25+
Metrics/AbcSize:
26+
Max: 39
27+
28+
Metrics/BlockLength:
29+
Exclude:
30+
- "**/*.rake"
31+
32+
Metrics/ClassLength:
33+
Exclude:
34+
- "test/*/**/*.rb"
35+
- "lib/metadocs/bbdocs.rb"
36+
Max: 250
37+
38+
Metrics/CyclomaticComplexity:
39+
Max: 9
40+
41+
Metrics/MethodLength:
42+
Max: 50
43+
44+
Metrics/PerceivedComplexity:
45+
Max: 9
46+
47+
Naming/InclusiveLanguage:
48+
Enabled: false
49+
50+
Minitest/MultipleAssertions:
51+
Enabled: false
52+
53+
Naming/MethodParameterName:
54+
MinNameLength: 2
55+
56+
Style/AndOr:
57+
Enabled: false
58+
59+
Style/ClassAndModuleChildren:
60+
Enabled: false
61+
62+
Style/Documentation:
63+
Enabled: false
64+
65+
Style/DoubleNegation:
66+
Enabled: false
67+
68+
Style/NegatedIf:
69+
Enabled: false
70+
71+
Style/NestedParenthesizedCalls:
72+
Enabled: false
73+
74+
Style/PercentLiteralDelimiters:
75+
PreferredDelimiters:
76+
default: "()"
77+
"%i": "()"
78+
"%r": "{}"
79+
"%w": "()"
80+
81+
Style/RescueModifier:
82+
Enabled: false
83+
84+
Style/IfUnlessModifier:
85+
Enabled: false

.ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.6.8

Gemfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# frozen_string_literal: true
2+
3+
source 'https://rubygems.org'
4+
5+
# Specify your gem's dependencies in metadocs.gemspec
6+
gemspec

Gemfile.lock

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
PATH
2+
remote: .
3+
specs:
4+
metadocs (0.1.0)
5+
google-api-client (~> 0.52)
6+
hashie (~> 3.6)
7+
parslet (~> 2.0)
8+
9+
GEM
10+
remote: https://rubygems.org/
11+
specs:
12+
activesupport (6.1.4.1)
13+
concurrent-ruby (~> 1.0, >= 1.0.2)
14+
i18n (>= 1.6, < 2)
15+
minitest (>= 5.1)
16+
tzinfo (~> 2.0)
17+
zeitwerk (~> 2.3)
18+
addressable (2.8.0)
19+
public_suffix (>= 2.0.2, < 5.0)
20+
ast (2.4.2)
21+
byebug (11.1.3)
22+
concurrent-ruby (1.1.9)
23+
declarative (0.0.20)
24+
faraday (1.8.0)
25+
faraday-em_http (~> 1.0)
26+
faraday-em_synchrony (~> 1.0)
27+
faraday-excon (~> 1.1)
28+
faraday-httpclient (~> 1.0.1)
29+
faraday-net_http (~> 1.0)
30+
faraday-net_http_persistent (~> 1.1)
31+
faraday-patron (~> 1.0)
32+
faraday-rack (~> 1.0)
33+
multipart-post (>= 1.2, < 3)
34+
ruby2_keywords (>= 0.0.4)
35+
faraday-em_http (1.0.0)
36+
faraday-em_synchrony (1.0.0)
37+
faraday-excon (1.1.0)
38+
faraday-httpclient (1.0.1)
39+
faraday-net_http (1.0.1)
40+
faraday-net_http_persistent (1.2.0)
41+
faraday-patron (1.0.0)
42+
faraday-rack (1.0.0)
43+
gems (1.2.0)
44+
google-api-client (0.53.0)
45+
google-apis-core (~> 0.1)
46+
google-apis-generator (~> 0.1)
47+
google-apis-core (0.4.1)
48+
addressable (~> 2.5, >= 2.5.1)
49+
googleauth (>= 0.16.2, < 2.a)
50+
httpclient (>= 2.8.1, < 3.a)
51+
mini_mime (~> 1.0)
52+
representable (~> 3.0)
53+
retriable (>= 2.0, < 4.a)
54+
rexml
55+
webrick
56+
google-apis-discovery_v1 (0.6.0)
57+
google-apis-core (>= 0.4, < 2.a)
58+
google-apis-generator (0.4.0)
59+
activesupport (>= 5.0)
60+
gems (~> 1.2)
61+
google-apis-core (>= 0.4, < 2.a)
62+
google-apis-discovery_v1 (~> 0.5)
63+
thor (>= 0.20, < 2.a)
64+
googleauth (1.0.0)
65+
faraday (>= 0.17.3, < 2.0)
66+
jwt (>= 1.4, < 3.0)
67+
memoist (~> 0.16)
68+
multi_json (~> 1.11)
69+
os (>= 0.9, < 2.0)
70+
signet (>= 0.16, < 2.a)
71+
hashie (3.6.0)
72+
httpclient (2.8.3)
73+
i18n (1.8.10)
74+
concurrent-ruby (~> 1.0)
75+
jwt (2.3.0)
76+
memoist (0.16.2)
77+
mini_mime (1.1.2)
78+
minitest (5.14.4)
79+
multi_json (1.15.0)
80+
multipart-post (2.1.1)
81+
os (1.1.1)
82+
parallel (1.21.0)
83+
parser (3.0.2.0)
84+
ast (~> 2.4.1)
85+
parslet (2.0.0)
86+
public_suffix (4.0.6)
87+
rainbow (3.0.0)
88+
rake (13.0.6)
89+
regexp_parser (2.1.1)
90+
representable (3.1.1)
91+
declarative (< 0.1.0)
92+
trailblazer-option (>= 0.1.1, < 0.2.0)
93+
uber (< 0.2.0)
94+
retriable (3.1.2)
95+
rexml (3.2.5)
96+
rubocop (1.22.1)
97+
parallel (~> 1.10)
98+
parser (>= 3.0.0.0)
99+
rainbow (>= 2.2.2, < 4.0)
100+
regexp_parser (>= 1.8, < 3.0)
101+
rexml
102+
rubocop-ast (>= 1.12.0, < 2.0)
103+
ruby-progressbar (~> 1.7)
104+
unicode-display_width (>= 1.4.0, < 3.0)
105+
rubocop-ast (1.12.0)
106+
parser (>= 3.0.1.1)
107+
rubocop-minitest (0.15.2)
108+
rubocop (>= 0.90, < 2.0)
109+
ruby-progressbar (1.11.0)
110+
ruby2_keywords (0.0.5)
111+
signet (0.16.0)
112+
addressable (~> 2.8)
113+
faraday (>= 0.17.3, < 2.0)
114+
jwt (>= 1.5, < 3.0)
115+
multi_json (~> 1.10)
116+
thor (1.1.0)
117+
trailblazer-option (0.1.1)
118+
tzinfo (2.0.4)
119+
concurrent-ruby (~> 1.0)
120+
uber (0.1.0)
121+
unicode-display_width (2.1.0)
122+
webrick (1.7.0)
123+
zeitwerk (2.4.2)
124+
125+
PLATFORMS
126+
x86_64-linux
127+
128+
DEPENDENCIES
129+
byebug
130+
googleauth
131+
metadocs!
132+
minitest
133+
rake
134+
rubocop
135+
rubocop-minitest
136+
137+
BUNDLED WITH
138+
2.2.29

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Metadocs
2+
3+
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/metadocs`. To experiment with that code, run `bin/console` for an interactive prompt.
4+
5+
TODO: Delete this and the text above, and describe your gem
6+
7+
## Installation
8+
9+
Add this line to your application's Gemfile:
10+
11+
```ruby
12+
gem 'metadocs'
13+
```
14+
15+
And then execute:
16+
17+
$ bundle install
18+
19+
Or install it yourself as:
20+
21+
$ gem install metadocs
22+
23+
## Usage
24+
25+
TODO: Write usage instructions here
26+
27+
## Development
28+
29+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30+
31+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32+
33+
## Contributing
34+
35+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/metadocs.

Rakefile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# frozen_string_literal: true
2+
3+
require 'bundler/gem_tasks'
4+
require 'rake/testtask'
5+
6+
Rake::TestTask.new(:test) do |t|
7+
t.libs << 'test'
8+
t.libs << 'lib'
9+
t.test_files = FileList['test/**/*_test.rb']
10+
end
11+
12+
require 'rubocop/rake_task'
13+
14+
RuboCop::RakeTask.new
15+
16+
task default: %i(test rubocop)
17+
task :console do
18+
lib = File.expand_path('lib', __dir__)
19+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
20+
require 'irb'
21+
require 'metadocs'
22+
ARGV.clear
23+
IRB.start
24+
end

bin/console

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require "bundler/setup"
5+
require "metadocs"
6+
7+
# You can add fixtures and/or initialization code here to make experimenting
8+
# with your gem easier. You can also use a different console, if you like.
9+
10+
# (If you use this, don't forget to add pry to your Gemfile!)
11+
# require "pry"
12+
# Pry.start
13+
14+
require "irb"
15+
IRB.start(__FILE__)

bin/google-auth-setup

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require "bundler/setup"
5+
require "metadocs"
6+
require "googleauth"
7+
require "googleauth/stores/file_token_store"
8+
9+
GOOGLE_CREDENTIALS_PATH = ENV.fetch("GOOGLE_CREDENTIALS_PATH", File.expand_path("../client_secrets.json", __dir__))
10+
GOOGLE_STORAGE_PATH = ENV.fetch("GOOGLE_STORAGE_PATH", File.expand_path("../tokens.yaml", __dir__))
11+
12+
OOB_URI = "urn:ietf:wg:oauth:2.0:oob"
13+
14+
client_id = Google::Auth::ClientId.from_file(GOOGLE_CREDENTIALS_PATH)
15+
token_store = Google::Auth::Stores::FileTokenStore.new(file: GOOGLE_STORAGE_PATH)
16+
authorizer = Google::Auth::UserAuthorizer.new(client_id, Metadocs::Parser::REQUIRED_SCOPES, token_store)
17+
18+
credentials = authorizer.get_credentials("default")
19+
if credentials.nil?
20+
url = authorizer.get_authorization_url(base_url: OOB_URI)
21+
puts "Open #{url} in your browser and enter the resulting code: "
22+
authorizer.get_and_store_credentials_from_code(
23+
user_id: "default",
24+
code: gets,
25+
base_url: OOB_URI
26+
)
27+
end

bin/rake

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'rake' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("bundle", __dir__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("rake", "rake")

0 commit comments

Comments
 (0)