railsthemes 2.0.1 → 2.0.2

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.
@@ -2,13 +2,12 @@ module Railsthemes
2
2
  class EmailInstaller
3
3
  include Railsthemes::Logging
4
4
 
5
- def email_stylesheet_filenames theme_name
6
- Dir["app/assets/stylesheets/railsthemes_#{theme_name}/*_email.css.*"]
5
+ def email_stylesheet_filenames
6
+ Dir["app/assets/stylesheets/railsthemes/*_email.css.*"]
7
7
  end
8
8
 
9
9
  def install_from_file_system source_filepath
10
- theme_name = Utils.read_file(File.join(source_filepath, 'theme_name')).chomp
11
- if email_stylesheet_filenames(theme_name).count > 0
10
+ if email_stylesheet_filenames.count > 0
12
11
  logger.warn 'Installing email...'
13
12
  logger.info "Source filepath: #{source_filepath}"
14
13
 
@@ -16,7 +15,7 @@ module Railsthemes
16
15
  Safe.log_and_abort 'Expected a directory to install email theme from, but found none.'
17
16
  end
18
17
 
19
- add_to_asset_precompilation_list theme_name
18
+ add_to_asset_precompilation_list
20
19
  install_mail_gems_if_necessary
21
20
 
22
21
  logger.warn 'Done installing email.'
@@ -26,14 +25,14 @@ module Railsthemes
26
25
  end
27
26
  end
28
27
 
29
- def add_to_asset_precompilation_list theme_name
30
- filenames = email_stylesheet_filenames(theme_name).map do |filename|
31
- "railsthemes_#{theme_name}/#{File.basename(filename.gsub(/\.erb$/, ''))}"
28
+ def add_to_asset_precompilation_list
29
+ filenames = email_stylesheet_filenames.map do |filename|
30
+ "railsthemes/#{File.basename(filename.gsub(/\.erb$/, ''))}"
32
31
  end
33
32
  updated_or_new_line = " config.assets.precompile += %w( #{filenames.join(' ')} )"
34
33
 
35
34
  config_lines = Utils.lines('config/environments/production.rb')
36
- email_regex = /^\s*config.assets.precompile\s*\+=\s*%w\(\s*railsthemes_#{theme_name}\/\w*email\.css.*\)$/
35
+ email_regex = /^\s*config.assets.precompile\s*\+=\s*%w\(\s*railsthemes\/\w*email\.css.*\)$/
37
36
  count = config_lines.grep(email_regex).count
38
37
  if count == 0 # precompile line we want not found, add it
39
38
  added = false # only want to add the new line once
@@ -1,5 +1,5 @@
1
1
  module Railsthemes
2
2
  unless defined?(Railsthemes::VERSION)
3
- VERSION = "2.0.1"
3
+ VERSION = "2.0.2"
4
4
  end
5
5
  end
@@ -47,8 +47,8 @@ describe Railsthemes::EmailInstaller do
47
47
 
48
48
  describe '#add_to_asset_precompilation_list' do
49
49
  before do
50
- create_file 'app/assets/stylesheets/railsthemes_magenta/1_email.css.erb'
51
- create_file 'app/assets/stylesheets/railsthemes_magenta/2_email.css.erb'
50
+ create_file 'app/assets/stylesheets/railsthemes/1_email.css.erb'
51
+ create_file 'app/assets/stylesheets/railsthemes/2_email.css.erb'
52
52
  end
53
53
 
54
54
  it 'should add it to the list if the line is not there yet' do
@@ -57,11 +57,11 @@ BaseApp::Application.configure do
57
57
  # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
58
58
  end
59
59
  EOS
60
- @installer.add_to_asset_precompilation_list 'magenta'
60
+ @installer.add_to_asset_precompilation_list
61
61
  File.read('config/environments/production.rb').should == <<-EOS
62
62
  BaseApp::Application.configure do
63
63
  # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
64
- config.assets.precompile += %w( railsthemes_magenta/1_email.css railsthemes_magenta/2_email.css )
64
+ config.assets.precompile += %w( railsthemes/1_email.css railsthemes/2_email.css )
65
65
  end
66
66
  EOS
67
67
  end
@@ -71,15 +71,15 @@ EOS
71
71
  BaseApp::Application.configure do
72
72
  # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
73
73
  config.assets.precompile += %w( railsthemes_magenta.js railsthemes_magenta.css )
74
- config.assets.precompile += %w( railsthemes_magenta/1_email.css )
74
+ config.assets.precompile += %w( railsthemes/1_email.css )
75
75
  end
76
76
  EOS
77
- @installer.add_to_asset_precompilation_list 'magenta'
77
+ @installer.add_to_asset_precompilation_list
78
78
  File.read('config/environments/production.rb').should == <<-EOS
79
79
  BaseApp::Application.configure do
80
80
  # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
81
81
  config.assets.precompile += %w( railsthemes_magenta.js railsthemes_magenta.css )
82
- config.assets.precompile += %w( railsthemes_magenta/1_email.css railsthemes_magenta/2_email.css )
82
+ config.assets.precompile += %w( railsthemes/1_email.css railsthemes/2_email.css )
83
83
  end
84
84
  EOS
85
85
  end
@@ -91,7 +91,7 @@ BaseApp::Application.configure do
91
91
  config.assets.precompile += %w( railsthemes_orange/email1.css )
92
92
  end
93
93
  EOS
94
- @installer.add_to_asset_precompilation_list 'magenta'
94
+ @installer.add_to_asset_precompilation_list
95
95
  end
96
96
  end
97
97
  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.0.1
4
+ version: 2.0.2
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-07-11 00:00:00.000000000 Z
12
+ date: 2013-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor