wycats-thor 0.11.4 → 0.11.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/CHANGELOG.rdoc +4 -2
  2. data/Thorfile +57 -0
  3. data/VERSION +1 -0
  4. data/lib/thor.rb +13 -6
  5. data/lib/thor/base.rb +4 -1
  6. data/lib/thor/invocation.rb +1 -1
  7. data/lib/thor/rake_compat.rb +67 -0
  8. data/lib/thor/runner.rb +12 -8
  9. data/lib/thor/shell/basic.rb +8 -4
  10. data/lib/thor/task.rb +9 -1
  11. data/lib/thor/util.rb +28 -8
  12. data/spec/actions/create_file_spec.rb +170 -0
  13. data/spec/actions/directory_spec.rb +118 -0
  14. data/spec/actions/empty_directory_spec.rb +91 -0
  15. data/spec/actions/file_manipulation_spec.rb +242 -0
  16. data/spec/actions/inject_into_file_spec.rb +80 -0
  17. data/spec/actions_spec.rb +291 -0
  18. data/spec/base_spec.rb +235 -0
  19. data/spec/core_ext/hash_with_indifferent_access_spec.rb +43 -0
  20. data/spec/core_ext/ordered_hash_spec.rb +115 -0
  21. data/spec/fixtures/bundle/execute.rb +6 -0
  22. data/spec/fixtures/doc/config.rb +1 -0
  23. data/spec/group_spec.rb +177 -0
  24. data/spec/invocation_spec.rb +107 -0
  25. data/spec/parser/argument_spec.rb +47 -0
  26. data/spec/parser/arguments_spec.rb +64 -0
  27. data/spec/parser/option_spec.rb +212 -0
  28. data/spec/parser/options_spec.rb +255 -0
  29. data/spec/rake_compat_spec.rb +64 -0
  30. data/spec/runner_spec.rb +204 -0
  31. data/spec/shell/basic_spec.rb +206 -0
  32. data/spec/shell/color_spec.rb +41 -0
  33. data/spec/shell_spec.rb +25 -0
  34. data/spec/spec_helper.rb +52 -0
  35. data/spec/task_spec.rb +82 -0
  36. data/spec/thor_spec.rb +234 -0
  37. data/spec/util_spec.rb +192 -0
  38. metadata +56 -36
  39. data/Rakefile +0 -6
  40. data/lib/thor/tasks.rb +0 -4
  41. data/lib/thor/tasks/install.rb +0 -35
  42. data/lib/thor/tasks/package.rb +0 -31
  43. data/lib/thor/tasks/spec.rb +0 -70
metadata CHANGED
@@ -1,76 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wycats-thor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.4
4
+ version: 0.11.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yehuda Katz
8
+ - "Jos\xC3\xA9 Valim"
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2009-08-03 00:00:00 -07:00
13
+ date: 2009-08-04 00:00:00 -07:00
13
14
  default_executable:
14
15
  dependencies: []
15
16
 
16
17
  description: A scripting framework that replaces rake, sake and rubigen
17
- email: wycats@gmail.com
18
+ email: ruby-thor@googlegroups.com
18
19
  executables:
19
20
  - thor
20
21
  - rake2thor
21
22
  extensions: []
22
23
 
23
24
  extra_rdoc_files:
24
- - README.rdoc
25
- - LICENSE
26
25
  - CHANGELOG.rdoc
27
- files:
28
- - README.rdoc
29
26
  - LICENSE
27
+ - README.rdoc
28
+ - Thorfile
29
+ - VERSION
30
+ files:
30
31
  - CHANGELOG.rdoc
31
- - Rakefile
32
+ - LICENSE
33
+ - README.rdoc
34
+ - Thorfile
35
+ - VERSION
32
36
  - bin/rake2thor
33
37
  - bin/thor
34
38
  - lib/thor.rb
35
- - lib/thor
36
- - lib/thor/error.rb
37
- - lib/thor/base.rb
38
- - lib/thor/group.rb
39
- - lib/thor/actions
40
- - lib/thor/actions/inject_into_file.rb
41
- - lib/thor/actions/directory.rb
39
+ - lib/thor/actions.rb
42
40
  - lib/thor/actions/create_file.rb
41
+ - lib/thor/actions/directory.rb
43
42
  - lib/thor/actions/empty_directory.rb
44
43
  - lib/thor/actions/file_manipulation.rb
