rg_stats 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rg_stats (1.0.1)
4
+ rg_stats (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/bin/rg_stats CHANGED
@@ -6,13 +6,24 @@ require_relative '../lib/rg_stats/statistic'
6
6
 
7
7
  class PersistDataBetweenSessions
8
8
 
9
- STORAGE_NAME = "/tmp/ruby_gems_sync.yaml"
9
+ HOME_FOLDER = "#{ENV['HOME']}/.rg_stats"
10
+ STORAGE_NAME = "ruby_gems_sync.yaml"
10
11
  def self.load
11
- File.exists?(STORAGE_NAME) ? File.open(STORAGE_NAME, "r") { |file| YAML.load(file) } : []
12
+ self.check_home_folder
13
+ File.exists?(self.FILE_NAME) ? File.open(self.FILE_NAME, "r") { |file| YAML.load(file) } : []
12
14
  end
13
15
 
14
16
  def self.save(list)
15
- File.open(STORAGE_NAME, "w") {|file| file.puts(list.to_yaml) }
17
+ self.check_home_folder
18
+ File.open(self.FILE_NAME, "w") {|file| file.puts(list.to_yaml) }
19
+ end
20
+
21
+ def self.check_home_folder
22
+ Dir::mkdir(HOME_FOLDER) unless File.exists?(HOME_FOLDER)
23
+ end
24
+
25
+ def self.FILE_NAME
26
+ "#{HOME_FOLDER}/#{STORAGE_NAME}"
16
27
  end
17
28
  end
18
29
 
@@ -56,8 +67,8 @@ ARGV.each do |user_name|
56
67
  puts "\e[32m#{user_name}\e[0m"
57
68
  puts "-" *(stat.max_gem_name_size + 30)
58
69
  stat.gem_infos.each do |gem_info|
59
- broj_izmjena = gem_info[1] - (old_map[gem_info[0]].nil? ? 0 : old_map[gem_info[0]])
60
- diff_from_last_time = broj_izmjena == 0 ? "" : " (+\e[32m#{broj_izmjena}\e[0m)"
70
+ number_of_changes = gem_info[1] - (old_map[gem_info[0]].nil? ? 0 : old_map[gem_info[0]])
71
+ diff_from_last_time = number_of_changes == 0 ? "" : " (+\e[32m#{number_of_changes}\e[0m)"
61
72
  puts "%-#{stat.max_gem_name_size + 1}s=> %6d %6s" % [ gem_info[0] , gem_info[1], diff_from_last_time ]
62
73
  puts "-" *(stat.max_gem_name_size + 30)
63
74
  end
@@ -1,3 +1,3 @@
1
1
  module RgStats
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rg_stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-07 00:00:00.000000000Z
12
+ date: 2012-05-08 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Get download statistic of yours gems on RubyGems
15
15
  email:
@@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
53
  version: '0'
54
54
  requirements: []
55
55
  rubyforge_project:
56
- rubygems_version: 1.8.17
56
+ rubygems_version: 1.8.10
57
57
  signing_key:
58
58
  specification_version: 3
59
59
  summary: I am wasting half of my day on checking stats...