matthewtodd-shoe 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.rdoc +24 -0
  2. data/Rakefile +8 -0
  3. data/bin/shoe +27 -0
  4. data/lib/shoe.rb +104 -0
  5. metadata +79 -0
data/README.rdoc ADDED
@@ -0,0 +1,24 @@
1
+ = Shoe
2
+
3
+ You probably don't want to use Shoe -- especially if you're like me!
4
+
5
+ I like tinkering with my build scripts. That's why I don't use hoe and jeweler and those guys, even though they're awesome. I like to put my own thing together, so I made Shoe.
6
+
7
+ == Install
8
+
9
+ gem sources --add http://gems.github.com
10
+ gem install matthewtodd-shoe
11
+
12
+ == Use
13
+
14
+ cd myproject
15
+ shoe # create a Rakefile
16
+ rake -T # see what you get
17
+
18
+ mkdir test
19
+ rake -T
20
+
21
+ mkdir features
22
+ rake -T
23
+
24
+ And that's about it. There's also a :release task that will pop up when you have a git remote called "origin", you're on the master branch, and you don't have a tag with the current version number.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
2
+ require 'shoe'
3
+
4
+ Shoe.tie('shoe', '0.1.0', "You probably don't want to use Shoe.") do |spec|
5
+ spec.remove_development_dependency_on_shoe
6
+ spec.add_runtime_dependency 'cucumber'
7
+ spec.add_runtime_dependency 'rake'
8
+ end
data/bin/shoe ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if File.exists?('Rakefile')
4
+ abort 'Rakefile exists. Not clobbering.'
5
+ else
6
+ project_name = File.basename(File.expand_path(Dir.pwd))
7
+ File.open('Rakefile', 'w') { |file| file.write(DATA.read.gsub('NAME', project_name)) }
8
+ end
9
+
10
+ __END__
11
+ begin
12
+ gem 'matthewtodd-shoe'
13
+ rescue Gem::LoadError
14
+ abort <<-END
15
+ ----------------------------------------
16
+ Please install Shoe:
17
+ gem sources --add http://gems.github.com
18
+ gem install matthewtodd-shoe
19
+ ----------------------------------------
20
+ END
21
+ else
22
+ require 'shoe'
23
+ end
24
+
25
+ Shoe.tie('NAME', '0.1.0', 'TODO write a summary of NAME here.') do |spec|
26
+ # spec.add_development_dependency 'thoughtbot-shoulda'
27
+ end
data/lib/shoe.rb ADDED
@@ -0,0 +1,104 @@
1
+ require 'pathname'
2
+ require 'rubygems/doc_manager'
3
+
4
+ require 'cucumber/rake/task'
5
+ require 'rake/testtask'
6
+
7
+ class Shoe
8
+ def self.tie(name, version, summary)
9
+ shoe = new(name, version, summary)
10
+ yield shoe.spec if block_given?
11
+ shoe.define_tasks
12
+ end
13
+
14
+ attr_reader :spec
15
+
16
+ def initialize(name, version, summary)
17
+ @spec = Gem::Specification.new do |spec|
18
+ spec.name = name
19
+ spec.version = version
20
+ spec.summary = summary
21
+ spec.files = FileList['Rakefile', '*.rdoc', 'bin/**/*', 'features/**/*', 'lib/**/*', 'test/**/*'].to_a
22
+ spec.executables = executables
23
+ spec.rdoc_options = %W(--main README.rdoc --title #{name}-#{version} --inline-source)
24
+ spec.extra_rdoc_files = FileList['*.rdoc'].to_a
25
+ spec.has_rdoc = true
26
+ spec.author = `git config --get user.name`.chomp
27
+ spec.email = `git config --get user.email`.chomp
28
+ spec.add_development_dependency 'matthewtodd-shoe'
29
+ end
30
+
31
+ def @spec.remove_development_dependency_on_shoe
32
+ dependencies.delete_if { |d| d.name == 'matthewtodd-shoe' }
33
+ end
34
+ end
35
+
36
+ def define_tasks
37
+ desc 'Remove ignored files'
38
+ task :clean do
39
+ sh 'git clean -fdX'
40
+ end
41
+
42
+ desc 'Generate documentation'
43
+ task :rdoc do
44
+ DocManager.new(local_spec).generate_rdoc
45
+ end
46
+
47
+ desc 'Generate gemspec'
48
+ task :gemspec do
49
+ File.open("#{spec.name}.gemspec", 'w') do |f|
50
+ f.write spec.to_ruby
51
+ end
52
+ end
53
+
54
+ if Pathname.pwd.join('test').directory?
55
+ Rake::TestTask.new { |task| task.pattern = 'test/*_test.rb' }
56
+ default_depends_on(:test)
57
+ end
58
+
59
+ if Pathname.pwd.join('features').directory?
60
+ Cucumber::Rake::Task.new('features', 'Run features')
61
+ default_depends_on(:features)
62
+ end
63
+
64
+ if system("git branch | grep '* master' > /dev/null") && system('git remote | grep origin > /dev/null')
65
+ unless system("git tag | grep #{spec.version} > /dev/null")
66
+ desc "Release #{spec.name}-#{spec.version}"
67
+ task :release => :gemspec do
68
+ sh "git commit -a -m 'Release #{spec.version}'"
69
+ sh "git tag #{spec.version}"
70
+ sh 'git push'
71
+ sh 'git push --tags'
72
+ end
73
+ end
74
+ end
75
+ end
76
+
77
+ private
78
+
79
+ def default_depends_on(task_name)
80
+ desc Rake.application.lookup(task_name).comment
81
+ task :default => task_name
82
+ end
83
+
84
+ def executables
85
+ bin = Pathname.pwd.join('bin')
86
+ bin.directory? ? bin.children.map { |child| child.basename.to_s } : []
87
+ end
88
+
89
+ def local_spec
90
+ local_spec = spec.dup
91
+ def local_spec.full_gem_path
92
+ Pathname.pwd
93
+ end
94
+ local_spec
95
+ end
96
+
97
+ class DocManager < Gem::DocManager #:nodoc:
98
+ def initialize(spec)
99
+ @spec = spec
100
+ @doc_dir = Pathname.pwd
101
+ @rdoc_args = []
102
+ end
103
+ end
104
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: matthewtodd-shoe
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Matthew Todd
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-07-11 00:00:00 -07:00
13
+ default_executable: shoe
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: cucumber
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ description:
36
+ email: matthew.todd@gmail.com
37
+ executables:
38
+ - shoe
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - README.rdoc
43
+ files:
44
+ - Rakefile
45
+ - README.rdoc
46
+ - bin/shoe
47
+ - lib/shoe.rb
48
+ has_rdoc: false
49
+ homepage:
50
+ post_install_message:
51
+ rdoc_options:
52
+ - --main
53
+ - README.rdoc
54
+ - --title
55
+ - shoe-0.1.0
56
+ - --inline-source
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "0"
70
+ version:
71
+ requirements: []
72
+
73
+ rubyforge_project:
74
+ rubygems_version: 1.2.0
75
+ signing_key:
76
+ specification_version: 3
77
+ summary: You probably don't want to use Shoe.
78
+ test_files: []
79
+