thor 0.11.7 → 0.11.8

Sign up to get free protection for your applications and to get access to all the features.
data/Thorfile CHANGED
@@ -1,4 +1,6 @@
1
- require 'rubygems'
1
+ # enconding: utf-8
2
+
3
+ require File.join(File.dirname(__FILE__), "lib", "thor", "version")
2
4
  require 'thor/rake_compat'
3
5
  require 'spec/rake/spectask'
4
6
  require 'rdoc/task'
@@ -10,11 +12,13 @@ class Default < Thor
10
12
  include Thor::RakeCompat
11
13
 
12
14
  Spec::Rake::SpecTask.new(:spec) do |t|
15
+ t.libs << 'lib'
13
16
  t.spec_opts = ['--options', "spec/spec.opts"]
14
17
  t.spec_files = FileList['spec/**/*_spec.rb']
15
18
  end
16
19
 
17
20
  Spec::Rake::SpecTask.new(:rcov) do |t|
21
+ t.libs << 'lib'
18
22
  t.spec_opts = ['--options', "spec/spec.opts"]
19
23
  t.spec_files = FileList['spec/**/*_spec.rb']
20
24
  t.rcov = true
@@ -34,6 +38,7 @@ class Default < Thor
34
38
  require 'jeweler'
35
39
  Jeweler::Tasks.new do |s|
36
40
  s.name = GEM_NAME
41
+ s.version = Thor::VERSION
37
42
  s.rubyforge_project = "textmate"
38
43
  s.platform = Gem::Platform::RUBY
39
44
  s.summary = "A scripting framework that replaces rake, sake and rubigen"
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'rubygems'
4
3
  require 'ruby2ruby'
5
4
  require 'parse_tree'
6
5
  if Ruby2Ruby::VERSION >= "1.2.0"
data/bin/thor CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- mode: ruby -*-
3
3
 
4
- require File.join(File.dirname(__FILE__), '..', 'lib', 'thor')
4
+ require 'thor'
5
5
  require 'thor/runner'
6
6
 
7
7
  Thor::Runner.start
@@ -1,4 +1,3 @@
1
- $:.unshift File.expand_path(File.dirname(__FILE__))
2
1
  require 'thor/base'
3
2
  require 'thor/group'
4
3
  require 'thor/actions'
@@ -73,7 +73,9 @@ class Thor
73
73
 
74
74
  case file_source
75
75
  when /\.empty_directory$/
76
- base.empty_directory(File.dirname(file_destination), config)
76
+ dirname = File.dirname(file_destination).gsub(/\/\.$/, '')
77
+ next if dirname == given_destination
78
+ base.empty_directory(dirname, config)
77
79
  when /\.tt$/
78
80
  base.template(file_source, file_destination[0..-4], config)
79
81
  else
@@ -22,7 +22,8 @@ class Thor
22
22
 
23
23
  def self.included(base)
24
24
  # Hack. Make rakefile point to invoker, so rdoc task is generated properly.
25
- Rake.application.instance_variable_set(:@rakefile, caller[0].match(/(.*):\d+/)[1])
25
+ rakefile = File.basename(caller[0].match(/(.*):\d+/)[1])
26
+ Rake.application.instance_variable_set(:@rakefile, rakefile)
26
27
  self.rake_classes << base
27
28
  end
28
29
  end
@@ -215,7 +215,7 @@ class Thor::Runner < Thor #:nodoc:
215
215
  # 5. c:\ <-- no Thorfiles found!
216
216
  #
217
217
  def thorfiles(relevant_to=nil, skip_lookup=false)
218
- # Deal with deprecated thor when :namespaces: is available as constants
218
+ # TODO Remove this dealing with deprecated thor when :namespaces: is available as constants
219
219
  save_yaml(thor_yaml) if Thor::Util.convert_constants_to_namespaces(thor_yaml)
220
220
 
221
221
  thorfiles = []
@@ -1,11 +1,17 @@
1
+ require 'rbconfig'
1
2
  require 'thor/shell/color'
