ciderizer 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55978e38ab18ab1adea7ad6e9b8ffae746d448db
4
- data.tar.gz: aad9c3d7c4ec4033f4864fd64ef1c4da1a79619f
3
+ metadata.gz: bc2da58bfab4d80f7d057fb226aa0c9845a90d23
4
+ data.tar.gz: 5cc8886bdca7a12508bbdac809d7f81cff2af10d
5
5
  SHA512:
6
- metadata.gz: f75eb9c029c139e83679744c2610b8f21562cff144f50454f3dc1c247380b5d514c4803913f6ac2cfe5c76381276c6aebc49d56c1502b30c6533d16c44c8ca83
7
- data.tar.gz: e13a401c25e8ef3dc4fa4aeac0c3bfb48559e86fcd545270332fa3f571c8219c8e79c630bfb2599ba240fddb4e40f01f32b1f393ab75522ca4c5a70996d9563a
6
+ metadata.gz: 30105a61d2d38c5938c95b4ce507888cc834f0afd6c4502aaa7af82da41ff09c861527b928a826ac98280634bf5859c665946bf6ca168d7091b36bc54b8edc21
7
+ data.tar.gz: 33d543a1e0d78d19197d8a56ccbc8d0d3800e85a78cc9b40f79f7833ae92d357b18dae8e5b73c203265b8cacdc497585c4ab51c2c04df90abe86b90a91d65d91
data/Readme.md CHANGED
@@ -25,13 +25,17 @@ Invokes all other generators
25
25
  rails generate ciderizer
