magicloader 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +21 -0
- data/README.markdown +18 -22
- data/Rakefile +44 -7
- data/VERSION +1 -0
- metadata +48 -25
- data/magicloader.gemspec +0 -24
- data/spec/tmp/example.rb +0 -10
data/.gitignore
ADDED
data/README.markdown
CHANGED
@@ -20,14 +20,12 @@ The "magicload" Rake task
|
|
20
20
|
The main way MagicLoader should be used is as a Rake task. Inside of your
|
21
21
|
project's Rakefile, do:
|
22
22
|
|
23
|
-
|
24
|
-
require 'magicloader/tasks'
|
23
|
+
require 'magicloader/tasks'
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
</code></pre>
|
25
|
+
MagicLoader::Task.new 'lib/my_project',
|
26
|
+
:target => 'lib/my_project.rb',
|
27
|
+
:strip => 'lib/',
|
28
|
+
:name => 'magicload'
|
31
29
|
|
32
30
|
What does this do exactly? Let's dig in.
|
33
31
|
|
@@ -44,16 +42,14 @@ MagicLoader will print what it would've generated to standard output. However,
|
|
44
42
|
if you set the target, you can annotate a particular file with a MagicLoader
|
45
43
|
Magic Block. What's that you ask? Well it looks a bit like this:
|
46
44
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
#------END MAGICLOADER MAGIC BLOCK------
|
56
|
-
</code></pre>
|
45
|
+
#-----BEGIN MAGICLOADER MAGIC BLOCK-----
|
46
|
+
# Automagically generated by MagicLoader. Editing may
|
47
|
+
# result in bad juju. Edit at your own risk!
|
48
|
+
require "my_project/foo.rb"
|
49
|
+
require "my_project/bar.rb"
|
50
|
+
require "my_project/baz.rb"
|
51
|
+
require "my_project/qux.rb"
|
52
|
+
#------END MAGICLOADER MAGIC BLOCK------
|
57
53
|
|
58
54
|
Here MagicLoader is automagically writing the dependency order of your library
|
59
55
|
into the master file for your project. The dependency order is appended to the
|
@@ -102,7 +98,7 @@ management, then proceed, young sorcerer.
|
|
102
98
|
The easiest way to use require_all is to just point it at a directory
|
103
99
|
containing a bunch of .rb files:
|
104
100
|
|
105
|
-
|
101
|
+
MagicLoader.require_all 'lib'
|
106
102
|
|
107
103
|
This will find all the .rb files under the lib directory (including all
|
108
104
|
subdirectories as well) and load them.
|
@@ -113,15 +109,15 @@ first unresolvable NameError.
|
|
113
109
|
|
114
110
|
You can also give it a glob, which will enumerate all the matching files:
|
115
111
|
|
116
|
-
|
112
|
+
MagicLoader.require_all 'lib/**/*.rb'
|
117
113
|
|
118
114
|
It will also accept an array of files:
|
119
115
|
|
120
|
-
|
116
|
+
MagicLoader.require_all Dir.glob("blah/**/*.rb").reject { |f| stupid_file? f }
|
121
117
|
|
122
118
|
Or if you want, just list the files directly as arguments:
|
123
119
|
|
124
|
-
|
120
|
+
MagicLoader.require_all 'lib/a.rb', 'lib/b.rb', 'lib/c.rb', 'lib/d.rb'
|
125
121
|
|
126
122
|
So what's the magic?
|
127
123
|
--------------------
|
@@ -155,4 +151,4 @@ Got issues with require_all to report? Post 'em here:
|
|
155
151
|
License
|
156
152
|
-------
|
157
153
|
|
158
|
-
MIT (see the LICENSE file for details)
|
154
|
+
MIT (see the LICENSE file for details)
|
data/Rakefile
CHANGED
@@ -1,12 +1,49 @@
|
|
1
|
+
require 'rubygems'
|
1
2
|
require 'rake'
|
2
|
-
require 'rake/clean'
|
3
3
|
|
4
|
-
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "magicloader"
|
8
|
+
gem.summary = "Painless code dependency management"
|
9
|
+
gem.description = <<-EOD
|
10
|
+
Painless code dependency management. Think Bundler, but for managing file load
|
11
|
+
ordering dependencies.
|
12
|
+
EOD
|
13
|
+
gem.email = "tony@medioh.com"
|
14
|
+
gem.homepage = "http://github.com/tarcieri/magicloader"
|
15
|
+
gem.authors = ["Tony Arcieri"]
|
16
|
+
gem.add_development_dependency "rspec", "~> 1.3.0"
|
17
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
|
+
end
|
19
|
+
Jeweler::GemcutterTasks.new
|
20
|
+
rescue LoadError
|
21
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'spec/rake/spectask'
|
25
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
26
|
+
spec.spec_opts = %w(-fs -c)
|
27
|
+
spec.libs << 'lib' << 'spec'
|
28
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
29
|
+
end
|
30
|
+
|
31
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
32
|
+
spec.libs << 'lib' << 'spec'
|
33
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
34
|
+
spec.rcov = true
|
35
|
+
end
|
36
|
+
|
37
|
+
task :spec => :check_dependencies
|
5
38
|
|
6
39
|
task :default => :spec
|
7
40
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
41
|
+
require 'rake/rdoctask'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
+
|
45
|
+
rdoc.rdoc_dir = 'rdoc'
|
46
|
+
rdoc.title = "magicloader #{version}"
|
47
|
+
rdoc.rdoc_files.include('README*')
|
48
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.10.0
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magicloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 55
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 10
|
9
|
+
- 0
|
10
|
+
version: 0.10.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tony Arcieri
|
@@ -17,10 +17,25 @@ cert_chain: []
|
|
17
17
|
|
18
18
|
date: 2010-10-25 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rspec
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 27
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 3
|
33
|
+
- 0
|
34
|
+
version: 1.3.0
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
description: " Painless code dependency management. Think Bundler, but for managing file load\n ordering dependencies.\n"
|
38
|
+
email: tony@medioh.com
|
24
39
|
executables: []
|
25
40
|
|
26
41
|
extensions: []
|
@@ -28,10 +43,15 @@ extensions: []
|
|
28
43
|
extra_rdoc_files:
|
29
44
|
- LICENSE
|
30
45
|
- README.markdown
|
31
|
-
- CHANGES
|
32
46
|
files:
|
33
|
-
-
|
47
|
+
- .gitignore
|
48
|
+
- CHANGES
|
49
|
+
- LICENSE
|
50
|
+
- README.markdown
|
51
|
+
- Rakefile
|
52
|
+
- VERSION
|
34
53
|
- lib/magic_loader.rb
|
54
|
+
- lib/magic_loader/tasks.rb
|
35
55
|
- spec/fixtures/circular/y.rb
|
36
56
|
- spec/fixtures/circular/z.rb
|
37
57
|
- spec/fixtures/resolvable/a.rb
|
@@ -45,23 +65,14 @@ files:
|
|
45
65
|
- spec/magic_loader_spec.rb
|
46
66
|
- spec/spec_helper.rb
|
47
67
|
- spec/task_spec.rb
|
48
|
-
- spec/tmp
|
49
|
-
- Rakefile
|
50
|
-
- magicloader.gemspec
|
51
|
-
- LICENSE
|
52
|
-
- README.markdown
|
53
|
-
- CHANGES
|
68
|
+
- spec/tmp/.gitignore
|
54
69
|
has_rdoc: true
|
55
|
-
homepage: http://github.com/tarcieri/
|
70
|
+
homepage: http://github.com/tarcieri/magicloader
|
56
71
|
licenses: []
|
57
72
|
|
58
73
|
post_install_message:
|
59
74
|
rdoc_options:
|
60
|
-
- --
|
61
|
-
- MagicLoader
|
62
|
-
- --main
|
63
|
-
- README.markdown
|
64
|
-
- --line-numbers
|
75
|
+
- --charset=UTF-8
|
65
76
|
require_paths:
|
66
77
|
- lib
|
67
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -88,6 +99,18 @@ rubyforge_project:
|
|
88
99
|
rubygems_version: 1.3.7
|
89
100
|
signing_key:
|
90
101
|
specification_version: 3
|
91
|
-
summary: Painless code dependency management
|
92
|
-
test_files:
|
93
|
-
|
102
|
+
summary: Painless code dependency management
|
103
|
+
test_files:
|
104
|
+
- spec/fixtures/circular/y.rb
|
105
|
+
- spec/fixtures/circular/z.rb
|
106
|
+
- spec/fixtures/resolvable/a.rb
|
107
|
+
- spec/fixtures/resolvable/b.rb
|
108
|
+
- spec/fixtures/resolvable/c.rb
|
109
|
+
- spec/fixtures/resolvable/d.rb
|
110
|
+
- spec/fixtures/unresolvable/a.rb
|
111
|
+
- spec/fixtures/unresolvable/b.rb
|
112
|
+
- spec/fixtures/unresolvable/c.rb
|
113
|
+
- spec/fixtures/unresolvable/d.rb
|
114
|
+
- spec/magic_loader_spec.rb
|
115
|
+
- spec/spec_helper.rb
|
116
|
+
- spec/task_spec.rb
|
data/magicloader.gemspec
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
|
3
|
-
GEMSPEC = Gem::Specification.new do |s|
|
4
|
-
s.name = "magicloader"
|
5
|
-
s.description = "Painless code dependency management"
|
6
|
-
s.summary = <<EOD
|
7
|
-
Painless code dependency management. Think Bundler, but for managing file load
|
8
|
-
ordering dependencies.
|
9
|
-
EOD
|
10
|
-
s.version = "0.9.2"
|
11
|
-
s.authors = "Tony Arcieri"
|
12
|
-
s.email = "bascule@gmail.com"
|
13
|
-
s.homepage = "http://github.com/tarcieri/MagicLoader"
|
14
|
-
s.date = Time.now
|
15
|
-
s.platform = Gem::Platform::RUBY
|
16
|
-
|
17
|
-
# Gem contents
|
18
|
-
s.files = Dir.glob("{lib,spec}/**/*") + ['Rakefile', 'magicloader.gemspec']
|
19
|
-
|
20
|
-
# RDoc settings
|
21
|
-
s.has_rdoc = true
|
22
|
-
s.rdoc_options = %w(--title MagicLoader --main README.markdown --line-numbers)
|
23
|
-
s.extra_rdoc_files = ["LICENSE", "README.markdown", "CHANGES"]
|
24
|
-
end
|
data/spec/tmp/example.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
# OMFG IMPORTANT CRAP DON'T DELETE THIS
|
2
|
-
#-----BEGIN MAGICLOADER MAGIC BLOCK-----
|
3
|
-
# Automagically generated by MagicLoader. Editing may
|
4
|
-
# result in bad juju. Edit at your own risk!
|
5
|
-
# Run "rake magicload4" to regenerate
|
6
|
-
require "resolvable/a.rb"
|
7
|
-
require "resolvable/b.rb"
|
8
|
-
require "resolvable/c.rb"
|
9
|
-
require "resolvable/d.rb"
|
10
|
-
#------END MAGICLOADER MAGIC BLOCK------
|