tachikoma_ai 0.3.1 → 0.4.0

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: 036d35e5edb505f39725fea36fb6ae032e9bcf27
4
- data.tar.gz: a7e00c50e8f9122a9f7f3d97aaa87bc29a2f02c3
3
+ metadata.gz: 490b72c7037724b06a533189f7535644cfd2c4c4
4
+ data.tar.gz: da5885c1d9ed78a314fbfb399a8566a398ea4881
5
5
  SHA512:
6
- metadata.gz: e69c17916d85dc6ecbb956e271b3b20aa0da0a75e02cc6ae15cb62cc704f7a278c24fd6f03d8a315ca0b99575a0a2eb77152c95031d5767d1532c1e23611effc
7
- data.tar.gz: 2eadf556ad0f42d58d83baf2029bca06a1144edc89c3a2de934ec22663bb3e7fff09ad41befc804f31584cd143d51537eaf44d2733047ddaa4cfd25db2efeebf
6
+ metadata.gz: 7dfcdbf60791a9c7fa84c0c2e8e376a5612744aa395e16efd5e921f0f80d405af352f0646c4ba55a351bb7238388807df97cc963fe225b6b7824242dbd83dd30
7
+ data.tar.gz: 6d41b37db99dc05343d069c89c05c2e0e378b3b6542432396971d9ce248e9ce9eaa9ae4c6f00d71d13778b28dcdf5534a423498cda64fa76e34868b51c4d6a0a
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ .byebug_history
@@ -1,5 +1,9 @@
1
1
  ## master (unreleased)
2
2
 
3
+ ## v0.4.0
4
+
5
+ - :sparkles: Fix the compare url when tags not found
6
+
3
7
  ## v0.3.1
4
8
 
5
9
  - :bug: Fix an error that occurs when GitHub API returns 301
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ gemspec
5
5
 
6
6
  gem 'codecov', require: false
7
7
  gem 'webmock'
8
+ gem 'byebug'
@@ -13,7 +13,14 @@ module TachikomaAi
13
13
  def compare(start, endd)
14
14
  s = find_tag(start)
15
15
  e = find_tag(endd)
16
- "https://github.com/#{owner}/#{repo}/compare/#{s}...#{e}"
16
+ base = "https://github.com/#{owner}/#{repo}"
17
+ if s.nil? && e.nil?
18
+ "#{base} (tags not found)"
19
+ elsif e.nil?
20
+ "#{base}/compare/#{s}...master"
21
+ else
22
+ "#{base}/compare/#{s}...#{e}"
23
+ end
17
24
  end
18
25
 
19
26
  private
@@ -30,21 +37,22 @@ module TachikomaAi
30
37
  return @tags if @tags
31
38
 
32
39
  res = fetch(api_tags_url)
33
- json = JSON.parse(res.body)
34
- @tags = json.map { |tag| tag['ref'].gsub('refs/tags/', '') }
40
+ @tags = if res.is_a? Net::HTTPSuccess
41
+ json = JSON.parse(res.body)
42
+ json.map { |tag| tag['ref'].gsub('refs/tags/', '') }
43
+ else
44
+ {}
45
+ end
35
46
  end
36
47
 
37
48
  def fetch(uri_str, limit = 10)
38
- raise ArgumentError, 'HTTP redirect too deep' if limit == 0
49
+ raise ArgumentError, 'HTTP redirect too deep' if limit.zero?
39
50
 
40
51
  response = Net::HTTP.get_response URI.parse(uri_str)
41
- case response
42
- when Net::HTTPSuccess
43
- response
44
- when Net::HTTPRedirection
52
+ if response.is_a? Net::HTTPRedirection
45
53
  fetch(response['location'], limit - 1)
46
54
  else
47
- response.value
55
+ response
48
56
  end
49
57
  end
50
58
  end
@@ -7,7 +7,8 @@ module TachikomaAi
7
7
  class Gem
8
8
  major, minor = RUBY_VERSION.split('.')
