noodle 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/README.rdoc +9 -0
  2. data/VERSION +1 -1
  3. data/bin/noodle +43 -0
  4. data/lib/noodle.rb +67 -42
  5. data/noodle.gemspec +7 -4
  6. metadata +29 -13
@@ -22,6 +22,15 @@ Then run
22
22
  Your project will now have a lib directory with structuremap's dll in it.
23
23
  Add a reference to said DLL in your .NET project.
24
24
 
25
+ == Example without rakefile
26
+
27
+ Or, if you don't want to use a Rakefile, try this:
28
+
29
+ bundle install
30
+ noodle
31
+
32
+ == See also
33
+
25
34
  See {Noodle::Rake::NoodleTask} for information on how to configure it.
26
35
 
27
36
  == Copyright
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'noodle'
5
+ rescue LoadError
6
+ require '../lib/noodle'
7
+ end
8
+
9
+ require 'optparse'
10
+
11
+ app = Noodle::Noodler.new
12
+ opts = OptionParser.new do |opts|
13
+ opts.banner = 'Usage: noodle [options]'
14
+ opts.on('-g', '--group GROUP', 'A bundler group to install.') do |group|
15
+ app.groups << group
16
+ end
17
+ opts.on('-o', '--dest DIR', 'The directory to copy the gem libs to (default: lib)') do |outdir|
18
+ app.outdir = outdir
19
+ end
20
+ opts.on('-m', '--merge', 'If specified, all the gem libs will be merged.') do
21
+ app.merge!
22
+ end
23
+ opts.on('-h', '--help') do
24
+ show_help opts
25
+ exit
26
+ end
27
+ end
28
+
29
+ def show_help(opts, out=$stdout)
30
+ puts <<END_COMMANDS
31
+ END_COMMANDS
32
+ puts opts
33
+ end
34
+
35
+ begin
36
+ opts.parse!
37
+ rescue OptionParser::InvalidOption => e
38
+ $stderr.puts e
39
+ show_help opts, $stderr
40
+ exit
41
+ end
42
+
43
+ app.install
@@ -1,29 +1,9 @@
1
1
  require 'rake/tasklib'
2
2
  require 'bundler'
3
- module Noodle
4
- module Rake
5
-
6
- # Rake tasks for setting up .NET dependencies.
7
- #
8
- # Four tasks are defined:
9
- # * noodle:copy - copy the lib directories from the gems to the local project.
10
- # * noodle:clean - remove the local lib directory.
11
- # * noodle:update - clean, then copy.
12
- # * noodle - alias of noodle:copy.
13
- #
14
- # @example
15
- # Noodle::Rake::NoodleTask.new :customname do |n|
16
- # n.groups << :dotnet # only use the bundler :dotnet group
17
- # n.outdir = 'someplace-other-than-lib'
18
- # n.merge! # merge all the libs together
19
- # end
20
- class NoodleTask < ::Rake::TaskLib
21
- # The name of the rake task to generate.
22
- #
23
- # Defaults to :noodle.
24
- # @return [String]
25
- attr_accessor :name
3
+ require 'forwardable'
26
4
 
5
+ module Noodle
6
+ class Noodler
27
7
  # An array of bundler groups that reference the required dlls.
28
8
  # Use an empty array for all groups.
29
9
  #
@@ -52,14 +32,73 @@ module Noodle
52
32
  @merge = true
53
33
  end
54
34
 
