component_party 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73fbc5bb12f3bbbd726ca0314afeac72fddf416b0adf9c0a324c74722675349d
4
- data.tar.gz: 251c72e7dac7ad1328ba42742fa3439cfeb69b009efd1937ef981bcdf7a90aa1
3
+ metadata.gz: 374d3d5e8c631909ac9a9837e0b29cdde69b51dcd9b21b05677201181d15f125
4
+ data.tar.gz: 168a86d646ccaa73d383031086f9590e6ed996ac07d20015e1ec2fb86d9cdea7
5
5
  SHA512:
6
- metadata.gz: 46b22b5d9a78f1927117e331ddcd90d07806e77f8118fe46683c281767485805ac30731aa91d8f26a0aca6f37f81255ff3b2af433bc533582c1c6c5afc92abd3
7
- data.tar.gz: eac0e6c9ca872d6ba997db86c52a869186bb9e4b528746b65bf35b2797a7e1932cad5a0228c6410c25f9f172bee58ce11cd5710abb5371fa7546ede646385a35
6
+ metadata.gz: 1fcb150b074eca2c99f5b3a6f41366e029aaca44445ca63e9db4d8183ea323991b7543ae9654f95d0e8b08a91a3578305d9a3d31b1e3b2a3138044b19d796272
7
+ data.tar.gz: 41d29e1f5adac97f4c5cf4aa225c726b02174c41ae9bac65d92552bcda3b2dd9f25d5b2fdbe3791ea231a544420bed1bd19b4ba2cefab39d9717a5a89ca0f302
data/.travis.yml CHANGED
@@ -1,11 +1,18 @@
1
1
  env:
2
2
  global:
3
3
  - CC_TEST_REPORTER_ID=2373c9fa7226b98ccf8bef72f133bc37b4cef57085c027e144a3b2fc71ce7558
4
+ - CI_NODE_TOTAL=5
4
5
  matrix:
5
- - "RAILS_VERSION=4.2.0"
6
- - "RAILS_VERSION=5.0.0"
7
- - "RAILS_VERSION=5.1.0"
8
- - "RAILS_VERSION=5.2.0"
6
+ - "RAILS_VERSION=4.2.0 BUNDLER_VERSION=1.17.3 CI_NODE_INDEX=1"
7
+ - "RAILS_VERSION=5.0.0 BUNDLER_VERSION=2.0.2 CI_NODE_INDEX=2"
8
+ - "RAILS_VERSION=5.1.0 BUNDLER_VERSION=2.0.2 CI_NODE_INDEX=3"
9
+ - "RAILS_VERSION=5.2.0 BUNDLER_VERSION=2.0.2 CI_NODE_INDEX=4"
10
+ - "RAILS_VERSION=6.0.0 BUNDLER_VERSION=2.0.2 CI_NODE_INDEX=5"
11
+
12
+ branches:
13
+ only:
14
+ - develop
15
+ - master
9
16
 
10
17
  language: ruby
11
18
 
@@ -13,11 +20,16 @@ cache:
13
20
  bundler: true
14
21
 
15
22
  rvm:
16
- - "2.4.1"
23
+ - "2.5.0"
17
24
 
18
25
  bundler_args: "--binstubs --standalone --without documentation --path ../bundle"
19
26
 
20
27
  before_install:
28
+ - 'curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"'
29
+ - 'unzip awscli-bundle.zip'
30
+ - './awscli-bundle/install -b ~/bin/aws'
31
+ - 'export PATH=~/bin:$PATH'
32
+ - gem install -v ${BUNDLER_VERSION} bundler --no-rdoc --no-ri
21
33
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
22
34
  - chmod +x ./cc-test-reporter
23
35
 
@@ -33,4 +45,7 @@ notifications:
33
45
 
34
46
  after_script:
35
47
  - if [[ "$TRAVIS_TEST_RESULT" == 0 ]]; then ./cc-test-reporter format-coverage -t simplecov -o ./coverage/codeclimate.$CI_NODE_INDEX.json ./coverage/spec/.resultset.json; fi