2
3
 
3
4
  class Thor
4
5
  module Base
5
- # Returns the shell used in all Thor classes. Default to color one.
6
+ # Returns the shell used in all Thor classes. If you are in a Unix platform
7
+ # it will use a colored log, otherwise it will use a basic one without color.
6
8
  #
7
9
  def self.shell
8
- @shell ||= Thor::Shell::Color
10
+ @shell ||= if Config::CONFIG['host_os'] =~ /mswin|mingw/
11
+ Thor::Shell::Basic
12
+ else
13
+ Thor::Shell::Color
14
+ end
9
15
  end
10
16
 
11
17
  # Sets the shell used in all Thor classes.
@@ -209,7 +209,7 @@ class Thor
209
209
  # Returns the root where thor files are located, dependending on the OS.
210
210
  #
211
211
  def self.thor_root
212
- File.join(user_home, ".thor")
212
+ File.join(user_home, ".thor").gsub(/\\/, '/')
213
213
  end
214
214
 
215
215
  # Returns the files in the thor root. On Windows thor_root will be something
@@ -220,7 +220,7 @@ class Thor
220
220
  # If we don't #gsub the \ character, Dir.glob will fail.
221
221
  #
222
222
  def self.thor_root_glob
223
- files = Dir["#{thor_root.gsub(/\\/, '/')}/*"]
223
+ files = Dir["#{thor_root}/*"]
224
224
 
225
225
  files.map! do |file|
226
226
  File.directory?(file) ? File.join(file, "main.thor") : file
@@ -0,0 +1,3 @@
1
+ class Thor
2
+ VERSION = "0.11.8".freeze
3
+ end
@@ -96,6 +96,11 @@ describe Thor::Actions::Directory do
96
96
  File.exists?(file).must be_true
97
97
  end
98
98
 
99
+ it "does not copy empty directories twice" do
100
+ content = invoke!("doc/components", "docs/components")
101
+ content.must_not =~ /exist/
102
+ end
103
+
99
104
  it "logs status" do
100
105
  content = invoke!("doc")
101
106
  content.must =~ /create doc\/README/
@@ -27,6 +27,10 @@ class ThorTask < Thor
27
27
  end
28
28
 
29
29
  describe Thor::RakeCompat do
30
+ it "sets the rakefile application" do
31
+ ["rake_compat_spec.rb", "Thorfile"].must include(Rake.application.rakefile)
32
+ end
33
+
30
34
  it "adds rake tasks to thor classes too" do
31
35
  task = ThorTask.tasks["cool"]
32
36
  task.must be
@@ -1,9 +1,9 @@
1
1
  $TESTING=true
2
2
 
3
- $:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
4
-
3
+ $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
5
4
  require 'thor'
6
5
  require 'stringio'
6
+
7
7
  require 'rubygems'
8
8
  require 'rr'
9
9
  require 'diff/lcs' # You need diff/lcs installed to run specs (but not to run Thor).
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.7
4
+ version: 0.11.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yehuda Katz
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-09-22 00:00:00 -03:00
13
+ date: 2009-10-21 00:00:00 -02:00
14
14
  default_executable:
15
15
  dependencies: []
16
16
 
@@ -26,13 +26,11 @@ extra_rdoc_files:
26
26
  - LICENSE
27
27
  - README.rdoc
28
28
  - Thorfile
29
- - VERSION
30
29
  files:
31
30
  - CHANGELOG.rdoc
32
31
  - LICENSE
33
32
  - README.rdoc
34
33
  - Thorfile
35
- - VERSION
36
34
  - bin/rake2thor
37
35
  - bin/thor
38
36
  - lib/thor.rb
@@ -60,6 +58,7 @@ files:
60
58
  - lib/thor/shell/color.rb
61
59
  - lib/thor/task.rb
62
60
  - lib/thor/util.rb
61
+ - lib/thor/version.rb
63
62
  has_rdoc: true
64
63
  homepage: http://yehudakatz.com
65
64
  licenses: []
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.11.7