wize_upgrader 0.0.3 → 0.0.4

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.
Files changed (2) hide show
  1. data/lib/wize_upgrader.rb +20 -9
  2. metadata +1 -1
data/lib/wize_upgrader.rb CHANGED
@@ -19,9 +19,11 @@ module Wize
19
19
  }
20
20
  COMMON_GEMS = [
21
21
  "gem 'jquery-rails'",
22
- "gem 'pg'",
23
- "gem 'sqlite3'",
24
22
  "gem 'rspec-rails'",
23
+ "gem 'coffee-rails', '~> 3.2.1'",
24
+ "gem 'sass-rails', '~> 3.2.3'",
25
+ "gem 'uglifier', '>= 1.0.3'",
26
+ "gem 'sqlite3'",
25
27
  "gem 'rails', '3.2.10'",
26
28
  "gem 'rails', '3.2.11'",
27
29
  "gem 'rails', '3.2.12'",
@@ -53,6 +55,7 @@ module Wize
53
55
  copy_special_files
54
56
  fix_models
55
57
  fix_controllers
58
+ version_control
56
59
  rescue => e
57
60
  puts e.message
58
61
  puts e.backtrace
@@ -62,6 +65,14 @@ module Wize
62
65
  puts "------ DONE UPGRADING! HAVE FUN ------"
63
66
  end
64
67
 
68
+ def version_control
69
+ Dir.chdir(@new_name)
70
+ puts `git add -A`
71
+ `git commit -m "upgraded to rails 4 with wize_upgrader"`
72
+ puts `git push`
73
+ Dir.chdir("..")
74
+ end
75
+
65
76
  def install_rspec
66
77
  `cd #{ @new_name }`
67
78
  `bundle install`
@@ -85,11 +96,11 @@ module Wize
85
96
  columns = attr_accessibles[model]
86
97
  params_block = <<-rb
87
98
 
88
- private
89
- def #{ model }_params
90
- params.require(:#{ model }).permit(#{ columns.join(", ") })
91
- end
92
- rb
99
+ private
100
+ def #{ model }_params
101
+ params.require(:#{ model }).permit(#{ columns.join(", ") })
102
+ end
103
+ rb
93
104
 
94
105
  # find last occurance of end and replace with params_block
95
106
  ctrlr = File.read("#{ @new_name }/app/controllers/#{ file }")
@@ -169,7 +180,7 @@ end
169
180
  def unusual_gems(gemfile)
170
181
  old_gems = File.readlines(gemfile)
171
182
  old_gems.select! do |gem|
172
- gem.strip.start_with?("gem") && !COMMON_GEMS.include?(gem.chomp)
183
+ gem.strip.start_with?("gem") && !COMMON_GEMS.include?(gem.strip)
173
184
  end
174
185
  puts "CHECK THE GEM GROUPS!!"
175
186
  puts "Special gems: "
@@ -178,7 +189,7 @@ end
178
189
 
179
190
  def rails_gen_new
180
191
  puts "Generating new rails app <#{ app_name }>"
181
- `rails new #{ app_name } -T`
192
+ puts `rails new #{ app_name } -T`
182
193
  puts "Renaming #{ app_name } to #{ @new_name }"
183
194
  `mv #{ app_name } #{ @new_name }`
184
195
  `rm #{ @new_name }/README.rdoc`
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wize_upgrader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: