Sha256: 17f91f304d464d809ce84037fee10576b00f599b995d34663d63b805cb7f587b

Contents?: true

Size: 1.59 KB

Versions: 16

Compression:

Stored size: 1.59 KB

Contents

---
##
# Apply dep state to a `.gemspec` file
##

- name: >-
    Apply `{{ ruby_dep_state }}` state to `{{ ruby_dep_name }}` dep in
    gemspec at `{{ bundle_root_path_facts.gem.gemspec_path }}`
  
  lineinfile:
    state: >-
      {{ ruby_dep_state }}
    
    path: >-
      {{ bundle_root_path_facts.gem.gemspec_path }}
    
    line: >-
      {{
        {
          'name': ruby_dep_name,
          'version': ruby_dep_version,
          'dev': ruby_dep_dev,
        } | to_gemspec_dep_line
      }}
    
    # Match any dependency of this type (runtime vs dev) for this gem
    regexp: >-
      {{
        {
          'name': ruby_dep_name,
          'version': ruby_dep_version,
          'dev': ruby_dep_dev,
        } | to_gemspec_dep_re_str
      }}
    
    # Insert after the *last* `spec.add_dependency` or
    # `spec.add_development_dependency` (depending on if the dep is dev)
    insertafter: >-
      {{
        {
          'name': ruby_dep_name,
          'version': ruby_dep_version,
          'dev': ruby_dep_dev,
        } | to_gemspec_dep_insert_after
      }}


- when: >-
    ruby_dep_comment and ruby_dep_state == 'present'
  
  name: >-
    Add the comment above the dep line
  
  lineinfile:
    state: present
    
    path: >-
      {{ bundle_root_path_facts.gem.gemspec_path }}
    
    line: >-
      {{ '  # ' + ruby_dep_comment }}
    
    # Insert it before the dep line, using the same regexp to find it
    insertbefore: >-
      {{
        {
          'name': ruby_dep_name,
          'version': ruby_dep_version,
          'dev': ruby_dep_dev,
        } | to_gemspec_dep_re_str
      }}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
qb-0.4.5 roles/qb/ruby/dependency/tasks/types/gemspec.yml
qb-0.4.4 roles/qb/ruby/dependency/tasks/types/gemspec.yml
qb-0.4.3 roles/qb/ruby/dependency/tasks/types/gemspec.yml
qb-0.4.2 roles/qb/ruby/dependency/tasks/types/gemspec.yml
qb-0.4.1 roles/qb/ruby/dependency/tasks/types/gemspec.yml
qb-0.4.0 roles/qb/ruby/dependency/tasks/types/gemspec.yml
qb-0.3.25 roles/qb/ruby/dependency/tasks/types/gemspec.yml
qb-0.3.24 roles/qb/ruby/dependency/tasks/types/gemspec.yml
qb-0.3.23 roles/qb/ruby/dependency/tasks/types/gemspec.yml
qb-0.3.22 roles/qb/ruby/dependency/tasks/types/gemspec.yml
qb-0.3.21 roles/qb/ruby/dependency/tasks/types/gemspec.yml
qb-0.3.20 roles/qb/ruby/dependency/tasks/types/gemspec.yml
qb-0.3.19 roles/qb/ruby/dependency/tasks/types/gemspec.yml
qb-0.3.18 roles/qb/ruby/dependency/tasks/types/gemspec.yml
qb-0.3.17 roles/qb/ruby/dependency/tasks/types/gemspec.yml
qb-0.3.16 roles/qb/ruby/dependency/tasks/types/gemspec.yml