Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: bundle install
run: |
bundle config set --local without 'gruff'
bundle install
- name: Run tests
run: bundle exec rspec
- name: Report coverage
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1
3.1.0
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ source "https://rubygems.org"

# Specify your gem's dependencies in graphql-groups.gemspec
gemspec

group :gruff do
gem 'gruff', '~> 0.29'
end
20 changes: 13 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ GEM
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.1)
base64 (0.2.0)
base64 (0.3.0)
benchmark-ips (2.8.2)
bigdecimal (3.1.8)
concurrent-ruby (1.3.4)
Expand All @@ -41,19 +41,21 @@ GEM
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
drb (2.2.1)
fiber-storage (1.0.0)
fiber-storage (1.0.1)
gqli (1.0.0)
hashie (~> 3.0)
http (> 0.8, < 3.0)
multi_json (~> 1)
graphql (2.3.19)
graphql (2.5.18)
base64
fiber-storage
logger
groupdate (6.5.1)
activesupport (>= 7)
gruff (0.10.0)
gruff (0.29.0)
bigdecimal (>= 3.0)
histogram
rmagick
rmagick (>= 5.5)
hashie (3.6.0)
histogram (0.2.4.1)
http (2.2.2)
Expand All @@ -71,15 +73,19 @@ GEM
mini_portile2 (2.8.7)
minitest (5.25.1)
multi_json (1.15.0)
observer (0.1.2)
parallel (1.19.2)
parser (2.7.1.4)
ast (~> 2.4.1)
pkg-config (1.6.5)
public_suffix (4.0.6)
rainbow (3.0.0)
rake (13.0.1)
regexp_parser (1.7.1)
rexml (3.3.9)
rmagick (4.1.2)
rmagick (6.1.5)
observer (~> 0.1)
pkg-config (~> 1.4)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
Expand Down Expand Up @@ -135,7 +141,7 @@ DEPENDENCIES
gqli (~> 1.0)
graphql-groups!
groupdate (~> 6.5.1)
gruff (~> 0.10)
gruff (~> 0.29)
rake (~> 13.0)
rspec (~> 3.0)
rubocop (~> 0.88)
Expand Down
1 change: 0 additions & 1 deletion graphql-groups.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'database_cleaner-active_record', '~> 2.1'
spec.add_development_dependency 'gqli', '~> 1.0'
spec.add_development_dependency 'groupdate', '~> 6.5.1'
spec.add_development_dependency 'gruff', '~> 0.10'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rubocop', '~> 0.88'
Expand Down
12 changes: 11 additions & 1 deletion lib/graphql/groups/has_aggregates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,17 @@ def aggregate(name, *_, **options, &block)
end

def aggregate_field(*args, **kwargs, &block)
field_defn = Schema::AggregateField.from_options(*args, owner: self, **kwargs, &block)
if args.any?
name_arg = args.shift
type_arg = args.shift
desc_arg = args.shift

kwargs[:name] ||= name_arg
kwargs[:type] ||= type_arg if type_arg
kwargs[:description] ||= desc_arg if desc_arg
end

field_defn = Schema::AggregateField.new(owner: self, **kwargs, &block)
field_defn.ensure_loaded if Gem::Version.new(GraphQL::VERSION) >= Gem::Version.new('2.3')
add_field(field_defn)
field_defn
Expand Down
12 changes: 11 additions & 1 deletion lib/graphql/groups/has_groups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ def by(name, **options, &block)
end

def group_field(*args, **kwargs, &block)
field_defn = field_class.from_options(*args, owner: self, **kwargs, &block)
if args.any?
name_arg = args.shift
type_arg = args.shift
desc_arg = args.shift

kwargs[:name] ||= name_arg
kwargs[:type] ||= type_arg if type_arg
kwargs[:description] ||= desc_arg if desc_arg
end

field_defn = field_class.new(owner: self, **kwargs, &block)
add_field(field_defn)
field_defn
end
Expand Down
Loading