rubocop-automata 0.0.2 → 0.0.3

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
  SHA256:
3
- metadata.gz: de53b2876c51c29bbe6635e77b8259efb6bcbe6a354d9e51efcf7ffb2dc28c8f
4
- data.tar.gz: 8a6371f848488251caa9eb8e024bccea7d5cf525f142f94453552206f4e18416
3
+ metadata.gz: 8487b86403a8743f6c38be878b5f8d33af25dd7d3fefab1604437d822a43ccee
4
+ data.tar.gz: 97a3e728e4668be72543bfd2b742a39f0c12137190de280da1ad8a79fc140d06
5
5
  SHA512:
6
- metadata.gz: 6a53d6b6299b3b8f7856d9752827baa22298eca45b6e2ddf13453c4d8789aa479f78f1995cb3fbd37ff6978aa291edcc71b6b1395c4ad76cb53177489e94364e
7
- data.tar.gz: '0861a1d457d04e3dd31e4034f69d30a40e82424a1a189f9a79be1b71a40b16acd58f932d9d943d0967ef26d31a4bae70ca9c48f7cb6e68628bcc9ce7a4f3a0e1'
6
+ metadata.gz: e74c9152614aff1779d3fade254ed481b8b7159d944bdde8b4a4fcb32270254713085a299a0dc937252c321c738049140b60b384b6ac99b73f15bd1ead622c4c
7
+ data.tar.gz: 3e9bcd22c0d54a0c28f84d5ce25920c7b658c20f97f36b82dd6e6da164020dfc588e16090f65b76244650f5efb8105d7523291182354621a33fcb5e410178d42
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # rubocop-automata
2
2
 