45
- - lib/thor/util.rb
46
- - lib/thor/runner.rb
47
- - lib/thor/actions.rb
48
- - lib/thor/parser.rb
49
- - lib/thor/shell
50
- - lib/thor/shell/basic.rb
51
- - lib/thor/shell/color.rb
44
+ - lib/thor/actions/inject_into_file.rb
45
+ - lib/thor/base.rb
46
+ - lib/thor/core_ext/hash_with_indifferent_access.rb
47
+ - lib/thor/core_ext/ordered_hash.rb
48
+ - lib/thor/error.rb
49
+ - lib/thor/group.rb
52
50
  - lib/thor/invocation.rb
53
- - lib/thor/parser
51
+ - lib/thor/parser.rb
54
52
  - lib/thor/parser/argument.rb
53
+ - lib/thor/parser/arguments.rb
55
54
  - lib/thor/parser/option.rb
56
55
  - lib/thor/parser/options.rb
57
- - lib/thor/parser/arguments.rb
58
- - lib/thor/tasks.rb
59
- - lib/thor/core_ext
60
- - lib/thor/core_ext/hash_with_indifferent_access.rb
61
- - lib/thor/core_ext/ordered_hash.rb
62
- - lib/thor/tasks
63
- - lib/thor/tasks/install.rb
64
- - lib/thor/tasks/spec.rb
65
- - lib/thor/tasks/package.rb
56
+ - lib/thor/rake_compat.rb
57
+ - lib/thor/runner.rb
66
58
  - lib/thor/shell.rb
59
+ - lib/thor/shell/basic.rb
60
+ - lib/thor/shell/color.rb
67
61
  - lib/thor/task.rb
62
+ - lib/thor/util.rb
68
63
  has_rdoc: true
69
64
  homepage: http://yehudakatz.com
70
65
  licenses:
71
66
  post_install_message:
72
- rdoc_options: []
73
-
67
+ rdoc_options:
68
+ - --charset=UTF-8
74
69
  require_paths:
75
70
  - lib
76
71
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -92,5 +87,30 @@ rubygems_version: 1.3.5
92
87
  signing_key:
93
88
  specification_version: 3
94
89
  summary: A scripting framework that replaces rake, sake and rubigen