35
+ def initialize
36
+ @groups = []
37
+ @outdir = 'lib'
38
+ @merge = false
39
+ end
40
+
41
+ def install
42
+ specs = groups.any? ? Bundler.definition.specs_for(groups) : Bundler.environment.requested_specs
43
+ specs.each do |spec|
44
+ next if spec.name == 'bundler'
45
+ spec.load_paths.each do |path|
46
+ dest_path = dest_for(spec)
47
+ FileUtils.mkdir_p dest_path
48
+ FileUtils.cp_r "#{path}/.", dest_path, :verbose => true
49
+ end
50
+ end
51
+ end
52
+
53
+ private
54
+ def dest_for spec
55
+ dest = outdir.dup
56
+ dest << "/#{spec.name}-#{spec.version}" unless merge
57
+ File.expand_path(dest)
58
+ end
59
+ end
60
+
61
+ module Rake
62
+
63
+ # Rake tasks for setting up .NET dependencies.
64
+ #
65
+ # Four tasks are defined:
66
+ # * noodle:copy - copy the lib directories from the gems to the local project.
67
+ # * noodle:clean - remove the local lib directory.
68
+ # * noodle:update - clean, then copy.
69
+ # * noodle - alias of noodle:copy.
70
+ #
71
+ # @example Gemfile
72
+ # source :rubygems
73
+ # group :dotnet do
74
+ # gem 'structuremap'
75
+ # end
76
+ #
77
+ # @example Rakefile
78
+ # Noodle::Rake::NoodleTask.new :customname do |n|
79
+ # n.groups << :dotnet # only use the bundler :dotnet group
80
+ # n.outdir = 'someplace-other-than-lib'
81
+ # n.merge! # merge all the libs together
82
+ # end
83
+ class NoodleTask < ::Rake::TaskLib
84
+ # The name of the rake task to generate.
85
+ #
86
+ # Defaults to :noodle.
87
+ # @return [String]
88
+ attr_accessor :name
89
+
90
+ extend Forwardable
91
+ def_delegators :@noodler,
92
+ :groups=, :groups,
93
+ :outdir=, :outdir,
94
+ :merge=, :merge, :merge!
95
+
55
96
  # Define noodle's rake tasks.
56
97
  # @yield [noodle]
57
98
  # @yieldparam [NoodleTask] noodle the noodle task generator.
58
99
  def initialize name = :noodle
59
- @name = name
60
- @groups = []
61
- @outdir = 'lib'
62
- @merge = false
100
+ @noodler = Noodler.new
101
+ @name = name
63
102
  yield self if block_given?
64
103
  define
65
104
  end
@@ -73,15 +112,7 @@ module Noodle
73
112
 
74
113
  desc "Copies .NET dependencies to '#{outdir}'"
75
114
  task "#{name}:copy" do
76
- specs = groups.any? ? Bundler.definition.specs_for(groups) : Bundler.environment.requested_specs
77
- specs.each do |spec|
78
- next if spec.name == 'bundler'
79
- spec.load_paths.each do |path|
80
- dest_path = dest_for(spec)
81
- FileUtils.mkdir_p dest_path
82
- FileUtils.cp_r "#{path}/.", dest_path, :verbose => true
83
- end
84
- end
115
+ @noodler.install
85
116
  end
86
117
 
87
118
  desc "Cleans '#{outdir}'"
@@ -92,12 +123,6 @@ module Noodle
92
123
  desc "Updates .NET dependencies in '#{outdir}'"
93
124
  task "#{name}:update" => ["#{name}:clean", "#{name}:copy"]
94
125
  end
95
-
96
- def dest_for spec
97
- dest = outdir.dup
98
- dest << "/#{spec.name}-#{spec.version}" unless merge
99
- File.expand_path(dest)
100
- end
101
126
  end
102
127
 
103
128
  end
@@ -5,13 +5,15 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{noodle}
8
- s.version = "0.2.1"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Burke"]
12
- s.date = %q{2010-08-13}
12
+ s.date = %q{2010-08-27}
13
+ s.default_executable = %q{noodle}
13
14
  s.description = %q{Use bundler to get your .NET assembly dependencies.}
14
15
  s.email = %q{maburke@sep.com}