48
+ - if [[ "$TRAVIS_TEST_RESULT" == 0 ]]; then aws s3 sync coverage/ "s3://componentparty/coverage/$TRAVIS_BUILD_NUMBER"; fi
49
+ - if [[ "$TRAVIS_TEST_RESULT" == 0 ]]; then aws s3 sync "s3://componentparty/coverage/$TRAVIS_BUILD_NUMBER" coverage/; fi
36
50
  - if [[ "$TRAVIS_TEST_RESULT" == 0 ]]; then ./cc-test-reporter sum-coverage --output - --parts $CI_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --input -; fi
51
+ - if [[ "$TRAVIS_TEST_RESULT" == 0 ]]; then ./cc-test-reporter upload-coverage; fi
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'component_party'
3
- s.version = '0.8.0'
3
+ s.version = '0.9.0'
4
4
  s.date = '2019-03-28'
5
5
  s.summary = 'Stop using views: frontend components architecture for Ruby on Rails.'
6
6
  s.description = 'Frontend components for Ruby on Rails: group your view logic, html and css files in components to be rendered from views or directly from controllers.'
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.license = 'MIT'
13
13
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
14
14
 
15
- s.add_dependency 'rails', '>= 4.2.0', '< 6'
15
+ s.add_dependency 'rails', '>= 4.2', '<= 6.0'
16
16
 
17
17
  # Quality Control
18
18
  s.add_development_dependency 'rspec'
@@ -11,13 +11,19 @@ module ComponentParty
11
11
  end
12
12
 
13
13
  def render(context, options)
14
- options[:file] = template_path_from_component_path(options[:component])
14
+ options[:template] = template_path_from_component_path(options[:component])
15
15
  options[:locals] = { vm: create_view_model(context, options) }
16
16
  super(context, options)
17
17
  end
18
18
 
19
- def render_template(template, layout_name = nil, locals = nil) #:nodoc:
20
- super(decorate_template(template), layout_name, locals)
19
+ if Rails::VERSION::STRING.start_with?('6')
20
+ def render_template(context, template, layout_name = nil, locals = nil) #:nodoc:
21
+ super(context, decorate_template(template), layout_name, locals)
22
+ end
23
+ else
24
+ def render_template(template, layout_name = nil, locals = nil) #:nodoc:
25
+ super(decorate_template(template), layout_name, locals)
26
+ end
21
27
  end
22
28
 
23
29
  def decorate_template(template)
@@ -2,7 +2,13 @@ module ComponentParty #:nodoc:
2
2
  # Renders a given component
3
3
  module ActionView
4
4
  module Renderer
5
- def render(context, options)
5
+ method_to_override = if Rails::VERSION::STRING.start_with?('6')
6
+ 'render_to_object'
7
+ else
8
+ 'render'
9
+ end
10
+
11
+ define_method(method_to_override) do |context, options|
6
12
  if options.key?(:component)
7
13
  normalize_data_for_component_rendering!(context, options)
8
14
  ComponentParty::ActionView::ComponentRenderer.new(lookup_context, options[:component]).render(context, options)
@@ -22,15 +28,15 @@ module ComponentParty #:nodoc:
22
28
  # :template=>"new",
23
29
  # :layout=> a Proc
24
30
  # }
25
- # rubocop:disable Metrics/LineLength
26
31
  def normalize_component_path!(_context, options)
27
32
  if options[:component] == true
28
- options[:component] = Pathname.new(ComponentParty.configuration.component_folder_for_actions).join(options[:prefixes].first.to_s, options[:template]).to_s
33
+ options[:component] = Pathname.new(options[:prefixes].first.to_s).join(options[:template]).to_s
34
+ options[:prefixes] = [ComponentParty.configuration.component_folder_for_actions]
29
35
  else
30
36
  options[:component]
37
+ options[:prefixes] = []
31
38
  end
32
39
  end
33
- # rubocop:enable all
34
40
  end
35
41
  end
36
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: component_party
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vinícius Oyama
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.0
20
- - - "<"
19
+ version: '4.2'
20
+ - - "<="
21
21
  - !ruby/object:Gem::Version
22
- version: '6'
22
+ version: '6.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 4.2.0
30
- - - "<"
29
+ version: '4.2'
30
+ - - "<="
31
31
  - !ruby/object:Gem::Version
32
- version: '6'
32
+ version: '6.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rspec
35
35
  requirement: !ruby/object:Gem::Requirement