Permalink
Browse files

Merge branch 'develop'

  • Loading branch information...
ongaeshi committed May 5, 2012
2 parents fd2bc4d + bc6e990 commit ed7cada95b3db458f1b9e5a2efe8ec2fdcfb71bc
View
@@ -10,6 +10,7 @@ doc
# bundler
.bundle
+Gemfile.lock
# jeweler generated
pkg
View
@@ -2,11 +2,10 @@ source "http://rubygems.org"
# Add dependencies required to use your gem here.
# Example:
# gem "activesupport", ">= 2.3.5"
-
+gemspec
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
- gem "bundler", "~> 1.0.0"
- gem "jeweler", "~> 1.5.2"
- gem "rcov", ">= 0"
+ gem "bundler"
+ gem "jeweler"
end
View
@@ -1,18 +0,0 @@
-GEM
- remote: http://rubygems.org/
- specs:
- git (1.2.5)
- jeweler (1.5.2)
- bundler (~> 1.0.0)
- git (>= 1.2.5)
- rake
- rake (0.8.7)
- rcov (0.9.9)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- bundler (~> 1.0.0)
- jeweler (~> 1.5.2)
- rcov
View
@@ -1,3 +1,24 @@
+=== 0.7.0 2012/05/05
+
+* milk
+ * 'milk add git://..' に対応、update時に`git pull`するように
+ * Thor を利用するように (thanks tomykaira)
+
+* gmilk
+ * gotolineモード(-g)で、複数のパスを渡せるように
+ * 例: gmilk -g VERSION:1 bin/milk:9 bin/gmilk:9 lib/milkode/cdweb/app.rb:23
+ * Windows環境(SJIS) + Ruby1.9 でエンコーディングエラーが起きる問題を修正
+
+* milk web
+ * カスタマイズしても<title></title>部分がMilkodeのままになっていた問題を修正
+ * 現在位置検索が正しく動いてない問題を修正
+
+* common
+ * Package#options[:update_with_git_pull] を追加
+ * Gemfile.lock を無視した (thanks tomykaira)
+ * Remove dependency on rcov (thanks tomykaira)
+ * 環境によってYAMLオブジェクトの構文が異なり、テストが落ちる可能性があるのを対策 (thanks tomykaira)
+
=== 0.6.0 2012/03/28
* milk web
View
@@ -1,3 +1,17 @@
+=== 0.7.0 2012/05/05
+
+* milk
+ * `milk add git://..` to enabled. When you update `git pull` like you.
+ * Use Thor
+* gmilk
+ * gotoline mode(-g) enabled multi args.
+ * Sample: gmilk -g VERSION:1 bin/milk:9 bin/gmilk:9 lib/milkode/cdweb/app.rb:23
+ * Windows(SJIS) + Ruby1.9 support
+* milk web
+ * Bug fix
+* common
+ * Bug fix
+
=== 0.6.0 2012/03/28
* milk web
View
@@ -23,7 +23,7 @@ Jeweler::Tasks.new do |gem|
# Include your dependencies below. Runtime dependencies are required when using your gem,
gem.add_runtime_dependency 'termcolor','>= 1.2.0'
- gem.add_runtime_dependency 'rroonga','>= 1.1.0','<2.0'
+ gem.add_runtime_dependency 'rroonga','>= 1.1.0'
gem.add_runtime_dependency 'rack','>=1.3.4'
gem.add_runtime_dependency 'sinatra', '>=1.2.6'
gem.add_runtime_dependency 'launchy', '>=0.3.7'
@@ -32,6 +32,7 @@ Jeweler::Tasks.new do |gem|
gem.add_runtime_dependency 'archive-zip', '>=0.4.0'
gem.add_runtime_dependency 'haml', '>=3.1.2'
gem.add_runtime_dependency 'sass', '>=3.1.3'
+ gem.add_runtime_dependency 'thor', '~> 0.15.0'
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
# gem.add_development_dependency 'rspec', '> 1.2.3'
@@ -67,13 +68,6 @@ task :test_all do
system('rake test')
end
-# require 'rcov/rcovtask'
-# Rcov::RcovTask.new do |test|
-# test.libs << 'test'
-# test.pattern = 'test/**/test_*.rb'
-# test.verbose = true
-# end
-
task :default => :test
require 'rdoc/task'
View
@@ -1 +1 @@
-0.6.0
+0.7.0
View
@@ -6,5 +6,5 @@
require 'rubygems'
require 'milkode/grep/cli_grep'
-Version = "0.6.0"
+Version = "0.7.0"
Milkode::CLI_Grep.execute(STDOUT, ARGV)
View
6 bin/milk 100644 → 100755
@@ -4,7 +4,7 @@
# Copyright (c) 2010. All rights reserved.
require 'rubygems'
-require 'milkode/cdstk/cli_cdstk'
+require 'milkode/cli'
-Version = "0.6.0"
-Milkode::CLI_Cdstk.execute(STDOUT, ARGV)
+Version = "0.7.0"
+Milkode::CLI.start(ARGV)
View
@@ -9,6 +9,7 @@
require 'milkode/common/grenfiletest'
require 'milkode/common/util'
require 'milkode/common/dir'
+require 'milkode/findgrep/findgrep'
include Milkode
require 'kconv'
begin
@@ -66,7 +67,7 @@ def init(options)
end
end
- def compatible?
+ def assert_compatible
db_open(db_file)
end
@@ -75,7 +76,7 @@ def update_all
db_open(db_file)
@yaml.contents.each do |package|
- update_dir_in(package.directory)
+ update_package_in(package)
end
end
end
@@ -93,7 +94,7 @@ def update(args, options)
if (package)
print_result do
db_open(db_file)
- update_dir_in(package.directory)
+ update_package_in(package)
end
else
@out.puts "Not registered. If you want to add, 'milk add #{path}'."
@@ -104,7 +105,7 @@ def update(args, options)
args.each do |name|
package = @yaml.find_name(name)
if (package)
- update_dir_in(package.directory)
+ update_package_in(package)
else
@out.puts "Not found package '#{name}'."
return
@@ -115,12 +116,8 @@ def update(args, options)
end
end
- def update_package(dir)
+ def update_for_grep(dir)
db_open(db_file)
- update_dir(dir)
- end
-
- def update_dir(dir)
update_dir_in(dir)
end
@@ -140,34 +137,44 @@ def add(dirs, options)
# YAMLに追加
package = Package.create(dir, options[:ignore])
add_yaml(package)
- set_yaml_options(package, options)
+
+ # オプション設定
+ is_update_with_git_pull = git_url?(v)
+ set_yaml_options(package, options, is_update_with_git_pull)
# アップデート
- update_dir(dir)
+ update_dir_in(dir)
end
rescue ConvetError
return
end
end
end
- def set_yaml_options(package, src)
+ def set_yaml_options(package, options, is_update_with_git_pull)
is_dirty = false
- if src[:no_auto_ignore]
+ if options[:no_auto_ignore]
dst = package.options
dst[:no_auto_ignore] = true
package.set_options(dst)
is_dirty = true
end
- if src[:name]
+ if options[:name]
dst = package.options
dst[:name] = src[:name]
package.set_options(dst)
is_dirty = true
end
+ if is_update_with_git_pull
+ dst = package.options
+ dst[:update_with_git_pull] = is_update_with_git_pull
+ package.set_options(dst)
+ is_dirty = true
+ end
+
if is_dirty
@yaml.update(package)
@yaml.save
@@ -177,7 +184,7 @@ def set_yaml_options(package, src)
def add_dir(dir, no_yaml = false)
add_yaml(Package.create(dir)) unless no_yaml
db_open(db_file)
- update_dir(dir)
+ update_dir_in(dir)
end
# yamlにパッケージを追加
@@ -236,11 +243,18 @@ def extract_file(src)
def download_file(src)
if (src =~ /^https?:/)
download_file_in(src)
+ elsif (git_url? src)
+ git_clone_in(src)
else
src
end
end
+ def git_url?(src)
+ (src =~ /^git:/) != nil
+ end
+ private :git_url?
+
def download_file_in(url)
alert("download", "#{url}")
@@ -258,6 +272,23 @@ def download_file_in(url)
filename
end
+ def git_clone_in(url)
+ alert("git", url)
+
+ dst_dir = File.join(@db_dir, "packages/git")
+ # FileUtils.mkdir_p dst_dir
+
+ filename = File.join(dst_dir, File.basename(url).sub(/\.git\Z/, ""))
+
+ # git output progress to stderr.
+ # `git clone #{url} #{filename} 2>&1`
+
+ # with output
+ system("git clone #{url} #{filename}")
+
+ filename
+ end
+
def remove_all
print_result do
list([], {:verbose => true})
@@ -481,14 +512,14 @@ def dir(args, options)
end
end
- def setdb(args, options)
+ def setdb(dbpath, options)
if (options[:reset])
CdstkCommand.setdb_reset
@out.puts "Reset default db\n remove: #{Dbdir.milkode_db_dir}\n default_db: #{Dbdir.default_dir}"
- elsif (args.empty?)
+ elsif (dbpath.nil?)
@out.puts Dbdir.default_dir
else
- path = File.expand_path(args[0])
+ path = File.expand_path(dbpath)
begin
CdstkCommand.setdb_set path
@out.puts "Set default db #{path}."
@@ -498,8 +529,9 @@ def setdb(args, options)
end
end
- def mcd(args, options)
- @out.print <<EOF
+ def mcd(options)
+ if options[:shell] != 'cygwin'
+ @out.print <<EOF
# Copy to '.bashrc'.
mcd() {
local args="$1 $2 $3 $4 $5 $6 $7 $8 $9"
@@ -514,7 +546,11 @@ def mcd(args, options)
pwd
fi
}
+EOF
+ end
+ if options[:shell] != 'sh'
+ @out.print <<EOF
# For Cygwin.
mcd() {
local args="$1 $2 $3 $4 $5 $6 $7 $8 $9"
@@ -530,9 +566,10 @@ def mcd(args, options)
fi
}
EOF
+ end
end
- def info(args, options)
+ def info
milkode_info
end
@@ -547,12 +584,12 @@ def ignore(args, options)
raise IgnoreError, "Not a package dir: '#{current_dir}'" unless package
end
- if options[:test]
+ if options[:dry_run]
# Test mode
db_open(db_file)
@is_display_info = true
@is_silent = true
- update_dir(package.directory)
+ update_dir_in(package.directory)
elsif options[:delete_all]
# Delete all
package.set_ignore([])
@@ -613,6 +650,14 @@ def yaml_file
YamlFileWrapper.yaml_file @db_dir
end
+ def update_package_in(package)
+ if package.options[:update_with_git_pull]
+ Dir.chdir(package.directory) { system("git pull") }
+ end
+
+ update_dir_in(package.directory)
+ end
+
def update_dir_in(dir)
alert("package", File.basename(dir) )
@package_count += 1
Oops, something went wrong.

0 comments on commit ed7cada

Please sign in to comment.