railsthemes 2.1.0 → 2.1.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.
data/bin/railsthemes
CHANGED
@@ -18,6 +18,7 @@ Usage:
|
|
18
18
|
railsthemes -v # Print the version of the installer gem you are using
|
19
19
|
railsthemes install your@email:code # Install from RailsThemes.com using your download code
|
20
20
|
railsthemes list # List all themes installed in this app
|
21
|
+
railsthemes use # Switch to use a different installed theme
|
21
22
|
railsthemes help [TASK] # Describe available tasks or one specific task
|
22
23
|
EOS
|
23
24
|
end
|
@@ -28,16 +28,17 @@ module Railsthemes
|
|
28
28
|
def install_from_directory source_filepath
|
29
29
|
copy_theme_portions source_filepath, [
|
30
30
|
['controllers', 'app'],
|
31
|
-
['
|
32
|
-
['
|
33
|
-
['
|
31
|
+
['doc', ''],
|
32
|
+
['fonts', 'app/assets'],
|
33
|
+
['helpers', 'app'],
|
34
|
+
['images', 'app/assets'],
|
34
35
|
['javascripts', 'app/assets'],
|
35
|
-
['
|
36
|
-
['
|
37
|
-
['mailers',
|
38
|
-
['
|
39
|
-
['
|
40
|
-
['
|
36
|
+
['layouts', 'app/views'],
|
37
|
+
['lib', ''],
|
38
|
+
['mailers', 'app'],
|
39
|
+
['stylesheets', 'app/assets'],
|
40
|
+
['vendor', ''],
|
41
|
+
['views', 'app'],
|
41
42
|
]
|
42
43
|
|
43
44
|
logger.warn 'Done installing.'
|
@@ -51,6 +52,7 @@ module Railsthemes
|
|
51
52
|
Utils.set_layout_in_application_controller theme_name
|
52
53
|
add_to_asset_precompilation_list theme_name
|
53
54
|
comment_out_formtastic_if_user_does_not_use_formtastic theme_name
|
55
|
+
add_sass_module_line
|
54
56
|
end
|
55
57
|
|
56
58
|
def remove_unwanted_public_files
|
@@ -163,6 +165,27 @@ module Railsthemes
|
|
163
165
|
end
|
164
166
|
end
|
165
167
|
|
168
|
+
def add_sass_module_line
|
169
|
+
config_lines = Utils.lines('config/application.rb')
|
170
|
+
count = config_lines.grep(/sass.rb/).count
|
171
|
+
if count == 0
|
172
|
+
Utils.safe_write('config/application.rb') do |f|
|
173
|
+
config_lines.each do |line|
|
174
|
+
f.puts line
|
175
|
+
if line =~ / < Rails::Application/
|
176
|
+
f.puts <<-EOS
|
177
|
+
# RailsThemes
|
178
|
+
if config.respond_to?(:sass)
|
179
|
+
require "#\{config.root}/lib/railsthemes/sass.rb"
|
180
|
+
end
|
181
|
+
|
182
|
+
EOS
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
166
189
|
def comment_out_formtastic_if_user_does_not_use_formtastic theme_name
|
167
190
|
return if (Utils.gemspecs.map(&:name) & ['formtastic']).count > 0
|
168
191
|
filename = "app/assets/stylesheets/railsthemes_#{theme_name}.css"
|
data/lib/railsthemes/version.rb
CHANGED
@@ -80,7 +80,13 @@ describe Railsthemes::ThemeInstaller do
|
|
80
80
|
filesystem_should_match ['app/assets/fonts/railsthemes_themename/myfont.ttf']
|
81
81
|
end
|
82
82
|
|
83
|
-
it 'should copy
|
83
|
+
it 'should copy lib files' do
|
84
|
+
create_file 'theme/lib/railsthemes/sass.rb'
|
85
|
+
@installer.install_from_file_system('theme')
|
86
|
+
filesystem_should_match ['lib/railsthemes/sass.rb']
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'should copy vendored stylesheets' do
|
84
90
|
create_file 'theme/vendor/assets/stylesheets/coderay.css'
|
85
91
|
@installer.install_from_file_system('theme')
|
86
92
|
filesystem_should_match ['vendor/assets/stylesheets/coderay.css']
|
@@ -186,6 +192,7 @@ describe Railsthemes::ThemeInstaller do
|
|
186
192
|
mock(Railsthemes::Utils).set_layout_in_application_controller 'theme_name'
|
187
193
|
mock(@installer).add_to_asset_precompilation_list 'theme_name'
|
188
194
|
mock(@installer).comment_out_formtastic_if_user_does_not_use_formtastic 'theme_name'
|
195
|
+
mock(@installer).add_sass_module_line
|
189
196
|
@installer.post_copying_changes 'theme_name'
|
190
197
|
end
|
191
198
|
end
|
@@ -467,4 +474,30 @@ end
|
|
467
474
|
end
|
468
475
|
end
|
469
476
|
|
477
|
+
describe '#add_sass_module_line' do
|
478
|
+
before do
|
479
|
+
create_file 'config/application.rb', :content => <<-EOS
|
480
|
+
module Rails3214
|
481
|
+
class Application < Rails::Application
|
482
|
+
end
|
483
|
+
end
|
484
|
+
EOS
|
485
|
+
end
|
486
|
+
|
487
|
+
context 'the content does not already exist' do
|
488
|
+
it 'should add the lines' do
|
489
|
+
@installer.add_sass_module_line
|
490
|
+
File.read('config/application.rb').split("\n").grep(/sass.rb/).count.should == 1
|
491
|
+
end
|
492
|
+
end
|
493
|
+
|
494
|
+
context 'the line already exists' do
|
495
|
+
it 'should not add it again' do
|
496
|
+
@installer.add_sass_module_line
|
497
|
+
@installer.add_sass_module_line
|
498
|
+
File.read('config/application.rb').split("\n").grep(/sass.rb/).count.should == 1
|
499
|
+
end
|
500
|
+
end
|
501
|
+
end
|
502
|
+
|
470
503
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railsthemes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-09-
|
12
|
+
date: 2013-09-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|