bowline 0.1.6 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/README.txt +26 -23
  2. data/Rakefile +18 -23
  3. data/VERSION +1 -0
  4. data/assets/jquery.bowline.js +51 -29
  5. data/assets/jquery.js +2122 -1295
  6. data/bin/bowline-gen +1 -1
  7. data/bowline.gemspec +94 -17
  8. data/examples/twitter.html +18 -18
  9. data/lib/bowline.rb +10 -14
  10. data/lib/bowline/async.rb +29 -0
  11. data/lib/bowline/binders.rb +11 -40
  12. data/lib/bowline/binders/collection.rb +11 -8
  13. data/lib/bowline/binders/singleton.rb +9 -6
  14. data/lib/bowline/commands/run.rb +4 -11
  15. data/lib/bowline/dependencies/FAQ.markdown +6 -0
  16. data/lib/bowline/dependencies/MIT-LICENSE +20 -0
  17. data/lib/bowline/dependencies/README.markdown +51 -0
  18. data/lib/bowline/dependencies/Rakefile +10 -0
  19. data/lib/bowline/dependencies/TODO.markdown +4 -0
  20. data/lib/bowline/dependencies/init.rb +41 -0
  21. data/lib/bowline/dependencies/lib/dependencies.rb +9 -0
  22. data/lib/bowline/dependencies/lib/dependencies/dependency.rb +12 -0
  23. data/lib/bowline/dependencies/lib/dependencies/reader.rb +30 -0
  24. data/lib/bowline/dependencies/lib/dependencies/repository.rb +64 -0
  25. data/lib/bowline/dependencies/lib/ext/rubygems.rb +125 -0
  26. data/lib/bowline/dependencies/lib/template/app_script.rb +31 -0
  27. data/lib/bowline/dependencies/spec/spec.opts +4 -0
  28. data/lib/bowline/dependencies/tasks/dependencies.rake +164 -0
  29. data/lib/bowline/ext/array.rb +1 -1
  30. data/lib/bowline/generators.rb +1 -0
  31. data/lib/bowline/generators/application.rb +7 -2
  32. data/lib/bowline/generators/helper.rb +28 -0
  33. data/lib/bowline/helpers.rb +7 -0
  34. data/lib/bowline/initializer.rb +75 -41
  35. data/lib/bowline/observer.rb +42 -19
  36. data/lib/bowline/tasks/app.rake +143 -77
  37. data/lib/bowline/tasks/gems.rake +34 -0
  38. data/lib/bowline/tasks/{misk.rake → misc.rake} +0 -0
  39. data/lib/bowline/version.rb +11 -0
  40. data/lib/bowline/window.rb +19 -0
  41. data/templates/config/boot.rb +4 -3
  42. data/templates/config/environment.rb +8 -4
  43. data/templates/gitignore +0 -2
  44. data/templates/helper.rb +2 -0
  45. data/templates/public/icon.png +0 -0
  46. data/templates/public/index.html +8 -10
  47. metadata +38 -41
  48. data/Manifest.txt +0 -58
  49. data/lib/bowline/gem_dependency.rb +0 -42
  50. data/templates/config/manifest +0 -18
  51. data/templates/config/tiapp.xml +0 -24