3
+ [![CircleCI](https://circleci.com/gh/rvillage/rubocop-automata/tree/master.svg?style=svg)](https://circleci.com/gh/rvillage/rubocop-automata/tree/master)
4
+ [![Gem Version](https://badge.fury.io/rb/rubocop-automata.svg)](https://badge.fury.io/rb/rubocop-automata)
5
+
3
6
  `rubocop-automata` is automation script for `rubocop --auto-correct` and create pull request.
4
7
 
5
8
  By requesting a nightly build to CircleCI to execute this script, `rubocop --auto-correct` is invoked, then commit changes and create pull request to GitHub repository if there some changes exist.
@@ -1,28 +1,28 @@
1
1
  require 'rubocop_automata/version'
2
2
  require 'rubocop_automata/skill'
3
3
 
4
- require 'rubocop_automata/ci'
5
4
  require 'rubocop_automata/ci/local'
6
5
  require 'rubocop_automata/ci/circleci'
7
6
 
7
+ # Create GitHub PullRequest of rubocop --auto-correct in CI Service
8
8
  module RubocopAutomata
9
9
  module_function
10
10
 
11
- @@backend_ci = CI::CircleCI
11
+ @@backend_ci = RubocopAutomata::CI::CircleCI
12
12
 
13
13
  def boot(github_email:, github_username:)
14
14
  if ENV['GITHUB_ACCESS_TOKEN'].nil?
15
15
  raise 'Please input ENV of GITHUB_ACCESS_TOKEN'
16
16
  end
17
17
 
18
- if Skill.rubocop_autocorrect
19
- Skill.create_branch(
18
+ if RubocopAutomata::Skill.rubocop_autocorrect
19
+ RubocopAutomata::Skill.create_branch(
20
20
  @@backend_ci.repository_url,
21
21
  github_email,
22
22
  github_username,
23
23
  @@backend_ci.topic_branch
24
24
  )
25
- Skill.create_pullrequest(
25
+ RubocopAutomata::Skill.create_pullrequest(
26
26
  @@backend_ci.repository_name,
27
27
  @@backend_ci.pullrequest_title,
28
28
  @@backend_ci.pullrequest_description,
@@ -1,32 +1,35 @@
1
1
  module RubocopAutomata
2
- module CI::CircleCI
3
- module_function
2
+ module CI
3
+ # For CircleCI
4
+ module CircleCI
5
+ module_function
4
6
 
5
- def repository_url
6
- "https://#{ENV['GITHUB_ACCESS_TOKEN']}@github.com/#{repository_name}"
7
- end
7
+ def repository_url
8
+ "https://#{ENV['GITHUB_ACCESS_TOKEN']}@github.com/#{repository_name}"
9
+ end
8
10
 
9
- def repository_name
10
- "#{ENV['CIRCLE_PROJECT_USERNAME']}/#{ENV['CIRCLE_PROJECT_REPONAME']}"
11
- end
11
+ def repository_name
12
+ /^.+?github.com[:\/](?<repository_name>.+?)\.git$/.match(`git config --get remote.origin.url`)[:repository_name]
13
+ end
12
14
 
13
- def base_branch
14
- ENV['CIRCLE_BRANCH']
15
- end
15
+ def base_branch
16
+ ENV['CIRCLE_BRANCH']
17
+ end
16
18
 
17
- def topic_branch
18
- "ci/auto_correction-#{ENV['CIRCLE_BUILD_NUM']}"
19
- end
19
+ def topic_branch
20
+ "ci/auto_correction-#{ENV['CIRCLE_BUILD_NUM']}"
21
+ end
20
22
 
21
- def pullrequest_title
22
- "rubocop --auto-correct at #{`echo -n $(date)`}"
23
- end
23
+ def pullrequest_title
24
+ "rubocop --auto-correct at #{`echo -n $(date)`}"
25
+ end
24
26
 
25
- def pullrequest_description
26
- <<~DESCRIPTION
27
- PR: #{ENV['CIRCLE_PULL_REQUEST']}
28
- Auto generated by [CircleCI](#{ENV['CIRCLE_BUILD_URL']})
29
- DESCRIPTION
27
+ def pullrequest_description
28
+ <<~DESCRIPTION
29
+ PR: #{ENV['CIRCLE_PULL_REQUEST']}
30
+ Auto generated by [CircleCI](#{ENV['CIRCLE_BUILD_URL']})
31
+ DESCRIPTION
32
+ end
30
33
  end
31
34
  end
32
35
  end
@@ -1,38 +1,38 @@
1
1
  module RubocopAutomata
2
- module CI::Local
3
- module_function
2
+ module CI
3
+ # For localhost
4
+ module Local
5
+ module_function
4
6
 
5
- def repository_url
6
- "https://#{ENV['GITHUB_ACCESS_TOKEN']}@github.com/#{repository_name}"
7
- end
7
+ def repository_url
8
+ "https://#{ENV['GITHUB_ACCESS_TOKEN']}@github.com/#{repository_name}"
9
+ end
8
10
 
9
- def repository_name
10
- if ENV['AUTOMATA_REPOSITORY_NAME'].nil?
11
- raise 'Please input ENV of AUTOMATA_REPOSITORY_NAME'
11
+ def repository_name
12
+ /^.+?github.com[:\/](?<repository_name>.+?)\.git$/.match(`git config --get remote.origin.url`)[:repository_name]
12
13
  end
13
- ENV['AUTOMATA_REPOSITORY_NAME']
14
- end
15
14
 
16
- def base_branch
17
- if ENV['AUTOMATA_BASE_BRANCH'].nil?
18
- raise 'Please input ENV of AUTOMATA_BASE_BRANCH'
15
+ def base_branch
16
+ if ENV['AUTOMATA_BASE_BRANCH'].nil?
17
+ raise 'Please input ENV of AUTOMATA_BASE_BRANCH'
18
+ end
19
+ ENV['AUTOMATA_BASE_BRANCH']
19
20
  end
20
- ENV['AUTOMATA_BASE_BRANCH']
21
- end
22
21
 
23
- def topic_branch
24
- @@topic_branch ||= "ci/auto_correction-#{Time.now.to_i}"
25
- end
22
+ def topic_branch
23
+ @@topic_branch ||= "ci/auto_correction-#{Time.now.to_i}"
24
+ end
26
25
 
27
- def pullrequest_title
28
- "rubocop --auto-correct at #{`echo -n $(date)`}"
29
- end
26
+ def pullrequest_title
27
+ "rubocop --auto-correct at #{`echo -n $(date)`}"
28
+ end
30
29
 
31
- def pullrequest_description
32
- <<~DESCRIPTION
33
- PR: https://github.com/#{repository_name}/pull/:id
34
- Auto generated by localhost
35
- DESCRIPTION
30
+ def pullrequest_description
31
+ <<~DESCRIPTION
32
+ PR: https://github.com/#{repository_name}/pull/:id
33
+ Auto generated by localhost
34
+ DESCRIPTION
35
+ end
36
36
  end
37
37
  end
38
38
  end
@@ -2,6 +2,7 @@ require 'json'
2
2
  require 'shellwords'
3
3
 
4
4
  module RubocopAutomata
5
+ # automata skill
5
6
  module Skill
6
7
  module_function
7
8
 
@@ -1,3 +1,3 @@
1
1
  module RubocopAutomata
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '0.0.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,58 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-automata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - rvillage
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-24 00:00:00.000000000 Z
11
+ date: 2017-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '0.51'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '0.51'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '1.16'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- description: For rubocop --autocorrect. Use in CircleCI
40
+ version: '1.16'
41
+ description: Create GitHub PullRequest of rubocop --auto-correct in CircleCI
56
42
  email:
57
43
  - rvillage@gmail.com
58
44
  executables:
@@ -60,24 +46,15 @@ executables:
60
46
  extensions: []
61
47
  extra_rdoc_files: []
62
48
  files:
63
- - ".circleci/config.yml"
64
- - ".gitignore"
65
49
  - CODE_OF_CONDUCT.md
66
- - Gemfile
67
- - Gemfile.lock
68
50
  - LICENSE.txt
69
- - Makefile.sample
70
51
  - README.md
71
- - Rakefile
72
52
  - bin/rubocop-automata
73
- - docker-compose.yml
74
53
  - lib/rubocop_automata.rb
75
- - lib/rubocop_automata/ci.rb
76
54
  - lib/rubocop_automata/ci/circleci.rb
77
55
  - lib/rubocop_automata/ci/local.rb
78
56
  - lib/rubocop_automata/skill.rb
79
57
  - lib/rubocop_automata/version.rb
80
- - rubocop-automata.gemspec
81
58
  homepage: https://github.com/rvillage/rubocop-automata
82
59
  licenses:
83
60
  - MIT
@@ -90,7 +67,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
67
  requirements:
91
68
  - - ">="
92
69
  - !ruby/object:Gem::Version
93
- version: '0'
70
+ version: '2.1'
94
71
  required_rubygems_version: !ruby/object:Gem::Requirement
95
72
  requirements:
96
73
  - - ">="
@@ -98,8 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
75
  version: '0'
99
76
  requirements: []
100
77
  rubyforge_project:
101
- rubygems_version: 2.7.3
78
+ rubygems_version: 2.7.4
102
79
  signing_key:
103
80
  specification_version: 4
104
- summary: Create GitHub PullRequest of rubocop --autocorrect in CircleCI
81
+ summary: Create GitHub PullRequest of rubocop --auto-correct in CircleCI
105
82
  test_files: []
@@ -1,39 +0,0 @@
1
- version: 2
2
-
3
- jobs:
4
- rake_build:
5
- working_directory: /usr/src/app
6
- docker:
7
- - image: ruby:2.4.2-alpine3.6
8
- steps:
9
- - checkout
10
- - run: apk --update --upgrade add --no-cache git openssh
11
- - run: rake build
12
-
13
- deploy:
14
- docker:
15
- - image: circleci/ruby:2.4
16
- steps:
17
- - checkout
18
- - run:
19
- name: create rubygems credentials
20
- command: |
21
- mkdir ~/.gem
22
- echo -e "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}" > ~/.gem/credentials
23
- chmod 0600 ~/.gem/credentials
24
- - run: bundle install -j4 --retry=3
25
- - run: rake release
26
-
27
- workflows:
28
- version: 2
29
-
30
- workflow:
31
- jobs:
32
- - rake_build
33
- - deploy:
34
- requires:
35
- - rake_build
36
- filters:
37
- branches:
38
- only:
39
- - deploy/production
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- Makefile
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in rubocop-automata.gemspec
6
- gemspec
@@ -1,36 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- rubocop-automata (0.0.2)
5
- rubocop
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- ast (2.3.0)
11
- parallel (1.12.1)
12
- parser (2.4.0.2)
13
- ast (~> 2.3)
14
- powerpack (0.1.1)
15
- rainbow (3.0.0)
16
- rake (12.3.0)
17
- rubocop (0.52.0)
18
- parallel (~> 1.10)
19
- parser (>= 2.4.0.2, < 3.0)
20
- powerpack (~> 0.1)
21
- rainbow (>= 2.2.2, < 4.0)
22
- ruby-progressbar (~> 1.7)
23
- unicode-display_width (~> 1.0, >= 1.0.1)
24
- ruby-progressbar (1.9.0)
25
- unicode-display_width (1.3.0)
26
-
27
- PLATFORMS
28
- ruby
29
-
30
- DEPENDENCIES
31
- bundler
32
- rake
33
- rubocop-automata!
34
-
35
- BUNDLED WITH
36
- 1.16.0
@@ -1,4 +0,0 @@
1
- # make release_tag
2
- release_tag:
3
- git checkout master
4
- docker-compose run --rm ruby sh -c 'apk --update --upgrade add --no-cache git openssh && rake release:source_control_push[https://<github_api_key>@github.com/rvillage/rubocop-automata]'
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require 'bundler/gem_tasks'
@@ -1,10 +0,0 @@
1
- version: '3'
2
-
3
- services:
4
- ruby:
5
- image: ruby:2.4.2-alpine3.6
6
- container_name: rubocop-automata_ruby
7
- working_dir: /usr/src/app
8
- command: ruby -v
9
- volumes:
10
- - .:/usr/src/app
@@ -1,4 +0,0 @@
1
- module RubocopAutomata
2
- module CI
3
- end
4
- end
@@ -1,27 +0,0 @@
1
- lib = File.expand_path('../lib', __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'rubocop_automata/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'rubocop-automata'
7
- spec.version = RubocopAutomata::VERSION
8
- spec.authors = ['rvillage']
9
- spec.email = ['rvillage@gmail.com']
10
-
11
- spec.summary = 'Create GitHub PullRequest of rubocop --autocorrect in CircleCI'
12
- spec.description = 'For rubocop --autocorrect. Use in CircleCI'
13
- spec.homepage = 'https://github.com/rvillage/rubocop-automata'
14
- spec.license = 'MIT'
15
-
16
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
- f.match(%r{^(test|spec|features)/})
18
- end
19
- spec.bindir = 'bin'
20
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
- spec.require_paths = ['lib']
22
-
23
- spec.add_runtime_dependency 'rubocop'
24
-
25
- spec.add_development_dependency 'bundler'
26
- spec.add_development_dependency 'rake'
27
- end