playmo 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/README.md +31 -0
  2. data/lib/playmo.rb +12 -2
  3. data/lib/playmo/action.rb +1 -1
  4. data/lib/playmo/cookbook.rb +0 -1
  5. data/lib/playmo/recipe.rb +2 -120
  6. data/lib/playmo/recipe/dsl.rb +52 -0
  7. data/lib/playmo/recipe/recipe.rb +68 -0
  8. data/lib/playmo/version.rb +1 -1
  9. data/playmo.gemspec +6 -6
  10. data/{lib/playmo/recipes → recipes}/application_controller_recipe.rb +0 -0
  11. data/{lib/playmo/recipes → recipes}/application_helper_recipe.rb +2 -4
  12. data/{lib/playmo/recipes → recipes}/assets_recipe.rb +0 -0
  13. data/{lib/playmo/recipes → recipes}/can_can_recipe.rb +0 -0
  14. data/{lib/playmo/recipes → recipes}/capistrano_recipe.rb +0 -0
  15. data/{lib/playmo/recipes → recipes}/compass_recipe.rb +0 -0
  16. data/{lib/playmo/recipes → recipes}/devise_recipe.rb +0 -0
  17. data/{lib/playmo/recipes → recipes}/forms_recipe.rb +0 -0
  18. data/{lib/playmo/recipes → recipes}/gemfile_recipe.rb +2 -2
  19. data/{lib/playmo/recipes → recipes}/git_recipe.rb +0 -1
  20. data/{lib/playmo/recipes → recipes}/home_controller_recipe.rb +0 -0
  21. data/{lib/playmo/recipes → recipes}/javascript_framework_recipe.rb +0 -0
  22. data/{lib/playmo/recipes → recipes}/layout_recipe.rb +0 -0
  23. data/{lib/playmo/recipes → recipes}/locale_recipe.rb +0 -0
  24. data/{lib/playmo/recipes → recipes}/markup_recipe.rb +0 -0
  25. data/{lib/playmo/recipes → recipes}/rails_recipe.rb +0 -0
  26. data/{lib/playmo/recipes → recipes}/rspec_recipe.rb +1 -1
  27. data/{lib/playmo/recipes → recipes}/rvm_recipe.rb +1 -0
  28. data/{lib/playmo/recipes → recipes}/setup_database_recipe.rb +0 -0
  29. data/{lib/playmo/recipes → recipes}/templates/application_controller_recipe/application_controller.rb +0 -0
  30. data/{lib/playmo/recipes → recipes}/templates/application_controller_recipe/internal_error.html.erb +0 -0
  31. data/{lib/playmo/recipes → recipes}/templates/application_controller_recipe/not_found.html.erb +0 -0
  32. data/recipes/templates/application_helper_recipe/application_helper.rb +134 -0
  33. data/recipes/templates/application_helper_recipe/flash_messages.js.coffee +16 -0
  34. data/{lib/playmo/recipes/templates/application_helper_recipe/application_helper.rb → recipes/templates/application_helper_recipe/playmo_helper.rb} +0 -0
  35. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/images/bg.jpg +0 -0
  36. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/images/input-bg.gif +0 -0
  37. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/stylesheets/application.css.scss +5 -2
  38. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/stylesheets/media.css.scss +0 -0
  39. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/stylesheets/partials/_buttons.css.scss +0 -0
  40. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/stylesheets/partials/_constants.css.scss +0 -0
  41. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/stylesheets/partials/_forms.css.scss +0 -0
  42. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/stylesheets/partials/_html5-boilerplate.css.scss +0 -0
  43. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/stylesheets/partials/_layout.css.scss +0 -41
  44. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/stylesheets/partials/_overrides.css.scss +0 -0
  45. data/recipes/templates/assets_recipe/stylesheets/partials/_shared.css.scss +45 -0
  46. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/stylesheets/partials/_simple_form.css.scss +0 -0
  47. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_fonts.css.scss +0 -0
  48. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_helpers.css.scss +0 -0
  49. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_media.css.scss +0 -0
  50. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_reset.css.scss +0 -0
  51. data/{lib/playmo/recipes → recipes}/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_styles.css.scss +0 -0
  52. data/{lib/playmo/recipes → recipes}/templates/capistrano_recipe/.gitkeep +0 -0
  53. data/{lib/playmo/recipes → recipes}/templates/capistrano_recipe/deploy.rb +0 -0
  54. data/{lib/playmo/recipes → recipes}/templates/devise_recipe/.gitkeep +0 -0
  55. data/{lib/playmo/recipes → recipes}/templates/forms_recipe/.gitkeep +0 -0
  56. data/{lib/playmo/recipes → recipes}/templates/home_controller_recipe/_sidebar.html.erb +0 -0
  57. data/{lib/playmo/recipes → recipes}/templates/layout_recipe/application.html.erb +0 -0
  58. data/{lib/playmo/recipes → recipes}/templates/rspec_recipe/.gitkeep +0 -0
  59. data/{lib/playmo/recipes → recipes}/templates/rvm_recipe/.gitkeep +0 -0
  60. data/{lib/playmo/recipes → recipes}/templates/thinking_sphinx_recipe/sphinx.yml +0 -0
  61. data/{lib/playmo/recipes → recipes}/templates/unicorn_recipe/unicorn.rb +0 -0
  62. data/{lib/playmo/recipes → recipes}/thinking_sphinx_recipe.rb +0 -0
  63. data/{lib/playmo/recipes → recipes}/unicorn_recipe.rb +0 -0
  64. metadata +74 -71
  65. data/lib/playmo/recipes/_/sample_recipe.rb +0 -46
  66. data/lib/playmo/recipes/templates/application_helper_recipe/flash_messages.js +0 -19
