Skip to content

Commit

Permalink
Merge pull request #286 from yhirano55/add_npm_with_ncu
Browse files Browse the repository at this point in the history
Add npm-check-updates
  • Loading branch information
sanemat committed Mar 16, 2017
2 parents 497879a + b439a0b commit 83bfeb9
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ You can use these strategies:
- Bundler (Ruby)
- Carton (Perl)
- David (Node.js)
- npm-check-updates (Node.js)
- CocoaPods (Objective-C, Swift)
- Carthage (Swift)
- Composer (PHP)
Expand Down
14 changes: 14 additions & 0 deletions lib/tachikoma/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,20 @@ def cocoapods
end
end

def ncu
Dir.chdir("#{Tachikoma.repos_path}/#{@build_for}") do
sh(*['git', 'config', 'user.name', @commiter_name])
sh(*['git', 'config', 'user.email', @commiter_email])
sh(*['git', 'checkout', '-b', "tachikoma/update-#{@readable_time}", @base_remote_branch])
sh(*%w(ncu -u))
sh(*['git', 'add', 'package.json']) if File.exist?('package.json')
sh(*['git', 'commit', '-m', "Ncu update #{@readable_time}"]) do
# ignore exitstatus
end
sh(*['git', 'push', @authorized_compare_url, "tachikoma/update-#{@readable_time}"])
end
end

def pull_request
@client = Octokit::Client.new access_token: @github_token
@client.create_pull_request(
Expand Down
1 change: 1 addition & 0 deletions lib/tachikoma/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def self.help(shell, *)
rake tachikoma:run_composer # run tachikoma with composer
rake tachikoma:run_cocoapods # run tachikoma with cocoapods
rake tachikoma:run_carthage # run tachikoma with carthage
rake tachikoma:run_ncu # run tachikoma with npm-check-updates
USAGE
end

Expand Down
5 changes: 5 additions & 0 deletions lib/tasks/app.rake
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,9 @@ namespace :tachikoma do
task :run_carthage do
Tachikoma::Application.run 'carthage'
end

desc 'run tachikoma with npm-check-updates'
task :run_ncu do
Tachikoma::Application.run 'ncu'
end
end
13 changes: 13 additions & 0 deletions spec/tachikoma/application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@
end
end

context 'if strategy is `ncu`' do
before do
allow_any_instance_of(Tachikoma::Application).to receive(:load)
allow_any_instance_of(Tachikoma::Application).to receive(:fetch)
allow_any_instance_of(Tachikoma::Application).to receive(:pull_request)
end

it 'should be called `ncu` method' do
expect_any_instance_of(Tachikoma::Application).to receive(:ncu)
Tachikoma::Application.run 'ncu'
end
end

describe '#bundler_parallel_option' do
subject { described_class.new }

Expand Down

0 comments on commit 83bfeb9

Please sign in to comment.