gigantron 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/History.txt +5 -0
  2. data/License.txt +20 -0
  3. data/Manifest.txt +48 -0
  4. data/PostInstall.txt +4 -0
  5. data/README.txt +70 -0
  6. data/Rakefile +4 -0
  7. data/app_generators/gigantron/USAGE +7 -0
  8. data/app_generators/gigantron/gigantron_generator.rb +80 -0
  9. data/app_generators/gigantron/templates/Rakefile +12 -0
  10. data/app_generators/gigantron/templates/database.yml +9 -0
  11. data/app_generators/gigantron/templates/initialize.rb +26 -0
  12. data/app_generators/gigantron/templates/tasks/import.rake +10 -0
  13. data/app_generators/gigantron/templates/test/tasks/test_import.rb +23 -0
  14. data/app_generators/gigantron/templates/test/test_helper.rb +5 -0
  15. data/bin/gigantron +15 -0
  16. data/config/hoe.rb +80 -0
  17. data/config/requirements.rb +15 -0
  18. data/gigantron_generators/model/USAGE +11 -0
  19. data/gigantron_generators/model/model_generator.rb +51 -0
  20. data/gigantron_generators/model/templates/models/model.rb +6 -0
  21. data/gigantron_generators/model/templates/test/models/test_model.rb +13 -0
  22. data/gigantron_generators/task/USAGE +10 -0
  23. data/gigantron_generators/task/task_generator.rb +50 -0
  24. data/gigantron_generators/task/templates/tasks/task.rake +4 -0
  25. data/gigantron_generators/task/templates/test/tasks/test_task.rb +22 -0
  26. data/lib/gigantron/tasks/db.rb +8 -0
  27. data/lib/gigantron/tasks/test.rb +30 -0
  28. data/lib/gigantron/version.rb +9 -0
  29. data/lib/gigantron.rb +0 -0
  30. data/script/console +10 -0
  31. data/script/destroy +14 -0
  32. data/script/generate +14 -0
  33. data/script/txt2html +82 -0
  34. data/setup.rb +1585 -0
  35. data/tasks/deployment.rake +34 -0
  36. data/tasks/environment.rake +7 -0
  37. data/tasks/website.rake +17 -0
  38. data/test/test_generator_helper.rb +29 -0
  39. data/test/test_gigantron.rb +11 -0
  40. data/test/test_gigantron_generator.rb +56 -0
  41. data/test/test_helper.rb +4 -0
  42. data/test/test_model_generator.rb +48 -0
  43. data/test/test_task_generator.rb +48 -0
  44. data/website/index.html +149 -0
  45. data/website/index.txt +93 -0
  46. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  47. data/website/stylesheets/screen.css +138 -0
  48. data/website/template.html.erb +48 -0
  49. metadata +110 -0
@@ -0,0 +1,9 @@
1
+ module Gigantron #:nodoc:
2
+ module VERSION #:nodoc:
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ TINY = 1
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+ end
9
+ end
data/lib/gigantron.rb ADDED
File without changes
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/gigantron.rb'}"
9
+ puts "Loading gigantron gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
data/script/txt2html ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ GEM_NAME = 'gigantron' # what ppl will type to install your gem
4
+ RUBYFORGE_PROJECT = 'gigantron'
5
+
6
+ require 'rubygems'
7
+ begin
8
+ require 'newgem'
9
+ require 'rubyforge'
10
+ rescue LoadError
11
+ puts "\n\nGenerating the website requires the newgem RubyGem"
12
+ puts "Install: gem install newgem\n\n"
13
+ exit(1)
14
+ end
15
+ require 'redcloth'
16
+ require 'syntax/convertors/html'
17
+ require 'erb'
18
+ require File.dirname(__FILE__) + "/../lib/#{GEM_NAME}/version.rb"
19
+
20
+ version = Gigantron::VERSION::STRING
21
+ download = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
22
+
23
+ def rubyforge_project_id
24
+ RubyForge.new.autoconfig["group_ids"][RUBYFORGE_PROJECT]
25
+ end
26
+
27
+ class Fixnum
28
+ def ordinal
29
+ # teens
30
+ return 'th' if (10..19).include?(self % 100)
31
+ # others
32
+ case self % 10
33
+ when 1: return 'st'
34
+ when 2: return 'nd'
35
+ when 3: return 'rd'
36
+ else return 'th'
37
+ end
38
+ end
39
+ end
40
+
41
+ class Time
42
+ def pretty
43
+ return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
44
+ end
45
+ end
46
+
47
+ def convert_syntax(syntax, source)
48
+ return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
49
+ end
50
+
51
+ if ARGV.length >= 1
52
+ src, template = ARGV
53
+ template ||= File.join(File.dirname(__FILE__), '/../website/template.html.erb')
54
+ else
55
+ puts("Usage: #{File.split($0).last} source.txt [template.html.erb] > output.html")
56
+ exit!
57
+ end
58
+
59
+ template = ERB.new(File.open(template).read)
60
+
61
+ title = nil
62
+ body = nil
63
+ File.open(src) do |fsrc|
64
+ title_text = fsrc.readline
65
+ body_text_template = fsrc.read
66
+ body_text = ERB.new(body_text_template).result(binding)
67
+ syntax_items = []
68
+ body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
69
+ ident = syntax_items.length
70
+ element, syntax, source = $1, $2, $3
71
+ syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
72
+ "syntax-temp-#{ident}"
73
+ }
74
+ title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
75
+ body = RedCloth.new(body_text).to_html
76
+ body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
77
+ end
78
+ stat = File.stat(src)
79
+ created = stat.ctime
80
+ modified = stat.mtime
81
+
82
+ $stdout << template.result(binding)