morsel 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/README ADDED
File without changes
data/bin/morsel ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'morsel'
4
+ Morsel::Runner.execute(*ARGV)
@@ -0,0 +1,11 @@
1
+ module Morsel
2
+ module Commands
3
+ extend self
4
+
5
+ def install(args)
6
+ recipes = Dsl.evaluate('Morselfile')
7
+ recipes.each {|r| Installer.install_recipe(r)}
8
+ end
9
+
10
+ end
11
+ end
data/lib/morsel/dsl.rb ADDED
@@ -0,0 +1,22 @@
1
+ module Morsel
2
+ class Dsl
3
+ attr_reader :recipes
4
+
5
+ def self.evaluate(morselfile)
6
+ builder = new
7
+ builder.instance_eval(File.read(morselfile))
8
+ builder.recipes
9
+ end
10
+
11
+ def initialize
12
+ @recipes = Array.new
13
+ end
14
+
15
+ def morsel(name)
16
+ recipe = Recipe.new(name)
17
+ yield(recipe)
18
+ @recipes << recipe
19
+ recipe
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,20 @@
1
+ require 'git'
2
+
3
+ module Morsel
4
+ module Installer
5
+ extend self
6
+
7
+ def install_recipe(recipe)
8
+ repo_dir = File.join(File.expand_path('~'), '.morsel', 'repos')
9
+ FileUtils.mkdir_p(repo_dir) unless File.exists? repo_dir
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
12
+ recipe.files.each do |f|
13
+ dirname = File.join('morsels', recipe.name, File.dirname(f))
14
+ FileUtils.mkdir_p(dirname)
15
+ FileUtils.cp(File.join(g.dir.path, f), dirname)
16
+ end
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,9 @@
1
+ module Morsel
2
+ class Recipe
3
+ attr_accessor :name, :url, :files
4
+
5
+ def initialize(name)
6
+ @name = name
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ module Morsel
2
+ class Runner
3
+ def self.execute(*args)
4
+ new(*args).execute
5
+ end
6
+
7
+ def initialize(*args)
8
+ @cmd = args.shift
9
+ @args = args
10
+ end
11
+
12
+ def execute
13
+ Commands.send(@cmd, @args) if Commands.respond_to?(@cmd)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module Morsel
2
+ Version = VERSION = '0.0.1'
3
+ end
data/lib/morsel.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'morsel/version'
2
+ require 'morsel/runner'
3
+ require 'morsel/dsl'
4
+ require 'morsel/commands'
5
+ require 'morsel/recipe'
6
+ require 'morsel/installer'
data/morsel.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $:.unshift lib unless $:.include?(lib)
4
+
5
+ require 'morsel/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "morsel"
9
+ s.version = Morsel::VERSION
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"
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.}
16
+
17
+ s.required_rubygems_version = ">= 1.3.6"
18
+ s.rubyforge_project = "nowarning"
19
+
20
+ s.add_dependency 'git', '>= 1.2.5'
21
+
22
+ # Man files are required because they are ignored by git
23
+ s.files = `git ls-files`.split("\n")
24
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
+ s.executables = %w(morsel)
26
+ s.default_executable = "morsel"
27
+ s.require_paths = ["lib"]
28
+ end
@@ -0,0 +1,12 @@
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
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: morsel
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
11
+ platform: ruby
12
+ authors:
13
+ - Anoop Ranganath
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-12-26 00:00:00 -05:00
19
+ default_executable: morsel
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: git
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 21
30
+ segments:
31
+ - 1
32
+ - 2
33
+ - 5
34
+ version: 1.2.5
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: A way to manage your source dependencies, inspired by rubygems and bundler.
38
+ email:
39
+ - anoop@ranganath.com
40
+ executables:
41
+ - morsel
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - .gitignore
48
+ - README
49
+ - bin/morsel
50
+ - lib/morsel.rb
51
+ - lib/morsel/commands.rb
52
+ - lib/morsel/dsl.rb
53
+ - lib/morsel/installer.rb
54
+ - lib/morsel/recipe.rb
55
+ - lib/morsel/runner.rb
56
+ - lib/morsel/version.rb
57
+ - morsel.gemspec
58
+ - recipes/asihttprequest.rb
59
+ has_rdoc: true
60
+ homepage: http://github.com/anoopr/morsel
61
+ licenses: []
62
+
63
+ post_install_message:
64
+ rdoc_options: []
65
+
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ hash: 23
83
+ segments:
84
+ - 1
85
+ - 3
86
+ - 6
87
+ version: 1.3.6
88
+ requirements: []
89
+
90
+ rubyforge_project: nowarning
91
+ rubygems_version: 1.3.7
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: A way to manage your source dependencies
95
+ test_files: []
96
+