ricogen 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,27 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ HAML_GEMSPEC = Gem::Specification.new do |s|
5
+ s.name = 'ricogen'
6
+ s.rubyforge_project = 'ricogen'
7
+ s.summary = "My rails 3 app generator based on hamgen"
8
+ s.version = File.read('VERSION').strip
9
+ s.authors = ['Hampton Catlin', "David Cuadrado"]
10
+ s.email = 'krawek@gmail.com'
11
+ s.description = <<-END
12
+ A Rails 3.0 generator (like for the whole project) that pre-generates
13
+ a bunch of shit I like. Most of it is stolen directly from Hampton's Rails Template
14
+ at http://github.com/hcatlin/hamgen but with changes just for ole' me
15
+ END
16
+
17
+ s.add_runtime_dependency('colored', ['~> 1.2'])
18
+ s.add_runtime_dependency('rails', ['~> 3.0.0'])
19
+ s.add_runtime_dependency('haml', ['~> 3.0.18'])
20
+
21
+ s.add_development_dependency('rake', ['~> 0.8.7'])
22
+
23
+ s.executables = ['ricogen']
24
+ s.files = Dir['**/**'].to_a.select { |f| f[0..2] != "pkg"}
25
+ s.homepage = 'http://www.hamptoncatlin.com/'
26
+ end
27
+
@@ -0,0 +1,42 @@
1
+ source "http://gemcutter.org"
2
+
3
+ gem "rails", "3.0.1"
4
+
5
+ # ui
6
+ gem "haml"
7
+ gem 'compass', '0.10.6.pre.1'
8
+
9
+ # utils
10
+ gem 'magic', '~> 0.2.6'
11
+ gem 'ruby-stemmer', '~> 0.8.2'
12
+ gem 'magent', '~> 0.5.2'
13
+ gem 'uuidtools'
14
+ gem 'sanitize', '~> 1.2.1'
15
+
16
+ # mongodb
17
+ gem 'bson', '1.1.1'
18
+ gem 'bson_ext', '1.1.1'
19
+ gem 'plucky', '0.3.6'
20
+
21
+ gem 'mongo', '1.1.1'
22
+ gem 'jnunemaker-validatable', '1.8.4'
23
+ gem 'mongo_mapper', '0.8.6'
24
+ gem 'mongomapper_ext', '0.5.1'
25
+
26
+ # authentication
27
+ gem 'omniauth', '0.1.4'
28
+ gem 'multiauth', '0.2.7'
29
+
30
+ group :scripts do
31
+ gem 'eventmachine', '~> 0.12.10'
32
+ gem 'em-websocket', '~> 0.1.4'
33
+ gem 'cronedit'
34
+ end
35
+
36
+ group :development do
37
+ gem 'rspec', '2.0.0'
38
+ gem 'rspec-rails', '2.0.0'
39
+ gem 'mongrel', '1.2.0.pre2'
40
+ gem 'nifty-generators', '~> 0.4.2'
41
+ gem 'capistrano'
42
+ end
@@ -0,0 +1,49 @@
1
+ require 'ostruct'
2
+
3
+ config_file = Rails.root+"config/app.yml"
4
+ options = YAML.load_file(config_file)
5
+ if !options[Rails.env]
6
+ raise "'#{Rails.env}' was not found in #{config_file}"
7
+ end
8
+ AppConfig = OpenStruct.new(options[Rails.env])
9
+
10
+
11
+ SANITIZE_CONFIG = {
12
+ :protocols => {
13
+ "a"=>{"href"=>["ftp", "http", "https", "mailto", :relative]},
14
+ "img"=>{"src"=>["http", "https", :relative]},
15
+ "blockquote"=>{"cite"=>["http", "https", :relative]},
16
+ "q"=>{"cite"=>["http", "https", :relative]}
17
+ },
18
+ :elements => ["a", "b", "blockquote", "br", "caption", "cite", "code", "col",
19
+ "colgroup", "dd", "dl", "dt", "em", "h1", "h2", "h3", "h4", "h5",
20
+ "h6", "i", "img", "li", "ol", "p", "pre", "q", "small", "strike",
21
+ "strong", "sub", "sup", "table", "tbody", "td", "tfoot", "th",
22
+ "thead", "tr", "u", "ul", "font", "s", "hr", "div", "span"],
23
+ :attributes => {
24
+ "div" => ["style"],
25
+ "pre" => ["style"],
26
+ "code" => ["style"],
27
+ "colgroup"=>["span", "width"],
28
+ "col"=>["span", "width"],
29
+ "ul"=>["type"],
30
+ "a"=>["href", "title"],
31
+ "img"=>["align", "alt", "height", "src", "title", "width"],
32
+ "blockquote"=>["cite"],
33
+ "td"=>["abbr", "axis", "colspan", "rowspan", "width"],
34
+ "table"=>["summary", "width"],
35
+ "q"=>["cite"],
36
+ "ol"=>["start", "type"],
37
+ "th"=>["abbr", "axis", "colspan", "rowspan", "scope", "width"]
38
+ }
39
+ }
40
+
41
+
42
+ Rails.application.config.session_store :cookie_store, :key => AppConfig.session_key, :domain => :all
43
+ Rails.application.config.secret_token = AppConfig.session_secret
44
+
45
+ ActionMailer::Base.default_url_options[:host] = AppConfig.domain
46
+
47
+ if File.exist?(Rails.root + "VERSION")
48
+ AppConfig.version = File.read(Rails.root + "VERSION")
49
+ end
@@ -0,0 +1,28 @@
1
+ !!!
2
+ %html{:lang => 'en'}
3
+ %head
4
+ %title #{@title}
5
+ %meta{:charset => 'utf-8'}
6
+ %meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'}
7
+ %meta{:name => 'viewport', :content => 'width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0'}
8
+ = csrf_meta_tag
9
+ <!--[if ! lte IE 7]><!-->
10
+ %link{:rel => 'stylesheet', :href => '/stylesheets/application.css'}
11
+ <!--<![endif]-->
12
+ /[if lte IE 7]
13
+ %link{:rel => 'stylesheet', :href => 'http://universal-ie6-css.googlecode.com/files/ie6.0.3.css'}
14
+ /[if IE]
15
+ %script{:src => 'http://html5shiv.googlecode.com/svn/trunk/html5.js'}
16
+
17
+ %body{:class => page_class}
18
+ = yield
19
+
20
+ <!--[if ! lte IE 7]><!-->
21
+ %script{:src => 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'}
22
+ %script{:src => '/javascripts/application.js'}
23
+ <!--<![endif]-->
24
+ /[if lte IE 8]
25
+ //%script{:src => 'http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js'}
26
+
27
+ / Google Analytics | Don't forget to include your tracking number!!!!
28
+ %script var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_trackPageview']); (function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);})();
@@ -0,0 +1,8 @@
1
+ config.generators do |g|
2
+ g.orm = :mongo_mapper
3
+ g.template_engine = :haml
4
+ g.test_framework = :rspec
5
+ end
6
+
7
+ config.middleware.use "MongoMapperExt::FileServer"
8
+
@@ -0,0 +1,15 @@
1
+ # Require any additional compass plugins here.
2
+
3
+ project_type = :rails
4
+ project_path = RAILS_ROOT if defined?(RAILS_ROOT)
5
+ # Set this to the root of your project when deployed:
6
+ http_path = "/"
7
+ css_dir = "public/stylesheets/compiled"
8
+ sass_dir = "app/stylesheets"
9
+ images_dir = "public/images"
10
+ javascripts_dir = "public/javascripts"
11
+ # To enable relative paths to assets via compass helper functions. Uncomment:
12
+ # relative_assets = true
13
+ http_images_path = "/images"
14
+ http_stylesheets_path = "/stylesheets"
15
+ http_javascripts_path = "/javascripts"
@@ -0,0 +1,5 @@
1
+ require 'compass'
2
+ # If you have any compass plugins, require them here.
3
+ Compass.add_project_configuration(File.join(RAILS_ROOT, "config", "compass.config"))
4
+ Compass.configuration.environment = RAILS_ENV.to_sym
5
+ Compass.configure_sass_plugin!
@@ -0,0 +1,10 @@
1
+ development:
2
+ database: app-development
3
+ host: localhost
4
+ port: 27017
5
+
6
+ test:
7
+ database: app-test
8
+
9
+ production:
10
+ database: app-development
@@ -0,0 +1,13 @@
1
+ # put rails errors inline on the tags themselves
2
+ ActionView::Base.field_error_proc = (
3
+ Proc.new do |html_tag, instance|
4
+ class_name = "error"
5
+ d = HTML::Document.new(html_tag)
6
+ tag = d.root.children.first
7
+ if tag.attributes.has_key?('class')
8
+ tag.attributes["class"] += " #{class_name}"
9
+ else
10
+ tag.attributes["class"] = class_name
11
+ end
12
+ tag.to_s.html_safe
13
+ end)
@@ -0,0 +1,6 @@
1
+ .DS_Store
2
+ .bundle
3
+ log/*.log
4
+ tmp/**/*
5
+ db/*.sqlite3
6
+ Gemfile.lock
@@ -0,0 +1,7 @@
1
+ // jQuery Browser Plugin | Version 2.3 | http://jquery.thewikies.com/browser
2
+ (function($){$.browserTest=function(a,z){var u='unknown',x='X',m=function(r,h){for(var i=0;i<h.length;i=i+1){r=r.replace(h[i][0],h[i][1]);}return r;},c=function(i,a,b,c){var r={name:m((a.exec(i)||[u,u])[1],b)};r[r.name]=true;r.version=(c.exec(i)||[x,x,x,x])[3];if(r.name.match(/safari/)&&r.version>400){r.version='2.0';}if(r.name==='presto'){r.version=($.browser.version>9.27)?'futhark':'linear_b';}r.versionNumber=parseFloat(r.version,10)||0;r.versionX=(r.version!==x)?(r.version+'').substr(0,1):x;r.className=r.name+r.versionX;return r;};a=(a.match(/Opera|Navigator|Minefield|KHTML|Chrome/)?m(a,[[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/,''],['Chrome Safari','Chrome'],['KHTML','Konqueror'],['Minefield','Firefox'],['Navigator','Netscape']]):a).toLowerCase();$.browser=$.extend((!z)?$.browser:{},c(a,/(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari)/,[],/(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari)(\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/));$.layout=c(a,/(gecko|konqueror|msie|opera|webkit)/,[['konqueror','khtml'],['msie','trident'],['opera','presto']],/(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);$.os={name:(/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase())||[u])[0].replace('sunos','solaris')};if(!z){$('html').addClass([$.os.name,$.browser.name,$.browser.className,$.layout.name,$.layout.className].join(' '));}};$.browserTest(navigator.userAgent);})(jQuery);
3
+
4
+ $(document).ready(function(){
5
+
6
+
7
+ });
@@ -0,0 +1 @@
1
+ jQuery(function($){var csrf_token=$('meta[name=csrf-token]').attr('content'),csrf_param=$('meta[name=csrf-param]').attr('content');$.fn.extend({triggerAndReturn:function(name,data){var event=new $.Event(name);this.trigger(event,data);return event.result!==false},callRemote:function(){var el=this,data=el.is('form')?el.serializeArray():[],method=el.attr('method')||el.attr('data-method')||'GET',url=el.attr('action')||el.attr('href');if(url===undefined){throw"No URL specified for remote call (action or href must be present).";}else{if(el.triggerAndReturn('ajax:before')){$.ajax({url:url,data:data,dataType:'script',type:method.toUpperCase(),beforeSend:function(xhr){el.trigger('ajax:loading',xhr)},success:function(data,status,xhr){el.trigger('ajax:success',[data,status,xhr])},complete:function(xhr){el.trigger('ajax:complete',xhr)},error:function(xhr,status,error){el.trigger('ajax:failure',[xhr,status,error])}})}el.trigger('ajax:after')}}});$('a[data-confirm],input[data-confirm]').live('click',function(){var el=$(this);if(el.triggerAndReturn('confirm')){if(!confirm(el.attr('data-confirm'))){return false}}});$('form[data-remote]').live('submit',function(e){$(this).callRemote();e.preventDefault()});$('a[data-remote],input[data-remote]').live('click',function(e){$(this).callRemote();e.preventDefault()});$('a[data-method]:not([data-remote])').live('click',function(e){var link=$(this),href=link.attr('href'),method=link.attr('data-method'),form=$('<form method="post" action="'+href+'">'),metadata_input='<input name="_method" value="'+method+'" type="hidden" />';if(csrf_param!=null&&csrf_token!=null){metadata_input+='<input name="'+csrf_param+'" value="'+csrf_token+'" type="hidden" />'}form.hide().append(metadata_input).appendTo('body');e.preventDefault();form.submit()});var disable_with_input_selector='input[data-disable-with]';var disable_with_form_selector='form[data-remote]:has('+disable_with_input_selector+')';$(disable_with_form_selector).live('ajax:before',function(){$(this).find(disable_with_input_selector).each(function(){var input=$(this);input.data('enable-with',input.val()).attr('value',input.attr('data-disable-with')).attr('disabled','disabled')})});$(disable_with_form_selector).live('ajax:after',function(){$(this).find(disable_with_input_selector).each(function(){var input=$(this);input.removeAttr('disabled').val(input.data('enable-with'))})})});
@@ -0,0 +1,13 @@
1
+ development:
2
+ database: magent-development
3
+ host: localhost
4
+ port: 27017
5
+ websocket_channel: magent.websocket
6
+
7
+ test:
8
+ database: magent-test
9
+
10
+ production:
11
+ database: magent-production
12
+ websocket_channel: magent.websocket
13
+
@@ -0,0 +1,18 @@
1
+ MongoMapper.setup(YAML.load_file(Rails.root.join('config', 'database.yml')),
2
+ Rails.env, { :logger => Rails.logger, :passenger => false })
3
+
4
+ Magent.setup(YAML.load_file(Rails.root.join('config', 'magent.yml')),
5
+ Rails.env, {})
6
+
7
+
8
+ MongoMapperExt.init
9
+
10
+ Dir.glob("#{RAILS_ROOT}/app/models/**/*.rb") do |model_path|
11
+ File.basename(model_path, ".rb").classify.constantize
12
+ end
13
+
14
+ # HACK: do not create indexes on every request
15
+ module MongoMapper::Plugins::Indexes::ClassMethods
16
+ def ensure_index(*args)
17
+ end
18
+ end
@@ -0,0 +1,12 @@
1
+ // setup.sass | BOOTSTRAP YOUR PROJECT
2
+
3
+ // Default Body Styles
4
+ $background: white
5
+ $font-family: $helvetica
6
+ $font-size: $medium
7
+ $colour: darken(white, 93%)
8
+
9
+ // Default link colours/styles
10
+ $link_colour: blue
11
+ $hover_colour: purple
12
+ $active_colour: red
@@ -0,0 +1,15 @@
1
+ // DEFAULT LIBRARIES
2
+ @import lib/mixins
3
+ @import lib/variables
4
+ @import styles/variables
5
+ @import setup
6
+ @import lib/reset
7
+ @import lib/extend
8
+
9
+ // DEFAULT BASE STYLES
10
+ @import styles/extend
11
+ @import styles/mixins
12
+ @import styles/common
13
+ @import styles/template
14
+
15
+
@@ -0,0 +1,87 @@
1
+ // extend.sass | LIBRARY @EXTEND CLASSES
2
+
3
+ // Clearing Floats
4
+ ----------------------------------------------
5
+ .clear => For non-floating element immediately below a floating element.
6
+
7
+ .clearfix => For floating children inside a parent.
8
+ Class goes on parent holding floating children.
9
+
10
+ // Use all of these classes with the @extend option
11
+ .zoom
12
+ :zoom 1
13
+
14
+ .left
15
+ :float left
16
+
17
+ .right
18
+ :float right
19
+
20
+ .block
21
+ :display block
22
+
23
+ .absolute
24
+ :position absolute
25
+
26
+ .relative
27
+ :position relative
28
+
29
+ .center
30
+ :text-align center
31
+
32
+ .hidden
33
+ :overflow hidden
34
+
35
+ .bold
36
+ :font-weight bold
37
+
38
+ .clear
39
+ :clear both
40
+
41
+ .clearfix:after
42
+ @extend .clear
43
+ @extend .block
44
+ :content ""
45
+
46
+ // Replacing text with a background image
47
+ .hide-text, .h
48
+ @extend .block
49
+ @extend .hidden
50
+ :font-size 0
51
+ :text-indent -9999em
52
+ :white-space nowrap
53
+ :.text-transform capitalize
54
+
55
+ // Reset some basic styling
56
+ .reset, .r
57
+ :border 0
58
+ :margin 0
59
+ :padding 0
60
+
61
+ // Consolidate fonts. Works with font $variables in lib/variables.
62
+ .font_x-small
63
+ :font-size $x-small
64
+
65
+ .font_small
66
+ :font-size $small
67
+
68
+ .font_medium
69
+ :font-size $medium
70
+
71
+ .font_x-medium
72
+ :font-size $x-medium
73
+
74
+ .font_large
75
+ :font-size $large
76
+
77
+ .font_x-large
78
+ :font-size $x-large
79
+
80
+ .font_xx-large
81
+ :font-size $xx-large
82
+
83
+ .font_huge
84
+ :font-size $huge
85
+
86
+ .font_x-huge
87
+ :font-size $x-huge
@@ -0,0 +1,78 @@
1
+ // mixins.sass | LIBRARY MIX-INS
2
+
3
+ // Quickly outline any tag for debug purposes
4
+ =o
5
+ :background rgba(255, 0, 0, 0.15) !important
6
+ :outline 1px solid red !important
7
+
8
+ // Cross browser box model resizing
9
+ =box-sizing( $box-sizing)
10
+ :-moz-box-sizing $box-sizing
11
+ :-webkit-box-sizing $box-sizing
12
+ :box-sizing $box-sizing
13
+
14
+ // Cross browser opacity
15
+ =opacity( $opacity)
16
+ :-ms-filter unquote("progid:DXImageTransform.Microsoft.Alpha(Opacity=") + $opacity + unquote(")")
17
+ :filter unquote("alpha(opacity=") + $opacity + unquote(")")
18
+ :opacity $opacity * 0.01
19
+
20
+ // Cross browser transition effect
21
+ =transition( $transition)
22
+ :-moz-transition $transition
23
+ :-o-transition $transition
24
+ :-webkit-transition $transition
25
+ :transition $transition
26
+
27
+ // Cross browser transform effect
28
+ =transform( $transform)
29
+ :-moz-transform $transform
30
+ :-o-transform $transform
31
+ :-webkit-transform $transform
32
+ :transform $transform
33
+
34
+ // Cross browser multi-column layout
35
+ // # of columns
36
+ =column-count( $count)
37
+ :-moz-column-count $count
38
+ :-webkit-column-count $count
39
+ :column-count $count
40
+ // Space between columns
41
+ =column-gap( $gap)
42
+ :-moz-column-gap $gap
43
+ :-webkit-column-gap $gap
44
+ :column-gap $gap
45
+ // Combine -count and -gap into one easy mixin
46
+ =columns( $count, $gap)
47
+ +column-count( $count)
48
+ +column-gap( $gap)
49
+
50
+ // Cross browser box shadow
51
+ // If you want to have multiple box shadows, you must enclose the values in quotes (" ").
52
+ =box-shadow( $shadow)
53
+ $shadow: unquote($shadow)
54
+ :-moz-box-shadow $shadow
55
+ :-webkit-box-shadow $shadow
56
+ :box-shadow $shadow
57
+
58
+ // Cross browser rounded corners
59
+ =border-radius( $radius)
60
+ :-moz-border-radius $radius
61
+ :-webkit-border-radius $radius
62
+ :border-radius $radius
63
+ =border-radius-top-left( $radius)
64
+ :-moz-border-radius-topleft $radius
65
+ :-webkit-border-top-left-radius $radius
66
+ :border-top-left-radius $radius
67
+ =border-radius-top-right( $radius)
68
+ :-moz-border-radius-topright $radius
69
+ :-webkit-border-top-right-radius $radius
70
+ :border-top-right-radius $radius
71
+ =border-radius-bottom-right( $radius)
72
+ :-moz-border-radius-bottomright $radius
73
+ :-webkit-border-bottom-right-radius $radius
74
+ :border-bottom-right-radius $radius
75
+ =border-radius-bottom-left( $radius)
76
+ :-moz-border-radius-bottomleft $radius
77
+ :-webkit-border-bottom-left-radius $radius
78
+ :border-bottom-left-radius $radius