26
26
  ```
27
27
 
28
- #### options
29
- - `rspec` - include `rspec` generator.
28
+ - `rspec` - include `rspec` generator.
30
29
  Defaults to `true`
31
- - `rubocop` - include `rubocop` generator
30
+ - `rubocop` - include `rubocop` generator
32
31
  Defaults to `true`
32
+ - `gemserver HOST` sets the gemserver used for bundling.
33
+ Defaults to `https://rubygems.org`
34
+ - `konacha` - include `konacha` generator
35
+ Defaults to `false`
33
36
  - options from [rspec generator](#rspec) (prefixed with `rspec-`)
34
37
  - options from [rubocop generator](#rubocop) (prefixed with `rubocop-`)
38
+ - options from [konacha generator](#konacha) (prefixed with `konacha-`)
35
39
 
36
40
  ### rspec
37
41
 
@@ -43,9 +47,9 @@ Generates config for running rspec tests
43
47
  ```
44
48
 
45
49
  #### options
46
- - `--bower` runs `bower-install` after bundling.
50
+ - `--bower` runs `bower-install` after bundling.
47
51
  Defaults to `false`
48
- - `--postgres` creates configuration for postgres database. Databases are deleted after the trial.
52
+ - `--postgres` creates configuration for postgres database. Databases are deleted after the trial.
49
53
  Defaults to `false`
50
54
 
51
55
  ### rubocop
@@ -58,5 +62,21 @@ Generates config for running rubocop checks
58
62
  ```
59
63
 
60
64
  #### options
61
- - `--github-comment` post comments about violations to GitHub.
65
+ - `--github-comment` post comments about violations to GitHub.
62
66
  Defaults to `true`
67
+
68
+ ### konacha
69
+
70
+ Generates config for running konacha Javascript specs
71
+
72
+ #### Usage
73
+ ```
74
+ rails generate ciderizer:konacha
75
+ ```
76
+
77
+ #### options
78
+ - `--bower` runs `bower-install` after bundling.
79
+ Defaults to `false`
80
+ - `--postgres` creates configuration for postgres database. Databases are deleted after the trial.
81
+ Defaults to `false`
82
+
@@ -1,3 +1,3 @@
1
1
  module Ciderizer
2
- VERSION = '0.2.2'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -1,7 +1,11 @@
1
+ require_relative 'options/bundle.rb'
2
+
1
3
  module Ciderizer
2
4
  class BaseRailsGenerator < Rails::Generators::Base
3
5
  source_root File.expand_path('../templates', __FILE__)
4
6
 
7
+ include Options::Bundle
8
+
5
9
  desc <<DESC
6
10
  Description:
7
11
  Basic scripts for rails based projects
@@ -10,7 +14,8 @@ DESC
10
14
  hide!
11
15
 
12
16
  def rails_scripts
13
- copy_file 'cider-ci/scripts/bundle.yml'
17
+ copy_file 'cider-ci/scripts/cleanup-rbenv.yml'
18
+ template 'cider-ci/scripts/bundle.yml'
14
19
  copy_file 'cider-ci/scripts/tmp-cache.yml'
15
20
  copy_file 'cider-ci/scripts/ruby-version.yml'
16
21
  end
@@ -1,5 +1,7 @@
1
1
  require_relative 'options/rspec.rb'
2
2
  require_relative 'options/rubocop.rb'
3
+ require_relative 'options/bundle.rb'
4
+ require_relative 'options/konacha.rb'
3
5
 
4
6
  module Ciderizer
5
7
  class CiderizerGenerator < Rails::Generators::Base
@@ -7,13 +9,17 @@ module Ciderizer
7
9
 
8
10
  include Options::Rspec
9
11
  include Options::Rubocop
12
+ include Options::Bundle
13
+ include Options::Konacha
10
14
 
11
15
  class_option :rspec, type: :boolean, default: true, desc: 'Include rspec job'
12
16
  class_option :rubocop, type: :boolean, default: true, desc: 'Include rubocop job'
17
+ class_option :konacha, type: :boolean, default: false, desc: 'Include konacha job'
13
18
 
14
19
  def ciderize
15
- invoke('ciderizer:rspec', [], rspec_options) if options.rspec?
16
- invoke('ciderizer:rubocop', [], rubocop_options) if options.rubocop?
20
+ invoke('ciderizer:rspec', [], rspec_options.merge(bundle_gemserver: options.bundle_gemserver)) if options.rspec?
21
+ invoke('ciderizer:rubocop', [], rubocop_options.merge(bundle_gemserver: options.bundle_gemserver)) if options.rubocop?
22
+ invoke('ciderizer:konacha', [], konacha_options) if options.konacha?
17
23
  end
18
24
  end
19
25
  end
@@ -0,0 +1,31 @@
1
+ require_relative 'options/konacha.rb'
2
+
3
+ module Ciderizer
4
+ class KonachaGenerator < Rails::Generators::Base
5
+ source_root File.expand_path('../templates', __FILE__)
6
+ include Options::Konacha
7
+
8
+ desc <<DESC
9
+ Description:
10
+ Generates configuration for a konacha job
11
+ DESC
12
+
13
+ def cider_ci_directory
14
+ invoke 'ciderizer:base_rails'
15
+
16
+ copy_file 'cider-ci/scripts/bower.yml' if options.bower?
17
+ template 'cider-ci/scripts/postgres.yml' if options.postgres?
18
+
19
+ template 'cider-ci/jobs/konacha.yml'
20
+ end
21
+
22
+ def master_file
23
+ copy_file 'cider-ci.yml', 'cider-ci.yml' unless File.exist?('cider-ci.yml')
24
+ # to avoid double inclusion
25
+ gsub_file 'cider-ci.yml', " - cider-ci/jobs/konacha.yml\n", ''
26
+ inject_into_file 'cider-ci.yml', after: "_cider-ci_include:\n" do
27
+ " - cider-ci/jobs/konacha.yml\n"
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,22 @@
1
+ module Ciderizer
2
+ module Options
3
+ module Bundle
4
+ def self.included(base)
5
+ base.class_option option_name(:gemserver, base), type: :string, default: 'https://rubygems.org', desc: 'Configures gemserver used for bundling'
6
+ end
7
+
8
+ def self.option_name(name, base)
9
+ base.name.demodulize =~ /^base_rails/i ? name : "bundle_#{name}"
10
+ end
11
+ private_class_method :option_name
12
+
13
+ private
14
+
15
+ def bundle_options
16
+ {
17
+ gemserver: options[:gemserver] || options[:bundle_gemserver]
18
+ }
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,24 @@
1
+ module Ciderizer
2
+ module Options
3
+ module Konacha
4
+ def self.included(base)
5
+ base.class_option option_name(:bower, base), type: :boolean, default: false, desc: 'Include `bower install`'
6
+ base.class_option option_name(:postgres, base), type: :boolean, default: false, desc: 'Include postgres setup'
7
+ end
8
+
9
+ def self.option_name(name, base)
10
+ base.name.demodulize =~ /^konacha/i ? name : "konacha_#{name}"
11
+ end
12
+ private_class_method :option_name
13
+
14
+ private
15
+
16
+ def konacha_options
17
+ {
18
+ bower: options[:bower] || options[:konacha_bower],
19
+ postgres: options[:postgres] || options[:konacha_postgres]
20
+ }
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,9 +1,11 @@
1
1
  require_relative 'options/rspec.rb'
2
+ require_relative 'options/bundle.rb'
2
3
 
3
4
  module Ciderizer
4
5
  class RspecGenerator < Rails::Generators::Base
5
6
  source_root File.expand_path('../templates', __FILE__)
6
7
  include Options::Rspec
8
+ include Options::Bundle
7
9
 
8
10
  desc <<DESC
9
11
  Description:
@@ -11,7 +13,7 @@ Description:
11
13
  DESC
12
14
 
13
15
  def cider_ci_directory
14
- invoke 'ciderizer:base_rails'
16
+ invoke('ciderizer:base_rails', [], bundle_options)
15
17
 
16
18
  copy_file 'cider-ci/scripts/rspec.yml'
17
19
 
@@ -1,9 +1,11 @@
1
1
  require_relative 'options/rubocop.rb'
2
+ require_relative 'options/bundle.rb'
2
3
 
3
4
  module Ciderizer
4
5
  class RubocopGenerator < Rails::Generators::Base
5
6
  source_root File.expand_path('../templates', __FILE__)
6
7
  include Options::Rubocop
8
+ include Options::Bundle
7
9
 
8
10
  desc <<DESC
9
11
  Description:
@@ -11,7 +13,7 @@ Description:
11
13
  DESC
12
14
 
13
15
  def cider_ci_directory
14
- invoke 'ciderizer:base_rails'
16
+ invoke('ciderizer:base_rails', [], bundle_options)
15
17
 
16
18
  copy_file 'cider-ci/scripts/rubocop.yml'
17
19
 
@@ -0,0 +1,54 @@
1
+ konacha:
2
+ name: 'Konacha tests'
3
+
4
+ run-on:
5
+ - type: branch
6
+ include-match: ^.*$
7
+
8
+ context:
9
+
10
+ task-defaults:
11
+ ports:
12
+ PHANTOMJS_PORT:
13
+ inet_address: "localhost"
14
+ min: 44600
15
+ max: 44999
16
+ scripts:
17
+ _cider-ci_include:
18
+ - cider-ci/scripts/cleanup-rbenv.yml
19
+ - cider-ci/scripts/bundle.yml
20
+ - cider-ci/scripts/tmp-cache.yml
21
+ - cider-ci/scripts/ruby-version.yml
22
+ - cider-ci/scripts/secrets.yml
23
+ <% if options.bower? %>
24
+ - cider-ci/scripts/bower.yml
25
+ <% end %>
26
+ <% if options.postgres? %>
27
+ - cider-ci/scripts/postgres.yml
28
+ <% end %>
29
+
30
+ trial-attachments:
31
+ logs:
32
+ include-match: log\/.*\.log$
33
+ content-type: text/plain
34
+
35
+ tasks:
36
+
37
+ konacha:
38
+ name: All Konacha tests
39
+ scripts:
40
+ konacha:
41
+ body: |
42
+ #!/usr/bin/env bash
43
+ RAILS_ENV=test bundle exec rake konacha:run
44
+ start-when:
45
+ - script: bundle
46
+ <% if options.bower? %>
47
+ - script: bower-install
48
+ <% end %>
49
+ - script: ruby-version
50
+ - script: tmp-cache
51
+ <% if options.postgres? %>
52
+ - script: prepare-database
53
+ <% end %>
54
+ - script: copy-secrets
@@ -1,5 +1,5 @@
1
1
  rspec:
2
- name: 'RSPec tests'
2
+ name: 'RSpec tests'
3
3
 
4
4
  run-on:
5
5
  - type: branch
@@ -31,6 +31,7 @@ rspec:
31
31
  <% end %>
32
32
 
33
33
  _cider-ci_include:
34
+ - cider-ci/scripts/cleanup-rbenv.yml
34
35
  - cider-ci/scripts/bundle.yml
35
36
  - cider-ci/scripts/tmp-cache.yml
36
37
  - cider-ci/scripts/ruby-version.yml
@@ -26,6 +26,7 @@ rubocop:
26
26
  <% end %>
27
27
 
28
28
  _cider-ci_include:
29
+ - cider-ci/scripts/cleanup-rbenv.yml
29
30
  - cider-ci/scripts/bundle.yml
30
31
  - cider-ci/scripts/tmp-cache.yml
31
32
  - cider-ci/scripts/ruby-version.yml
@@ -1,2 +1,5 @@
1
1
  bundle:
2
- body: sed 's/^source.*/source "http\:\/\/52.29.7.59:9292"/g' Gemfile > Gemfile.tmp ; mv Gemfile.tmp Gemfile && bundle install
2
+ body: sed 's/^source.*/source "<%= options.gemserver %>"/g' Gemfile > Gemfile.tmp ; mv Gemfile.tmp Gemfile && bundle install
3
+ exclusive-executor-resource: bundler
4
+ start-when:
5
+ - script: cleanup-rbenv
@@ -0,0 +1,2 @@
1
+ cleanup-rbenv:
2
+ body: rm /home/cider-ci_exec-user/.rbenv/shims/.rbenv-shim -f
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ciderizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Sakwerda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-22 00:00:00.000000000 Z
11
+ date: 2016-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -83,15 +83,20 @@ files:
83
83
  - lib/ciderizer/version.rb
84
84
  - lib/generators/ciderizer/base_rails_generator.rb
85
85
  - lib/generators/ciderizer/ciderizer_generator.rb
86
+ - lib/generators/ciderizer/konacha_generator.rb
87
+ - lib/generators/ciderizer/options/bundle.rb
88
+ - lib/generators/ciderizer/options/konacha.rb
86
89
  - lib/generators/ciderizer/options/rspec.rb
87
90
  - lib/generators/ciderizer/options/rubocop.rb
88
91
  - lib/generators/ciderizer/rspec_generator.rb
89
92
  - lib/generators/ciderizer/rubocop_generator.rb
90
93
  - lib/generators/ciderizer/templates/cider-ci.yml
94
+ - lib/generators/ciderizer/templates/cider-ci/jobs/konacha.yml
91
95
  - lib/generators/ciderizer/templates/cider-ci/jobs/rspec.yml
92
96
  - lib/generators/ciderizer/templates/cider-ci/jobs/rubocop.yml
93
97
  - lib/generators/ciderizer/templates/cider-ci/scripts/bower.yml
94
98
  - lib/generators/ciderizer/templates/cider-ci/scripts/bundle.yml
99
+ - lib/generators/ciderizer/templates/cider-ci/scripts/cleanup-rbenv.yml
95
100
  - lib/generators/ciderizer/templates/cider-ci/scripts/github_comment.yml
96
101
  - lib/generators/ciderizer/templates/cider-ci/scripts/postgres.yml
97
102
  - lib/generators/ciderizer/templates/cider-ci/scripts/rspec.yml