tachikoma 4.2.3 → 4.2.4

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: ccefb5b3e08fc2bb64e40a77a2c47ee8e904eba3
4
- data.tar.gz: 697ec5ac1435b638f60369dc6d3e0e2ff0016ab9
3
+ metadata.gz: 522b54b9884e1e63e68b6cf5f79fe0ce762357fc
4
+ data.tar.gz: 9aab06a2596c184e427f442771dc242c4e18fcf9
5
5
  SHA512:
6
- metadata.gz: c61d525e247595a7455892582e523434e817d8cc7f12316b283732956d325d753f54afd1e189e1701393cca414d323a1f081d3945be632e36cd049906cf69301
7
- data.tar.gz: 02e9fba402f3e61054ae23da4887f911183f0c2df4af9111539350c0c2b539a0082a29a1c1e74f39d70ca7842db2ff1bff0272f2a33c6e5f765e4af4fa8f7c0b
6
+ metadata.gz: a92aa07095cc333cdc6f9d695b7c511e5a391bd11f14f27c0fa0f094a85b6acd6e7ef8c0394c6d1b733b41ce523e934f74713f0aea1fece5cf66c1c8dc5bbf73
7
+ data.tar.gz: 3134b45bfec31b93daa0aab3df1edba8e76bcdab4ca3079b7ad4c0c3c6981f667252887f9f84ae189edcf0ea0b6120afba96fed8f0eda40692f1ec1354a32b5c
data/.gitignore CHANGED
@@ -16,5 +16,8 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
 
19
- $ Ignore dotenv setting
19
+ # Ignore dotenv setting
20
20
  /.env
21
+
22
+ # Ignore bundler binstubs
23
+ /bundle_bin
data/.rubocop.yml CHANGED
@@ -1,14 +1,19 @@
1
- inherit_from: rubocop-todo.yml
2
1
  AllCops:
3
2
  Include:
4
3
  - '**/Rakefile'
5
4
  - Gemfile
6
5
  - tachikoma.gemspec
7
- - bin/**
6
+ - bin/**/*
8
7
  - lib/**/*.rake
9
8
  Exclude:
10
- - pkg/**
11
- - repos/**
12
- - vendor/**
9
+ - pkg/**/*
10
+ - repos/**/*
11
+ - vendor/**/*
13
12
  StringLiterals:
14
13
  EnforcedStyle: single_quotes
14
+ LineLength:
15
+ Max: 120
16
+ Blocks:
17
+ Enabled: false
18
+ Style/DotPosition:
19
+ Enabled: true
data/.travis.yml CHANGED
@@ -3,6 +3,7 @@ rvm:
3
3
  - 1.9
4
4
  - 2.0
5
5
  - 2.1
6
+ - 2.2
6
7
  before_install:
7
8
  - gem update bundler
8
9
  notifications:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 4.2.4 (2015-01-31)
