fontello_rails_converter 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +15 -0
  2. data/.rspec +2 -0
  3. data/CHANGELOG.md +14 -0
  4. data/Gemfile +3 -0
  5. data/README.md +33 -14
  6. data/Rakefile +2 -1
  7. data/bin/fontello +98 -0
  8. data/fontello_rails_converter.gemspec +4 -1
  9. data/lib/fontello_rails_converter/cli.rb +110 -0
  10. data/lib/fontello_rails_converter/fontello_api.rb +49 -0
  11. data/lib/fontello_rails_converter/railtie.rb +4 -0
  12. data/lib/fontello_rails_converter/version.rb +1 -1
  13. data/lib/fontello_rails_converter.rb +3 -2
  14. data/lib/tasks/fontello_rails_converter.rake +4 -2
  15. data/spec/dummy/README.rdoc +28 -0
  16. data/spec/dummy/Rakefile +6 -0
  17. data/spec/dummy/app/assets/images/.keep +0 -0
  18. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  19. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  20. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  21. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  22. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  23. data/spec/dummy/app/mailers/.keep +0 -0
  24. data/spec/dummy/app/models/.keep +0 -0
  25. data/spec/dummy/app/models/concerns/.keep +0 -0
  26. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  27. data/spec/dummy/bin/bundle +3 -0
  28. data/spec/dummy/bin/rails +4 -0
  29. data/spec/dummy/bin/rake +4 -0
  30. data/spec/dummy/config/application.rb +28 -0
  31. data/spec/dummy/config/boot.rb +5 -0
  32. data/spec/dummy/config/database.yml +25 -0
  33. data/spec/dummy/config/environment.rb +5 -0
  34. data/spec/dummy/config/environments/development.rb +29 -0
  35. data/spec/dummy/config/environments/production.rb +80 -0
  36. data/spec/dummy/config/environments/test.rb +36 -0
  37. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  38. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  39. data/spec/dummy/config/initializers/inflections.rb +16 -0
  40. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  41. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  42. data/spec/dummy/config/initializers/session_store.rb +3 -0
  43. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  44. data/spec/dummy/config/locales/en.yml +23 -0
  45. data/spec/dummy/config/routes.rb +56 -0
  46. data/spec/dummy/config.ru +4 -0
  47. data/spec/dummy/db/development.sqlite3 +0 -0
  48. data/spec/dummy/db/schema.rb +16 -0
  49. data/spec/dummy/db/test.sqlite3 +0 -0
  50. data/spec/dummy/lib/assets/.keep +0 -0
  51. data/spec/dummy/log/.keep +0 -0
  52. data/spec/dummy/log/development.log +7 -0
  53. data/spec/dummy/public/404.html +58 -0
  54. data/spec/dummy/public/422.html +58 -0
  55. data/spec/dummy/public/500.html +57 -0
  56. data/spec/dummy/public/favicon.ico +0 -0
  57. data/spec/fixtures/config.json +236 -0
  58. data/spec/fixtures/fontello_session_id_changing +1 -0
  59. data/spec/fixtures/fontello_session_id_empty +0 -0
  60. data/spec/fixtures/fontello_session_id_persisted +1 -0
  61. data/spec/fixtures/minimal-config.json +14 -0
  62. data/spec/fontello_api_spec.rb +102 -0
  63. data/spec/spec_helper.rb +13 -0
  64. metadata +161 -25
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZmE5YjIxMTdiMmI1YjhkNzJhOTNlNWNiZTNlZTE5ODM0MWFlMmMwNA==
5
+ data.tar.gz: !binary |-
6
+ ZDdhNjEyMzA4ZmFhOTY1MDZkM2VmYTg2NGE4YzE5NmQ5NjQwZGUxOQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MTFlOTgxMmM4YTE3MTNiMTRmNzIwZGQzOWY2N2RmMGQ0N2IzNzNmY2NjNzRj
10
+ MWI3YzViYWFmOWQ3OTAzNTllNzdjZWM0MTVlOTdhM2QzZDI0NzM4YzMwOGM1
11
+ ZjY2M2M1ZGY2NmFjMzUwNDdiMzhjZTA2NzE3YjM2OTlmY2FjMDE=
12
+ data.tar.gz: !binary |-
13
+ Y2IzNjE0MmRiZTI4ODViNzdlMDgwZmExNjNlNjA1YWYzMzlmM2RjZjdhNTgx
14
+ ZDA0M2I0OWI3NjhjOGNmMmRhOTlhYzY2NjhjYmEzNzU4MTQ1NzEzY2E2ZjI1
15
+ ZWJhMDczNGMzODYwOGUwZDA2MTExMDhjZjEzZGM4OWUyZDdlM2Y=
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ ### 0.1.0
4
+
5
+ * convert the gem to a CLI tool
6
+ * deprecated rake task
7
+
8
+ ### 0.0.2
9
+
10
+ updated rubyzip dependency
11
+
12
+ ### 0.0.1
13
+
14
+ initial release
data/Gemfile CHANGED
@@ -2,3 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in fontello_rails_converter.gemspec
4
4
  gemspec
5
+
6
+ gem 'rails-dummy'
7
+ gem 'sqlite3' # dummy app dependency
data/README.md CHANGED
@@ -1,34 +1,53 @@
1
1
  ## fontello_rails_converter
2
2
 
3
- Rake task to be run on .zip file downloaded from fontello.com. It will copy all the assets to the appropiate places in your Rails app and convert them where necessary.
3
+ CLI gem for comfortably working with icon fonts from [http://fontello.com](http://fontello.com) for usage in Rails apps.
4
4
 
5
- ## Usage
5
+ Main features:
6
6
 
7
- 1. Add the gem to your Gemfile `gem 'fontello_rails_converter'` and run `bundle install`
7
+ * **Open** up your current fontello font in the browser from the command line
8
+ * **Copy & convert** files from the zip into rails app (inclusively Sass enhancements)
8
9
 
9
- 1. Download `.zip` file from [http://fontello.com](http://fontello.com) and copy it to your app directory, e.g. into `myapp/tmp/`
10
10
 
11
- 1. Run the rake task `rake import_fontello["tmp/fontello-b9661c9f.zip"]`
11
+ ## Initial usage
12
12
 
13
- It will copy all the assets from the fontello .zip file into the appropiate places in your app's `vendor/assets/` directory.
13
+ #### Rails app setup
14
14
 
15
- To use them in your app you will need to `@import` the main stylesheet `vendor/assets/stylesheets/fontname.css.scss` in your `application.css.sass` using `@import 'fontname'`. For special cases you might also want `@import` some of the other stylesheets (`fontname-ie7-codes.css.scss`, `fontname-embedded.css.scss`, `animation.css.scss`, `fontname-ie7.css.scss`, `fontname-codes.css.scss`).
15
+ Add the gem to your Gemfile `gem 'fontello_rails_converter'` and run `bundle install`
16
16
 
17
- In order for the fonts in `vendor/assets/fonts/` to be served up through the Rails asset pipeline, you will need tell it about font directories, by adding this to your `application.rb`:
17
+ #### Get your icon font
18
18
 
19
- config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
19
+ 1. Download your initial `.zip` file from [http://fontello.com](http://fontello.com) and save it to `myapp/tmp/fontello.zip`
20
20
 
21
- You can check if the icon font is working correctly by visiting [http://localhost:3000/demo.html](http://localhost:3000/demo.html).
21
+ 1. Run `fontello convert` inside your app's root directory
22
22
 
23
- ## Updating your font
23
+ It will copy all the assets from the `fontello.zip` file into the appropiate places in your app's `vendor/assets/` directory.
24
24
 
25
- When you want to add new icons to your fontello font, just grab the `config.json` from `vendor/assets/fonts/` upload it to fontello, select new icons, download the .zip file and start at step 1.
25
+ #### Use the font in your app
26
26
 
27
- ## TODO
27
+ To use your font in your app you will need to `@import` the main stylesheet `vendor/assets/stylesheets/fontname.css.scss` in your `application.css.sass` using `@import 'fontname'`.
28
28
 
29
- Fontello recently added an API ([https://github.com/fontello/fontello#developers-api](https://github.com/fontello/fontello#developers-api)), which would save us all the .zip file downloading hassle.
29
+ You can check if the icon font is working correctly by visiting [http://localhost:3000/fontello-demo.html](http://localhost:3000/fontello-demo.html).
30
30
 
31
31
 
32
+ ## Updating your existing fontello font
32
33
 
34
+ When you want to add new icons to your existing fontello font you can open it in the browser by using `fontello open` and select all the additional icons you want to add.
33
35
 
36
+ Next you click the 'Save session' button on the fontello website. After that you can download, copy and convert the changed font by running `fontello convert` (it has persisted the session id in `tmp/fontello_session_id` and will used that to pull down your changed font).
37
+
38
+ Alternatively, you can download & save the `.zip` file just like in the initial setp and run `fontello convert --no-download` to use the manually downloaded file instead of pulling it down from fontello.
39
+
40
+ ## More help
41
+
42
+ For more help run `fontello --help`
43
+
44
+ ## Misc
45
+
46
+ #### Additional fontello stylesheets
47
+
48
+ Besides the main stylesheet (`fontname.css.scss`) fontello also provides a couple of additional stylesheets that you might want to `@import` in your app for special use cases: `fontname-ie7-codes.css.scss`, `fontname-embedded.css.scss`, `animation.css.scss`, `fontname-ie7.css.scss`, `fontname-codes.css.scss`
49
+
50
+ ----
51
+
52
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/railslove/fontello_rails_converter/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
34
53
 
data/Rakefile CHANGED
@@ -1 +1,2 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'rails/dummy/tasks'
data/bin/fontello ADDED
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require "fontello_rails_converter"
5
+ command = ARGV[0]
6
+
7
+ if ARGV[0].nil?
8
+ puts "Run fontello --help for help"
9
+ exit
10
+ end
11
+
12
+ def options_based_on_rails_root(options)
13
+ options[:asset_dir] = "#{options[:rails_root_dir]}/vendor/assets"
14
+ options.merge!({
15
+ stylesheet_dir: "#{options[:asset_dir]}/stylesheets",
16
+ font_dir: "#{options[:asset_dir]}/fonts",
17
+ zip_file: "#{options[:rails_root_dir]}/tmp/fontello.zip",
18
+ config_file: "#{options[:asset_dir]}/fonts/config.json",
19
+ fontello_session_id_file: "#{options[:rails_root_dir]}/tmp/fontello_session_id"
20
+ })
21
+ end
22
+
23
+ options = { rails_root_dir: "." } # default
24
+ options = options_based_on_rails_root(options)
25
+
26
+ OptionParser.new do |opts|
27
+ opts.banner = "Usage: fontello COMMAND [options]\n\n"
28
+
29
+ opts.separator "Available commands: open, convert, download\n\n"
30
+
31
+ opts.separator "Global options:"
32
+
33
+ opts.on("-i", "--fontello-session-id [ID]", "Pass in session ID from fontello.com (e.g. fb235ab72cad01d2b46aaa023ab4abbd) otherwise it will be taken from session-id-file\n\n") do |opt|
34
+ options[:fontello_session_id] = opt
35
+ end
36
+
37
+ opts.separator "`open` options:"
38
+
39
+ opts.on("-e", "--open-existing", "Doesn't open fontello based on config.json, but based on passed in or persisted sesssion id\n\n") do |opt|
40
+ options[:open_existing] = true
41
+ end
42
+
43
+ opts.separator "`convert` options:"
44
+
45
+ opts.on("-n", "--no-download", "Converts existing .zip file without automatically downloading a new one\n\n") do |opt|
46
+ options[:no_download] = true
47
+ end
48
+
49
+ opts.separator "`download` options:"
50
+
51
+ opts.on("-u", "--use-config", "Uses existing config.json instead of persisted or passed in fontello session ID\n\n") do |opt|
52
+ options[:use_config] = true
53
+ end
54
+
55
+ opts.separator "Path options:"
56
+
57
+ opts.on("-r", "--rails-root [PATH]", "Rails root path (default: current location)") do |opt|
58
+ options[:rails_root_dir] = opt
59
+ options = options_based_on_rails_root(options)
60
+ end
61
+
62
+ opts.on("-c", "--config-file [PATH]", "config.json file (default: /rails_root/vendor/assets/fonts/config.json)") do |opt|
63
+ options[:config_file] = opt
64
+ end
65
+
66
+ opts.on("-z", "--zip-file [PATH]", "Downloaded zip file (default: /rails_root/tmp/fontello.zip)") do |opt|
67
+ options[:zip_file] = opt
68
+ end
69
+
70
+ opts.on("-a", "--asset-dir [PATH]", "Target asset directory (default: /rails_root/vendor/assets)") do |opt|
71
+ options[:asset_dir] = opt
72
+ end
73
+
74
+ opts.on("-s", "--stylesheet-dir [PATH]", "Target stylesheet directory (default: /rails_root/vendor/assets/stylesheets)") do |opt|
75
+ options[:stylesheet_dir] = opt
76
+ end
77
+
78
+ opts.on("-f", "--font-dir [PATH]", "Target font directory (default: /rails_root/vendor/assets/fonts)") do |opt|
79
+ options[:font_dir] = opt
80
+ end
81
+
82
+ opts.on("-p", "--session-id-file [PATH]", "File to persist fontello session ID (default: /rails_root/tmp/fontello_session_id)") do |opt|
83
+ options[:font_dir] = opt
84
+ end
85
+
86
+ opts.separator "\nExamples:\n"\
87
+ " fontello open -r /path/to/railsapp\n"\
88
+ " fontello convert\n"\
89
+ " fontello download -e -i fb235ab72cad01d2b46aaa023ab4abbd\n"
90
+ end.parse!
91
+
92
+
93
+ unless ["open", "download", "convert"].include?(command)
94
+ puts "available commands: open, download, convert"
95
+ exit
96
+ end
97
+
98
+ FontelloRailsConverter::Cli.new(options).send(command)
@@ -18,9 +18,12 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "rails", ">= 3.1"
22
21
  spec.add_runtime_dependency "rubyzip", "~> 1.0"
22
+ spec.add_runtime_dependency "launchy"
23
+ spec.add_runtime_dependency "rest-client"
23
24
 
24
25
  spec.add_development_dependency "bundler", "~> 1.3"
25
26
  spec.add_development_dependency "rake"
27
+ spec.add_development_dependency "rspec"
28
+ spec.add_development_dependency "pry-debugger"
26
29
  end
@@ -0,0 +1,110 @@
1
+ require 'fileutils'
2
+ require 'launchy'
3
+ require 'zip'
4
+
5
+ module FontelloRailsConverter
6
+ class Cli
7
+ include ColorizedOutput
8
+
9
+ def initialize(options)
10
+ @options = options
11
+ @fontello_api = FontelloApi.new @options
12
+ end
13
+
14
+ def open
15
+ @fontello_api.new_session_from_config unless @options[:open_existing] == true
16
+ Launchy.open @fontello_api.session_url
17
+ end
18
+
19
+ def download
20
+ @fontello_api.new_session_from_config if @options[:use_config] == true
21
+ File.open(@options[:zip_file], "w+") do |file|
22
+ file.write @fontello_api.download_zip_body
23
+ end
24
+ end
25
+
26
+ def convert
27
+ self.download unless @options[:no_download] == true || !config_file_exists?
28
+ self.prepare_directories
29
+
30
+ Zip::File.open(@options[:zip_file]) do |zipfile|
31
+ zipfile.each do |file|
32
+ filename = file.to_s.split("/").last
33
+
34
+ # stylesheets
35
+ if filename.end_with? '.css'
36
+ # extract stylesheet to target location
37
+ target_file = File.join @options[:stylesheet_dir], "#{filename}.scss"
38
+ zipfile.extract(file, target_file) { true }
39
+ puts green("copied #{target_file}")
40
+
41
+ if !filename.end_with? "animation.css", "-ie7.css", "-codes.css", "-ie7-codes.css", "-embedded.css"
42
+ converted_css = self.convert_main_stylesheet File.read(target_file)
43
+ File.open(target_file, 'w') { |f| f.write(converted_css) }
44
+ puts green("converted #{target_file} for Sass & asset pipeline")
45
+ end
46
+
47
+ # font files
48
+ elsif filename.end_with? ".eot", ".woff", ".ttf", ".svg", "config.json"
49
+ target_file = File.join @options[:font_dir], filename
50
+ zipfile.extract(file, target_file) { true }
51
+ puts green("copied #{target_file}")
52
+
53
+ # demo.html
54
+ elsif filename == 'demo.html'
55
+ target_file = File.join @options[:rails_root_dir], "public", "fontello-demo.html"
56
+ zipfile.extract(file, target_file) { true }
57
+ puts green("copied #{target_file}")
58
+
59
+ converted_html = convert_demo_html File.read(target_file)
60
+ File.open(target_file, 'w') { |f| f.write(converted_html) }
61
+ puts green("converted #{filename}'s HTML for asset pipeline")
62
+ end
63
+
64
+ end
65
+ end
66
+ end
67
+
68
+ def prepare_directories
69
+ FileUtils.mkdir_p @options[:font_dir]
70
+ FileUtils.mkdir_p @options[:stylesheet_dir]
71
+ FileUtils.mkdir_p @options[:asset_dir]
72
+ end
73
+
74
+ def convert_main_stylesheet(content)
75
+ # asset URLs
76
+ content.gsub! /\.\.\/font\//, ""
77
+ content.gsub!(/url\(([^\(]+)\)/) { |m| "url(font-path(#{$1}))" }
78
+
79
+ # turn icon base class into placeholder selector
80
+ content.gsub! /\[class\^="icon-[^\{]+{/m, "%icon-base {"
81
+
82
+ # get icons
83
+ icons = content.scan(/\.(icon-\S+):before/).map(&:first)
84
+
85
+ # convert icon classes to placeholder selectors
86
+ content.gsub!(/^\.(icon-\S+:before) { (.+)$/) { |m| "%#{$1} { @extend %icon-base; #{$2}" }
87
+
88
+ # recreate icon classes using the mixins
89
+ if icons.any?
90
+ content += "\n\n"
91
+ icons.each do |icon|
92
+ content += ".#{icon} { @extend %#{icon}; }\n"
93
+ end
94
+ end
95
+
96
+ return content
97
+ end
98
+
99
+ private
100
+
101
+ def config_file_exists?
102
+ @options[:config_file] && File.exist?(@options[:config_file])
103
+ end
104
+
105
+ def convert_demo_html(content)
106
+ content.gsub! /css\//, "/assets/"
107
+ end
108
+
109
+ end
110
+ end
@@ -0,0 +1,49 @@
1
+ require 'rest_client'
2
+ require 'json'
3
+
4
+ module FontelloRailsConverter
5
+ class FontelloApi
6
+ FONTELLO_HOST = "http://fontello.com"
7
+
8
+ def initialize(options)
9
+ @config_file = options[:config_file]
10
+ @session_id = options[:fontello_session_id]
11
+ @fontello_session_id_file = options[:fontello_session_id_file]
12
+ end
13
+
14
+ # creates a new fontello session from config.json
15
+ def new_session_from_config
16
+ @session_id = RestClient.post FONTELLO_HOST, config: File.new(@config_file, 'rb')
17
+ persist_session
18
+ @session_id
19
+ end
20
+
21
+ def session_url
22
+ "#{FONTELLO_HOST}/#{session_id}"
23
+ end
24
+
25
+ def download_zip_body
26
+ response = RestClient.get "#{session_url}/get"
27
+ response.body
28
+ end
29
+
30
+ private
31
+
32
+ def session_id
33
+ @session_id ||= read_or_create_session
34
+ end
35
+
36
+ def read_or_create_session
37
+ if @fontello_session_id_file && File.exist?(@fontello_session_id_file)
38
+ @session_id = File.read(@fontello_session_id_file)
39
+ return @session_id unless @session_id == ""
40
+ end
41
+
42
+ new_session_from_config
43
+ end
44
+
45
+ def persist_session
46
+ File.open(@fontello_session_id_file, 'w+') { |f| f.write @session_id }
47
+ end
48
+ end
49
+ end
@@ -3,5 +3,9 @@ module FontelloRailsConverter
3
3
  rake_tasks do
4
4
  load File.join(File.dirname(__FILE__), '../tasks/fontello_rails_converter.rake')
5
5
  end
6
+
7
+ initializer "fontello_rails_converter.setup" do |app|
8
+ app.config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
9
+ end
6
10
  end
7
11
  end
@@ -1,3 +1,3 @@
1
1
  module FontelloRailsConverter
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -1,7 +1,8 @@
1
1
  require "fontello_rails_converter/version"
2
2
  require "fontello_rails_converter/colorized_output"
3
- require "fontello_rails_converter/railtie"
3
+ require "fontello_rails_converter/fontello_api"
4
+ require "fontello_rails_converter/cli"
5
+ require "fontello_rails_converter/railtie" if defined?(Rails)
4
6
 
5
7
  module FontelloRailsConverter
6
- # Your code goes here...
7
8
  end
@@ -1,5 +1,7 @@
1
- desc "import new zipfile from fontello"
1
+ desc "[deprecated] import new zipfile from fontello"
2
2
  task :import_fontello, [:zipfile] => :environment do |t, args|
3
+ puts "THIS RAKE TASK IS DEPRECATED AND WILL BE REMOVED IN THE NEXT VERSION"
4
+
3
5
  include FontelloRailsConverter::ColorizedOutput
4
6
  require 'zip'
5
7
 
@@ -74,7 +76,7 @@ task :import_fontello, [:zipfile] => :environment do |t, args|
74
76
 
75
77
  # demo.html
76
78
  elsif filename == 'demo.html'
77
- target_file = File.join Rails.root, "public", filename
79
+ target_file = File.join Rails.root, "public", "fontello-demo.html"
78
80
  zipfile.extract(file, target_file) { true }
79
81
  puts green("copied #{target_file}")
80
82
 
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Dummy::Application.load_tasks
File without changes
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6
+ <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,28 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_mailer/railtie"
7
+ require "sprockets/railtie"
8
+ # require "rails/test_unit/railtie"
9
+
10
+ Bundler.require(*Rails.groups)
11
+ require "fontello_rails_converter"
12
+
13
+ module Dummy
14
+ class Application < Rails::Application
15
+ # Settings in config/environments/* take precedence over those specified here.
16
+ # Application configuration should go into files in config/initializers
17
+ # -- all .rb files in that directory are automatically loaded.
18
+
19
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
20
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
21
+ # config.time_zone = 'Central Time (US & Canada)'
22
+
23
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
24
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
25
+ # config.i18n.default_locale = :de
26
+ end
27
+ end
28
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Dummy::Application.initialize!