firestarter 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in firestarter.gemspec
4
+ gemspec
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "firestarter/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "firestarter"
7
+ s.version = Firestarter::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Gabriel Fonseca Engel"]
10
+ s.email = ["gabriel@fande.com.br"]
11
+ s.homepage = ""
12
+ s.summary = %q{A gem to ease rails templates creation}
13
+ s.description = %q{Couple of methods to make life easier when starting a project from scratch}
14
+
15
+ s.rubyforge_project = "firestarter"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
@@ -0,0 +1,171 @@
1
+ module Firestarter
2
+ def remove_useless_files
3
+ run "rm README"
4
+ run "rm public/index.html"
5
+ run "rm public/favicon.ico"
6
+ run "rm public/robots.txt"
7
+ run "rm -f public/javascripts/*"
8
+ end
9
+
10
+ def dont_generate_css
11
+ initializer 'generators.rb', <<-RUBY
12
+ Rails.application.config.generators do |g|
13
+ g.stylesheets false
14
+ end
15
+ RUBY
16
+ end
17
+
18
+ def add_gem(gem_name, options=nil)
19
+ gem_line = " gem '#{gem_name}'"
20
+ if options
21
+ gem_line += ", '#{options[:version]}'" if options[:version]
22
+ gem_line += ", :group => :#{options[:group]}" if options[:group]
23
+ end
24
+ gem_line += E
25
+ inject_into_file "Gemfile", gem_line, :after => "source 'http://rubygems.org'\n"
26
+ end
27
+
28
+ def add_gems(gem_list, options=nil)
29
+ gem_list.each do |gem_name|
30
+ add_gem(gem_name, options)
31
+ end
32
+ end
33
+
34
+ def install_gems
35
+ run('bundle install')
36
+ end
37
+
38
+ # JAVASCRIPTS
39
+
40
+ def install_jquery
41
+ run "rails generate jquery:install --ui"
42
+ end
43
+
44
+
45
+ # TEST
46
+
47
+ def use_rspec_generators
48
+ inject_into_file "config/initializers/generators.rb", :after => "Rails.application.config.generators do |g|\n" do
49
+ " g.test_framework = :rspec\n"
50
+ end
51
+ end
52
+
53
+ # AUTHENTICATION
54
+
55
+ def install_devise
56
+ generate 'devise:install'
57
+ case template['orm']
58
+ when 'mongo_mapper'
59
+ gem 'mm-devise'
60
+ gsub_file 'config/intializers/devise.rb', 'devise/orm/active_record', 'devise/orm/mongo_mapper_active_model'
61
+ when 'mongoid'
62
+ gsub_file 'config/intializers/devise.rb', 'devise/orm/active_record', 'devise/orm/mongoid'
63
+ when 'active_record'
64
+ # Nothing to do
65
+ end
66
+
67
+ generate 'devise user'
68
+ generate 'devise user:views'
69
+ end
70
+
71
+ # BDD SUITE
72
+
73
+ def install_cucumber
74
+ generate "cucumber:install --capybara#{' --rspec' if recipes.include?('rspec')}#{' -D' unless recipes.include?('activerecord')}"
75
+ end
76
+
77
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
78
+ # PREPARE TO TWEAK
79
+
80
+ ARB = "ActiveRecord::Base\n" ; M = 'app/models/' ; E ="\n"
81
+ CO = "config/" ; V = 'app/views/' ; C ='app/controllers/'
82
+
83
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
84
+ # EDIT MODELS
85
+
86
+ def add_to_model(model_name, text)
87
+ inject_into_file M+"#{model_name}.rb", " #{text}"+E, :after => ARB
88
+ end
89
+
90
+ def add_to_model_header(model_name, text)
91
+ inject_into_file M+"#{model_name}.rb", " #{text}"+E, :after => "class "
92
+ end
93
+
94
+ def start_database
95
+ run "rake db:drop"
96
+ run "rake db:create"
97
+ run "rake db:migrate"
98
+ end
99
+
100
+ def start_admin
101
+ # Default Routes
102
+ routes = <<-APP
103
+ namespace :admin do
104
+ end
105
+
106
+ root :to => "products#index"
107
+ APP
108
+ inject_into_file CO+'routes.rb', routes, :after => "Cartmen::Application.routes.draw do\n"
109
+
110
+ run "rails g active_admin:install"
111
+ run "rake db:migrate"
112
+ end
113
+
114
+ def generate_admin(path)
115
+ # run "rails g web_app_theme:themed #{path} --engine=haml"
116
+ # run "rails g controller #{path.split('/').join('::')} index show new edit create update"
117
+ # inject_into_file CO+'routes.rb', "resources :#{path.split('/')[1].pluralize}", :after => "\n namespace :admin do\n"
118
+ run "rails g active_admin:resource #{path}"
119
+ end
120
+
121
+
122
+ # DETAILS
123
+ # inject_into_file 'amin/...', "conteudo", :after => "linha"
124
+ # create_file 'app/views/layouts/application.haml', APPLICATION
125
+ # get 'url', 'place to save'
126
+ # generate :mailer, "UserNotifier confirm_account welcome inactive account"
127
+
128
+
129
+ def start_git
130
+ # Git
131
+ run 'git init'
132
+
133
+ run "rm .gitignore"
134
+ file ".gitignore", <<-END
135
+ .DS_Store
136
+ log/*.log
137
+ tmp/**/*
138
+ config/database.yml
139
+ assets/*
140
+ .idea
141
+ .generators
142
+ *.swp
143
+ END
144
+
145
+ run "cp config/database.yml config/database.yml.model"
146
+
147
+ run 'git add .'
148
+ run 'git commit -am "Another brand new app"'
149
+ end
150
+
151
+ def add_carrierwave_assets
152
+ generate :model, "asset file:string asset_type:string asset_id:integer"
153
+
154
+ run "rails generate uploader Asset"
155
+
156
+ inject_into_file M+'asset.rb', " mount_uploader :file, AssetUploader"+E, :after => ARB
157
+
158
+ files_allowed = " def extension_white_list ; %w(jpg jpeg gif png) ; end "+E
159
+ inject_into_file 'app/uploaders/asset_uploader.rb', files_allowed, :after => "CarrierWave::Uploader::Base\n"
160
+
161
+ image_magick = " include CarrierWave::RMagick"+E
162
+ image_magick += " process :resize_to_fit [800,800]"+E
163
+ image_magick += " version :thumb do"+E
164
+ image_magick += " process :resize_to_fill => [200,200]"+E
165
+ image_magick += " end"+E
166
+
167
+ inject_into_file 'app/uploaders/asset_uploader.rb', image_magick, :after => "CarrierWave::Uploader::Base\n"
168
+ end
169
+ end
170
+
171
+ include Firestarter
@@ -0,0 +1,3 @@
1
+ module Firestarter
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: firestarter
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Gabriel Fonseca Engel
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-07-05 00:00:00 -03:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description: Couple of methods to make life easier when starting a project from scratch
18
+ email:
19
+ - gabriel@fande.com.br
20
+ executables: []
21
+
22
+ extensions: []
23
+
24
+ extra_rdoc_files: []
25
+
26
+ files:
27
+ - .gitignore
28
+ - Gemfile
29
+ - Rakefile
30
+ - firestarter.gemspec
31
+ - lib/firestarter.rb
32
+ - lib/firestarter/version.rb
33
+ has_rdoc: true
34
+ homepage: ""
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ requirements: []
55
+
56
+ rubyforge_project: firestarter
57
+ rubygems_version: 1.6.2
58
+ signing_key:
59
+ specification_version: 3
60
+ summary: A gem to ease rails templates creation
61
+ test_files: []
62
+