data/README.md CHANGED
@@ -114,3 +114,34 @@ And example of 'ask' recipe:
114
114
  Playmo contains a number of built-in recipes, but you can to add custom recipes for your purposes.
115
115
 
116
116
  ## How to add custom recipes?
117
+
118
+ There is only way to add custom recipes. Create own gem on top of Playmo! Seriously. Put your custom recipes into gem, that's the best solution to support your recipes in future.
119
+
120
+ I'll tell you how to do it.
121
+
122
+ First, you need to create a gem with Bundler:
123
+
124
+ $ bundle gem companyname-playmo
125
+
126
+ As a prefix I recommend to use your company name or your nickname, or something else. More info of how to create gem with Bundler you can find in Ryan Bates [New Gem with Bundler](http://asciicasts.com/episodes/245-new-gem-with-bundler) episode.
127
+
128
+ After the gem was generated you should fill your __gemspec__. Don't forget to add playmo dependency into __gemspec__ file:
129
+
130
+ s.add_dependency("playmo")
131
+
132
+ Then paste this code into __lib/companyname-playmo.rb__ file:
133
+
134
+ require "playmo"
135
+
136
+ module CompanynamePlaymo
137
+ # Retrieve Cookbook instance
138
+ cookbook = ::Playmo::Cookbook.instance
139
+
140
+ # Example: Remove all recipes from Cookbook
141
+ # cookbook.delete_all
142
+
143
+ # Load custom recipes
144
+ Dir["#{File.dirname(__FILE__)}/companyname_playmo/recipes/*_recipe.rb"].each { |f| require f }
145
+ end
146
+
147
+ __... to be continued ...__
@@ -1,5 +1,13 @@
1
1
  # encoding: utf-8
2
- require 'rails/all'
2
+ begin
3
+ require 'rails/all'
4
+ rescue LoadError
5
+ puts "Rails is not installed!"
6
+ puts "It seems to lack some needed gems for further work."
7
+ puts "If you are using RVM it may mean that Playmo was installed to another gemset."
8
+ puts "Try to install Playmo again with 'gem install playmo' or switch to another gemset that already have installed Playmo."
9
+ exit!
10
+ end
3
11
 
4
12
  # Recipes order:
5
13
  # rails
@@ -24,6 +32,8 @@ require 'rails/all'
24
32
  # git
25
33
 
26
34
  module Playmo
35
+ ROOT = File.dirname(__FILE__) + "/../"
36
+
27
37
  extend ActiveSupport::Autoload
28
38
 
29
39
  class Railtie < Rails::Railtie
@@ -44,7 +54,7 @@ module Playmo
44
54
  include Playmo::Recipe
45
55
  end
46
56
 
47
- Dir["#{File.dirname(__FILE__)}/playmo/recipes/*_recipe.rb"].each { |f| require f }
57
+ Dir["#{ROOT}/recipes/*_recipe.rb"].each { |f| require f }
48
58
  end
49
59
 
50
60
 
@@ -28,7 +28,7 @@ module Playmo
28
28
  recipe, block = action[0], action[1]
29
29
 
30
30
  recipe.class.class_eval do
31
- source_root File.expand_path("../recipes/templates/#{recipe.name}_recipe", __FILE__)
31
+ source_root "#{Playmo::ROOT}/recipes/templates/#{recipe.name}_recipe"
32
32
  end
33
33
 
34
34
  recipe.instance_eval &block
@@ -59,7 +59,6 @@ module Playmo
59
59
 
60
60
  def cook_recipes!(application_name, options)
61
61
  recipes.each do |recipe|
62
- #puts recipe.name
63
62
  recipe.cook!(application_name)
64
63
  end
65
64
 
@@ -4,130 +4,12 @@ module Playmo
4
4
  autoload :Action
5
5
  autoload :Question
6
6
  autoload :Silent
7
+ autoload :Recipe, 'playmo/recipe/recipe'
8
+ autoload :Dsl, 'playmo/recipe/dsl'
7
9
 
8
10
  module Recipe
9
11
  def recipe(name, options = {}, &block)
10
12
  Dsl.new(name, options, &block)
11
13
  end
12
-
13
- # Переименовать этот класс в DSL, и сделать отдельный класс Recipe,
14
- # который будет предком DSL и от которого можно наследоваться для создания complex recipes
15
- # У класса DSL будут еще свои методы типма build (?)
16
- class Recipe < Rails::Generators::Base
17
- attr_accessor :actions, :application_name
18
-
19
- def initialize
20
- super
21
-
22
- @actions = []
23
- end
24
-
25
- def store(*args)
26
- Options.instance.set(*args)
27
- end
28
-
29
- def retrieve(*args)
30
- Options.instance.get(*args)
31
- end
32
-
33
- # TODO: Move it into module
34
- def after_install(&block)
35
- Event.events.listen(:after_install) do
36
- # TODO: DRY this
37
- recipe_name = name
38
-
39
- self.class.class_eval do
40
- source_root File.expand_path("../recipes/templates/#{recipe_name}_recipe", __FILE__)
41
- end
42
-
43
- self.instance_eval &block
44
- end
45
- end
46
-
47
- def before_exit(&block)
48
- Event.events.listen(:before_exit) do
49
- # TODO: DRY this
50
- recipe_name = name
51
-
52
- self.class.class_eval do
53
- source_root File.expand_path("../recipes/templates/#{recipe_name}_recipe", __FILE__)
54
- end
55
-
56
- self.instance_eval &block
57
- end
58
- end
59
-
60
- def generate(*args)
61
- after_install { super(*args) }
62
- end
63
-
64
- #def template(*args)
65
- # after_install { super(*args) }
66
- #end
67
-
68
- def cook!(application_name)
69
- self.destination_root = application_name
70
- self.application_name = application_name
71
-
72
- actions.each do |action|
73
- action.call
74
- end
75
- end
76
-
77
- def to_s
78
- name
79
- end
80
- end
81
-
82
-
83
- class Dsl < Playmo::Recipe::Recipe
84
- attr_accessor :description, :name, :options, :after
85
-
86
- def initialize(name, options, &block)
87
- super()
88
-
89
- raise 'Recipe name not specified!' unless name
90
-
91
- @name = name
92
- @options = options
93
- #@actions = []
94
-
95
- instance_eval &block
96
- end
97
-
98
- def description(description = nil)
99
- @description = description if description.present?
100
- @description
101
- end
102
-
103
- # Если блок с агрументами - то поддерживается ввод данных пользователем
104
- def question(question, &block)
105
- actions << lambda { Playmo::Question.new(self, question, :type => :question, &block).to_s }
106
- end
107
-
108
- def ask(question, &block)
109
- actions << lambda { Playmo::Question.new(self, question, :type => :ask, &block).to_s }
110
- end
111
-
112
- def silently(&block)
113
- actions << lambda { Playmo::Silent.new(self, &block) }
114
- end
115
-
116
- # TODO: Сделать автолоадинг для зависимых рецептов
117
- def after(after)
118
- @after = after
119
- after_recipe = Playmo::Cookbook.instance.find_recipe(@after)
120
-
121
- if after_recipe.nil? && @after.present?
122
- require "#{File.dirname(__FILE__)}/recipes/#{@after}_recipe.rb"
123
- end
124
-
125
- if after_recipe.nil?
126
- Playmo::Cookbook.instance.use(self)
127
- else
128
- Playmo::Cookbook.instance.insert_after(after_recipe, self)
129
- end
130
- end
131
- end
132
14
  end
133
15
  end
@@ -0,0 +1,52 @@
1
+ module Playmo
2
+ module Recipe
3
+ class Dsl < Playmo::Recipe::Recipe
4
+ attr_accessor :description, :name, :options, :after
5
+
6
+ def initialize(name, options, &block)
7
+ super()
8
+
9
+ raise 'Recipe name not specified!' unless name
10
+
11
+ @name = name
12
+ @options = options
13
+
14
+ instance_eval &block
15
+ end
16
+
17
+ def description(description = nil)
18
+ @description = description if description.present?
19
+ @description
20
+ end
21
+
22
+ # Если блок с агрументами - то поддерживается ввод данных пользователем
23
+ def question(question, &block)
24
+ actions << lambda { Playmo::Question.new(self, question, :type => :question, &block).to_s }
25
+ end
26
+
27
+ def ask(question, &block)
28
+ actions << lambda { Playmo::Question.new(self, question, :type => :ask, &block).to_s }
29
+ end
30
+
31
+ def silently(&block)
32
+ actions << lambda { Playmo::Silent.new(self, &block) }
33
+ end
34
+
35
+ # TODO: Сделать автолоадинг для зависимых рецептов
36
+ def after(after)
37
+ @after = after
38
+ after_recipe = Playmo::Cookbook.instance.find_recipe(@after)
39
+
40
+ if after_recipe.nil? && @after.present?
41
+ require "#{Playmo::ROOT}/recipes/#{@after}_recipe.rb"
42
+ end
43
+
44
+ if after_recipe.nil?
45
+ Playmo::Cookbook.instance.use(self)
46
+ else
47
+ Playmo::Cookbook.instance.insert_after(after_recipe, self)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,68 @@
1
+ module Playmo
2
+ module Recipe
3
+ # Переименовать этот класс в DSL, и сделать отдельный класс Recipe,
4
+ # который будет предком DSL и от которого можно наследоваться для создания complex recipes
5
+ # У класса DSL будут еще свои методы типма build (?)
6
+ class Recipe < Rails::Generators::Base
7
+ attr_accessor :actions, :application_name
8
+
9
+ def initialize
10
+ super
11
+
12
+ @actions = []
13
+ end
14
+
15
+ def store(*args)
16
+ Options.instance.set(*args)
17
+ end
18
+
19
+ def retrieve(*args)
20
+ Options.instance.get(*args)
21
+ end
22
+
23
+ # TODO: Move it into module
24
+ def after_install(&block)
25
+ Event.events.listen(:after_install) do
26
+ # TODO: DRY this
27
+ recipe_name = name
28
+
29
+ self.class.class_eval do
30
+ source_root "#{Playmo::ROOT}/recipes/templates/#{recipe_name}_recipe"
31
+ end
32
+
33
+ self.instance_eval &block
34
+ end
35
+ end
36
+
37
+ def before_exit(&block)
38
+ Event.events.listen(:before_exit) do
39
+ # TODO: DRY this
40
+ recipe_name = name
41
+
42
+ self.class.class_eval do
43
+ source_root "#{Playmo::ROOT}/recipes/templates/#{recipe_name}_recipe"
44
+ end
45
+
46
+ self.instance_eval &block
47
+ end
48
+ end
49
+
50
+ def generate(*args)
51
+ after_install { super(*args) }
52
+ end
53
+
54
+ def cook!(application_name)
55
+ self.destination_root = application_name
56
+ self.application_name = application_name
57
+
58
+ actions.each do |action|
59
+ action.call
60
+ end
61
+ end
62
+
63
+ def to_s
64
+ name
65
+ end
66
+ end
67
+ end
68
+ end
@@ -1,3 +1,3 @@
1
1
  module Playmo
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.name = "playmo"
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Andrew Kozloff"]
10
- s.email = ["andrew@tanraya.com"]
10
+ s.email = ["demerest@gmail.com"]
11
11
  s.homepage = "https://github.com/tanraya/playmo"
12
12
  s.summary = %q{Special kit that allows you create html5-ready Rails 3 apps quick with pre-included few useful libs in your app}
13
13
 
@@ -18,10 +18,10 @@ Gem::Specification.new do |s|
18
18
  s.executables = ['playmo']
19
19
  s.require_paths = ["lib"]
20
20
  s.has_rdoc = false
21
- s.rubygems_version = %q{1.3.7}
22
- s.add_dependency("rails", ["~> 3.1"])
21
+ s.rubygems_version = %q{1.8.15}
22
+ s.add_dependency("rails", ["= 3.2.0"])
23
23
  s.add_dependency("ruby_events")
24
- s.add_dependency("haml2slim", ["=0.4.6"])
25
- s.add_dependency("haml", ["=3.1.3"])
26
- s.add_development_dependency("rspec-rails", ["~> 2.5"])
24
+ s.add_dependency("haml2slim", ["= 0.4.6"])
25
+ s.add_dependency("haml", ["= 3.1.4"])
26
+ s.add_development_dependency("rspec-rails", ["= 2.8.1"])
27
27
  end
@@ -3,12 +3,10 @@ recipe :application_helper do
3
3
  after :home_controller
4
4
 
5
5
  silently do
6
- remove_file 'app/helpers/application_helper.rb'
7
- copy_file 'application_helper.rb', 'app/helpers/application_helper.rb'
6
+ copy_file 'playmo_helper.rb', 'app/helpers/playmo_helper.rb'
8
7
 
9
8
  # TODO: Add version for prototype and Jquery
10
- # TODO: Translate flash_messages.js to CoffeeScript
11
- copy_file 'flash_messages.js', 'app/assets/javascripts/flash_messages.js'
9
+ copy_file 'flash_messages.js.coffee', 'app/assets/javascripts/flash_messages.js.coffee'
12
10
 
13
11
  gsub_file 'app/assets/javascripts/application.js', '//= require_tree .' do
14
12
  <<-CONTENT.gsub(/^ {8}/, '')
@@ -4,7 +4,7 @@ recipe :gemfile do
4
4
 
5
5
  silently do
6
6
  gem 'rake', '~> 0.9.2'
7
- gem 'therubyracer'
8
- gem 'playmo', :group => :development
7
+ gem 'therubyracer', '0.9.9'
8
+ gem 'playmo', Playmo::VERSION, :group => :development
9
9
  end
10
10
  end
@@ -13,7 +13,6 @@ recipe :git do
13
13
  tmp/**/*
14
14
  db/*.sqlite3
15
15
  .idea/
16
- public/uploads/*
17
16
  public/assets/*
18
17
  .sass-cache/
19
18
  CONTENT
@@ -3,7 +3,7 @@ recipe :rspec do
3
3
  after :thinking_sphinx
4
4
 
5
5
  ask "Would you like to use Rspec in this project?" do
6
- gem 'rspec-rails'
6
+ gem 'rspec-rails', :group => :development
7
7
  generate "rspec:install"
8
8
  remove_dir "test"
9
9
 
@@ -5,6 +5,7 @@ recipe :rvm do
5
5
  silently do
6
6
  if system 'which rvm > /dev/null'
7
7
  in_root do
8
+ #run '[ -s "$HOME/.rvm/scripts/rvm" ] && . "$HOME/.rvm/scripts/rvm"'
8
9
  run "rvm #{RUBY_VERSION}@#{application_name} --rvmrc --create"
9
10
  end
10
11
  end
@@ -0,0 +1,134 @@
1
+ # coding: utf-8
2
+
3
+ module PlaymoHelper
4
+ attr_accessor :page_title
5
+
6
+ def link_to_delete(link, title, heading_tag = :h3)
7
+ content_for :sidebar do
8
+ content_tag :div, :class => 'danger-zone' do
9
+ result = content_tag heading_tag, raw(title)
10
+ link_text = t('helpers.application.link_to_delete.link_text')
11
+ confirmation = t('helpers.application.link_to_delete.confirmation')
12
+
13
+ result << link_to(link_text, link, confirm: confirmation, method: :delete)
14
+ result
15
+ end
16
+ end
17
+ end
18
+
19
+ def flash_messages
20
+ return unless flash.any?
21
+
22
+ items = []
23
+ flash.each do |name, msg|
24
+ msg << content_tag(:a, raw('&times;'), :href => "#")
25
+ items << content_tag(:li, raw(msg), :id => "flash-#{name}")
26
+ end
27
+
28
+ content_tag :div, :id => 'flash-messages' do
29
+ content_tag :ul, raw(items.join)
30
+ end
31
+ end
32
+
33
+ # Set page title. Use this method in your views
34
+ def title(page_title)
35
+ @page_title = page_title
36
+ end
37
+
38
+ # This prints page title. Call this helper
39
+ # inside title tag of your layout
40
+ def page_title(default_title = '')
41
+ @page_title || default_title
42
+ end
43
+
44
+ # Print heading (h1 by default) and set page title
45
+ # at the same time. Use this method in your views
46
+ def heading_with_title(heading, tag=:h1)
47
+ title(heading)
48
+ heading(heading, tag)
49
+ end
50
+
51
+ def heading(heading, tag=:h1)
52
+ tag = :h1 if tag.nil?
53
+ content_tag(tag, heading)
54
+ end
55
+
56
+ def admin_area(&block)
57
+ if user_signed_in?
58
+ content = with_output_buffer(&block)
59
+ content_tag(:div, content, :class => 'admin')
60
+ end
61
+ end
62
+
63
+ def link_to_section(name, options = {}, html_options = {}, &block)
64
+ url_string = url_for(options)
65
+
66
+ if "/#{request.path.split('/')[1]}" == url_string
67
+ html_options[:class] = "#{html_options[:class]} current"
68
+ end
69
+
70
+ link_to(name, options, html_options, &block)
71
+ end
72
+
73
+ def page_id
74
+ name = 'page-' + request.path_parameters[:controller] + '-' + request.path_parameters[:action]
75
+ name.gsub!(/_+/, '-')
76
+ name
77
+ end
78
+
79
+ def link_to_website(url, html_options = {})
80
+ return nil if url.blank?
81
+
82
+ url = "http://#{url}" unless url =~ /^(ht|f)tps?:\/\//i
83
+ html_options[:href] = url
84
+ content_tag(:a, url, html_options)
85
+ end
86
+
87
+ # Create a named haml tag to wrap IE conditional around a block
88
+ # http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
89
+ def ie_tag(name=:body, attrs={}, &block)
90
+ attrs.symbolize_keys!
91
+ result = "<!--[if lt IE 7 ]> #{ tag(name, add_class('ie6', attrs), true) } <![endif]-->\n".html_safe
92
+ result += "<!--[if IE 7 ]> #{ tag(name, add_class('ie7', attrs), true) } <![endif]-->\n".html_safe
93
+ result += "<!--[if IE 8 ]> #{ tag(name, add_class('ie8', attrs), true) } <![endif]-->\n".html_safe
94
+ result += "<!--[if IE 9 ]> #{ tag(name, add_class('ie9', attrs), true) } <![endif]-->\n".html_safe
95
+ result += "<!--[if (gte IE 9)|!(IE)]><!-->".html_safe
96
+
97
+ result += content_tag name, attrs do
98
+ "<!--<![endif]-->\n".html_safe + with_output_buffer(&block)
99
+ end
100
+
101
+ result
102
+ end
103
+
104
+ def ie_html(attrs={}, &block)
105
+ ie_tag(:html, attrs, &block)
106
+ end
107
+
108
+ def ie_body(attrs={}, &block)
109
+ ie_tag(:body, attrs, &block)
110
+ end
111
+
112
+ def google_account_id
113
+ ENV['GOOGLE_ACCOUNT_ID'] || google_config(:google_account_id)
114
+ end
115
+
116
+ def google_api_key
117
+ ENV['GOOGLE_API_KEY'] || google_config(:google_api_key)
118
+ end
119
+
120
+ private
121
+
122
+ def add_class(name, attrs)
123
+ classes = attrs[:class] || ''
124
+ classes.strip!
125
+ classes = ' ' + classes if !classes.blank?
126
+ classes = name + classes
127
+ attrs.merge(:class => classes)
128
+ end
129
+
130
+ def google_config(key)
131
+ configs = YAML.load_file(File.join(Rails.root, 'config', 'google.yml'))[Rails.env.to_sym] rescue {}
132
+ configs[key]
133
+ end
134
+ end
@@ -0,0 +1,16 @@
1
+ flash_messages = ->
2
+ $ = document.id
3
+
4
+ document.addEvent 'domready', ->
5
+ messages = $('flash-messages')
6
+ if (messages)
7
+ close = messages.getElement('a')
8
+ hideMessages = -> messages.slide('out')
9
+
10
+ close.addEvent 'click', -> (e)
11
+ e.stop()
12
+ hideMessages()
13
+
14
+ hideMessages.delay(10000)
15
+
16
+ flash_messages()
@@ -19,10 +19,13 @@
19
19
 
20
20
  // Finally, put your own styles in these partials
21
21
  // and add more as needed (i.e. forms, tables, nav)
22
- @import "partials/layout";
22
+ @import "partials/shared";
23
23
  @import "partials/forms";
24
-
25
24
  @import "partials/simple_form";
25
+ @import "partials/layout";
26
+
27
+ // Include your app partials and stylesheets here
28
+ // !!! Right here !!!
26
29
 
27
30
  // Media should come last
28
31
  @import "media";
@@ -31,47 +31,6 @@ body {
31
31
  margin: 0;
32
32
  background: #222 asset-url("bg.jpg", image);
33
33
 
34
- #flash-messages {
35
- left: 0;
36
- position: fixed;
37
- top: 0;
38
- width: 100%;
39
- z-index: 65000;
40
-
41
- ul {
42
- @include border-radius(0 0 7px 7px);
43
- @include single-box-shadow(#555, 1px, 1px, 10px, 1px);
44
- @include opacity(0.9);
45
- background: #555;
46
- color: #fff;
47
- font-size: 120%;
48
- margin: 0 auto;
49
- padding: 5px;
50
- position: relative;
51
- text-align: center;
52
- width: 700px;
53
- }
54
-
55
- li {
56
- margin: 18px 50px;
57
-
58
- a {
59
- color: #fff;
60
- display: inline-block;
61
- font-size: 200%;
62
- left: 670px;
63
- padding: 5px;
64
- position: absolute;
65
- text-decoration: none;
66
- top: 17px;
67
-
68
- &:hover {
69
- color: maroon;
70
- }
71
- }
72
- }
73
- }
74
-
75
34
  #main-wrapper {
76
35
  width: 915px;
77
36
  margin: 20px auto 0 auto;
@@ -0,0 +1,45 @@
1
+ ///////////////////////////////////////////////////////////////////
2
+ // Styles for flash messages
3
+ #flash-messages {
4
+ left: 0;
5
+ position: fixed;
6
+ top: 0;
7
+ width: 100%;
8
+ z-index: 65000;
9
+
10
+ ul {
11
+ @include border-radius(0 0 7px 7px);
12
+ @include single-box-shadow(#555, 1px, 1px, 10px, 1px);
13
+ @include opacity(0.9);
14
+ background: #555;
15
+ color: #fff;
16
+ font-size: 120%;
17
+ margin: 0 auto;
18
+ padding: 5px;
19
+ position: relative;
20
+ text-align: center;
21
+ width: 700px;
22
+ }
23
+
24
+ li {
25
+ margin: 18px 50px;
26
+
27
+ a {
28
+ color: #fff;
29
+ display: inline-block;
30
+ font-size: 200%;
31
+ left: 670px;
32
+ padding: 5px;
33
+ position: absolute;
34
+ text-decoration: none;
35
+ top: 17px;
36
+
37
+ &:hover {
38
+ color: maroon;
39
+ }
40
+ }
41
+ }
42
+ }
43
+
44
+ ///////////////////////////////////////////////////////////////////
45
+ // Something else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playmo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-16 00:00:00.000000000Z
12
+ date: 2012-01-21 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &84197830 !ruby/object:Gem::Requirement
16
+ requirement: &83707350 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - =
20
20
  - !ruby/object:Gem::Version
21
- version: '3.1'
21
+ version: 3.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *84197830
24
+ version_requirements: *83707350
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: ruby_events
27
- requirement: &84197440 !ruby/object:Gem::Requirement
27
+ requirement: &83706800 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *84197440
35
+ version_requirements: *83706800
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: haml2slim
38
- requirement: &84196980 !ruby/object:Gem::Requirement
38
+ requirement: &83627550 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - =
@@ -43,32 +43,32 @@ dependencies:
43
43
  version: 0.4.6
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *84196980
46
+ version_requirements: *83627550
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: haml
49
- requirement: &84196560 !ruby/object:Gem::Requirement
49
+ requirement: &83627180 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - =
53
53
  - !ruby/object:Gem::Version
54
- version: 3.1.3
54
+ version: 3.1.4
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *84196560
57
+ version_requirements: *83627180
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec-rails
60
- requirement: &84196010 !ruby/object:Gem::Requirement
60
+ requirement: &83626330 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
- - - ~>
63
+ - - =
64
64
  - !ruby/object:Gem::Version
65
- version: '2.5'
65
+ version: 2.8.1
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *84196010
68
+ version_requirements: *83626330
69
69
  description:
70
70
  email:
71
- - andrew@tanraya.com
71
+ - demerest@gmail.com
72
72
  executables:
73
73
  - playmo
74
74
  extensions: []
@@ -101,62 +101,65 @@ files:
101
101
  - lib/playmo/options.rb
102
102
  - lib/playmo/question.rb
103
103
  - lib/playmo/recipe.rb
104
- - lib/playmo/recipes/_/sample_recipe.rb
105
- - lib/playmo/recipes/application_controller_recipe.rb
106
- - lib/playmo/recipes/application_helper_recipe.rb
107
- - lib/playmo/recipes/assets_recipe.rb
108
- - lib/playmo/recipes/can_can_recipe.rb
109
- - lib/playmo/recipes/capistrano_recipe.rb
110
- - lib/playmo/recipes/compass_recipe.rb
111
- - lib/playmo/recipes/devise_recipe.rb
112
- - lib/playmo/recipes/forms_recipe.rb
113
- - lib/playmo/recipes/gemfile_recipe.rb
114
- - lib/playmo/recipes/git_recipe.rb
115
- - lib/playmo/recipes/home_controller_recipe.rb
116
- - lib/playmo/recipes/javascript_framework_recipe.rb
117
- - lib/playmo/recipes/layout_recipe.rb
118
- - lib/playmo/recipes/locale_recipe.rb
119
- - lib/playmo/recipes/markup_recipe.rb
120
- - lib/playmo/recipes/rails_recipe.rb
121
- - lib/playmo/recipes/rspec_recipe.rb
122
- - lib/playmo/recipes/rvm_recipe.rb
123
- - lib/playmo/recipes/setup_database_recipe.rb
124
- - lib/playmo/recipes/templates/application_controller_recipe/application_controller.rb
125
- - lib/playmo/recipes/templates/application_controller_recipe/internal_error.html.erb
126
- - lib/playmo/recipes/templates/application_controller_recipe/not_found.html.erb
127
- - lib/playmo/recipes/templates/application_helper_recipe/application_helper.rb
128
- - lib/playmo/recipes/templates/application_helper_recipe/flash_messages.js
129
- - lib/playmo/recipes/templates/assets_recipe/images/bg.jpg
130
- - lib/playmo/recipes/templates/assets_recipe/images/input-bg.gif
131
- - lib/playmo/recipes/templates/assets_recipe/stylesheets/application.css.scss
132
- - lib/playmo/recipes/templates/assets_recipe/stylesheets/media.css.scss
133
- - lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/_buttons.css.scss
134
- - lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/_constants.css.scss
135
- - lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/_forms.css.scss
136
- - lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/_html5-boilerplate.css.scss
137
- - lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/_layout.css.scss
138
- - lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/_overrides.css.scss
139
- - lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/_simple_form.css.scss
140
- - lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_fonts.css.scss
141
- - lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_helpers.css.scss
142
- - lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_media.css.scss
143
- - lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_reset.css.scss
144
- - lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_styles.css.scss
145
- - lib/playmo/recipes/templates/capistrano_recipe/.gitkeep
146
- - lib/playmo/recipes/templates/capistrano_recipe/deploy.rb
147
- - lib/playmo/recipes/templates/devise_recipe/.gitkeep
148
- - lib/playmo/recipes/templates/forms_recipe/.gitkeep
149
- - lib/playmo/recipes/templates/home_controller_recipe/_sidebar.html.erb
150
- - lib/playmo/recipes/templates/layout_recipe/application.html.erb
151
- - lib/playmo/recipes/templates/rspec_recipe/.gitkeep
152
- - lib/playmo/recipes/templates/rvm_recipe/.gitkeep
153
- - lib/playmo/recipes/templates/thinking_sphinx_recipe/sphinx.yml
154
- - lib/playmo/recipes/templates/unicorn_recipe/unicorn.rb
155
- - lib/playmo/recipes/thinking_sphinx_recipe.rb
156
- - lib/playmo/recipes/unicorn_recipe.rb
104
+ - lib/playmo/recipe/dsl.rb
105
+ - lib/playmo/recipe/recipe.rb
157
106
  - lib/playmo/silent.rb
158
107
  - lib/playmo/version.rb
159
108
  - playmo.gemspec
109
+ - recipes/application_controller_recipe.rb
110
+ - recipes/application_helper_recipe.rb
111
+ - recipes/assets_recipe.rb
112
+ - recipes/can_can_recipe.rb
113
+ - recipes/capistrano_recipe.rb
114
+ - recipes/compass_recipe.rb
115
+ - recipes/devise_recipe.rb
116
+ - recipes/forms_recipe.rb
117
+ - recipes/gemfile_recipe.rb
118
+ - recipes/git_recipe.rb
119
+ - recipes/home_controller_recipe.rb
120
+ - recipes/javascript_framework_recipe.rb
121
+ - recipes/layout_recipe.rb
122
+ - recipes/locale_recipe.rb
123
+ - recipes/markup_recipe.rb
124
+ - recipes/rails_recipe.rb
125
+ - recipes/rspec_recipe.rb
126
+ - recipes/rvm_recipe.rb
127
+ - recipes/setup_database_recipe.rb
128
+ - recipes/templates/application_controller_recipe/application_controller.rb
129
+ - recipes/templates/application_controller_recipe/internal_error.html.erb
130
+ - recipes/templates/application_controller_recipe/not_found.html.erb
131
+ - recipes/templates/application_helper_recipe/application_helper.rb
132
+ - recipes/templates/application_helper_recipe/flash_messages.js.coffee
133
+ - recipes/templates/application_helper_recipe/playmo_helper.rb
134
+ - recipes/templates/assets_recipe/images/bg.jpg
135
+ - recipes/templates/assets_recipe/images/input-bg.gif
136
+ - recipes/templates/assets_recipe/stylesheets/application.css.scss
137
+ - recipes/templates/assets_recipe/stylesheets/media.css.scss
138
+ - recipes/templates/assets_recipe/stylesheets/partials/_buttons.css.scss
139
+ - recipes/templates/assets_recipe/stylesheets/partials/_constants.css.scss
140
+ - recipes/templates/assets_recipe/stylesheets/partials/_forms.css.scss
141
+ - recipes/templates/assets_recipe/stylesheets/partials/_html5-boilerplate.css.scss
142
+ - recipes/templates/assets_recipe/stylesheets/partials/_layout.css.scss
143
+ - recipes/templates/assets_recipe/stylesheets/partials/_overrides.css.scss
144
+ - recipes/templates/assets_recipe/stylesheets/partials/_shared.css.scss
145
+ - recipes/templates/assets_recipe/stylesheets/partials/_simple_form.css.scss
146
+ - recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_fonts.css.scss
147
+ - recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_helpers.css.scss
148
+ - recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_media.css.scss
149
+ - recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_reset.css.scss
150
+ - recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_styles.css.scss
151
+ - recipes/templates/capistrano_recipe/.gitkeep
152
+ - recipes/templates/capistrano_recipe/deploy.rb
153
+ - recipes/templates/devise_recipe/.gitkeep
154
+ - recipes/templates/forms_recipe/.gitkeep
155
+ - recipes/templates/home_controller_recipe/_sidebar.html.erb
156
+ - recipes/templates/layout_recipe/application.html.erb
157
+ - recipes/templates/rspec_recipe/.gitkeep
158
+ - recipes/templates/rvm_recipe/.gitkeep
159
+ - recipes/templates/thinking_sphinx_recipe/sphinx.yml
160
+ - recipes/templates/unicorn_recipe/unicorn.rb
161
+ - recipes/thinking_sphinx_recipe.rb
162
+ - recipes/unicorn_recipe.rb
160
163
  - spec/cookbook_spec.rb
161
164
  - spec/recipes/home_controller_recipe_spec.rb
162
165
  - spec/spec_helper.rb
@@ -1,46 +0,0 @@
1
- module Playmo
2
- module Generators
3
- module Recipes
4
- class SampleRecipe < Playmo::Recipe
5
- # Cook the recipe
6
- # TODO: Add rspec tests
7
- # TODO: Recipe with more than one question
8
- # TODO: You can create own gem and redefine Playmo behavior by removing or adding recipes
9
- # TODO: Create a web service built on top of Playmo to prepare new app and putting it to Github or download in archive
10
- # TODO: A playmo bin file that generate rails app and do all the stuff as altennative to manually installing rails app and include playmo into this app
11
- # TODO: Require playmo to the app only when in development mode
12
- # TODO: Copy Playmo view heplers into the app
13
-
14
- def initialize
15
- silently do
16
- # do something without any questions
17
- end
18
-
19
- question "What's up Docz?" => :do_something_for_doc
20
-
21
- def do_something_for_doc
22
- # do something for Doc
23
- end
24
-
25
- question "What's up Docx?" do
26
- answer "So-so" => :so_so
27
- answer "Nice!" => :nice
28
- end
29
-
30
- question "What's up Docy?" do
31
- answer "So-so" do
32
- # do something
33
- end
34
-
35
- answer "Nice!" do
36
- # do something
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
43
- end
44
-
45
- # Write down this recipe to our Cookbook if it's available
46
- # Playmo::Cookbook.instance.use(Playmo::Generators::Recipes::SampleRecipe.new) if defined?(Playmo::Cookbook)
@@ -1,19 +0,0 @@
1
- (function(){
2
- var $ = document.id;
3
-
4
- document.addEvent('domready', function() {
5
- var messages = $('flash-messages');
6
-
7
- if (messages) {
8
- var close = messages.getElement('a');
9
- var hideMessages = function() { messages.slide('out'); };
10
-
11
- close.addEvent('click', function(e) {
12
- e.stop();
13
- hideMessages();
14
- });
15
-
16
- hideMessages.delay(10000);
17
- }
18
- })
19
- })();