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 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
@@ -0,0 +1,5 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ RSpec::Core::RakeTask.new(:spec)
4
+
5
+ task :default => :spec
@@ -0,0 +1,7 @@
1
+ module Morsel
2
+ extend self
3
+
4
+ def repo_dir
5
+ File.join(File.expand_path('~'), '.morsel', 'repos')
6
+ end
7
+ end
data/lib/morsel/dsl.rb CHANGED
@@ -18,5 +18,6 @@ module Morsel
18
18
  @recipes << recipe
19
19
  recipe
20
20
  end
21
+
21
22
  end
22
23
  end
@@ -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.pull
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
@@ -1,9 +1,10 @@
1
1
  module Morsel
2
2
  class Recipe
3
- attr_accessor :name, :url, :files
3
+ attr_accessor :name, :url, :branch, :files
4
4
 
5
5
  def initialize(name)
6
6
  @name = name
7
7
  end
8
+
8
9
  end
9
10
  end
data/lib/morsel/runner.rb CHANGED
@@ -12,5 +12,6 @@ module Morsel
12
12
  def execute
13
13
  Commands.send(@cmd, @args) if Commands.respond_to?(@cmd)
14
14
  end
15
+
15
16
  end
16
17
  end
@@ -1,3 +1,3 @@
1
1
  module Morsel
2
- Version = VERSION = '0.0.1'
2
+ Version = VERSION = '0.0.2'
3
3
  end
data/lib/morsel.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'morsel/base'
1
2
  require 'morsel/version'
2
3
  require 'morsel/runner'
3
4
  require 'morsel/dsl'
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 = "morsel"
8
+ s.name = 'morsel'
9
9
  s.version = Morsel::VERSION
10
10
  s.platform = Gem::Platform::RUBY
11
- s.authors = ["Anoop Ranganath"]
12
- s.email = ["anoop@ranganath.com"]
13
- s.homepage = "http://github.com/anoopr/morsel"
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 bundler.}
15
+ s.description = %q{A way to manage your source dependencies, inspired by rubygems, bundler, and homebrew.}
16
16
 
17
- s.required_rubygems_version = ">= 1.3.6"
18
- s.rubyforge_project = "nowarning"
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
- # Man files are required because they are ignored by git
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 = "morsel"
27
- s.require_paths = ["lib"]
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
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "base specs" do
4
+
5
+ it "returns the repository directory" do
6
+ Morsel.repo_dir.should match('.morsel/repos')
7
+ end
8
+
9
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,10 @@
1
+ begin
2
+ require 'rspec'
3
+ rescue LoadError
4
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
5
+ gem 'rspec'
6
+ require 'rspec'
7
+ end
8
+
9
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require 'morsel'
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morsel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease: false
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: 2010-12-26 00:00:00 -05:00
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
- description: A way to manage your source dependencies, inspired by rubygems and bundler.
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
- - recipes/asihttprequest.rb
59
- has_rdoc: true
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.3.7
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
@@ -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