95
- test_files: []
96
-
90
+ test_files:
91
+ - spec/rake_compat_spec.rb
92
+ - spec/actions/directory_spec.rb
93
+ - spec/actions/empty_directory_spec.rb
94
+ - spec/actions/create_file_spec.rb
95
+ - spec/actions/inject_into_file_spec.rb
96
+ - spec/actions/file_manipulation_spec.rb
97
+ - spec/shell_spec.rb
98
+ - spec/invocation_spec.rb
99
+ - spec/base_spec.rb
100
+ - spec/task_spec.rb
101
+ - spec/spec_helper.rb
102
+ - spec/actions_spec.rb
103
+ - spec/shell/basic_spec.rb
104
+ - spec/shell/color_spec.rb
105
+ - spec/group_spec.rb
106
+ - spec/thor_spec.rb
107
+ - spec/fixtures/doc/config.rb
108
+ - spec/fixtures/bundle/execute.rb
109
+ - spec/util_spec.rb
110
+ - spec/parser/argument_spec.rb
111
+ - spec/parser/option_spec.rb
112
+ - spec/parser/options_spec.rb
113
+ - spec/parser/arguments_spec.rb
114
+ - spec/runner_spec.rb
115
+ - spec/core_ext/ordered_hash_spec.rb
116
+ - spec/core_ext/hash_with_indifferent_access_spec.rb
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- task :default => :install
2
-
3
- desc "install the gem locally"
4
- task :install do
5
- sh %{ruby "#{File.dirname(__FILE__)}/bin/thor" :install}
6
- end
@@ -1,4 +0,0 @@
1
- # This only loads all tasks inside tasks.
2
- Dir[File.join(File.dirname(__FILE__), "tasks", "*.rb")].each do |task|
3
- require task
4
- end
@@ -1,35 +0,0 @@
1
- class Thor
2
- # Creates an install task.
3
- #
4
- # ==== Parameters
5
- # spec<Gem::Specification>
6
- #
7
- # ==== Options
8
- # :dir - The directory where the package is hold before installation. Defaults to ./pkg.
9
- #
10
- def self.install_task(spec, options={})
11
- package_task(spec, options)
12
- tasks['install'] = Thor::InstallTask.new(spec, options)
13
- end
14
-
15
- class InstallTask < Task #:nodoc:
16
- attr_accessor :spec, :config
17
-
18
- def initialize(gemspec, config={})
19
- super(:install, "Install the gem", "install", {})
20
- @spec = gemspec
21
- @config = { :dir => File.join(Dir.pwd, "pkg") }.merge(config)
22
- end
23
-
24
- def run(instance, args=[])
25
- null, sudo, gem = RUBY_PLATFORM =~ /mswin|mingw/ ? ['NUL', '', 'gem.bat'] :
26
- ['/dev/null', 'sudo', 'gem']
27
-
28
- old_stderr, $stderr = $stderr.dup, File.open(null, "w")
29
- instance.invoke(:package)
30
- $stderr = old_stderr
31
-
32
- system %{#{sudo} #{Gem.ruby} -S #{gem} install #{config[:dir]}/#{spec.name}-#{spec.version} --no-rdoc --no-ri --no-update-sources}
33
- end
34
- end
35
- end
@@ -1,31 +0,0 @@
1
- require "fileutils"
2
-
3
- class Thor
4
- # Creates a package task.
5
- #
6
- # ==== Parameters
7
- # spec<Gem::Specification>
8
- #
9
- # ==== Options
10
- # :dir - The package directory. Defaults to ./pkg.
11
- #
12
- def self.package_task(spec, options={})
13
- tasks['package'] = Thor::PackageTask.new(spec, options)
14
- end
15
-
16
- class PackageTask < Task #:nodoc:
17
- attr_accessor :spec, :config
18
-
19
- def initialize(gemspec, config={})
20
- super(:package, "Build a gem package", "package", {})
21
- @spec = gemspec
22
- @config = {:dir => File.join(Dir.pwd, "pkg")}.merge(config)
23
- end
24
-
25
- def run(instance, args=[])
26
- FileUtils.mkdir_p(config[:dir])
27
- Gem::Builder.new(spec).build
28
- FileUtils.mv(spec.file_name, File.join(config[:dir], spec.file_name))
29
- end
30
- end
31
- end
@@ -1,70 +0,0 @@
1
- require "fileutils"
2
-
3
- class Thor
4
- # Creates a spec task.
5
- #
6
- # ==== Parameters
7
- # files<Array> - Array of files to spec
8
- #
9
- # ==== Options
10
- # :name - The name of the task. It can be rcov or spec. Spec is the default.
11
- # :rcov - A hash with rcov specific options.
12
- # :rcov_dir - Where rcov reports should be printed.
13
- # :verbose - Sets the default value for verbose, although it can be specified
14
- # also through the command line.
15
- #
16
- # All other options are added to rspec.
17
- #
18
- def self.spec_task(files, options={}) #:nodoc:
19
- name = (options.delete(:name) || 'spec').to_s
20
- tasks[name] = Thor::SpecTask.new(name, files, options)
21
- end
22
-
23
- class SpecTask < Task #:nodoc:
24
- attr_accessor :name, :files, :rcov_dir, :rcov_config, :spec_config
25
-
26
- def initialize(name, files, config={})
27
- options = { :verbose => Thor::Option.parse(:verbose, config.delete(:verbose) || false) }
28
- super(name, "#{name.capitalize} task", name, options)
29
-
30
- @name = name
31
- @files = files.map{ |f| %["#{f}"] }.join(" ")
32
- @rcov_dir = config.delete(:rdoc_dir) || File.join(Dir.pwd, 'coverage')
33
- @rcov_config = config.delete(:rcov) || {}
34
- @spec_config = { :format => 'specdoc', :color => true }.merge(config)
35
- end
36
-
37
- def run(instance, args=[])
38
- rcov_opts = Thor::Options.to_switches(rcov_config)
39
- spec_opts = Thor::Options.to_switches(spec_config)
40
-
41
- require 'rbconfig'
42
- cmd = RbConfig::CONFIG['ruby_install_name'] << " "
43
-
44
- if rcov?
45
- FileUtils.rm_rf(rcov_dir)
46
- cmd << "-S #{where('rcov')} -o #{rcov_dir} #{rcov_opts} "
47
- end
48
-
49
- cmd << [where('spec'), rcov? ? " -- " : nil, files, spec_opts].join(" ")
50
-
51
- puts cmd if instance.options.verbose?
52
- system(cmd)
53
- exit($?.exitstatus)
54
- end
55
-
56
- private
57
-
58
- def rcov?
59
- name == "rcov"
60
- end
61
-
62
- def where(file)
63
- ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
64
- file_with_path = File.join(path, file)
65
- next unless File.exist?(file_with_path) && File.executable?(file_with_path)
66
- return File.expand_path(file_with_path)
67
- end
68
- end
69
- end
70
- end