9
9
  SPECS_PATH = "vendor/bundle/ruby/#{major}.#{minor}.0/specifications/".freeze
10
- URLS = JSON.parse(File.read(File.expand_path('urls.json', __dir__)))
10
+ GITHUB_URLS = File.read(File.expand_path('github_urls.json', __dir__))
11
+ GITHUB_URL_JSON = JSON.parse(GITHUB_URLS)
11
12
 
12
13
  attr_reader :name, :from, :version
13
14
 
@@ -24,8 +25,8 @@ module TachikomaAi
24
25
  def github_url
25
26
  if homepage.include?('github.com')
26
27
  homepage
27
- elsif URLS.key?(name)
28
- URLS[name]
28
+ elsif GITHUB_URL_JSON.key?(name)
29
+ "https://github.com/#{GITHUB_URL_JSON[name]}"
29
30
  end
30
31
  end
31
32
 
@@ -0,0 +1,18 @@
1
+ {
2
+ "action_args": "asakusarb/action_args",
3
+ "airbrake": "airbrake/airbrake",
4
+ "capistrano": "capistrano/capistrano",
5
+ "coderay": "rubychan/coderay",
6
+ "concurrent-ruby": "ruby-concurrency/concurrent-ruby",
7
+ "eventmachine": "eventmachine/eventmachine",
8
+ "logging": "TwP/logging",
9
+ "nokogiri": "sparklemotion/nokogiri",
10
+ "puma": "puma/puma",
11
+ "rails_best_practices": "railsbp/rails_best_practices",
12
+ "rack-mini-profiler": "MiniProfiler/rack-mini-profiler",
13
+ "sass": "sass/sass",
14
+ "sidekiq": "mperham/sidekiq",
15
+ "thin": "macournoyer/thin",
16
+ "unicorn": "defunkt/unicorn",
17
+ "uniform_notifier": "flyerhzm/uniform_notifier"
18
+ }
@@ -1,3 +1,3 @@
1
1
  module TachikomaAi
2
- VERSION = '0.3.1'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tachikoma_ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sinsoku
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-29 00:00:00.000000000 Z
11
+ date: 2016-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tachikoma
@@ -103,7 +103,7 @@ files:
103
103
  - lib/tachikoma_ai/repository.rb
104
104
  - lib/tachikoma_ai/strategies/bundler.rb
105
105
  - lib/tachikoma_ai/strategies/bundler/gem.rb
106
- - lib/tachikoma_ai/strategies/bundler/urls.json
106
+ - lib/tachikoma_ai/strategies/bundler/github_urls.json
107
107
  - lib/tachikoma_ai/strategy.rb
108
108
  - lib/tachikoma_ai/tachikoma_extention.rb
109
109
  - lib/tachikoma_ai/version.rb
@@ -1,17 +0,0 @@
1
- {
2
- "action_args": "https://github.com/asakusarb/action_args",
3
- "airbrake": "https://github.com/airbrake/airbrake",
4
- "capistrano": "https://github.com/capistrano/capistrano",
5
- "coderay": "https://github.com/rubychan/coderay",
6
- "concurrent-ruby": "https://github.com/ruby-concurrency/concurrent-ruby",
7
- "eventmachine": "https://github.com/eventmachine/eventmachine",
8
- "logging": "https://github.com/TwP/logging",
9
- "nokogiri": "https://github.com/sparklemotion/nokogiri",
10
- "rails_best_practices": "https://github.com/railsbp/rails_best_practices",
11
- "rack-mini-profiler": "https://github.com/MiniProfiler/rack-mini-profiler",
12
- "sass": "https://github.com/sass/sass",
13
- "sidekiq": "https://github.com/mperham/sidekiq",
14
- "thin": "https://github.com/macournoyer/thin",
15
- "unicorn": "https://github.com/defunkt/unicorn",
16
- "uniform_notifier": "https://github.com/flyerhzm/uniform_notifier"
17
- }