mustwin-designmodo-flatuipro-rails 1.1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013, Samuel Chou
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
17
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,69 @@
1
+ <a href="http://designmodo.com/shop/?u=223" target="_blank"><img src="http://designmodo.com/img/affiliate/flatui_468_60.jpg" border="0"/></a>
2
+
3
+ This gem integrates Designmodo's Flat UI Pro Design for Twitter Bootstrap into the Rails 3 and 4 Asset Pipeline.
4
+
5
+ You **must** purchase and download a licensed copy to use this gem (none of the assets are packaged per Flat UI Pro license). You may do so by clicking the above image (full disclosure: affiliate link).
6
+
7
+ The version major and minors should match the Flat UI Pro version. Anything after these are gem versions.
8
+
9
+ ## Installation
10
+ First install and configure dependencies: [twitter-bootstrap-rails](https://github.com/seyhunak/twitter-bootstrap-rails) and [jquery-ui-rails](https://github.com/joliss/jquery-ui-rails) .
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'designmodo-flatuipro-rails'
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install designmodo-flatuipro-rails
23
+
24
+ ### Install Generator
25
+ One **must** run this after install *and* after update of designmodo-flatuipro-rails gem:
26
+
27
+ $ rails generate flatuipro:install <Flat UI Pro Directory>
28
+
29
+ ### Demo Page Generator
30
+ If you want to integrate the demo page:
31
+
32
+ $ rails generate flatuipro:demo
33
+
34
+ The demo generator creates a 'flatuipro\_demo' controller with a default 'flatuipro\_demo/index' route.
35
+
36
+ IMPORTANT: After deciding which components to use from the demo page, make sure to only include the corresponding less/css and js that you need from the flatuipro-demo.* files
37
+
38
+ ## Usage
39
+ After running the install generator, all assets should be setup.
40
+
41
+ This gem will detect whether you chose less/static for the twitter-bootstrap-rails install and generate either less/css flatuipro files accordingly.
42
+
43
+ ## Thanks
44
+ If you haven't bought it already, please use my Designmodo Affiliate Link (image above)
45
+
46
+ Thanks [@jehughes](https://github.com/jehughes) for the blog post that inspired me to stop being lazy and write the demo page generator =)
47
+
48
+ ## Changes
49
+ #### 1.1.3.1
50
+ * Move directory from vendor -> app because of rails 4 (https://github.com/rails/rails/pull/7968)
51
+ * Ensure all assets are precompiled correctly if so desired
52
+
53
+ #### 1.1.3.0
54
+ * Support Flat UI Pro 1.1.3
55
+ * Add new 'flatuipro:demo' generator to integrate demo page
56
+
57
+ #### 1.1.1
58
+ * Minor documentation changes to include Rails 4 compatibility
59
+
60
+ #### 1.1.0
61
+ * Initial commit
62
+
63
+ ## Contributing
64
+
65
+ 1. Fork it
66
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
67
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
68
+ 4. Push to the branch (`git push origin my-new-feature`)
69
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,17 @@
1
+ require "designmodo/flatuipro/rails/version"
2
+
3
+ module Designmodo
4
+ module Flatuipro
5
+ module Rails
6
+ class Engine < ::Rails::Engine
7
+ initializer 'designmodo-flatuipro-rails.setup',
8
+ :after => 'less-rails.after.load_config_initializers',
9
+ :group => :all do |app|
10
+ if defined?(Less)
11
+ app.config.less.paths << File.join(config.root, 'app', 'less')
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,7 @@
1
+ module Designmodo
2
+ module Flatuipro
3
+ module Rails
4
+ VERSION = "1.1.3.1"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,27 @@
1
+ require 'rails/generators'
2
+ require 'pathname'
3
+
4
+ module Flatuipro
5
+ module Generators
6
+ class AppInstallGenerator < Rails::Generators::Base
7
+ desc "Install to rails app 'vendor' directory"
8
+ source_root File.expand_path("../../../../../vendor/assets", __FILE__)
9
+
10
+ # Detect if Flat UI Pro assets copied over to gem
11
+ def check_flatuipro_install
12
+ unless File.exist?(File.expand_path("../../../../../vendor/assets", __FILE__))
13
+ raise "Please run install generator first"
14
+ end
15
+ end
16
+
17
+ def copy_to_vendor
18
+ directory "fonts", "vendor/assets/fonts"
19
+ directory "images", "vendor/assets/images"
20
+ directory "javascripts", "vendor/assets/javascripts"
21
+ if File.exist?("less")
22
+ directory "less", "vendor/assets/less"
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,68 @@
1
+ require 'rails/generators'
2
+ require 'pathname'
3
+
4
+ module Flatuipro
5
+ module Generators
6
+ class DemoGenerator < Rails::Generators::Base
7
+ desc "Setup Flat UI Pro Demo page."
8
+ source_root File.expand_path("../../../../../app/assets/demo", __FILE__)
9
+
10
+ # Detect if Flat UI Pro assets copied over to gem
11
+ def check_flatuipro_install
12
+ unless File.exist?(File.expand_path("../../../../../app/assets", __FILE__))
13
+ raise "Please run install generator first"
14
+ end
15
+ end
16
+
17
+ def generate_demo_controller
18
+ generate "controller flatuipro_demo index --no-helper --no-test-framework --no-assets"
19
+ end
20
+
21
+ def add_demo_assets
22
+ # Overwrite generated index.html.erb with demo html
23
+ copy_file "index.html.erb", "app/views/flatuipro_demo/index.html.erb"
24
+
25
+ # Add demo less/css
26
+ if use_less?
27
+ copy_file "flatuipro-demo.less", "app/assets/stylesheets/flatuipro-demo.less"
28
+ else
29
+ copy_file "flatuipro-demo.css", "app/assets/stylesheets/flatuipro-demo.css"
30
+ end
31
+
32
+ # Handle CSS Manifest
33
+ css_manifest = "app/assets/stylesheets/application.css"
34
+ if File.exist?(css_manifest)
35
+ content = File.read(css_manifest)
36
+ unless content.match(/require_tree\s+\./)
37
+ style_require_block = " *= require flatuipro-demo\n"
38
+ insert_into_file css_manifest, style_require_block, :after => "require_self\n"
39
+ end
40
+ end
41
+
42
+ # Add demo javascript
43
+ copy_file "flatuipro-demo.js", "app/assets/javascripts/flatuipro-demo.js"
44
+
45
+ # Handle JS Manifest
46
+ js_manifest = "app/assets/javascripts/application.js"
47
+ if File.exist?(js_manifest)
48
+ content = File.read(js_manifest)
49
+ unless content.match(/require_tree\s+\./)
50
+ insert_into_file js_manifest, "//= require flatuipro-demo\n", :after => "flatuipro\n"
51
+ end
52
+ end
53
+ end
54
+
55
+ private
56
+ # Detect if twitter-bootstrap-rails installed with LESS or static stylesheets
57
+ def use_less?
58
+ if File.exist?("app/assets/stylesheets/bootstrap_and_overrides.css.less")
59
+ return true
60
+ elsif File.exist?("app/assets/stylesheets/bootstrap_and_overrides.css")
61
+ return false
62
+ else
63
+ raise "Cannot detect twitter-bootstrap-rails install"
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,143 @@
1
+ require 'rails/generators'
2
+ require 'pathname'
3
+
4
+ module Flatuipro
5
+ module Generators
6
+ class InstallGenerator < Rails::Generators::Base
7
+ desc "Copies licensed Flat UI Pro files to designmodo-flatuipro-rails gem."
8
+ argument :flatuipro_dir, :type => :string, :banner => "<Licensed Flat UI Pro directory>"
9
+ source_root File.expand_path("../templates", __FILE__)
10
+
11
+ def copy_assets
12
+ gem_assets_dir = File.expand_path("../../../../../app/assets", __FILE__)
13
+ pro_dir = flatuipro_dir
14
+
15
+ unless File.exist?(File.join(pro_dir, "index.html"))
16
+ pro_dir = File.join(pro_dir, "HTML/UI")
17
+ end
18
+ unless File.directory?(pro_dir) && File.exist?(File.join(pro_dir, "index.html"))
19
+ raise "Invalid Flat UI Pro directory"
20
+ end
21
+
22
+ if use_less?
23
+ directory File.join(pro_dir, "less"), File.join(gem_assets_dir, "less")
24
+ else
25
+ copy_file File.join(pro_dir, "css", "flat-ui.css"), "app/assets/stylesheets/flat-ui.css"
26
+ end
27
+ directory File.join(pro_dir, "js"), File.join(gem_assets_dir, "javascripts")
28
+ directory File.join(pro_dir, "images"), File.join(gem_assets_dir, "images")
29
+ directory File.join(pro_dir, "fonts"), File.join(gem_assets_dir, "fonts")
30
+
31
+ # Demo page assets
32
+ copy_file File.join(pro_dir, "index.html"), File.join(gem_assets_dir, "demo", "index.html")
33
+ copy_file File.join(pro_dir, "js", "application.js"), File.join(gem_assets_dir, "demo", "flatuipro-demo.js")
34
+ copy_file File.join(pro_dir, "css", "demo.css"), File.join(gem_assets_dir, "demo", "flatuipro-demo.css")
35
+ copy_file File.join(pro_dir, "less", "demo.less"), File.join(gem_assets_dir, "demo", "flatuipro-demo.less")
36
+ end
37
+
38
+ def add_assets
39
+ copy_file "flatuipro.js", "app/assets/javascripts/flatuipro.js"
40
+ if use_less?
41
+ copy_file "flatuipro.less", "app/assets/stylesheets/flatuipro.less"
42
+ end
43
+
44
+ # Handle JS Manifest
45
+ js_manifest = "app/assets/javascripts/application.js"
46
+ if File.exist?(js_manifest)
47
+ content = File.read(js_manifest)
48
+ unless content.match(/require\s+flatuipro/)
49
+ insert_into_file js_manifest, "//= require flatuipro\n", :after => "twitter/bootstrap\n"
50
+ end
51
+ unless content.match(/require\s+jquery.ui.all/)
52
+ unless content.match(/require\s+jquery.ui.effect/)
53
+ insert_into_file js_manifest, "//= require jquery.ui.effect\n", :after => "jquery\n"
54
+ end
55
+ unless content.match(/require\s+jquery.ui.tooltip/)
56
+ insert_into_file js_manifest, "//= require jquery.ui.tooltip\n", :after => "jquery\n"
57
+ end
58
+ unless content.match(/require\s+jquery.ui.spinner/)
59
+ insert_into_file js_manifest, "//= require jquery.ui.spinner\n", :after => "jquery\n"
60
+ end
61
+ unless content.match(/require\s+jquery.ui.slider/)
62
+ insert_into_file js_manifest, "//= require jquery.ui.slider\n", :after => "jquery\n"
63
+ end
64
+ unless content.match(/require\s+jquery.ui.datepicker/)
65
+ insert_into_file js_manifest, "//= require jquery.ui.datepicker\n", :after => "jquery\n"
66
+ end
67
+ end
68
+ else
69
+ copy_file "application.js", js_manifest
70
+ end
71
+
72
+ # Handle CSS Manifest
73
+ css_manifest = "app/assets/stylesheets/application.css"
74
+ if File.exist?(css_manifest)
75
+ content = File.read(css_manifest)
76
+ unless content.match(/require_tree\s+\./)
77
+ style_require_block = " *= require flatuipro\n"
78
+ insert_into_file css_manifest, style_require_block, :after => "require_self\n"
79
+ end
80
+ else
81
+ copy_file "application.css", "app/assets/stylesheets/application.css"
82
+ end
83
+ end
84
+
85
+ def patch_assets
86
+ gem_assets_dir = File.expand_path("../../../../../app/assets", __FILE__)
87
+
88
+ # Stylesheets patches
89
+ # image url() -> image-url()
90
+ # font url() -> font-url()
91
+ # LESS
92
+ if use_less?
93
+ # switch.less
94
+ # More involved patch because less-rails won't translate when inside ~""
95
+ # Create LESS variable and interpolate into .mask(~"")
96
+ switch_file = File.join(gem_assets_dir, "less/modules", "switch.less")
97
+ mask_image_url = "@mask-image-url: image-url('switch/mask.png');\n"
98
+ insert_into_file switch_file, mask_image_url, :before => ".has-switch {\n"
99
+ gsub_file switch_file, /url\('\.\.\/images\/.+?\)/, "@{mask-image-url}"
100
+
101
+ # icon-font.less
102
+ gsub_file File.join(gem_assets_dir, "less", "icon-font.less"), /url\("\.\.\/fonts\//, 'font-url("'
103
+ # CSS
104
+ else
105
+ gsub_file "app/assets/stylesheets/flat-ui.css", /url\('\.\.\/images\//, "url('/assets/"
106
+ gsub_file "app/assets/stylesheets/flat-ui.css", /url\("\.\.\/fonts\//, 'url("/assets/'
107
+ end
108
+
109
+ # Demo page patches
110
+ file = File.join(gem_assets_dir, "demo", "index.html")
111
+ # Fix image links
112
+ gsub_file file, /<img src="images\/.+?>/ do |s|
113
+ match = /images\/(.+?)"/.match(s)
114
+ '<%= image_tag "' + match[1] + '" %>'
115
+ end
116
+
117
+ # Remove everything before <body> tag and after 'Load JS', inclusive
118
+ new_file = File.open("#{file}.erb", "w")
119
+ include_line = false
120
+ IO.foreach(file) do |line|
121
+ include_line = false if line =~ /Load JS/
122
+
123
+ new_file.write line if include_line
124
+
125
+ include_line = true if line =~ /<body>/
126
+ end
127
+ new_file.close
128
+ end
129
+
130
+ private
131
+ # Detect if twitter-bootstrap-rails installed with LESS or static stylesheets
132
+ def use_less?
133
+ if File.exist?("app/assets/stylesheets/bootstrap_and_overrides.css.less")
134
+ return true
135
+ elsif File.exist?("app/assets/stylesheets/bootstrap_and_overrides.css")
136
+ return false
137
+ else
138
+ raise "Cannot detect twitter-bootstrap-rails install"
139
+ end
140
+ end
141
+ end
142
+ end
143
+ end
@@ -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,22 @@
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
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery.ui.datepicker
15
+ //= require jquery.ui.slider.js
16
+ //= require jquery.ui.spinner.js
17
+ //= require jquery.ui.tooltip.js
18
+ //= require jquery.ui.effect.js
19
+ //= require jquery_ujs
20
+ //= require twitter/bootstrap
21
+ //= require flatuipro
22
+ //= require_tree .
@@ -0,0 +1,8 @@
1
+ //= require jquery.ui.touch-punch.min
2
+ //= require bootstrap-select
3
+ //= require bootstrap-switch
4
+ //= require flatui-checkbox
5
+ //= require flatui-radio
6
+ //= require jquery.tagsinput
7
+ //= require jquery.placeholder
8
+ //= require jquery.stacktable
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mustwin-designmodo-flatuipro-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.3.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Samuel Chou
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-09-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: twitter-bootstrap-rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 2.2.6
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 2.2.6
30
+ - !ruby/object:Gem::Dependency
31
+ name: jquery-rails
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 2.2.1
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 2.2.1
46
+ - !ruby/object:Gem::Dependency
47
+ name: jquery-ui-rails
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 4.0.3
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 4.0.3
62
+ description: designmodo-flatuipro-rails integrates Flat UI Pro for Rails 3 and 4 Asset
63
+ Pipelines
64
+ email:
65
+ - sam.chou@windystudios.com
66
+ executables: []
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - lib/designmodo/flatuipro/rails/version.rb
71
+ - lib/designmodo/flatuipro/rails.rb
72
+ - lib/generators/flatuipro/app_install/app_install_generator.rb
73
+ - lib/generators/flatuipro/demo/demo_generator.rb
74
+ - lib/generators/flatuipro/install/install_generator.rb
75
+ - lib/generators/flatuipro/install/templates/application.css
76
+ - lib/generators/flatuipro/install/templates/application.js
77
+ - lib/generators/flatuipro/install/templates/flatuipro.js
78
+ - lib/generators/flatuipro/install/templates/flatuipro.less
79
+ - LICENSE.txt
80
+ - Rakefile
81
+ - README.md
82
+ homepage: https://github.com/reflection/designmodo-flatuipro-rails
83
+ licenses:
84
+ - Simplified BSD
85
+ post_install_message: ! '**********************************************
86
+
87
+
88
+ DO NOT USE THIS GEM UNLESS YOU HAVE ACQUIRED A FLATUIPRO LICENSE.One *must* run
89
+ `rails generate flatuipro:install <Flat UI Pro Directory>`
90
+
91
+ when gem updated
92
+
93
+
94
+ **********************************************'
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubyforge_project:
112
+ rubygems_version: 1.8.24
113
+ signing_key:
114
+ specification_version: 3
115
+ summary: Flat UI Pro for Rails 3 and 4 Asset Pipelines
116
+ test_files: []