the_silver_spoon 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: the_silver_spoon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &72683270 !ruby/object:Gem::Requirement
16
+ requirement: &80979980 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *72683270
24
+ version_requirements: *80979980
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bootstrap-sass
27
- requirement: &72682750 !ruby/object:Gem::Requirement
27
+ requirement: &80979490 !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: *72682750
35
+ version_requirements: *80979490
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: gritter
38
- requirement: &72681900 !ruby/object:Gem::Requirement
38
+ requirement: &80977770 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *72681900
46
+ version_requirements: *80977770
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: spreadsheet
49
- requirement: &72681450 !ruby/object:Gem::Requirement
49
+ requirement: &80976870 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *72681450
57
+ version_requirements: *80976870
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: carrierwave
60
- requirement: &72680780 !ruby/object:Gem::Requirement
60
+ requirement: &80975640 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *72680780
68
+ version_requirements: *80975640
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: devise
71
- requirement: &72679550 !ruby/object:Gem::Requirement
71
+ requirement: &80972490 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *72679550
79
+ version_requirements: *80972490
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: cancan
82
- requirement: &72679040 !ruby/object:Gem::Requirement
82
+ requirement: &80971640 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *72679040
90
+ version_requirements: *80971640
91
91
  description: This gem preps a new Rails app with some of the best Rails gems and Jquery
92
92
  sweetness available( Twitter-Bootstrap, Devise, CanCan, Rails Admin, Spreadsheet,
93
93
  ) Not only does it takes care of the installation of these gems, it also extends
@@ -100,13 +100,7 @@ email:
100
100
  executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
- files:
104
- - .gitignore
105
- - Gemfile
106
- - Rakefile
107
- - lib/the_silver_spoon.rb
108
- - lib/the_silver_spoon/version.rb
109
- - the_silver_spoon.gemspec
103
+ files: []
110
104
  homepage: http://www.ptotem.com
111
105
  licenses: []
