tachikoma 4.0.1 → 4.0.2

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: 39ddf01cae7d332c30dfe0aa73ecd8af467e402d
4
- data.tar.gz: 18b463702ca130fa83aeb7d5b7e42d7d7fb10d89
3
+ metadata.gz: f618004743a16b2c9bfeab746b69f3edc0488625
4
+ data.tar.gz: 13ef48e03589ed1aa6959079afdda7d303a7ba3b
5
5
  SHA512:
6
- metadata.gz: 6e7047d855ae8ffddafd33a8eb07b455fdd97952affd7196eee6b1e1c7ba1cc262441e697893a231e4ef249470ab004de6454f011843a3b4593673128df1218d
7
- data.tar.gz: d5e49603c26ab3b7249adb5afd26cab61453d7dda1005c4a2e68ee7cc547dc9956957f959db917d2a6793c654b3c90a8e5ffc0a1e0b6d9a1fc09e3cb096fb651
6
+ metadata.gz: 039c38ee4a88403b275e3c65044d48d2205c653f586e8a50982bcb50df012bd90559f411d462266b1eae549e163afcdd14e8cc9714ef18e045ba49e9ee9101b6
7
+ data.tar.gz: 9c22939957a1abe16a6628b851e2bd488d789ad11a40ecc847e9e42d64c9a9d46211f9bd92f33aa4558db9a5aba7880084534b8841f93bcd0b9ce362f655bc1f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 4.0.2 (2013-12-20)
2
+
3
+ Features:
4
+
5
+ - Support for older git versions (1.7.x) and OAuth (#58, @kenchan)
6
+ - Adjust rspec 3 syntax (#59, #60, @banyan)
7
+ - Use Thor, and split template file from script (#61, #63, @sanemat)
8
+
1
9
  ## 4.0.1 (2013-12-07)
2
10
 
3
11
  Features:
data/Gemfile CHANGED
@@ -4,6 +4,10 @@ gemspec
4
4
 
5
5
  group :development, :test do
6
6
  gem 'pry'
7
+ # https://github.com/rspec/rspec-rails/issues/878#issuecomment-30575316
8
+ gem 'rspec-core', git: 'https://github.com/rspec/rspec-core.git', branch: 'master'
9
+ # https://github.com/rspec/rspec-mocks/pull/467
10
+ gem 'rspec-mocks', git: 'https://github.com/rspec/rspec-mocks.git', branch: 'master'
7
11
  end
8
12
 
9
13
  gem 'oj'
data/bin/tachikoma CHANGED
@@ -1,59 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- case ARGV[0]
3
- when 'init'
4
- require 'fileutils'
5
- File.open('.gitignore', 'a') do |f|
6
- f << <<-EOS
7
-
8
- /repos/*
9
- !/repos/.gitkeep
10
- EOS
11
- end
12
- puts 'appended .gitignore'
13
- File.open('Rakefile', 'a') do |f|
14
- f << <<-EOS
15
-
16
2
  require 'bundler/setup'
17
- require 'tachikoma/tasks'
18
- EOS
19
- end
20
- puts 'appended Rakefile'
21
- FileUtils.mkdir_p('data')
22
- puts 'created data/'
23
- File.open(File.join('data', '__user_config__.yaml'), 'w') do |f|
24
- f << <<-EOS
25
- EOS
26
- end
27
- puts 'created data/__user_config__.yaml'
28
- File.open(File.join('data', 'bot-motoko-tachikoma.yaml'), 'w') do |f|
29
- f << <<-EOS
30
- url:
31
- 'https://github.com/sanemat/bot-motoko-tachikoma.git'
32
- frequency:
33
- "every 1.day, :at => '6:30 am'"
34
- type:
35
- 'fork'
36
- language:
37
- 'ruby'
38
- version:
39
- '2.0.0'
40
- EOS
41
- end
42
- puts 'created data/bot-motoko-tachikoma.yaml'
43
- FileUtils.mkdir_p('repos')
44
- puts 'created repos/'
45
- FileUtils.touch(File.join('repos', '.gitkeep'))
46
- puts 'created repos/.gitkeep'
47
- puts 'tachikoma init completed!'
48
- puts 'You might want to see README!'
49
- else
50
- puts <<-EOS
51
- Command Lists
52
- tachikoma init # Initialize files
3
+ require 'tachikoma'
4
+ require 'tachikoma/cli'
53
5
 
54
- rake tachikoma:bundle # bundle
55
- rake tachikoma:fetch # fetch
56
- rake tachikoma:fetch_data # fetch another `/data` directory from another location
57
- rake tachikoma:pull_request # pull_request
58
- EOS
59
- end
6
+ Tachikoma::CLI.start
@@ -116,9 +116,9 @@ module Tachikoma
116
116
  uri = URI.parse(fetch_url)
117
117
  case type
118
118
  when 'fork'
119
- %Q!#{uri.scheme}://#{github_token}@#{uri.host}#{path_for_fork(uri.path, github_account)}!
119
+ %Q!#{uri.scheme}://#{github_token}:x-oauth-basic@#{uri.host}#{path_for_fork(uri.path, github_account)}!
120
120
  when 'shared', 'private'
121
- "#{uri.scheme}://#{github_token}@#{uri.host}#{uri.path}"
121
+ "#{uri.scheme}://#{github_token}:x-oauth-basic@#{uri.host}#{uri.path}"
122
122
  else
123
123
  raise "Invalid type #{type}"
124
124
  end
@@ -0,0 +1,57 @@
1
+ require 'thor'
2
+
3
+ module Tachikoma
4
+ class CLI < Thor
5
+ include Thor::Actions
6
+
7
+ desc 'init', 'Initialize files'
8
+ def init
9
+ require 'fileutils'
10
+
11
+ copy_or_append_file_lists = %w(
12
+ .gitignore
13
+ Rakefile
14
+ data/__user_config__.yaml
15
+ )
16
+ copy_file_lists = %w(
17
+ repos/.gitkeep
18
+ data/bot-motoko-tachikoma.yaml
19
+ )
20
+
21
+ copy_or_append_file_lists.each do |target|
22
+ if File.exist?(target)
23
+ append_to_file target do
24
+ File.read(File.join(self.class.source_root, target))
25
+ end
26
+ else
27
+ copy_file target
28
+ end
29
+ end
30
+
31
+ copy_file_lists.each do |target|
32
+ copy_file target
33
+ end
34
+
35
+ puts 'tachikoma init completed!'
36
+ puts 'You might want to see README!'
37
+ end
38
+
39
+ def self.help(shell, *)
40
+ list = printable_tasks
41
+
42
+ shell.say 'Commands:'
43
+ shell.print_table(list, indent: 2, truncate: true)
44
+ shell.say
45
+ class_options_help(shell)
46
+ shell.say <<-USAGE
47
+ Tasks:
48
+ rake tachikoma:run_bundle # run tachikoma with bundle
49
+ rake tachikoma:run_carton # run tachikoma with carton
50
+ USAGE
51
+ end
52
+
53
+ def self.source_root
54
+ File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,3 @@
1
+
2
+ /repos/*
3
+ !/repos/.gitkeep
@@ -0,0 +1,3 @@
1
+
2
+ require 'bundler/setup'
3
+ require 'tachikoma/tasks'
File without changes
@@ -0,0 +1,10 @@
1
+ url:
2
+ 'https://github.com/sanemat/bot-motoko-tachikoma.git'
3
+ frequency:
4
+ "every 1.day, :at => '6:30 am'"
5
+ type:
6
+ 'fork'
7
+ language:
8
+ 'ruby'
9
+ version:
10
+ '2.0.0'
File without changes
@@ -1,4 +1,4 @@
1
1
  # Version of tachikoma
2
2
  module Tachikoma
3
- VERSION = '4.0.1'
3
+ VERSION = '4.0.2'
4
4
  end
data/lib/tasks/app.rake CHANGED
@@ -1,29 +1,40 @@
1
1
  require 'tachikoma/application'
2
2
 
3
3
  namespace :tachikoma do
4
- desc 'run tachikoma'
4
+ desc 'run tachikoma with bundle'
5
5
  task :run_bundle do
6
6
  Tachikoma::Application.run 'bundle'
7
7
  end
8
8
 
9
+ desc 'run tachikoma with carton'
9
10
  task :run_carton do
10
11
  Tachikoma::Application.run 'carton'
11
12
  end
12
13
 
14
+ # Deprecated: Please use `tachikoma:run_bundle` or `tachikoma:run_carton` instead
13
15
  task :load do
16
+ warn '[DEPRECATION] `tachikoma:load` is deleted. Please use `tachikoma:run_bundle` or `tachikoma:run_carton instead.'
14
17
  end
15
18
 
19
+ # Deprecated: Please use `tachikoma:run_bundle` or `tachikoma:run_carton` instead
16
20
  task :fetch do
21
+ warn '[DEPRECATION] `tachikoma:fetch` is deleted. Please use `tachikoma:run_bundle` or `tachikoma:run_carton instead.'
17
22
  end
18
23
 
24
+ # Deprecated: Please use `tachikoma:run_bundle` or `tachikoma:run_carton` instead
19
25
  task :bundle do
26
+ warn '[DEPRECATION] `tachikoma:bundle` is deprecated. Please use `tachikoma:run_bundle` or `tachikoma:run_carton` instead.'
20
27
  Tachikoma::Application.run 'bundle'
21
28
  end
22
29
 
30
+ # Deprecated: Please use `tachikoma:run_bundle` or `tachikoma:run_carton` instead
23
31
  task :carton do
32
+ warn '[DEPRECATION] `tachikoma:carton` is deprecated. Please use `tachikoma:run_bundle` or `tachikoma:run_carton` instead.'
24
33
  Tachikoma::Application.run 'carton'
25
34
  end
26
35
 
36
+ # Deprecated: Please use `tachikoma:run_bundle` or `tachikoma:run_carton` instead
27
37
  task :pull_request do
38
+ warn '[DEPRECATION] `tachikoma:pull_request` is deleted. Please use `tachikoma:run_bundle` or `tachikoma:run_carton` instead.'
28
39
  end
29
40
  end
data/spec/spec_helper.rb CHANGED
@@ -7,6 +7,7 @@
7
7
  RSpec.configure do |config|
8
8
  config.run_all_when_everything_filtered = true
9
9
  config.filter_run :focus
10
+ config.raise_errors_for_deprecations!
10
11
 
11
12
  # Run specs in random order to surface order dependencies. If you find an
12
13
  # order dependency and want to debug it, you can fix the order by providing
@@ -14,5 +15,3 @@ RSpec.configure do |config|
14
15
  # --seed 1234
15
16
  config.order = 'random'
16
17
  end
17
-
18
- require 'rspec/autorun'
@@ -2,22 +2,17 @@ require 'spec_helper'
2
2
  require 'rake'
3
3
  require 'tachikoma/tasks'
4
4
 
5
- describe 'app.rake' do
6
- describe 'tachikoma:pull_request' do
5
+ # FIXME: This is not test against rake task.
6
+ describe 'Tachikoma::Aplication' do
7
+ describe '#pull_request' do
7
8
  context 'when github returns 422 UnprocessableEntity' do
8
9
  before do
9
- # FIXME: Using `stub_chain` from rspec-mocks' old `:should`
10
- # syntax without explicitly enabling the syntax is deprecated.
11
- # Use the new `:expect` syntax or explicitly enable `:should`
12
- # instead. Called from
13
- # /Users/sane/work/ruby-study/tachikoma/spec/tasks/app_task_spec.rb:9:
14
- # in `block (4 levels) in <top (required)>'.
15
- Octokit::Client.stub_chain(:new, :create_pull_request).and_raise(Octokit::UnprocessableEntity)
10
+ allow(Octokit::Client).to receive_message_chain(:new, :create_pull_request).and_raise(Octokit::UnprocessableEntity)
16
11
  end
17
12
 
18
13
  it 'should not raise Octokit::UnprocessableEntity error' do
19
14
  expect {
20
- Rake::Task['tachikoma:pull_request'].invoke
15
+ Tachikoma::Application.new.pull_request
21
16
  }.to_not raise_error
22
17
  end
23
18
  end
data/tachikoma.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency 'rake'
23
23
  spec.add_dependency 'octokit', '>= 2', '< 3'
24
24
  spec.add_dependency 'json'
25
+ spec.add_dependency 'thor'
25
26
 
26
27
  spec.add_development_dependency 'bundler', '~> 1.3'
27
28
  spec.add_development_dependency 'dotenv'
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.0.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sanemat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-07 00:00:00.000000000 Z
11
+ date: 2013-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: safe_yaml
@@ -72,6 +72,20 @@ dependencies:
72
72
  - - '>='
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: thor
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :runtime
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
75
89
  - !ruby/object:Gem::Dependency
76
90
  name: bundler
77
91
  requirement: !ruby/object:Gem::Requirement
@@ -137,8 +151,14 @@ files:
137
151
  - data/default.yaml
138
152
  - lib/tachikoma.rb
139
153
  - lib/tachikoma/application.rb
154
+ - lib/tachikoma/cli.rb
140
155
  - lib/tachikoma/settings.rb
141
156
  - lib/tachikoma/tasks.rb
157
+ - lib/tachikoma/templates/.gitignore
158
+ - lib/tachikoma/templates/Rakefile
159
+ - lib/tachikoma/templates/data/__user_config__.yaml
160
+ - lib/tachikoma/templates/data/bot-motoko-tachikoma.yaml
161
+ - lib/tachikoma/templates/repos/.gitkeep
142
162
  - lib/tachikoma/version.rb
143
163
  - lib/tasks/app.rake
144
164
  - rubocop-todo.yml