@@ -1,11 +1,4 @@
1
- require "config/environment"
2
- exec_path = File.join(APP_ROOT, 'build', 'osx', "#{APP_NAME}.app")
3
-
4
- unless File.exist?(exec_path)
5
- require 'rake'
6
- require 'bowline/tasks/bowline'
7
- Rake::Task['app:bundle'].invoke
8
- end
9
-
10
- # Debug view
11
- `open #{File.join(exec_path, 'Contents', 'MacOS', APP_NAME)}`
1
+ require 'rake'
2
+ require 'bowline/tasks/bowline'
3
+ ENV['TIRUN'] = 'true'
4
+ Rake::Task['app'].invoke
@@ -0,0 +1,6 @@
1
+ FAQ
2
+ ===
3
+
4
+ 1. gem install or uninstall fails with gem >= 0 message
5
+ > gems/gems/ directory is likely dirty, remove any specifications, cache, doc, gems, or bin folders beneath it.
6
+
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 [name of plugin creator]
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,51 @@
1
+ Dependencies
2
+ ============
3
+
4
+ A port of Merb's dependency system to a Rails plugin.
5
+
6
+ Usage
7
+ =====
8
+
9
+ 1. Install the plugin
10
+
11
+ script/plugin install git://github.com/ddollar/dependencies.git
12
+
13
+ 2. Add the following line to your config/environment.rb
14
+
15
+ config.plugins = [:dependencies, :all]
16
+
17
+ 3. Add the following line to your .gitignore
18
+
19
+ gems
20
+
21
+ 4. Create a config/dependencies.rb file that looks like:
22
+
23
+ dependency 'gem'
24
+ dependency 'gem', '1.0.1'
25
+ dependency 'gem', :require_as => 'Gem'
26
+ dependency 'gem', :only => %w(test staging)
27
+ dependency 'gem', :except => 'production'
28
+
29
+ with_options(:only => 'test') do |test|
30
+ test.dependency 'tester-gem'
31
+ end
32
+
33
+ 5. Remove or comment out any config.gem lines from config/environment.rb or config/environments/*.rb
34
+
35
+ 6. Install the gems into your project and keep them up to date using:
36
+
37
+ rake dependencies:sync
38
+
39
+ 7. Alternatively you can use the following rake task to read your existing config.gem declarations and output a file suitable for this plugin. This task will appropriately handle any gems that you are currently loading on a per-environment basis as well.
40
+
41
+ rake dependencies:import
42
+
43
+
44
+ About
45
+ =====
46
+
47
+ Initial idea and Rubygems extension code from [Merb](http://merbivore.com/)
48
+
49
+ Rewritten for Rails by [David Dollar](http://daviddollar.org) ([@ddollar](http://twitter.com/ddollar))
50
+
51
+ Documentation, testing, ideas by Steven Soroka ([@ssoroka](http://twitter.com/ssoroka))
@@ -0,0 +1,10 @@
1
+ require 'spec/rake/spectask'
2
+ require 'rcov'
3
+
4
+ task :default => :spec
5
+
6
+ desc "Run all specs"
7
+ Spec::Rake::SpecTask.new(:spec) do |t|
8
+ t.spec_opts = ['--options', 'spec/spec.opts']
9
+ t.spec_files = FileList['spec/**/*_spec.rb']
10
+ end
@@ -0,0 +1,4 @@
1
+ To Do
2
+ =====
3
+
4
+ * Better handling of gems that depend on Rails to load.
@@ -0,0 +1,41 @@
1
+ unless $block_dependencies_plugin_init
2
+
3
+ require File.join(File.dirname(__FILE__), 'lib', 'dependencies')
4
+
5
+ Gem.clear_paths
6
+ Gem.path.unshift(File.join(Rails.root, 'gems'))
7
+
8
+ deps = ::Dependencies::Reader.read_file(File.join(Rails.root, 'config', 'dependencies.rb'))
9
+
10
+ deps.each do |dep|
11
+ current_environment = ENV['RAILS_ENV'] || 'development'
12
+
13
+ options = {
14
+ :only => [current_environment],
15
+ :except => [],
16
+ :require_as => dep.name
17
+ }.merge(dep.options)
18
+
19
+ # swap their :only and :except to an array if they used a not-Array
20
+ [ :only, :except ].each do |option|
21
+ options[option] = [options[option].to_s] unless options[option].is_a?(Array)
22
+ end
23
+
24
+ # don't run if require_as is nil or false
25
+ next if [nil, false].include?(options[:require_as])
26
+
27
+ # don't run if the dependency wants an env that is not the current one
28
+ next unless options[:only].include?(current_environment)
29
+
30
+ # don't run if the dependency does not want to load in the current env
31
+ next if options[:except].include?(current_environment)
32
+
33
+ begin
34
+ require options[:require_as]
35
+ rescue LoadError => e
36
+ puts "was unable to require #{dep.name} as '#{options[:require_as]}'
37
+ Reason: #{e.class.name} error raised with message: #{e.message}"
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,9 @@
1
+ module Dependencies; end
2
+
3
+ Dir[File.join(File.dirname(__FILE__), 'ext', '*.rb')].each do |file|
4
+ require file
5
+ end
6
+
7
+ Dir[File.join(File.dirname(__FILE__), 'dependencies', '*.rb')].each do |file|
8
+ require file
9
+ end
@@ -0,0 +1,12 @@
1
+ class Dependencies::Dependency
2
+ attr_accessor :name, :versions, :options
3
+
4
+ def initialize(name, *options)
5
+ opts = options.last.is_a?(Hash) ? options.pop : {}
6
+ vers = options
7
+
8
+ @name = name
9
+ @versions = vers
10
+ @options = opts
11
+ end
12
+ end
@@ -0,0 +1,30 @@
1
+ require 'active_support/core_ext/hash/deep_merge'
2
+ require 'active_support/option_merger'
3
+
4
+ class Dependencies::Reader
5
+
6
+ attr_reader :dependencies
7
+
8
+ def self.read(definitions)
9
+ reader = new
10
+ reader.instance_eval(definitions)
11
+ reader.dependencies
12
+ end
13
+
14
+ def self.read_file(filename)
15
+ self.read(File.read(filename))
16
+ end
17
+
18
+ def initialize
19
+ @dependencies = []
20
+ end
21
+
22
+ def dependency(name, *options)
23
+ @dependencies << ::Dependencies::Dependency.new(name, *options)
24
+ end
25
+
26
+ def with_options(options)
27
+ yield ActiveSupport::OptionMerger.new(self, options)
28
+ end
29
+
30
+ end
@@ -0,0 +1,64 @@
1
+ class Dependencies::Repository
2
+
3
+ def initialize(base)
4
+ @paths = {
5
+ :gems => File.join(base),
6
+ :bin => File.join(base, 'bin'),
7
+ :specs => File.join(base, 'specifications')
8
+ }
9
+ end
10
+
11
+ def index
12
+ @index ||= reload_index!
13
+ end
14
+
15
+ def reload_index!
16
+ @index = ::Gem::SourceIndex.new.load_gems_in(@paths[:specs])
17
+ end
18
+
19
+ def gem(name, versions=[])
20
+ ::Gem::Dependency.new(name, versions)
21
+ end
22
+
23
+ def search(gem)
24
+ index.search(gem)
25
+ end
26
+
27
+ def install(gem)
28
+ reload_index!
29
+ return if index.search(gem).last
30
+
31
+ installer = ::Gem::DependencyInstaller.new(
32
+ :bin_dir => @paths[:bin],
33
+ :install_dir => @paths[:gems],
34
+ :user_install => false)
35
+
36
+ begin
37
+ installer.install gem.name, gem.version_requirements
38
+ rescue ::Gem::GemNotFoundException => e
39
+ puts "Cannot find #{gem.name} #{gem.version_requirements}"
40
+ rescue ::Gem::RemoteFetcher::FetchError => e
41
+ puts "Problem with fetch, retrying..."
42
+ retry
43
+ end
44
+ end
45
+
46
+ def uninstall(name, version)
47
+ uninstaller = ::Gem::Uninstaller.new(name,
48
+ :version => version,
49
+ :bin_dir => @paths[:bin],
50
+ :install_dir => @paths[:gems],
51
+ :ignore => true,
52
+ :executables => true
53
+ )
54
+ uninstaller.uninstall
55
+ end
56
+
57
+ def installed
58
+ Dir[File.join(@paths[:gems], 'gems', '*')].map! { |n| File.basename(n) }
59
+ end
60
+
61
+ def gems
62
+ end
63
+
64
+ end
@@ -0,0 +1,125 @@
1
+ require 'erb'
2
+ require 'rubygems'
3
+ require 'rubygems/dependency_installer'
4
+
5
+ Gem.pre_install_hooks.push(proc do |installer|
6
+ unless File.file?(File.join(installer.bin_dir, "common.rb"))
7
+ FileUtils.mkdir_p(installer.bin_dir)
8
+ FileUtils.cp(File.join(File.dirname(__FILE__), "common.rb"),
9
+ File.join(installer.bin_dir, "common.rb"))
10
+ end
11
+
12
+ name = installer.spec.name
13
+
14
+ puts "+ #{name}"
15
+
16
+ if $GEMS && versions = ($GEMS.assoc(name) || [])[1]
17
+ dep = Gem::Dependency.new(name, versions)
18
+ unless dep.version_requirements.satisfied_by?(installer.spec.version)
19
+ raise "Cannot install #{installer.spec.full_name} " \
20
+ "for #{$INSTALLING}; " \
21
+ "you required #{dep}"
22
+ end
23
+ end
24
+ end)
25
+
26
+ class ::Gem::Uninstaller
27
+ def self._with_silent_ui
28
+
29
+ ui = Gem::DefaultUserInteraction.ui
30
+ def ui.say(str)
31
+ puts "- #{str}"
32
+ end
33
+
34
+ yield
35
+
36
+ class << Gem::DefaultUserInteraction.ui
37
+ remove_method :say
38
+ end
39
+ end
40
+
41
+ def self._uninstall(source_index, name, op, version)
42
+ unless source_index.find_name(name, "#{op} #{version}").empty?
43
+ uninstaller = Gem::Uninstaller.new(
44
+ name,
45
+ :version => "#{op} #{version}",
46
+ :install_dir => Dir.pwd / "gems",
47
+ :all => true,
48
+ :ignore => true,
49
+ :executables => true
50
+ )
51
+ _with_silent_ui { uninstaller.uninstall }
52
+ end
53
+ end
54
+
55
+ def self._uninstall_others(source_index, name, version)
56
+ _uninstall(source_index, name, "<", version)
57
+ _uninstall(source_index, name, ">", version)
58
+ end
59
+ end
60
+
61
+ Gem.post_install_hooks.push(proc do |installer|
62
+ source_index = installer.instance_variable_get("@source_index")
63
+ ::Gem::Uninstaller._uninstall_others(
64
+ source_index, installer.spec.name, installer.spec.version
65
+ )
66
+ end)
67
+
68
+ class ::Gem::DependencyInstaller
69
+ alias old_fg find_gems_with_sources
70
+
71
+ def find_gems_with_sources(dep)
72
+ if @source_index.any? { |_, installed_spec|
73
+ installed_spec.satisfies_requirement?(dep)
74
+ }
75
+ return []
76
+ end
77
+
78
+ old_fg(dep)
79
+ end
80
+ end
81
+
82
+ class ::Gem::SpecFetcher
83
+ alias old_fetch fetch
84
+ def fetch(*args) # in rubygems 1.3.2 fetch takes 4 parameters
85
+ dependency, all, matching_platform, prerelease = *args
86
+ idx = Gem::SourceIndex.from_installed_gems
87
+
88
+ reqs = dependency.version_requirements.requirements
89
+
90
+ if reqs.size == 1 && reqs[0][0] == "="
91
+ dep = idx.search(dependency).sort.last
92
+ end
93
+
94
+ if dep
95
+ file = dep.loaded_from.dup
96
+ file.gsub!(/specifications/, "cache")
97
+ file.gsub!(/gemspec$/, "gem")
98
+ spec = ::Gem::Format.from_file_by_path(file).spec
99
+ [[spec, file]]
100
+ else
101
+ old_fetch(*args)
102
+ end
103
+ end
104
+ end
105
+
106
+ class ::Gem::Installer
107
+ def app_script_text(bin_file_name)
108
+ template = File.read(File.join(File.dirname(__FILE__), '..', 'template' , "app_script.rb"))
109
+ erb = ERB.new(template)
110
+ erb.result(binding)
111
+ end
112
+ end
113
+
114
+ class ::Gem::Specification
115
+ def recursive_dependencies(from, index = Gem.source_index)
116
+ specs = self.runtime_dependencies.map do |dep|
117
+ spec = index.search(dep).last
118
+ unless spec
119
+ raise "Needed #{dep} for #{from}, but could not find it"
120
+ end
121
+ spec
122
+ end
123
+ specs + specs.map {|s| s.recursive_dependencies(self, index)}.flatten.uniq
124
+ end
125
+ end
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This was added by Merb's bundler
4
+
5
+ require "rubygems"
6
+ require File.join(File.dirname(__FILE__), "common")
7
+
8
+ gems_dir = File.join(File.dirname(__FILE__), '..', 'gems')
9
+
10
+ if File.directory?(gems_dir)
11
+ $BUNDLE = true
12
+ Gem.clear_paths
13
+ Gem.path.replace([File.expand_path(gems_dir)])
14
+ ENV["PATH"] = "#{File.dirname(__FILE__)}:#{ENV["PATH"]}"
15
+
16
+ gem_file = File.join(gems_dir, "specifications", "<%= spec.name %>-*.gemspec")
17
+
18
+ if local_gem = Dir[gem_file].last
19
+ version = File.basename(local_gem)[/-([\.\d]+)\.gemspec$/, 1]
20
+ end
21
+ end
22
+
23
+ version ||= "<%= Gem::Requirement.default %>"
24
+
25
+ if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
26
+ version = $1
27
+ ARGV.shift
28
+ end
29
+
30
+ gem '<%= @spec.name %>', version
31
+ load '<%= bin_file_name %>'
@@ -0,0 +1,4 @@
1
+ --colour
2
+ --format progress
3
+ --loadby mtime
4
+ --reverse
@@ -0,0 +1,164 @@
1
+ require "rubygems"
2
+ require "rubygems/source_index"
3
+ require "rubygems/dependency_installer"
4
+ require "rubygems/uninstaller"
5
+ require "fileutils"
6
+
7
+ # there has got to be a better way to do this
8
+ unless ARGV.first == 'dependencies:import'
9
+ Gem.clear_paths
10
+ Gem.path.unshift(File.join(RAILS_ROOT, 'gems'))
11
+ end
12
+
13
+ namespace :dependencies do
14
+
15
+ task :setup do
16
+ # avoid requiring environment by working up from vendor/plugins/dependencies/tasks
17
+ rails_root = File.expand_path(File.join(File.dirname(__FILE__), %w(.. .. .. ..)))
18
+
19
+ # Dependencies isn't loaded when running from rake. This is a good place to load it.
20
+ require File.expand_path(File.join(File.dirname(__FILE__), %w(.. lib dependencies))) unless defined?(Dependencies)
21
+
22
+ SETTINGS = {
23
+ :dependencies_file => File.join(rails_root, 'config', 'dependencies.rb'),
24
+ :gem_dir => File.join(rails_root, 'gems')
25
+ }
26
+ FileUtils.mkdir(SETTINGS[:gem_dir]) unless File.exists?(SETTINGS[:gem_dir])
27
+ end
28
+
29
+ task :load => :setup do
30
+ SETTINGS[:dependencies] = ::Dependencies::Reader.read_file(SETTINGS[:dependencies_file])
31
+ end
32
+
33
+ namespace :transaction do
34
+ task :setup do
35
+ SETTINGS[:gem_original_dir] = SETTINGS[:gem_dir]
36
+ SETTINGS[:gem_dir] = SETTINGS[:gem_dir] + '.install'
37
+ end
38
+
39
+ task :begin => :setup do
40
+ FileUtils.rm_rf(SETTINGS[:gem_dir])
41
+ FileUtils.cp_r(SETTINGS[:gem_original_dir], SETTINGS[:gem_dir])
42
+ end
43
+
44
+ task :commit => :setup do
45
+ FileUtils.rm_rf(SETTINGS[:gem_original_dir])
46
+ FileUtils.mv(SETTINGS[:gem_dir], SETTINGS[:gem_original_dir])
47
+ end
48
+
49
+ task :rollback => :setup do
50
+ FileUtils.rm_rf(SETTINGS[:gem_dir])
51
+ end
52
+ end
53
+
54
+ desc 'synchronize the stuff'
55
+ task :sync => [ :setup, :load ] do
56
+ Rake::Task['dependencies:transaction:begin'].invoke
57
+
58
+ begin
59
+ repo = Dependencies::Repository.new(SETTINGS[:gem_dir])
60
+
61
+ SETTINGS[:dependencies].each do |dep|
62
+ gem = repo.gem(dep.name, dep.versions)
63
+ next unless repo.search(gem).empty?
64
+ repo.install(gem)
65
+ end
66
+
67
+ repo.reload_index!
68
+
69
+ full_list = SETTINGS[:dependencies].map do |dep|
70
+ gem = repo.gem(dep.name, dep.versions)
71
+ spec = repo.index.search(gem).last
72
+ unless spec
73
+ # Rake::Task['dependencies:transaction:rollback'].invoke # gets run on rescue below.
74
+ raise Exception.new("A required dependency #{gem} was not found")
75
+ end
76
+ deps = spec.recursive_dependencies(gem, repo.index)
77
+ [spec] + deps
78
+ end.flatten.uniq.map do |spec|
79
+ "#{spec.name}-#{spec.version}"
80
+ end
81
+
82
+ (repo.installed - full_list).each do |g|
83
+ /^(.*)\-(.*)$/ =~ g
84
+ repo.uninstall($1, $2)
85
+ end
86
+
87
+ #confirm(gems)
88
+
89
+ Rake::Task['dependencies:transaction:commit'].invoke
90
+
91
+ rescue Exception => ex
92
+ puts ex.message
93
+ puts ex.backtrace
94
+ Rake::Task['dependencies:transaction:rollback'].invoke
95
+ end
96
+ end
97
+
98
+ desc 'Build a dependencies.rb from old config.gem style declarations'
99
+ task :import do
100
+
101
+ # gross
102
+ $block_dependencies_plugin_init = true
103
+ $gems_rake_task = true
104
+ $gems_build_rake_task = true
105
+
106
+ Rake::Task['environment'].invoke
107
+ environments = %w( development test production )
108
+
109
+ gems = environments.inject({}) do |memo, environment|
110
+ begin
111
+ ENV['RAILS_ENV'] = environment
112
+ RAILS_ENV = environment
113
+ load File.join(RAILS_ROOT, 'config', 'environment.rb')
114
+ rescue StandardError => ex
115
+ puts "Something went wrong: #{ex.message}"
116
+ exit 1
117
+ end
118
+
119
+ Rails.configuration.gems.each do |gem|
120
+ signature = [gem.name, gem.requirement.to_s]
121
+ memo[signature] ||= {
122
+ :name => gem.name,
123
+ :version => gem.requirement.to_s,
124
+ :require_as => gem.lib,
125
+ :environments => []
126
+ }
127
+ memo[signature][:environments] << environment
128
+ end
129
+
130
+ memo
131
+ end
132
+
133
+ all_environments, some_environments = gems.values.partition do |gem|
134
+ gem[:environments].sort == environments.sort
135
+ end
136
+
137
+ all_environments.each do |gem|
138
+ puts dependency_declaration_from_hash(gem)
139
+ end
140
+
141
+ environments.each do |environment|
142
+ gems = some_environments.select do |gem|
143
+ gem[:environments].include?(environment)
144
+ end
145
+
146
+ unless gems.length.zero?
147
+ puts
148
+ puts "with_options(:only => '#{environment}') do |#{environment}|"
149
+ gems.each do |gem|
150
+ puts " #{environment}." + dependency_declaration_from_hash(gem)
151
+ end
152
+ puts 'end'
153
+ end
154
+ end
155
+ end
156
+ end
157
+
158
+ def dependency_declaration_from_hash(gem)
159
+ declaration = []
160
+ declaration << "dependency '#{gem[:name]}'"
161
+ declaration << "'#{gem[:version]}'" unless gem[:version].blank?
162
+ declaration << ":require_as => '#{gem[:lib]}'" unless gem[:lib] == nil
163
+ declaration.join(', ')
164
+ end