require 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -44,6 +44,7 @@ Then in your library file (<code>lib/whatever.rb</code>):
44
44
  require File.expand_path("#{File.dirname(__FILE_)}/../require")
45
45
  Require.lib!
46
46
  # Activates sinatra and haml gems
47
+ # Requires sinatra, haml, and sass
47
48
  # Adds vendor/authlogic/lib to the load paths
48
49
  # Requires authlogic
49
50
  </pre>
data/lib/require.rb CHANGED
@@ -8,19 +8,23 @@ class Require
8
8
  @@gemspec = Gemspec.new
9
9
  @@root = nil
10
10
 
11
+ def self.all(*args)
12
+ @@dsl.all *args
13
+ end
14
+
11
15
  def self.call(root=nil, &block)
12
16
  @@root = File.expand_path(root) if root
13
17
  @@dsl.call &block
14
18
  end
15
19
 
16
- def self.instance
17
- @@gemspec.instance
18
- end
19
-
20
20
  def self.get(*args)
21
21
  @@dsl.get *args
22
22
  end
23
23
 
24
+ def self.instance
25
+ @@gemspec.instance
26
+ end
27
+
24
28
  def self.name
25
29
  @@gemspec.name
26
30
  end
data/lib/require/tasks.rb CHANGED
@@ -1,14 +1,80 @@
1
+ class Require
2
+ module Tasks
3
+
4
+ def self.set(*types)
5
+ if types.include?(:ask_docs)
6
+ $stdout.puts "Generate documentation?"
7
+ @@gen_docs = $stdin.gets.downcase[0..0] == 'y'
8
+ elsif types.include?(:docs)
9
+ @@gen_docs = true
10
+ elsif types.include?(:no_docs)
11
+ @@gen_docs = false
12
+ end
13
+ if types.include?(:ask_sudo)
14
+ $stdout.puts "Use sudo?"
15
+ @@use_sudo = $stdin.gets.downcase[0..0] == 'y'
16
+ elsif types.include?(:sudo)
17
+ @@gen_docs = true
18
+ elsif types.include?(:no_sudo)
19
+ @@use_sudo = false
20
+ end
21
+ end
22
+
23
+ def self.rm_pkg
24
+ cmd = "rm -Rf pkg"
25
+ $stdout.puts cmd
26
+ system cmd
27
+ end
28
+
29
+ def self.run(cmd)
30
+ cmd = "#{'sudo ' if @@use_sudo}#{cmd}#{' --no-ri --no-rdoc' unless @@gen_docs}"
31
+ $stdout.puts cmd
32
+ system cmd
33
+ end
34
+ end
35
+ end
36
+
1
37
  desc "Package gem"
2
38
  Rake::GemPackageTask.new(Require.instance) do |pkg|
3
39
  pkg.gem_spec = Require.instance
4
40
  end
5
41
 
6
- desc "Install gem"
7
- task :install do
8
- Rake::Task['gem'].invoke
9
- `sudo gem uninstall #{Require.name} -x`
10
- `sudo gem install pkg/#{Require.name}*.gem`
11
- `rm -Rf pkg`
42
+ namespace :gem do
43
+ desc "Install gem"
44
+ task :install do
45
+ Require::Tasks.rm_pkg
46
+ Rake::Task['gem'].invoke
47
+ Require::Tasks.set :docs, :ask_sudo
48
+ Require::Tasks.run "gem uninstall #{Require.name} -x"
49
+ Require::Tasks.run "gem install pkg/#{Require.name}*.gem"
50
+ Require::Tasks.rm_pkg
51
+ end
52
+
53
+ desc "Push gem"
54
+ task :push do
55
+ Require::Tasks.rm_pkg
56
+ Rake::Task['gem'].invoke
57
+ Require::Tasks.set :docs, :no_sudo
58
+ Require::Tasks.run "gem push pkg/#{Require.name}*.gem"
59
+ Require::Tasks.rm_pkg
60
+ end
61
+ end
62
+
63
+ desc "List gem dependencies"
64
+ task :gems do
65
+ Require.all(:gem).sort { |a,b| a.name.to_s <=> b.name.to_s }.each do |dsl|
66
+ puts "#{dsl.name} (#{dsl.version})"
67
+ end
68
+ end
69
+
70
+ namespace :gems do
71
+ desc "Install gem dependencies"
72
+ task :install do
73
+ Require::Tasks.set :ask_docs, :ask_sudo
74
+ Require.all(:gem).sort { |a,b| a.name.to_s <=> b.name.to_s }.each do |dsl|
75
+ Require::Tasks.run "gem install #{dsl.name} -v '#{dsl.version}'"
76
+ end
77
+ end
12
78
  end
13
79
 
14
80
  desc "Run specs"
data/require.rb CHANGED
@@ -11,7 +11,7 @@ Require File.dirname(__FILE__) do
11
11
  name 'require'
12
12
  homepage "http://github.com/winton/#{name}"
13
13
  summary "Manage your project's dependencies with a pretty DSL"
14
- version '0.1.5'
14
+ version '0.1.6'
15
15
  end
16
16
 
17
17
  rakefile do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: require
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
  - Winton Welsh
@@ -28,7 +28,6 @@ files:
28
28
  - lib/require/tasks.rb
29
29
  - lib/require.rb
30
30
  - MIT-LICENSE
31
- - pkg/require
32
31
  - Rakefile
33
32
  - README.markdown
34
33
  - require.rb
data/pkg/require DELETED
Binary file