shepherd 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # shepherd 0.1.4 (24-11-2011)
2
+
3
+ + Ability to `rm` some sheeps.
4
+
1
5
  # shepherd 0.1.3 (18-09-2011)
2
6
 
3
7
  + Now we can `show` some sheeps!
@@ -0,0 +1,86 @@
1
+ module Shepherd::Command
2
+ class Check
3
+ def init
4
+ @opts = Trollop::options do
5
+ banner <<-EOB
6
+ usage: shep check [id] [options]
7
+ EOB
8
+ opt :help, "show me and exit", :short => '-h'
9
+ end
10
+
11
+ if id = ARGV.shift
12
+ update_one id.to_i
13
+ else
14
+ update_all
15
+ end
16
+ end
17
+
18
+ def update_all
19
+ n = 0
20
+ Shepherd::Db.new.execute "select * from sheeps" do |sheep|
21
+ n += 1
22
+ update_one sheep[0]
23
+ count = Shepherd::Db.new.execute("select count(*) from sheeps").first.first
24
+ puts " ---\n\n" if n < count
25
+ end
26
+ end
27
+
28
+ def update_one id
29
+ out = ""
30
+
31
+ sheep = Shepherd::Db.new.get_first_row "select * from sheeps where id = ?", id
32
+ if sheep
33
+ out += " name: \e[1;35m#{sheep[1]}\e[0;0m from \e[1;34m#{sheep[2]}\e[0;0m\n\n"
34
+ Shepherd::Counter.new(sheep[2]) do |count|
35
+ files = count.files - sheep[3]
36
+ if files < 0
37
+ files = files.to_s[1..-1].to_i
38
+ out += " state: \e[1;34m#{count.files.to_nice}\e[0;0m files (#{sheep[3].to_nice} \e[1;31m- #{files.to_nice}\e[0;0m)"
39
+ elsif files == 0
40
+ out += " state: \e[1;34m#{count.files.to_nice}\e[0;0m files\n"
41
+ else
42
+ out += " state: \e[1;34m#{count.files.to_nice}\e[0;0m files (#{sheep[3].to_nice} \e[1;32m+ #{files.to_nice}\e[0;0m)\n"
43
+ end
44
+
45
+ lines = count.lines - sheep[4]
46
+ if lines < 0
47
+ lines = lines.to_s[1..-1].to_i
48
+ out += " \e[1;34m#{count.lines.to_nice}\e[0;0m lines (#{sheep[4].to_nice} \e[1;31m- #{lines.to_nice}\e[0;0m)"
49
+ elsif lines == 0
50
+ out += " \e[1;34m#{count.lines.to_nice}\e[0;0m lines\n"
51
+ else
52
+ out += " \e[1;34m#{count.lines.to_nice}\e[0;0m lines (#{sheep[4].to_nice} \e[1;32m+ #{lines.to_nice}\e[0;0m)\n"
53
+ end
54
+
55
+ chars = count.chars - sheep[5]
56
+ if chars < 0
57
+ chars = chars.to_s[1..-1].to_i
58
+ out += " \e[1;34m#{count.chars.to_nice}\e[0;0m chars (#{sheep[5].to_nice} \e[1;31m- #{chars.to_nice}\e[0;0m)\n\n"
59
+ elsif chars == 0
60
+ out += " \e[1;34m#{count.chars.to_nice}\e[0;0m chars\n\n"
61
+ else
62
+ out += " \e[1;34m#{count.chars.to_nice}\e[0;0m chars (#{sheep[5].to_nice} \e[1;32m+ #{chars.to_nice}\e[0;0m)\n\n"
63
+ end
64
+
65
+ bytes = count.bytes - sheep[6]
66
+ if bytes < 0
67
+ bytes = bytes.to_s[1..-1].to_i
68
+ out += " \e[1;34m#{Shepherd::Utils.nice_bytes count.bytes}\e[0;0m bytes (#{Shepherd::Utils.nice_bytes sheep[6]} \e[1;31m- #{Shepherd::Utils.nice_bytes bytes}\e[0;0m)"
69
+ elsif bytes == 0
70
+ out += " \e[1;34m#{Shepherd::Utils.nice_bytes count.bytes}\e[0;0m"
71
+ else
72
+ out += " \e[1;34m#{Shepherd::Utils.nice_bytes count.bytes}\e[0;0m bytes (#{Shepherd::Utils.nice_bytes sheep[6]} \e[1;32m+ #{Shepherd::Utils.nice_bytes bytes}\e[0;0m)"
73
+ end
74
+
75
+ puts "#{out}\n\n"
76
+ end
77
+ else
78
+ puts "[shep] error: no such sheep."
79
+ end
80
+ end
81
+
82
+ def desc
83
+ "see how the projects have grown"
84
+ end
85
+ end
86
+ end
@@ -1,8 +1,8 @@
1
1
  module Shepherd
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 1
5
- PATCH = 4
4
+ MINOR = 2
5
+ PATCH = 0
6
6
  BUILD = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join "."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shepherd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-24 00:00:00.000000000 Z
12
+ date: 2012-01-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sqlite3
16
- requirement: &72995120 !ruby/object:Gem::Requirement
16
+ requirement: &74463190 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *72995120
24
+ version_requirements: *74463190
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: yard
27
- requirement: &72994480 !ruby/object:Gem::Requirement
27
+ requirement: &74462680 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.7.2
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *72994480
35
+ version_requirements: *74462680
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &72993490 !ruby/object:Gem::Requirement
38
+ requirement: &74462420 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 2.6.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *72993490
46
+ version_requirements: *74462420
47
47
  description: Check if/how your projects are growing up!
48
48
  email:
49
49
  - szymon.urbas@yahoo.com
@@ -62,6 +62,7 @@ files:
62
62
  - lib/shepherd.rb
63
63
  - lib/shepherd/cli.rb
64
64
  - lib/shepherd/command.rb
65
+ - lib/shepherd/commands/check.rb
65
66
  - lib/shepherd/commands/init.rb
66
67
  - lib/shepherd/commands/rm.rb
67
68
  - lib/shepherd/commands/show.rb