16
+ s.executables = ["noodle"]
15
17
  s.extra_rdoc_files = [
16
18
  "LICENSE",
17
19
  "README.rdoc"
@@ -25,6 +27,7 @@ Gem::Specification.new do |s|
25
27
  "README.rdoc",
26
28
  "Rakefile",
27
29
  "VERSION",
30
+ "bin/noodle",
28
31
  "lib/noodle.rb",
29
32
  "noodle.gemspec",
30
33
  "spec/noodle_spec.rb",
@@ -34,7 +37,7 @@ Gem::Specification.new do |s|
34
37
  s.homepage = %q{http://github.com/spraints/noodle}
35
38
  s.rdoc_options = ["--charset=UTF-8"]
36
39
  s.require_paths = ["lib"]
37
- s.rubygems_version = %q{1.3.6}
40
+ s.rubygems_version = %q{1.3.7}
38
41
  s.summary = %q{Use bundler to get your .NET assembly dependencies}
39
42
  s.test_files = [
40
43
  "spec/noodle_spec.rb",
@@ -45,7 +48,7 @@ Gem::Specification.new do |s|
45
48
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
46
49
  s.specification_version = 3
47
50
 
48
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
51
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
52
  s.add_development_dependency(%q<jeweler>, [">= 0"])
50
53
  s.add_development_dependency(%q<yard>, [">= 0"])
51
54
  s.add_development_dependency(%q<rspec>, [">= 0"])
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noodle
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 19
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 2
8
- - 1
9
- version: 0.2.1
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Matt Burke
@@ -14,62 +15,73 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-08-13 00:00:00 -04:00
18
- default_executable:
18
+ date: 2010-08-27 00:00:00 -04:00
19
+ default_executable: noodle
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
22
+ prerelease: false
21
23
  version_requirements: &id001 !ruby/object:Gem::Requirement
24
+ none: false
22
25
  requirements:
23
26
  - - ">="
24
27
  - !ruby/object:Gem::Version
28
+ hash: 3
25
29
  segments:
26
30
  - 0
27
31
  version: "0"
28
32
  name: jeweler
29
33
  requirement: *id001
30
- prerelease: false
31
34
  type: :development
32
35
  - !ruby/object:Gem::Dependency
36
+ prerelease: false
33
37
  version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ none: false
34
39
  requirements:
35
40
  - - ">="
36
41
  - !ruby/object:Gem::Version
42
+ hash: 3
37
43
  segments:
38
44
  - 0
39
45
  version: "0"
40
46
  name: yard
41
47
  requirement: *id002
42
- prerelease: false
43
48
  type: :development
44
49
  - !ruby/object:Gem::Dependency
50
+ prerelease: false
45
51
  version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ none: false
46
53
  requirements:
47
54
  - - ">="
48
55
  - !ruby/object:Gem::Version
56
+ hash: 3
49
57
  segments:
50
58
  - 0
51
59
  version: "0"
52
60
  name: rspec
53
61
  requirement: *id003
54
- prerelease: false
55
62
  type: :development
56
63
  - !ruby/object:Gem::Dependency
64
+ prerelease: false
57
65
  version_requirements: &id004 !ruby/object:Gem::Requirement
66
+ none: false
58
67
  requirements:
59
68
  - - ">="
60
69
  - !ruby/object:Gem::Version
70
+ hash: 3
61
71
  segments:
62
72
  - 0
63
73
  version: "0"
64
74
  name: rake
65
75
  requirement: *id004
66
- prerelease: false
67
76
  type: :runtime
68
77
  - !ruby/object:Gem::Dependency
78
+ prerelease: false
69
79
  version_requirements: &id005 !ruby/object:Gem::Requirement
80
+ none: false
70
81
  requirements:
71
82
  - - ">="
72
83
  - !ruby/object:Gem::Version
84
+ hash: 15424051
73
85
  segments:
74
86
  - 1
75
87
  - 0
@@ -79,12 +91,11 @@ dependencies:
79
91
  version: 1.0.0.rc.3
80
92
  name: bundler
81
93
  requirement: *id005
82
- prerelease: false
83
94
  type: :runtime
84
95
  description: Use bundler to get your .NET assembly dependencies.
85
96
  email: maburke@sep.com
86
- executables: []
87
-
97
+ executables:
98
+ - noodle
88
99
  extensions: []
89
100
 
90
101
  extra_rdoc_files:
@@ -99,6 +110,7 @@ files:
99
110
  - README.rdoc
100
111
  - Rakefile
101
112
  - VERSION
113
+ - bin/noodle
102
114
  - lib/noodle.rb
103
115
  - noodle.gemspec
104
116
  - spec/noodle_spec.rb
@@ -114,23 +126,27 @@ rdoc_options:
114
126
  require_paths:
115
127
  - lib
116
128
  required_ruby_version: !ruby/object:Gem::Requirement
129
+ none: false
117
130
  requirements:
118
131
  - - ">="
119
132
  - !ruby/object:Gem::Version
133
+ hash: 3
120
134
  segments:
121
135
  - 0
122
136
  version: "0"
123
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
+ none: false
124
139
  requirements:
125
140
  - - ">="
126
141
  - !ruby/object:Gem::Version
142
+ hash: 3
127
143
  segments:
128
144
  - 0
129
145
  version: "0"
130
146
  requirements: []
131
147
 
132
148
  rubyforge_project:
133
- rubygems_version: 1.3.6
149
+ rubygems_version: 1.3.7
134
150
  signing_key:
135
151
  specification_version: 3
136
152
  summary: Use bundler to get your .NET assembly dependencies