112
106
  post_install_message:
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- *.gem
2
- .bundle
3
- Gemfile.lock
4
- pkg/*
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in the_silver_spoon.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"
@@ -1,301 +0,0 @@
1
- require "the_silver_spoon/version"
2
-
3
- # Require the RAILS generators to be able to extend Rails:Generators::NamedBase
4
- require 'rails/generators'
5
-
6
- module Everything
7
- # If you use the NamedBase inheritance, a 'name' parameter has to follow the 'rails g integratedscaffold'. Won't work otherwise. If you don't want this, use ::Base
8
- class Scaffold < Rails::Generators::NamedBase
9
-
10
- # Method in the 'thor' library which gives you access to the accessor methods
11
- no_tasks { attr_accessor :model_attributes, :controller_actions }
12
-
13
- # This captures the arguments that the generator can take after "rails g integratedscaffold name"
14
- argument :g_parameters, :type => :array, :default => [], :banner => "field:type field:type"
15
-
16
- # this sets the path where the code looks for templates within the gem
17
- def self.source_root
18
- File.expand_path("../templates", __FILE__)
19
- end
20
-
21
- def initialize(*args, &block)
22
-
23
- # This is a standard initializer
24
-
25
- super # Call parent class
26
- @model_attributes = [] # Initialize empty array for 'thor' attributes
27
-
28
- # This method splits the name:type arguments in the parameters list
29
- g_parameters.each do |arg|
30
- @model_attributes << Rails::Generators::GeneratedAttribute.new(*arg.split(':'))
31
- end
32
-
33
- # Creates a list of all the standard actions in the controller
34
- @controller_actions=all_actions
35
-
36
- end
37
-
38
-
39
- def create_model
40
-
41
- # creates the model using the 'model.rb' template and puts it into the rails app
42
- template 'model.rb', "app/models/#{model_path}.rb"
43
-
44
- end
45
-
46
- def create_controller
47
-
48
- # creates the controller using the 'controller.rb' template and puts it into the rails app
49
- template 'controller.rb', "app/controllers/#{plural_name}_controller.rb"
50
- end
51
-
52
- def create_migration
53
-
54
- # creates the migration file using the 'migration.rb' template and puts it into the rails app with a time stamp
55
- template 'migration.rb', "db/migrate/#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_create_#{model_path.pluralize.gsub('/', '_')}.rb"
56
-
57
- end
58
-
59
- def create_helper
60
-
61
- # creates the helper using the 'helper.rb' template and puts it into the rails app
62
- template 'helper.rb', "app/helpers/#{plural_name}_helper.rb"
63
- end
64
-
65
- def create_routes
66
-
67
- # adds the routes for the gem into the routes file
68
- namespaces = plural_name.split('/')
69
- resource = namespaces.pop
70
- route namespaces.reverse.inject("resources :#{resource}") { |acc, namespace|
71
- "namespace(:#{namespace}){ #{acc} }"
72
- }
73
- end
74
-
75
-
76
- def create_views
77
-
78
- # creates the standard views using the '[action].html.erb' templates and puts it into the rails app
79
- controller_actions.each do |action|
80
- if action!="show" and action!="create" and action!="update" and action!="destroy" and action!="parse_save_from_excel"
81
- template "views/erb/#{action}.html.erb", "app/views/#{plural_name}/#{action}.html.erb"
82
- end
83
- end
84
- if form_partial?
85
- template "views/erb/_form.html.erb", "app/views/#{plural_name}/_form.html.erb"
86
- end
87
- end
88
-
89
- private
90
-
91
- def class_name
92
- name.camelize
93
- end
94
-
95
-
96
- def model_path
97
- name.underscore
98
- end
99
-
100
- def controller_methods(dir_name)
101
- controller_actions.map do |action|
102
- read_template("#{dir_name}/#{action}.rb")
103
- end.join("\n").strip
104
- end
105
-
106
- def read_template(relative_path)
107
- ERB.new(File.read(find_in_source_paths(relative_path)), nil, '-').result(binding)
108
- end
109
-
110
- def instance_name
111
- if @namespace_model
112
- singular_name.gsub('/', '_')
113
- else
114
- singular_name.split('/').last
115
- end
116
- end
117
-
118
- def instances_name
119
- instance_name.pluralize
120
- end
121
-
122
- def all_actions
123
- %w[index show new create edit update destroy]
124
- end
125
-
126
- def item_resource
127
- name.underscore.gsub('/', '_')
128
- end
129
-
130
- def items_path
131
- if action? :index
132
- "#{item_resource.pluralize}_path"
133
- else
134
- "root_path"
135
- end
136
- end
137
-
138
- def item_path(options = {})
139
- name = options[:instance_variable] ? "@#{instance_name}" : instance_name
140
- suffix = options[:full_url] ? "url" : "path"
141
- if options[:action].to_s == "new"
142
- "new_#{item_resource}_#{suffix}"
143
- elsif options[:action].to_s == "edit"
144
- "edit_#{item_resource}_#{suffix}(#{name})"
145
- else
146
- if name.include?('::') && !@namespace_model
147
- namespace = singular_name.split('/')[0..-2]
148
- "[:#{namespace.join(', :')}, #{name}]"
149
- else
150
- name
151
- end
152
- end
153
- end
154
-
155
- def item_url
156
- if action? :show
157
- item_path(:full_url => true, :instance_variable => true)
158
- else
159
- items_url
160
- end
161
- end
162
-
163
- def items_url
164
- if action? :index
165
- item_resource.pluralize + '_url'
166
- else
167
- "root_url"
168
- end
169
- end
170
-
171
-
172
- def plural_name
173
- name.underscore.pluralize
174
- end
175
-
176
- def form_partial?
177
- actions? :new, :edit
178
- end
179
-
180
- def all_actions
181
- %w[index show new create edit update destroy parse_save_from_excel]
182
- end
183
-
184
- def action?(name)
185
- controller_actions.include? name.to_s
186
- end
187
-
188
- def actions?(*names)
189
- names.all? { |name| action? name }
190
- end
191
-
192
- def add_gem(name, options = {})
193
- gemfile_content = File.read(destination_path("Gemfile"))
194
- File.open(destination_path("Gemfile"), 'a') { |f| f.write("\n") } unless gemfile_content =~ /\n\Z/
195
- gem name, options unless gemfile_content.include? name
196
- end
197
-
198
- def destination_path(path)
199
- File.join(destination_root, path)
200
- end
201
-
202
-
203
- # If you use the NamedBase inheritance, a 'name' parameter has to follow the 'rails g integratedscaffold'. Won't work otherwise. If you don't want this, use ::Base
204
-
205
-
206
- end
207
- #endd of class
208
-
209
- end
210
- module The_silver_spoon
211
- class Install < Rails::Generators::Base
212
-
213
- def self.source_root
214
- File.expand_path("../templates", __FILE__)
215
- end
216
-
217
-
218
- def initialize(*args, &block)
219
- super
220
- #now we invokde generators off twitter boootstrap and gritter
221
- Rails::Generators.invoke('bootstrap:install')
222
- Rails::Generators.invoke('gritter:locale')
223
- Rails::Generators.invoke('devise:install')
224
- Rails::Generators.invoke('devise', ["user"])
225
- Rails::Generators.invoke('devise:views')
226
- Rails::Generators.invoke('cancan:ability')
227
-
228
-
229
-
230
-
231
-
232
-
233
-
234
-
235
- end
236
-
237
- def create_uploader
238
- #creates the uploader ruby file using carrierwave
239
- template 'file_uploader.rb', "app/uploaders/file_uploader.rb"
240
- end
241
-
242
- def create_images
243
-
244
- # copies the standard images into the assets/images folder
245
- @images=Array.new
246
- @images= Dir.entries("#{Install.source_root}/assets/images")
247
- @images.each do |image|
248
-
249
- if image!=".." and image !="."
250
- copy_file "assets/images/#{image.to_s}", "app/assets/images/#{image}"
251
- end
252
- end
253
-
254
-
255
- end
256
-
257
- def create_javascripts
258
-
259
- # copies the standard javascripts into the assets/javascripts folder - Currently hard-coded
260
- # TODO : Remove the hardcoding for the javascripts inclusion
261
-
262
- copy_file "#{Install.source_root}/assets/javascripts/jquery.dataTables.min.js", "app/assets/javascripts/jquery.dataTables.min.js"
263
-
264
- end
265
-
266
- def create_stylesheets_exclusions
267
-
268
- # copies the sequenced css into the assets/stylesheets/exclusions folder
269
- directory "#{Install.source_root}/assets/stylesheets/exclusions", "app/assets/stylesheets/exclusions"
270
- end
271
-
272
- def create_javascript_exclusions
273
-
274
- # copies the sequenced javascript into the assets/javascripts/exclusions folder
275
- directory "#{Install.source_root}/assets/javascripts/exclusions", "app/assets/javascripts/exclusions"
276
- end
277
-
278
- def create_stylesheet_images
279
-
280
- # copies the dependent css images into the assets/stylesheets/images folder
281
- directory "#{Install.source_root}/assets/stylesheets/images", "app/assets/stylesheets/images"
282
-
283
- end
284
-
285
-
286
- def create_layouts
287
- #TODO :remove hardcoding and make a loop for including all files in this folder
288
- remove_file "app/views/layouts/application.html.erb"
289
- template "#{Install.source_root}/layouts/application.html.erb", "app/views/layouts/application.html.erb"
290
- template "#{Install.source_root}/layouts//dummy_data.html.erb", "app/views/layouts/scaffold.html.erb"
291
- template "#{Install.source_root}/layouts/information_page.html.erb", "app/views/layouts/information_page.html.erb"
292
- template "#{Install.source_root}/layouts/pageslide_form_at.html.erb", "app/views/layouts/pageslide_form_at.html.erb"
293
- template "#{Install.source_root}/layouts/welcome.html.erb", "app/views/layouts/welcome.html.erb"
294
-
295
- end
296
-
297
-
298
- end
299
-
300
-
301
- end
@@ -1,3 +0,0 @@
1
- module TheSilverSpoon
2
- VERSION = "0.0.1"
3
- end
@@ -1,33 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "the_silver_spoon/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "the_silver_spoon"
7
- s.version = TheSilverSpoon::VERSION
8
- s.authors = ["Ptotem Learnings"]
9
- s.email = ["info@ptotem.com"]
10
- s.homepage = "http://www.ptotem.com"
11
- s.summary = %q{Let your Rails App be born with a silver spoon in its mouth}
12
- s.description = %q{This gem preps a new Rails app with some of the best Rails gems and Jquery sweetness available( Twitter-Bootstrap, Devise, CanCan, Rails Admin, Spreadsheet, ) Not only does it takes care of the installation of these gems, it also extends your scaffolds to give aesthetically improved views. Further, apart from the standard scaffold views, it also creates an AJAX driven integrated view for your scaffold. It dries up your controllers and makes your models friendlier by adding schema stubs and standard validation options. Expect Cucumber integration in our next version}
13
-
14
- s.rubyforge_project = "the_silver_spoon"
15
-
16
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
20
-
21
-
22
- s.add_dependency 'railties', '3.1.3'
23
- s.add_dependency 'bootstrap-sass'
24
- s.add_dependency 'gritter'
25
- s.add_dependency 'spreadsheet'
26
- s.add_dependency 'carrierwave'
27
- s.add_dependency 'devise'
28
- s.add_dependency 'cancan'
29
-
30
- # specify any dependencies here; for example:
31
- # s.add_development_dependency "rspec"
32
- # s.add_runtime_dependency "rest-client"
33
- end