matthewtodd-shoe 0.1.5 → 0.1.6

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/Rakefile +1 -1
  2. data/bin/shoe +15 -1
  3. data/lib/shoe.rb +25 -24
  4. data/shoe.gemspec +36 -0
  5. metadata +3 -2
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
2
2
  require 'shoe'
3
3
 
4
- Shoe.tie('shoe', '0.1.5', "You probably don't want to use Shoe.") do |spec|
4
+ Shoe.tie('shoe', '0.1.6', "You probably don't want to use Shoe.") do |spec|
5
5
  spec.remove_development_dependency_on_shoe
6
6
  spec.requirements = ['git']
7
7
  spec.add_runtime_dependency 'cucumber'
data/bin/shoe CHANGED
@@ -4,8 +4,10 @@ if File.exists?('Rakefile')
4
4
  abort 'Rakefile exists. Not clobbering.'
5
5
  end
6
6
 
7
+ project_name = File.basename(File.expand_path(Dir.pwd))
8
+
7
9
  File.open('Rakefile', 'w') do |file|
8
- file.write <<-END_RAKEFILE.gsub('NAME', File.basename(File.expand_path(Dir.pwd)))
10
+ file.write <<-END_RAKEFILE.gsub('NAME', project_name)
9
11
  this_rakefile_uses_shoe = <<END
10
12
  ----------------------------------------
11
13
  Please install Shoe:
@@ -27,3 +29,15 @@ Shoe.tie('NAME', '0.1.0', 'TODO write a summary of NAME here.') do |spec|
27
29
  end
28
30
  END_RAKEFILE
29
31
  end
32
+
33
+ if File.exists?('README.rdoc')
34
+ abort 'README.rdoc exists. Not clobbering.'
35
+ end
36
+
37
+ File.open('README.rdoc', 'w') do |file|
38
+ file.write <<-END_README.gsub('NAME', project_name.capitalize)
39
+ = NAME
40
+
41
+ NAME is one of my favorite things! Let me tell you about it:
42
+ END_README
43
+ end
data/lib/shoe.rb CHANGED
@@ -28,7 +28,7 @@ class Shoe
28
28
  spec.name = name
29
29
  spec.version = version
30
30
  spec.summary = summary
31
- spec.files = FileList['Rakefile', '*.rdoc', 'bin/**/*', 'features/**/*', 'lib/**/*', 'resources/**/*', 'test/**/*'].to_a
31
+ spec.files = FileList['Rakefile', '*.gemspec', '*.rdoc', 'bin/**/*', 'features/**/*', 'lib/**/*', 'resources/**/*', 'test/**/*'].to_a
32
32
  spec.executables = everything_in_the_bin_directory
