yac 0.0.1 → 0.0.2

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.
Files changed (5) hide show
  1. data/README.rdoc +0 -1
  2. data/bin/yac +1 -2
  3. data/lib/yac.rb +11 -6
  4. data/yac.gemspec +23 -22
  5. metadata +16 -10
@@ -23,7 +23,6 @@
23
23
  $ yac content [keyword]
24
24
  === Update repositories
25
25
  $ yac update main => Update main repository
26
- Update the main stockroom
27
26
  $ yac update private => Update private repository
28
27
  $ yac update => Update All
29
28
  === Help
data/bin/yac CHANGED
@@ -1,4 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
- require 'rubygems'
3
- require 'yac'
2
+ require File.join(File.dirname(__FILE__), "..", "lib", "yac.rb")
4
3
  Yac.new(ARGV)
data/lib/yac.rb CHANGED
@@ -3,17 +3,20 @@
3
3
  module Yac
4
4
  extend self
5
5
 
6
- CHITRC = File.join("#{ENV['HOME']}",".chitrc")
7
- FileUtils.cp(File.join(File.dirname(__FILE__), "..","resources","yacrc"), CHITRC) unless File.exist?(CHITRC)
6
+ YACRC = File.join("#{ENV['HOME']}",".yacrc")
7
+ FileUtils.cp(File.join(File.dirname(__FILE__), "..","resources","yacrc"), YACRC) unless File.exist?(YACRC)
8
8
  CONFIG = YAML.load_file(File.join(ENV['HOME'],".yacrc"))
9
9
  CONFIG["root"] ||= File.join(ENV['HOME'],".yac")
10
10
 
11
11
  @main_path = File.join(CONFIG["root"],"/main/")
12
12
  @pri_path = File.join(CONFIG["root"],"/private/")
13
- @main_git = Git.open(@main_path)
14
- @pri_git = Git.open(@pri_path)
13
+ @main_git = Git.open(@main_path) if File.exist?(@main_path)
14
+ @pri_git = Git.open(@pri_path)if File.exist?(@pri_path)
15
15
 
16
16
  def new(args)
17
+ unless File.exist?(@main_path) && File.exist?(@pri_path)
18
+ return unless init
19
+ end
17
20
  @all_result = []
18
21
  help && exit if args.empty?
19
22
  case args.first
@@ -65,7 +68,7 @@ module Yac
65
68
  end
66
69
 
67
70
  def help
68
- format_file(File.dirname(__FILE__)+"/../README")
71
+ format_file(File.dirname(__FILE__)+"/../README.rdoc")
69
72
  end
70
73
 
71
74
  def shell(args = "pri")
@@ -194,7 +197,7 @@ module Yac
194
197
  end
195
198
 
196
199
  def show_possible_result
197
- puts "\n\033[" + CONFIG["possible_result_title"].to_s + "mALL POSSIBLE RESULT:\n\033[0m\033[" +CONFIG["possible_result_content"].to_s + "m" + @all_result.join("\s"*2) + "\033[0m" unless @all_result.to_s.empty?
200
+ puts "\n\033[" + CONFIG["possible_result_title"].to_s + "mALL POSSIBLE RESULT:\033[0m\n \033[" +CONFIG["possible_result_content"].to_s + "m" + @all_result.join("\s"*2) + "\033[0m" unless @all_result.to_s.empty?
198
201
  end
199
202
 
200
203
  def init
@@ -227,6 +230,8 @@ module Yac
227
230
  else
228
231
  puts "Private repository has already been initialized."
229
232
  end
233
+ @main_git = Git.open(@main_path) if File.exist?(@main_path)
234
+ @pri_git = Git.open(@pri_path)if File.exist?(@pri_path)
230
235
  puts "Repository init done."
231
236
  end
232
237
  end
@@ -1,32 +1,33 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
-
1
+ GEM = "yac"
2
+ VER = "0.0.2"
3
+ AUTHOR = "Jinzhu Zhang"
4
+ EMAIL = "wosmvp@gmail.com"
5
+ HOMEPAGE = "http://www.zhangjinzhu.com"
6
+ SUMMARY = "Yet Another Cheat"
7
+
5
8
  Gem::Specification.new do |s|
6
- s.name = %q{yac}
7
- s.version = "0.0.1"
8
9
 
10
+ s.specification_version = 2 if s.respond_to? :specification_version=
9
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
- s.authors = ["Jinzhu Zhang"]
12
+
13
+ s.name = GEM
14
+ s.version = VER
15
+ s.author = AUTHOR
11
16
  s.date = %q{2008-10-10}
12
- s.homepage = %q{http://www.zhangjinzhu.com}
13
- s.default_executable = %q{yac}
14
- s.summary = %q{Yet Another Cheat}
15
- s.email = ["wosmvp@gmail.com"]
17
+ s.email = EMAIL
18
+ s.homepage = HOMEPAGE
19
+ s.summary = SUMMARY
20
+ s.description = s.summary
21
+
22
+ s.require_path = 'lib'
23
+ s.autorequire = 'yac'
16
24
  s.executables = ["yac"]
17
-
18
- files = []
19
- files += Dir.glob('lib/*')
20
- files += Dir.glob('bin/*')
21
- files += Dir.glob('resources/*')
22
- files += %w[README.rdoc README.cn yac.gemspec]
23
- s.files = files
25
+
26
+ s.files = %w[README.rdoc README.cn yac.gemspec resources/yacrc bin/yac lib/yac.rb]
24
27
 
25
28
  s.has_rdoc = true
26
-
27
- s.require_paths = ["lib"]
29
+ s.rdoc_options = ["--quiet", "--title", "YAC => Yet Another Cheat", "--opname", "index.html", "--line-numbers", "--main", "README.rdoc", "--inline-source"]
28
30
  s.extra_rdoc_files = "README.rdoc"
29
- s.rdoc_options = ["--main", "README.rdoc"]
30
- s.rubyforge_project = %q{yac}
31
+
31
32
  s.add_dependency("schacon-git", ">1.0.0")
32
33
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jinzhu Zhang
8
- autorequire:
8
+ autorequire: yac
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
12
  date: 2008-10-10 00:00:00 +08:00
13
- default_executable: yac
13
+ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: schacon-git
@@ -22,9 +22,8 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 1.0.0
24
24
  version:
25
- description:
26
- email:
27
- - wosmvp@gmail.com
25
+ description: Yet Another Cheat
26
+ email: wosmvp@gmail.com
28
27
  executables:
29
28
  - yac
30
29
  extensions: []
@@ -32,18 +31,25 @@ extensions: []
32
31
  extra_rdoc_files:
33
32
  - README.rdoc
34
33
  files:
35
- - lib/yac.rb
36
- - bin/yac
37
- - resources/yacrc
38
34
  - README.rdoc
39
35
  - README.cn
40
36
  - yac.gemspec
37
+ - resources/yacrc
38
+ - bin/yac
39
+ - lib/yac.rb
41
40
  has_rdoc: true
42
41
  homepage: http://www.zhangjinzhu.com
43
42
  post_install_message:
44
43
  rdoc_options:
44
+ - --quiet
45
+ - --title
46
+ - YAC => Yet Another Cheat
47
+ - --opname
48
+ - index.html
49
+ - --line-numbers
45
50
  - --main
46
51
  - README.rdoc
52
+ - --inline-source
47
53
  require_paths:
48
54
  - lib
49
55
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -60,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
66
  version:
61
67
  requirements: []
62
68
 
63
- rubyforge_project: yac
69
+ rubyforge_project:
64
70
  rubygems_version: 1.2.0
65
71
  signing_key:
66
72
  specification_version: 2