morsel 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +61 -0
- data/Rakefile +5 -0
- data/lib/morsel/base.rb +7 -0
- data/lib/morsel/dsl.rb +1 -0
- data/lib/morsel/installer.rb +2 -1
- data/lib/morsel/recipe.rb +2 -1
- data/lib/morsel/runner.rb +1 -0
- data/lib/morsel/version.rb +1 -1
- data/lib/morsel.rb +1 -0
- data/morsel.gemspec +11 -10
- data/spec/morsel/dsl_spec.rb +22 -0
- data/spec/morsel_spec.rb +9 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +10 -0
- metadata +28 -29
- data/README +0 -0
- data/recipes/asihttprequest.rb +0 -12
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
morsel: git submodules are overkill
|
2
|
+
===================================
|
3
|
+
|
4
|
+
I want to user other people's code. Most of the time, I don't want to use `git submodules`. For those times, I wrote `morsel`.
|
5
|
+
|
6
|
+
Point `morsel` at a git repository and tell it which files you want. It'll fetch them for you and place them into your source tree.
|
7
|
+
|
8
|
+
Problem
|
9
|
+
-------
|
10
|
+
|
11
|
+
There is no dependency management system for Cocoa development. Everytime I want to use a new library, my options are:
|
12
|
+
|
13
|
+
1) Clone the repository. Figure out which files I need. Copy them into my source tree.
|
14
|
+
|
15
|
+
2) Add a git submodule.
|
16
|
+
|
17
|
+
Both options are annoying in their own way. Inspired by [bundler](http://gembundler.com/) and [homebrew](http://mxcl.github.com/homebrew/), I present `morsel`.
|
18
|
+
|
19
|
+
Install
|
20
|
+
-------
|
21
|
+
|
22
|
+
`morsel` is available as a RubyGem
|
23
|
+
|
24
|
+
$ gem install morsel
|
25
|
+
|
26
|
+
Usage
|
27
|
+
-----
|
28
|
+
|
29
|
+
Create a `Morselfile` in your project's root that looks something like this:
|
30
|
+
|
31
|
+
morsel 'jsonkit' do |m|
|
32
|
+
m.url = 'https://github.com/johnezang/JSONKit.git'
|
33
|
+
m.files = %w{
|
34
|
+
JSONKit.h
|
35
|
+
JSONKit.m
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
Then run `morsel install`. It'll clone the repos into `~/.morsel/repos` and then copy your desired files into a `morsels` directory in your project's root:
|
40
|
+
|
41
|
+
$ find .
|
42
|
+
.
|
43
|
+
./Morselfile
|
44
|
+
./morsels
|
45
|
+
./morsels/jsonkit
|
46
|
+
./morsels/jsonkit/JSONKit.h
|
47
|
+
./morsels/jsonkit/JSONKit.m
|
48
|
+
|
49
|
+
That's it!
|
50
|
+
|
51
|
+
What's Next
|
52
|
+
-----------
|
53
|
+
|
54
|
+
First, the whole thing is half-baked, so fleshing it out a bit will be nice.
|
55
|
+
|
56
|
+
Then, it's annoying to have to define the url and files for each morsel. An ideal `Morselfile` would look something like this:
|
57
|
+
|
58
|
+
morsel 'jsonkit', :sha => 'c9ffd8f823e68df96fa2f87185bee861984ef637'
|
59
|
+
morsel 'asihttprequest', :tag => 'v1.8'
|
60
|
+
|
61
|
+
That'll require some [homebrew](http://mxcl.github.com/homebrew/)-style package management.
|
data/Rakefile
ADDED
data/lib/morsel/base.rb
ADDED
data/lib/morsel/dsl.rb
CHANGED
data/lib/morsel/installer.rb
CHANGED
@@ -8,7 +8,8 @@ module Morsel
|
|
8
8
|
repo_dir = File.join(File.expand_path('~'), '.morsel', 'repos')
|
9
9
|
FileUtils.mkdir_p(repo_dir) unless File.exists? repo_dir
|
10
10
|
g = File.exists?(File.join(repo_dir, recipe.name)) ? Git.open(File.join(repo_dir, recipe.name)) : Git.clone(recipe.url, recipe.name, :path => repo_dir)
|
11
|
-
g.
|
11
|
+
g.fetch
|
12
|
+
g.branch(recipe.branch ? recipe.branch : 'HEAD').checkout
|
12
13
|
recipe.files.each do |f|
|
13
14
|
dirname = File.join('morsels', recipe.name, File.dirname(f))
|
14
15
|
FileUtils.mkdir_p(dirname)
|
data/lib/morsel/recipe.rb
CHANGED
data/lib/morsel/runner.rb
CHANGED
data/lib/morsel/version.rb
CHANGED
data/lib/morsel.rb
CHANGED
data/morsel.gemspec
CHANGED
@@ -5,24 +5,25 @@ $:.unshift lib unless $:.include?(lib)
|
|
5
5
|
require 'morsel/version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
|
-
s.name =
|
8
|
+
s.name = 'morsel'
|
9
9
|
s.version = Morsel::VERSION
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
|
-
s.authors = [
|
12
|
-
s.email = [
|
13
|
-
s.homepage =
|
11
|
+
s.authors = ['Anoop Ranganath']
|
12
|
+
s.email = ['anoop@ranganath.com']
|
13
|
+
s.homepage = 'http://github.com/anoopr/morsel'
|
14
14
|
s.summary = %q{A way to manage your source dependencies}
|
15
|
-
s.description = %q{A way to manage your source dependencies, inspired by rubygems and
|
15
|
+
s.description = %q{A way to manage your source dependencies, inspired by rubygems, bundler, and homebrew.}
|
16
16
|
|
17
|
-
s.required_rubygems_version =
|
18
|
-
s.rubyforge_project =
|
17
|
+
s.required_rubygems_version = '>= 1.3.6'
|
18
|
+
s.rubyforge_project = 'nowarning'
|
19
19
|
|
20
20
|
s.add_dependency 'git', '>= 1.2.5'
|
21
21
|
|
22
|
-
|
22
|
+
s.add_development_dependency 'rspec', '>= 2.3.0'
|
23
|
+
|
23
24
|
s.files = `git ls-files`.split("\n")
|
24
25
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
26
|
s.executables = %w(morsel)
|
26
|
-
s.default_executable =
|
27
|
-
s.require_paths = [
|
27
|
+
s.default_executable = 'morsel'
|
28
|
+
s.require_paths = ['lib']
|
28
29
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
|
+
|
3
|
+
describe "dsl specs" do
|
4
|
+
|
5
|
+
it "parses a basic Morselfile" do
|
6
|
+
d = Morsel::Dsl.new
|
7
|
+
d.instance_eval <<-MORSELFILE
|
8
|
+
morsel 'some_morsel' do |m|
|
9
|
+
m.url = 'some_url'
|
10
|
+
m.branch = 'some_branch'
|
11
|
+
m.files = %w{ file1.txt file2.txt }
|
12
|
+
end
|
13
|
+
MORSELFILE
|
14
|
+
d.recipes.size.should == 1
|
15
|
+
d.recipes.first.name.should == 'some_morsel'
|
16
|
+
d.recipes.first.url.should == 'some_url'
|
17
|
+
d.recipes.first.branch.should == 'some_branch'
|
18
|
+
d.recipes.first.files.size.should == 2
|
19
|
+
d.recipes.first.files.should == %w{ file1.txt file2.txt }
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/spec/morsel_spec.rb
ADDED
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: morsel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 0.0.1
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.2
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Anoop Ranganath
|
@@ -15,8 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date:
|
19
|
-
default_executable: morsel
|
13
|
+
date: 2011-07-10 00:00:00 Z
|
20
14
|
dependencies:
|
21
15
|
- !ruby/object:Gem::Dependency
|
22
16
|
name: git
|
@@ -26,15 +20,21 @@ dependencies:
|
|
26
20
|
requirements:
|
27
21
|
- - ">="
|
28
22
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 21
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 2
|
33
|
-
- 5
|
34
23
|
version: 1.2.5
|
35
24
|
type: :runtime
|
36
25
|
version_requirements: *id001
|
37
|
-
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rspec
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 2.3.0
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id002
|
37
|
+
description: A way to manage your source dependencies, inspired by rubygems, bundler, and homebrew.
|
38
38
|
email:
|
39
39
|
- anoop@ranganath.com
|
40
40
|
executables:
|
@@ -45,9 +45,11 @@ extra_rdoc_files: []
|
|
45
45
|
|
46
46
|
files:
|
47
47
|
- .gitignore
|
48
|
-
- README
|
48
|
+
- README.md
|
49
|
+
- Rakefile
|
49
50
|
- bin/morsel
|
50
51
|
- lib/morsel.rb
|
52
|
+
- lib/morsel/base.rb
|
51
53
|
- lib/morsel/commands.rb
|
52
54
|
- lib/morsel/dsl.rb
|
53
55
|
- lib/morsel/installer.rb
|
@@ -55,8 +57,10 @@ files:
|
|
55
57
|
- lib/morsel/runner.rb
|
56
58
|
- lib/morsel/version.rb
|
57
59
|
- morsel.gemspec
|
58
|
-
-
|
59
|
-
|
60
|
+
- spec/morsel/dsl_spec.rb
|
61
|
+
- spec/morsel_spec.rb
|
62
|
+
- spec/spec.opts
|
63
|
+
- spec/spec_helper.rb
|
60
64
|
homepage: http://github.com/anoopr/morsel
|
61
65
|
licenses: []
|
62
66
|
|
@@ -70,27 +74,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
74
|
requirements:
|
71
75
|
- - ">="
|
72
76
|
- !ruby/object:Gem::Version
|
73
|
-
hash: 3
|
74
|
-
segments:
|
75
|
-
- 0
|
76
77
|
version: "0"
|
77
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
79
|
none: false
|
79
80
|
requirements:
|
80
81
|
- - ">="
|
81
82
|
- !ruby/object:Gem::Version
|
82
|
-
hash: 23
|
83
|
-
segments:
|
84
|
-
- 1
|
85
|
-
- 3
|
86
|
-
- 6
|
87
83
|
version: 1.3.6
|
88
84
|
requirements: []
|
89
85
|
|
90
86
|
rubyforge_project: nowarning
|
91
|
-
rubygems_version: 1.
|
87
|
+
rubygems_version: 1.8.5
|
92
88
|
signing_key:
|
93
89
|
specification_version: 3
|
94
90
|
summary: A way to manage your source dependencies
|
95
|
-
test_files:
|
96
|
-
|
91
|
+
test_files:
|
92
|
+
- spec/morsel/dsl_spec.rb
|
93
|
+
- spec/morsel_spec.rb
|
94
|
+
- spec/spec.opts
|
95
|
+
- spec/spec_helper.rb
|
data/README
DELETED
File without changes
|
data/recipes/asihttprequest.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'morsel/recipe'
|
2
|
-
|
3
|
-
class Asihttprequest < Morsel::Recipe
|
4
|
-
|
5
|
-
url 'https://github.com/pokeb/asi-http-request.git'
|
6
|
-
homepage 'http://allseeing-i.com/ASIHTTPRequest/'
|
7
|
-
|
8
|
-
files %w{
|
9
|
-
Classes/ASIAuthenticationDialog.h
|
10
|
-
Classes/ASIAuthenticationDialog.m
|
11
|
-
}
|
12
|
-
end
|