2
+
3
+ Features:
4
+ - Use shalow copy(optional) (#151, #141, #139, @laiso, @sanemat)
5
+
1
6
  ## 4.2.3 (2014-12-18)
2
7
 
3
8
  Features:
data/README.md CHANGED
@@ -64,6 +64,8 @@ version:
64
64
  '2.0.0'
65
65
  pull_request_body:
66
66
  ':ideograph_advantage::ideograph_advantage::ideograph_advantage:'
67
+ git_clone_depth:
68
+ 50
67
69
  ```
68
70
 
69
71
  ### Build script example
data/data/default.yaml CHANGED
@@ -14,3 +14,5 @@ pull_request_base:
14
14
  'master'
15
15
  bundler_parallel_number:
16
16
  4
17
+ git_clone_depth:
18
+ false
@@ -48,6 +48,7 @@ module Tachikoma
48
48
  @timestamp_format = @configure['timestamp_format']
49
49
  @readable_time = Time.now.utc.strftime(@timestamp_format)
50
50
  @parallel_option = bundler_parallel_option(Bundler::VERSION, @configure['bundler_parallel_number'])
51
+ @depth_option = git_clone_depth_option(@configure['git_clone_depth'])
51
52
 
52
53
  @target_head = target_repository_user(@type, @url, @github_account)
53
54
  @pull_request_url = repository_identity(@url)
@@ -64,21 +65,35 @@ module Tachikoma
64
65
 
65
66
  def fetch
66
67
  clean
67
- sh "git clone #{@authorized_base_url} #{Tachikoma.repos_path}/#{@build_for}"
68
+ sh(*([
69
+ 'git', 'clone',
70
+ *@depth_option,
71
+ @authorized_base_url,
72
+ "#{Tachikoma.repos_path}/#{@build_for}"
73
+ ].compact))
68
74
  end
69
75
 
70
76
  def bundler
71
77
  Dir.chdir("#{Tachikoma.repos_path}/#{@build_for}") do
72
78
  Bundler.with_clean_env do
73
- sh %(ruby -i -pe '$_.gsub! /^ruby/, "#ruby"' Gemfile)
74
- sh "git config user.name #{@commiter_name}"
75
- sh "git config user.email #{@commiter_email}"
76
- sh "git checkout -b tachikoma/update-#{@readable_time} #{@base_remote_branch}"
77
- sh "bundle --gemfile Gemfile --no-deployment --without nothing --path vendor/bundle #{@parallel_option}"
78
- sh 'bundle update'
79
- sh 'git add Gemfile.lock'
80
- sh %(git commit -m "Bundle update #{@readable_time}") do; end # ignore exitstatus
81
- sh "git push #{@authorized_compare_url} tachikoma/update-#{@readable_time}"
79
+ sh(*['ruby', '-i', '-pe', '$_.gsub! /^ruby/, "#ruby"', 'Gemfile'])
80
+ sh(*['git', 'config', 'user.name', @commiter_name])
81
+ sh(*['git', 'config', 'user.email', @commiter_email])
82
+ sh(*['git', 'checkout', '-b', "tachikoma/update-#{@readable_time}", @base_remote_branch])
83
+ sh(*([
84
+ 'bundle',
85
+ '--gemfile', 'Gemfile',
86
+ '--no-deployment',
87
+ '--without', 'nothing',
88
+ '--path', 'vendor/bundle',
89
+ @parallel_option
90
+ ].compact))
91
+ sh(*%w(bundle update))
92
+ sh(*['git', 'add', 'Gemfile.lock'])
93
+ sh(*['git', 'commit', '-m', "Bundle update #{@readable_time}"]) do
94
+ # ignore exitstatus
95
+ end
96
+ sh(*['git', 'push', @authorized_compare_url, "tachikoma/update-#{@readable_time}"])
82
97
  end
83
98
  end
84
99
  end
@@ -90,71 +105,87 @@ module Tachikoma
90
105
 
91
106
  def carton
92
107
  Dir.chdir("#{Tachikoma.repos_path}/#{@build_for}") do
93
- sh "git config user.name #{@commiter_name}"
94
- sh "git config user.email #{@commiter_email}"
95
- sh "git checkout -b tachikoma/update-#{@readable_time} #{@base_remote_branch}"
96
- sh 'carton install'
97
- sh 'carton update'
98
- sh 'git add carton.lock' if File.exist?('carton.lock')
99
- sh 'git add cpanfile.snapshot' if File.exist?('cpanfile.snapshot')
100
- sh %(git commit -m "Carton update #{@readable_time}") do; end # ignore exitstatus
101
- sh "git push #{@authorized_compare_url} tachikoma/update-#{@readable_time}"
108
+ sh(*['git', 'config', 'user.name', @commiter_name])
109
+ sh(*['git', 'config', 'user.email', @commiter_email])
110
+ sh(*['git', 'checkout', '-b', "tachikoma/update-#{@readable_time}", @base_remote_branch])
111
+ sh(*%w(carton install))
112
+ sh(*%w(carton update))
113
+ sh(*['git', 'add', 'carton.lock']) if File.exist?('carton.lock')
114
+ sh(*['git', 'add', 'cpanfile.snapshot']) if File.exist?('cpanfile.snapshot')
115
+ sh(*['git', 'commit', '-m', "Carton update #{@readable_time}"]) do
116
+ # ignore exitstatus
117
+ end
118
+ sh(*['git', 'push', @authorized_compare_url, "tachikoma/update-#{@readable_time}"])
102
119
  end
103
120
  end
104
121
 
105
122
  def none
106
123
  Dir.chdir("#{Tachikoma.repos_path}/#{@build_for}") do
107
- sh "git config user.name #{@commiter_name}"
108
- sh "git config user.email #{@commiter_email}"
109
- sh "git checkout -b tachikoma/update-#{@readable_time} #{@base_remote_branch}"
110
- sh %(git commit --allow-empty -m "None update #{@readable_time}") do; end # ignore exitstatus
111
- sh "git push #{@authorized_compare_url} tachikoma/update-#{@readable_time}"
124
+ sh(*['git', 'config', 'user.name', @commiter_name])
125
+ sh(*['git', 'config', 'user.email', @commiter_email])
126
+ sh(*['git', 'checkout', '-b', "tachikoma/update-#{@readable_time}", @base_remote_branch])
127
+ sh(*['git', 'commit', '--allow-empty', '-m', "None update #{@readable_time}"]) do
128
+ # ignore exitstatus
129
+ end
130
+ sh(*['git', 'push', @authorized_compare_url, "tachikoma/update-#{@readable_time}"])
112
131
  end
113
132
  end
114
133
 
115
134
  def david
116
135
  Dir.chdir("#{Tachikoma.repos_path}/#{@build_for}") do
117
- sh "git config user.name #{@commiter_name}"
118
- sh "git config user.email #{@commiter_email}"
119
- sh "git checkout -b tachikoma/update-#{@readable_time} #{@base_remote_branch}"
120
- sh 'david update --warn404'
121
- sh 'git add package.json'
122
- sh %(git commit -m "David update #{@readable_time}") do; end # ignore exitstatus
123
- sh "git push #{@authorized_compare_url} tachikoma/update-#{@readable_time}"
136
+ sh(*['git', 'config', 'user.name', @commiter_name])
137
+ sh(*['git', 'config', 'user.email', @commiter_email])
138
+ sh(*['git', 'checkout', '-b', "tachikoma/update-#{@readable_time}", @base_remote_branch])
139
+ sh(*['david', 'update', '--warn404'])
140
+ sh(*['git', 'add', 'package.json'])
141
+ sh(*['git', 'commit', '-m', "David update #{@readable_time}"]) do
142
+ # ignore exitstatus
143
+ end
144
+ sh(*['git', 'push', @authorized_compare_url, "tachikoma/update-#{@readable_time}"])
124
145
  end
125
146
  end
126
147
 
127
148
  def composer
128
149
  Dir.chdir("#{Tachikoma.repos_path}/#{@build_for}") do
129
- sh "git config user.name #{@commiter_name}"
130
- sh "git config user.email #{@commiter_email}"
131
- sh "git checkout -b tachikoma/update-#{@readable_time} #{@base_remote_branch}"
150
+ sh(*['git', 'config', 'user.name', @commiter_name])
151
+ sh(*['git', 'config', 'user.email', @commiter_email])
152
+ sh(*['git', 'checkout', '-b', "tachikoma/update-#{@readable_time}", @base_remote_branch])
132
153
  # FIXME: Use Octokit.api_endpoint for GitHub Enterprise
133
- sh "composer config github-oauth.github.com #{@github_token}"
134
- sh 'composer install --no-interaction'
135
- sh 'composer update --no-interaction'
136
- sh 'git add composer.lock'
137
- sh %(git commit -m "Composer update #{@readable_time}") do; end # ignore exitstatus
138
- sh "git push #{@authorized_compare_url} tachikoma/update-#{@readable_time}"
154
+ sh(*['composer', 'config', 'github-oauth.github.com', @github_token])
155
+ sh(*['composer', 'install', '--no-interaction'])
156
+ sh(*['composer', 'update', '--no-interaction'])
157
+ sh(*['git', 'add', 'composer.lock'])
158
+ sh(*['git', 'commit', '-m', "Composer update #{@readable_time}"]) do
159
+ # ignore exitstatus
160
+ end
161
+ sh(*['git', 'push', @authorized_compare_url, "tachikoma/update-#{@readable_time}"])
139
162
  end
140
163
  end
141
164
 
142
165
  def cocoapods
143
166
  Dir.chdir("#{Tachikoma.repos_path}/#{@build_for}") do
144
- sh "git config user.name #{@commiter_name}"
145
- sh "git config user.email #{@commiter_email}"
146
- sh "git checkout -b tachikoma/update-#{@readable_time} #{@base_remote_branch}"
147
- sh 'pod install'
148
- sh 'pod update'
149
- sh 'git add Podfile.lock'
150
- sh %(git commit -m "Cocoapods update #{@readable_time}") do; end # ignore exitstatus
151
- sh "git push #{@authorized_compare_url} tachikoma/update-#{@readable_time}"
167
+ sh(*['git', 'config', 'user.name', @commiter_name])
168
+ sh(*['git', 'config', 'user.email', @commiter_email])
169
+ sh(*['git', 'checkout', '-b', "tachikoma/update-#{@readable_time}", @base_remote_branch])
170
+ sh(*%w(pod install))
171
+ sh(*%w(pod update))
172
+ sh(*['git', 'add', 'Podfile.lock'])
173
+ sh(*['git', 'commit', '-m', "Cocoapods update #{@readable_time}"]) do
174
+ # ignore exitstatus
175
+ end
176
+ sh(*['git', 'push', @authorized_compare_url, "tachikoma/update-#{@readable_time}"])
152
177
  end
153
178
  end
154
179
 
155
180
  def pull_request
156
181
  @client = Octokit::Client.new access_token: @github_token
157
- @client.create_pull_request(@pull_request_url, @pull_request_base, @pull_request_head, @pull_request_title, @pull_request_body)
182
+ @client.create_pull_request(
183
+ @pull_request_url,
184
+ @pull_request_base,
185
+ @pull_request_head,
186
+ @pull_request_title,
187
+ @pull_request_body
188
+ )
158
189
  rescue Octokit::UnprocessableEntity
159
190
  end
160
191
 
@@ -212,10 +243,18 @@ module Tachikoma
212
243
  end
213
244
 
214
245
  def bundler_parallel_option(bundler_version, parallel_number)
215
- # bundler 1.4.0.pre.1 gets parallel number option
216
- if Gem::Version.create(bundler_version) >= Gem::Version.create('1.4.0.pre.1') && parallel_number > 1
217
- "--jobs=#{parallel_number}"
218
- end
246
+ return if !bundler_parallel_available?(bundler_version) || parallel_number <= 1
247
+ "--jobs=#{parallel_number}"
248
+ end
249
+
250
+ def bundler_parallel_available?(bundler_version)
251
+ # bundler 1.4.0 gets parallel number option
252
+ Gem::Version.create(bundler_version) >= Gem::Version.create('1.4.0')
253
+ end
254
+
255
+ def git_clone_depth_option(depth)
256
+ return [nil] unless depth
257
+ ['--depth', depth.to_s]
219
258
  end
220
259
  end
221
260
  end
@@ -8,3 +8,5 @@ language:
8
8
  'ruby'
9
9
  version:
10
10
  '2.0.0'
11
+ git_clone_depth:
12
+ 50
@@ -1,4 +1,4 @@
1
1
  # Version of tachikoma
2
2
  module Tachikoma
3
- VERSION = '4.2.3'
3
+ VERSION = '4.2.4'
4
4
  end
@@ -142,6 +142,25 @@ YAML
142
142
  end
143
143
  end
144
144
 
145
+ describe '#git_clone_depth_option' do
146
+ subject { described_class.new }
147
+
148
+ context 'depth is not provided' do
149
+ let(:nil_for_expand) { [nil] }
150
+ it 'returns nil' do
151
+ expect(subject.git_clone_depth_option(nil)).to eq nil_for_expand
152
+ end
153
+ end
154
+
155
+ context 'depth is provided' do
156
+ let(:depth) { 10 }
157
+ let(:depth_for_expand) { ['--depth', '10'] }
158
+ it 'returns depth' do
159
+ expect(subject.git_clone_depth_option(depth)).to eq depth_for_expand
160
+ end
161
+ end
162
+ end
163
+
145
164
  describe '#repository_identity' do
146
165
  subject { described_class.new }
147
166
  let(:identity) { 'example1/example2' }
@@ -7,7 +7,9 @@ describe 'Tachikoma::Aplication' do
7
7
  describe '#pull_request' do
8
8
  context 'when github returns 422 UnprocessableEntity' do
9
9
  before do
10
- allow(Octokit::Client).to receive_message_chain(:new, :create_pull_request).and_raise(Octokit::UnprocessableEntity)
10
+ allow(Octokit::Client).to \
11
+ receive_message_chain(:new, :create_pull_request)
12
+ .and_raise(Octokit::UnprocessableEntity)
11
13
  end
12
14
 
13
15
  it 'should not raise Octokit::UnprocessableEntity error' do
data/tachikoma.gemspec CHANGED
@@ -14,8 +14,8 @@ Gem::Specification.new do |spec|
14
14
  spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(/^(test|spec|features)\//)
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_dependency 'safe_yaml'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tachikoma
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.3
4
+ version: 4.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - sanemat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-18 00:00:00.000000000 Z
11
+ date: 2015-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: safe_yaml
@@ -171,7 +171,6 @@ files:
171
171
  - lib/tachikoma/templates/repos/.gitkeep
172
172
  - lib/tachikoma/version.rb
173
173
  - lib/tasks/app.rake
174
- - rubocop-todo.yml
175
174
  - spec/spec_helper.rb
176
175
  - spec/tachikoma/application_spec.rb
177
176
  - spec/tachikoma/settings_spec.rb
@@ -197,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
196
  version: '0'
198
197
  requirements: []
199
198
  rubyforge_project:
200
- rubygems_version: 2.2.2
199
+ rubygems_version: 2.4.5
201
200
  signing_key:
202
201
  specification_version: 4
203
202
  summary: Update gem frequently gets less pain. Let's doing bundle update as a habit!
data/rubocop-todo.yml DELETED
@@ -1,9 +0,0 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`.
2
- # The point is for the user to remove these configuration records
3
- # one by one as the offences are removed from the code base.
4
-
5
- Blocks:
6
- Enabled: false
7
-
8
- LineLength:
9
- Enabled: false