33
33
  spec.rdoc_options = %W(--main README.rdoc --title #{name}-#{version} --inline-source) # MAYBE include --all, so that we document private methods?
34
34
  spec.extra_rdoc_files = FileList['*.rdoc'].to_a
@@ -45,25 +45,32 @@ class Shoe
45
45
 
46
46
  # This is where the magic happens.
47
47
  def define_tasks
48
- desc 'Remove ignored files'
49
- task :clean do
50
- sh 'git clean -fdX'
48
+ if File.directory?('.git')
49
+ desc 'Remove ignored files'
50
+ task :clean do
51
+ sh 'git clean -fdX'
52
+ end
51
53
  end
52
54
 
53
- desc 'Generate documentation'
54
- task :rdoc do
55
- LocalDocManager.new(spec).generate_rdoc
56
- sh 'open rdoc/index.html' if RUBY_PLATFORM =~ /darwin/
55
+ if File.directory?('lib')
56
+ desc 'Generate documentation'
57
+ task :rdoc do
58
+ LocalDocManager.new(spec).generate_rdoc
59
+ sh 'open rdoc/index.html' if RUBY_PLATFORM =~ /darwin/
60
+ end
57
61
  end
58
62
 
59
- desc 'Run an irb console'
60
- task :shell do
61
- # MAYBE include -Iext. I think I'd like to wait until I handle C extensions in general.
62
- exec 'irb', '-Ilib', "-r#{spec.name}"
63
+ if File.file?("lib/#{spec.name}.rb")
64
+ desc 'Run an irb console'
65
+ task :shell do
66
+ # MAYBE include -Iext. I think I'd like to wait until I handle C extensions in general.
67
+ exec 'irb', '-Ilib', "-r#{spec.name}"
68
+ end
63
69
  end
64
70
 
65
71
  if File.directory?('test')
66
72
  require 'rake/testtask'
73
+ # MAYBE be a little more forgiving in test selection, using test/**/*_test.rb. Or create suites based on subdirectory?
67
74
  Rake::TestTask.new { |task| task.pattern = 'test/*_test.rb' }
68
75
  default_depends_on(:test)
69
76
  end
@@ -74,7 +81,7 @@ class Shoe
74
81
  default_depends_on(:features)
75
82
  end
76
83
 
77
- if these_shell_commands_all_succeed(there_is_no_tag_for_the_current_version, we_are_on_the_master_branch, there_is_a_remote_called_origin)
84
+ if there_is_no_tag_for_the_current_version && we_are_on_the_master_branch && we_have_already_pushed_the_master_branch_to_a_remote_called_origin
78
85
  desc "Release #{spec.name}-#{spec.version}"
79
86
  task :release do
80
87
  File.open("#{spec.name}.gemspec", 'w') { |f| f.write spec.to_ruby }
@@ -98,25 +105,19 @@ class Shoe
98
105
  File.directory?('bin') ? Dir.entries('bin') - ['.', '..'] : []
99
106
  end
100
107
 
101
- # I'm guessing it's a little faster shell out to all these commands
102
- # together, rather than running each one separately.
103
- def these_shell_commands_all_succeed(*commands)
104
- system(commands.join(' && '))
105
- end
106
-
107
108
  def there_is_no_tag_for_the_current_version
108
- "[[ -z `git tag -l #{spec.version}` ]]"
109
+ !File.file?(".git/refs/tags/#{spec.version}")
109
110
  end
110
111
 
111
112
  def we_are_on_the_master_branch
112
- "git branch | grep -q '* master'"
113
+ File.file?('.git/HEAD') && File.read('.git/HEAD').strip == 'ref: refs/heads/master'
113
114
  end
114
115
 
115
- def there_is_a_remote_called_origin
116
- 'git remote | grep -q origin'
116
+ def we_have_already_pushed_the_master_branch_to_a_remote_called_origin
117
+ File.file?('.git/refs/remotes/origin/master')
117
118
  end
118
119
 
119
- # Using Gem::DocManager instead of Rake::RdocTask means you get to see your
120
+ # Using Gem::DocManager instead of Rake::RDocTask means you get to see your
120
121
  # rdoc *exactly* as users who install your gem will.
121
122
  class LocalDocManager < Gem::DocManager #:nodoc:
122
123
  def initialize(spec)
data/shoe.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{shoe}
5
+ s.version = "0.1.6"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Matthew Todd"]
9
+ s.date = %q{2009-07-24}
10
+ s.default_executable = %q{shoe}
11
+ s.email = %q{matthew.todd@gmail.com}
12
+ s.executables = ["shoe"]
13
+ s.extra_rdoc_files = ["README.rdoc"]
14
+ s.files = ["Rakefile", "shoe.gemspec", "README.rdoc", "bin/shoe", "lib/shoe.rb"]
15
+ s.rdoc_options = ["--main", "README.rdoc", "--title", "shoe-0.1.6", "--inline-source"]
16
+ s.require_paths = ["lib"]
17
+ s.requirements = ["git"]
18
+ s.rubygems_version = %q{1.3.5}
19
+ s.summary = %q{You probably don't want to use Shoe.}
20
+
21
+ if s.respond_to? :specification_version then
22
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
26
+ s.add_runtime_dependency(%q<cucumber>, [">= 0"])
27
+ s.add_runtime_dependency(%q<rake>, [">= 0"])
28
+ else
29
+ s.add_dependency(%q<cucumber>, [">= 0"])
30
+ s.add_dependency(%q<rake>, [">= 0"])
31
+ end
32
+ else
33
+ s.add_dependency(%q<cucumber>, [">= 0"])
34
+ s.add_dependency(%q<rake>, [">= 0"])
35
+ end
36
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matthewtodd-shoe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Todd
@@ -42,6 +42,7 @@ extra_rdoc_files:
42
42
  - README.rdoc
43
43
  files:
44
44
  - Rakefile
45
+ - shoe.gemspec
45
46
  - README.rdoc
46
47
  - bin/shoe
47
48
  - lib/shoe.rb
@@ -52,7 +53,7 @@ rdoc_options:
52
53
  - --main
53
54
  - README.rdoc
54
55
  - --title
55
- - shoe-0.1.5
56
+ - shoe-0.1.6
56
57
  - --inline-source
57
58
  require_paths:
58
59
  - lib