pipedawg 0.1.0 → 0.1.1

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: 6da632acfefa54ce858d4277758160be20246355596f84a5cf7f7a47c6bf7f93
4
- data.tar.gz: 52c803810e345742b2ae1f0ff10e19e3afd5a8423164667346fcda75d78b54ee
3
+ metadata.gz: 9167728fbd620f0098099ff53a90fb1d85336a8a771b24cc3059b8dc03144285
4
+ data.tar.gz: 6f1d59f9fb1ca2de1a49d04520f6a9cd7f171f569c72a372899f9f28749ead34
5
5
  SHA512:
6
- metadata.gz: 3aa2f038cabfca9659ac80cc1c04a186d3ffed3d5dac47e3ab64140f09d1c5dfecba9d41c59e90e7215dab99edad8aeff8a3f2162b11b88b42551fe88ace12e8
7
- data.tar.gz: 758697c43505ff847d74e3c5db85417652636dda97082b444ef975752dd03cd0853d6cc78b9403c9ecf11894510daf5ded82edeab7bb7b1e99b9441ec28b207b
6
+ metadata.gz: f53e89a60305aaa04c14443c404e3bcfa0fa24274503751c927ff6ace5f9cabbeb87f3bc2e87ca81d04a9c14aa280ca2942b381eeecbbae23db4bfd4c4c2165e
7
+ data.tar.gz: a3f7acd6b467e21fee88fa2e2b22ef55e60030311355fb3074ae0f4eac0a52674c0027c0b4ebb0b21dfb1317ee5d1e3a753ece8f96c098183699c53d04a703ae
data/README.md CHANGED
@@ -1,10 +1,18 @@
1
- # Pipedawg
1
+ # pipedawg
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/pipedawg.svg)](https://rubygems.org/gems/pipedawg)
2
4
 
3
5
  Generate GitLab CI pipelines.
4
6
 
5
7
  ## Installation
6
8
 
7
- Add this line to your application's Gemfile:
9
+ Install `pipedawg` with:
10
+
11
+ ```
12
+ gem install pipedawg
13
+ ```
14
+
15
+ Or add this line to your application's Gemfile:
8
16
 
9
17
  ```ruby
10
18
  gem 'pipedawg'
@@ -12,25 +20,104 @@ gem 'pipedawg'
12
20
 
13
21
  And then execute:
14
22
 
15
- $ bundle install
23
+ ```sh
24
+ bundle install
25
+ ```
16
26
 
17
- Or install it yourself as:
27
+ ## Ruby library
18
28
 
19
- $ gem install pipedawg
29
+ Example:
20
30
 
21
- ## Usage
31
+ ```ruby
32
+ #!/usr/bin/env ruby
33
+ # frozen_string_literal: true
34
+
35
+ # print_pipeline.rb
36
+ require 'pipedawg'
37
+
38
+ gem_job = Pipedawg::Job.new(
39
+ 'build:gem',
40
+ artifacts: ['*.gem'],
41
+ image: 'ruby',
42
+ script: ['bundle install', 'gem build *.gemspec']
43
+ )
44
+
45
+ docker_job = Pipedawg::Job.new(
46
+ 'build:docker',
47
+ image: 'docker',
48
+ needs: ['build:gem'],
49
+ retry: 2,
50
+ script: [
51
+ 'docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY',
52
+ 'docker pull $CI_REGISTRY_IMAGE || true',
53
+ 'docker build --pull --cache-from $CI_REGISTRY_IMAGE -t $CI_REGISTRY_IMAGE .',
54
+ 'docker push $CI_REGISTRY_IMAGE'
55
+ ],
56
+ services: ['docker:dind']
57
+ )
58
+
59
+ pipeline = Pipedawg::Pipeline.new 'build:image', jobs: [gem_job, docker_job]
60
+
61
+ # Automatically calculates stages of jobs based on 'needs'
62
+ pipeline.update_stages
63
+
64
+ puts pipeline.to_yaml
65
+ ```
22
66
 
67
+ ```console
68
+ $ chmod +x print_pipeline.rb
69
+ $ ./print_pipeline.rb
70
+ ---
71
+ stages:
72
+ - '1'
73
+ - '2'
74
+ workflow: {}
75
+ build:gem:
76
+ artifacts:
77
+ - "*.gem"
78
+ cache: {}
79
+ image: ruby
80
+ needs: []
81
+ rules: []
82
+ script:
83
+ - bundle install
84
+ - gem build *.gemspec
85
+ stage: '1'
86
+ tags: []
87
+ build:docker:
88
+ artifacts: {}
89
+ cache: {}
90
+ image: docker
91
+ needs:
92
+ - build:gem
93
+ retry: 2
94
+ rules: []
95
+ script:
96
+ - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
97
+ - docker pull $CI_REGISTRY_IMAGE || true
98
+ - docker build --pull --cache-from $CI_REGISTRY_IMAGE -t $CI_REGISTRY_IMAGE .
99
+ - docker push $CI_REGISTRY_IMAGE
100
+ stage: '2'
101
+ tags: []
102
+ services:
103
+ - docker:dind
104
+ ```
23
105
 
24
106
  ## Development
25
107
 
26
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
108
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake spec` to run the tests. Run `bundle exec rubocop` to run the linter. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
109
+
110
+ Note that by default, Bundler will attempt to install gems to the system, e.g. `/usr/bin`, `/usr/share`, which requires elevated access and can interfere with files that are managed by the system's package manager. This behaviour can be overridden by creating the file `.bundle/config` and adding the following line:
111
+ ```
112
+ BUNDLE_PATH: "./.bundle"
113
+ ```
114
+ When you run `bin/setup` or `bundle install`, all gems will be installed inside the .bundle directory of this project.
27
115
 
28
- 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
116
+ To make this behaviour a default for all gem projects, the above line can be added to the user's bundle config file in their home directory (`~/.bundle/config`)
29
117
 
30
118
  ## Contributing
31
119
 
32
- Bug reports and pull requests are welcome on GitHub at https://github.com/liger1978/pipedawg.
33
-
120
+ Bug reports and pull requests are welcome on [GitHub](https://github.com/liger1978/pipedawg).
34
121
 
35
122
  ## License
36
123
 
@@ -24,7 +24,7 @@ module Pipedawg
24
24
  JSON.parse(pipeline.to_json).to_yaml
25
25
  end
26
26
 
27
- def to_yaml_file(file = '.gitlab-ci.yml')
27
+ def to_yaml_file(file = 'pipeline.yml')
28
28
  File.write(file, to_yaml)
29
29
  end
30
30
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pipedawg
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pipedawg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - harbottle
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-18 00:00:00.000000000 Z
11
+ date: 2022-01-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Generate GitLab CI pipelines.
14
14
  email:
@@ -17,21 +17,12 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - ".bundle/config"
21
- - ".gitignore"
22
- - ".gitlab-ci.yml"
23
- - ".rspec"
24
- - ".rubocop.yml"
25
- - ".travis.yml"
26
- - Gemfile
27
20
  - LICENSE.txt
28
21
  - README.md
29
- - Rakefile
30
22
  - lib/pipedawg.rb
31
23
  - lib/pipedawg/job.rb
32
24
  - lib/pipedawg/pipeline.rb
33
25
  - lib/pipedawg/version.rb
34
- - pipedawg.gemspec
35
26
  homepage: https://github.com/liger1978/pipedawg
36
27
  licenses:
37
28
  - MIT
data/.bundle/config DELETED
@@ -1,4 +0,0 @@
1
- ---
2
- BUNDLE_BIN: "bin"
3
- BUNDLE_DISABLE_SHARED_GEMS: "true"
4
- BUNDLE_PATH: "./bundle"
data/.gitignore DELETED
@@ -1,15 +0,0 @@
1
- /bin/
2
- /bundle/
3
- /.yardoc
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- /*.gem
11
- /vendor
12
- Gemfile.lock
13
-
14
- # rspec failure tracking
15
- .rspec_status
data/.gitlab-ci.yml DELETED
@@ -1,14 +0,0 @@
1
- ---
2
- stages:
3
- - build
4
- workflow: {}
5
- build:
6
- artifacts: {}
7
- cache: {}
8
- image:
9
- name: ruby:2.5
10
- needs: []
11
- rules: []
12
- script: []
13
- stage: build
14
- tags: []
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,14 +0,0 @@
1
- ---
2
- AllCops:
3
- Exclude:
4
- - 'bin/**/*'
5
- - 'bundle/**/*'
6
- - '*.gemspec'
7
- NewCops: enable
8
-
9
- Metrics/BlockLength:
10
- Exclude:
11
- - 'Rakefile'
12
- - '**/*.rake'
13
- - 'test/**/*.rb'
14
- - 'spec/**/*_spec.rb'
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.6.6
6
- before_install: gem install bundler -v 2.1.4
data/Gemfile DELETED
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in pipedawg.gemspec
6
- gemspec
7
-
8
- gem 'irb', '~> 1.4'
9
- gem 'rake', '~> 12.0'
10
- gem 'rdoc', '~> 6.4'
11
- gem 'rspec', '~> 3.0'
12
- gem 'rubocop', '~> 1.24', require: false
13
- gem 'rubocop-rake', '~> 0.6', require: false
14
- gem 'rubocop-rspec', '~> 2.7', require: false
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task default: :spec
data/pipedawg.gemspec DELETED
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'lib/pipedawg/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'pipedawg'
7
- spec.version = Pipedawg::VERSION
8
- spec.authors = ['harbottle']
9
- spec.email = ['harbottle@room3d3.com']
10
-
11
- spec.summary = 'Generate GitLab CI pipelines.'
12
- spec.description = 'Generate GitLab CI pipelines.'
13
- spec.homepage = 'https://github.com/liger1978/pipedawg'
14
- spec.license = 'MIT'
15
-
16
- spec.metadata['homepage_uri'] = spec.homepage
17
- spec.metadata['source_code_uri'] = 'https://github.com/liger1978/pipedawg'
18
- spec.metadata['changelog_uri'] = 'https://github.com/liger1978/pipedawg'
19
-
20
- # Specify which files should be added to the gem when it is released.
21
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
- end
25
- spec.bindir = 'exe'
26
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
- spec.require_paths = ['lib']
28
-
29
- end