GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Description: Resource-oriented open source Ruby framework for Web apps.
Homepage: http://rubywaves.com/
Clone URL: git://github.com/dyoder/waves.git
reworked scripts and rake for easier hacking of source


git-svn-id: https://waves.googlecode.com/svn/trunk@9 
1a046131-c842-0410-aed1-15fd42da8445
automatthew (author)
Fri Feb 29 15:03:45 -0800 2008
commit  400aae3312163cf920c2cb42a7d6955843359f72
tree    23a4135b7b8ae5f771abbf0358e4a30c0341a350
parent  9fd7228d18486a93404f354878ac6b4c54378047
...
45
46
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
0
@@ -45,3 +45,24 @@ Rake::RDocTask.new do |rdoc|
0
   rdoc.rdoc_dir = 'doc/rdoc'; rdoc.options << '--line-numbers' << '--inline-source'
0
   rdoc.rdoc_files.add [ 'lib/**/*.rb', 'doc/README', 'doc/HISTORY' ]
0
 end
0
+
0
+desc "Set up dependencies so you can work from source"
0
+task( :setup ) do
0
+ gems = Gem::SourceIndex.from_installed_gems
0
+ # Runtime dependencies from the Gem's spec.
0
+ dependencies = gem.dependencies
0
+ # Add build-time dependencies, like this:
0
+ dependencies.each do |dep|
0
+ if gems.search(dep.name, dep.version_requirements).empty?
0
+ puts "Installing dependency: #{dep}"
0
+ begin
0
+ require 'rubygems/dependency_installer'
0
+ Gem::DependencyInstaller.new(dep.name, dep.version_requirements).install
0
+ rescue LoadError # < rubygems 1.0.1
0
+ require 'rubygems/remote_installer'
0
+ Gem::RemoteInstaller.new.install(dep.name, dep.version_requirements)
0
+ end
0
+ end
0
+ end
0
+ system(cmd = "chmod +x bin/waves*")
0
+end
...
1
2
3
 
 
 
 
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
...
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
0
@@ -1,4 +1,22 @@
0
-require 'waves'
0
-Waves::Console.load
0
-%w( schema cluster generate ).each { |task| require "lib/tasks/#{task}.rb" }
0
+#!/usr/bin/env ruby
0
+if File.exist?(waves_src = File.join(File.dirname(__FILE__), 'waves'))
0
+ $:.unshift(File.join(waves_src, 'lib'))
0
+end
0
 
0
+begin
0
+ require 'waves'
0
+ Waves::Console.load
0
+ %w( schema cluster generate ).each { |task| require "lib/tasks/#{task}.rb" }
0
+rescue LoadError
0
+ puts "Can't find waves gem or ./waves/lib directory. try rake symlink waves=/path/to/waves/"
0
+end
0
+
0
+desc "Create lib and bin symlinks using waves=<path>"
0
+task :symlink do
0
+ waves = ENV['waves']
0
+ system "mkdir waves"
0
+ libdir = File.join(waves, 'lib')
0
+ bindir = File.join(waves, 'bin')
0
+ system(cmd = "ln -s #{libdir} waves/") && puts(cmd)
0
+ system(cmd = "ln -s #{bindir} waves/") && puts(cmd)
0
+end
0
\ No newline at end of file
...
41
42
43
44
 
45
46
47
...
41
42
43
 
44
45
46
47
0
@@ -41,7 +41,7 @@ module <%= name %>
0
   # accessor methods for modules and other key application objects ...
0
   class << self
0
     def config ; Waves::Server.config rescue nil || Waves::Console.config ; end
0
- def database ; @database ||= Sequel.mysql( config.database ) ; end
0
+ def database ; @database ||= Sequel.send(config.database[:adapter].to_sym, config.database ) ; end
0
     def configurations ; <%= name %>::Configurations ; end
0
     def controllers ; <%= name %>::Controllers ; end
0
     def models ; <%= name %>::Models ; end
...
1
2
3
 
 
4
...
1
 
2
3
4
5
0
@@ -1,2 +1,3 @@
0
 require 'lib/<%= name.downcase %>'
0
-Waves << <%= name %>
0
\ No newline at end of file
0
+Waves << <%= name %>
0
+Application = <%= name %>
0
\ No newline at end of file
...
5
6
7
8
 
9
10
11
...
5
6
7
 
8
9
10
11
0
@@ -5,7 +5,7 @@ namespace :schema do
0
   task :migration do |task|
0
   
0
     version = ( ENV['version'].nil? ?
0
- Sequel::Migrator.get_current_migration_version( Blog.database ) :
0
+ Sequel::Migrator.get_current_migration_version( Application.database ) :
0
       ENV['version'].to_i ) + 1
0
 
0
     name = ENV['name'] || 'migration'
0
bin/waves 100644 →
...
6
7
8
9
 
 
 
10
11
12
 
 
13
14
 
15
16
17
 
18
19
20
21
 
 
22
23
24
...
26
27
28
 
 
 
29
30
 
31
32
...
6
7
8
 
9
10
11
12
13
 
14
15
16
 
17
18
19
 
20
21
22
 
 
23
24
25
26
27
...
29
30
31
32
33
34
35
 
36
37
38
0
@@ -6,19 +6,22 @@ unless ARGV.length == 1
0
 end
0
 
0
 require 'rubygems'
0
-require 'waves'
0
+require 'erubis'
0
+require 'extensions/all'
0
+require File.join(File.dirname(__FILE__), '..', 'lib', 'utilities', 'string')
0
 
0
 puts "** Creating new Waves application ..."
0
-app_name = ARGV[0]
0
+app_path = ARGV[0]
0
+app_name = File.basename(app_path)
0
 template = File.join( File.dirname(__FILE__),'..','app')
0
-system "cp -R #{template} #{app_name}"
0
+system "cp -R #{template} #{app_path}"
0
 
0
 # get rid of placeholder files left over from gem install
0
-Dir["#{app_name}/**/EMPTY"].each { |path| system "rm #{path}" }
0
+Dir["#{app_path}/**/EMPTY"].each { |path| system "rm #{path}" }
0
 
0
 # next, process all template files ...
0
-Dir["#{app_name}/**/*.erb"].each do |path|
0
- unless path =~ %r{^#{app_name}/(schema/migrations/templates|templates)}
0
+Dir["#{app_path}/**/*.erb"].each do |path|
0
+ unless path =~ %r{^#{app_path}/(schema/migrations/templates|templates)}
0
     name = app_name.camel_case
0
     File.write( path.gsub(/\.erb$/,''),
0
       Erubis::Eruby.new( File.read( path ) ).result( binding ) )
0
@@ -26,7 +29,10 @@ Dir["#{app_name}/**/*.erb"].each do |path|
0
   end
0
 end
0
 
0
+# make the scripts executable
0
+system "chmod ug+x #{app_path}/bin/waves-*"
0
+
0
 # finally, change the lib/application.rb file
0
-system "mv #{app_name}/lib/application.rb #{app_name}/lib/#{app_name}.rb"
0
+system "mv #{app_path}/lib/application.rb #{app_path}/lib/#{app_name}.rb"
0
 
0
 puts "** Application created!"
0
bin/waves-console 100644 →
...
 
1
2
3
...
1
2
3
4
0
@@ -1,3 +1,4 @@
0
+#!/usr/bin/env ruby
0
 require 'waves'
0
 require 'choice'
0
 
0
bin/waves-server 100644 → 100755

Comments

    No one has commented yet.