Permalink
Browse files

use bundler to manage gem

  • Loading branch information...
1 parent 585cd1c commit 6d436ec262732f6b43ace27f5af734b222ecdf5f @flyerhzm committed Mar 1, 2013
Showing with 50 additions and 64 deletions.
  1. +2 −0 Gemfile
  2. +1 −1 MIT-LICENSE
  3. +25 −15 Rakefile
  4. +0 −1 VERSION
  5. +15 −45 chinese_pinyin.gemspec
  6. +3 −2 lib/chinese_pinyin.rb
  7. +4 −0 lib/chinese_pinyin/version.rb
View
@@ -1,3 +1,5 @@
source "https://rubygems.org"
gemspec
+
+gem 'rake'
View
@@ -1,4 +1,4 @@
-Copyright (c) 2010 - 2012 Richard Huang (flyerhzm@gmail.com)
+Copyright (c) 2010 - 2013 Richard Huang (flyerhzm@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
@@ -1,8 +1,29 @@
-require 'rake'
+$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
+require "bundler"
+Bundler.setup
+
+require "rake"
require 'rake/testtask'
-require 'rdoc/task'
-require 'rubygems'
-require 'jeweler'
+require "rdoc/task"
+
+require "chinese_pinyin/version"
+
+task :build do
+ system "gem build chinese_pinyin.gemspec"
+end
+
+task :install => :build do
+ system "sudo gem install chinese_pinyin-#{ChinesePinyin::VERSION}.gem"
+end
+
+task :release => :build do
+ puts "Tagging #{ChinesePinyin::VERSION}..."
+ system "git tag -a #{ChinesePinyin::VERSION} -m 'Tagging #{ChinesePinyin::VERSION}'"
+ puts "Pushing to Github..."
+ system "git push --tags"
+ puts "Pushing to rubygems.org..."
+ system "gem push chinese_pinyin-#{ChinesePinyin::VERSION}.gem"
+end
desc 'Default: run unit tests.'
task :default => :test
@@ -23,14 +44,3 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end
-
-Jeweler::Tasks.new do |gemspec|
- gemspec.name = 'chinese_pinyin'
- gemspec.summary = 'translate chinese hanzi to pinyin.'
- gemspec.description = 'translate chinese hanzi to pinyin.'
- gemspec.email = 'flyerhzm@gmail.com'
- gemspec.homepage = 'http://github.com/flyerhzm/chinese_pinyin'
- gemspec.authors = ['Richard Huang']
- gemspec.files.exclude '.gitignore'
-end
-Jeweler::GemcutterTasks.new
View
@@ -1 +0,0 @@
-0.4.2
View
@@ -1,51 +1,21 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
-# -*- encoding: utf-8 -*-
+lib = File.expand_path('../lib/', __FILE__)
+$:.unshift lib unless $:.include?(lib)
-Gem::Specification.new do |s|
- s.name = "chinese_pinyin"
- s.version = "0.4.2"
+require "chinese_pinyin/version"
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Richard Huang"]
- s.date = "2013-03-01"
+Gem::Specification.new do |s|
+ s.name = "chinese_pinyin"
+ s.version = ChinesePinyin::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["Richard Huang"]
+ s.email = ["flyerhzm@gmail.com"]
+ s.homepage = "http://github.com/flyerhzm/chinese_pinyin"
+ s.summary = "translate chinese hanzi to pinyin."
s.description = "translate chinese hanzi to pinyin."
- s.email = "flyerhzm@gmail.com"
- s.extra_rdoc_files = [
- "README.md"
- ]
- s.files = [
- "Gemfile",
- "MIT-LICENSE",
- "README.md",
- "Rakefile",
- "VERSION",
- "chinese_pinyin.gemspec",
- "data/Mandarin.dat",
- "lib/chinese_pinyin.rb",
- "test/Words.dat",
- "test/chinese_pinyin_test.rb",
- "test/test_helper.rb"
- ]
- s.homepage = "http://github.com/flyerhzm/chinese_pinyin"
- s.require_paths = ["lib"]
- s.rubygems_version = "2.0.0"
- s.summary = "translate chinese hanzi to pinyin."
- if s.respond_to? :specification_version then
- s.specification_version = 4
+ s.required_rubygems_version = ">= 1.3.6"
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<chinese_pinyin>, [">= 0"])
- s.add_development_dependency(%q<jeweler>, [">= 0"])
- else
- s.add_dependency(%q<chinese_pinyin>, [">= 0"])
- s.add_dependency(%q<jeweler>, [">= 0"])
- end
- else
- s.add_dependency(%q<chinese_pinyin>, [">= 0"])
- s.add_dependency(%q<jeweler>, [">= 0"])
- end
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.require_paths = ["lib"]
end
-
View
@@ -1,8 +1,9 @@
-# -*- encoding : utf-8 -*-
+# coding: utf-8
$KCODE = 'u' if RUBY_VERSION =~ /1\.8/
-class Pinyin
+require 'chinese_pinyin/version'
+class Pinyin
class <<self
attr_accessor :table
@@ -0,0 +1,4 @@
+# encoding: utf-8
+module ChinesePinyin
+ VERSION = "0.4.2"
+end

0 comments on commit 6d436ec

Please sign in to comment.