anticuado 0.2.12 → 0.2.13

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: 03d7277ca669cb9bf876100813d5cf1689d4ca98
4
- data.tar.gz: 4e97874a1be753e6bde7ef8dccf084078cd24178
3
+ metadata.gz: '0609518668ff2779883e9191014e5c92d276aec8'
4
+ data.tar.gz: 192d84ff647088e45d843645bbeda02b2eb464a6
5
5
  SHA512:
6
- metadata.gz: 44a0fb090083ff4ddf3cfc8ba14abfe75885df77dd608df14aa70c8f01dbf7d75f6766f39d20596054f7143f128878d2e2f639005411737e6860067b24a2b048
7
- data.tar.gz: f46040cdf58db6c5e1f1c103fc4d9aa3bf67836be4b75efdec7dbd336237c0183a443a8d1fc25e4fcecce3b542e617ca08aed32fc2ae7903ac3acdd3ef2d73da
6
+ metadata.gz: ea636dc1dd30ff5aa0eba95ccf5c7cf507ef0bc637b565cb19aeec5d68339e6b4e42a3bdc6aa8c7584d1209138a897028ac54af545e795e23fe7231acefcaf60
7
+ data.tar.gz: bab8a04f8ca1483f9ce8c8715377683ed0fd9b667f9dc24035bf5685cd0782eda7b744ca2674ce4ad6dc8a9e411456e717eefa0290d3c52205939d626a6e7e21
@@ -2,10 +2,9 @@ sudo: false
2
2
  language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
- - 2.0.0
6
- - 2.1.0
7
5
  - 2.2.0
8
6
  - 2.3.0
7
+ - 2.4.0
9
8
  os:
10
9
  - linux
11
10
  - osx
@@ -4,6 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'anticuado/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
+ spec.required_ruby_version = ">= 2.1"
7
8
  spec.name = "anticuado"
8
9
  spec.version = Anticuado::VERSION
9
10
  spec.authors = ["Kazuaki MATSUO"]
@@ -7,5 +7,29 @@ module Anticuado
7
7
  def self.format(_outdated)
8
8
  raise NotImplementedError
9
9
  end
10
+
11
+ private
12
+
13
+ def self.update_with_prefix(pod_file_in:, pod_file_out: nil, libraries:, prefix:)
14
+ pod_file_out = pod_file_in if pod_file_out.nil?
15
+ current_pod = File.read(pod_file_in)
16
+
17
+ result = current_pod.each_line.reduce("") do |memo, line|
18
+ memo << if line.strip.start_with?(prefix)
19
+ key = get_key libraries, line
20
+ key.nil? ? line : line.sub(/[0-9|.]+/, libraries[key])
21
+ else
22
+ line
23
+ end
24
+ end
25
+
26
+ File.write(pod_file_out, result)
27
+ result
28
+ end
29
+
30
+ def self.get_key(libraries, line)
31
+ libraries.each_key { |k| return k if line.include?(k.to_s) }
32
+ nil
33
+ end
10
34
  end
11
35
  end
@@ -1,16 +1,29 @@
1
1
  module Anticuado
2
2
  module IOS
3
3
  class CocoaPods < Anticuado::Base
4
+ # @param [String] project Name of library.
5
+ # @return [String] The result of command `pod outdated`.
6
+ def self.update_lock(library: nil)
7
+ return puts "have no pod command" if `which pod`.empty?
8
+
9
+ if library
10
+ `pod update #{library}`
11
+ else
12
+ `pod update`
13
+ end
14
+ end
15
+
4
16
  # @param [String] project Path to project directory.
5
17
  # @return [String] The result of command `pod outdated`.
6
18
  def self.outdated(project = nil)
7
19
  return puts "have no pod command" if `which pod`.empty?
8
-
9
- `pod install`
10
20
 
11
21
  if project
22
+
23
+ `pod install --project-directory=#{project}`
12
24
  `pod outdated --project-directory=#{project}`
13
25
  else
26
+ `pod install`
14
27
  `pod outdated`
15
28
  end
16
29
  end
@@ -36,6 +49,16 @@ module Anticuado
36
49
  end
37
50
  }.compact
38
51
  end
52
+
53
+ # @param [String] pod_file_in The file path to Podfile you'd like to update
54
+ # @param [String] pod_file_out The file path to new Podfile updated. Default is nil and then `pod_file_in` is used
55
+ # as the file path
56
+ # @param [Hash] library_name The library name you'd like to update
57
+ # {library_name: "version", library_name2: "version"}
58
+ # @return [String] new Podfile
59
+ def self.update(pod_file_in:, pod_file_out: nil, libraries:)
60
+ update_with_prefix(pod_file_in: pod_file_in, pod_file_out: pod_file_out, libraries: libraries, prefix: "pod ")
61
+ end
39
62
  end # class CocoaPods
40
63
  end # module IOS
41
64
  end # module Anticuado
@@ -1,3 +1,3 @@
1
1
  module Anticuado
2
- VERSION = "0.2.12"
2
+ VERSION = "0.2.13"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anticuado
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.12
4
+ version: 0.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-03 00:00:00.000000000 Z
11
+ date: 2017-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -91,7 +91,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
- version: '0'
94
+ version: '2.1'
95
95
  required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - ">="