oulu 0.9.0 → 0.9.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a7bca85dc42b12756c52ad98ca2fd57f11bbc6d
4
- data.tar.gz: 5faa93065f186dd7d7632bf2d603e62c281ded31
3
+ metadata.gz: 9aa920b503b0c2efc4e9de3f3ab510335e89a186
4
+ data.tar.gz: 010f5bb50a934fe1342be65d7c19cbd46a96229b
5
5
  SHA512:
6
- metadata.gz: cf44992b81bf669cfa4dca633d764054e7070b4812555e8ba2c1c72a8ca408f25f6278a1603f1408df1d517bafe7521adee1c4de1b3cd31ba3af1539671a4953
7
- data.tar.gz: 68345ae29cf938d5429a76790463602b5956d0c3277e854cefe06e964530941ce2c1f57be0de5a219d1c0c53224f1ab08ef20f951577e27c9ec4d7f82d41ac36
6
+ metadata.gz: 2cb9f79f94219efdedf3da278eb6b4579d8fd7f96fd5505b044314a898285c542815e990afa28d63a70ced7d52f28bdeb91e74ac439881e3af237d77f0be603b
7
+ data.tar.gz: d7345a63ab983a450c793d0490d5276a7f36c7652a3035f1106155b5bfbbb83000cb142037f165a6795a43860ad2e9e6094ca7f7727e8783dc4966755c81b21d
@@ -0,0 +1,5 @@
1
+ module Oulu
2
+ class Engine < Rails::Engine
3
+ # auto wire
4
+ end
5
+ end
@@ -0,0 +1,80 @@
1
+ require 'oulu/version'
2
+ require "fileutils"
3
+ require 'thor'
4
+
5
+ module Oulu
6
+ class Generator < Thor
7
+ map ['-v', '--version'] => :version
8
+
9
+ desc 'install', 'Install Oulu into your project'
10
+ method_options :path => :string, :force => :boolean
11
+ def install
12
+ if oulu_files_already_exist? && !options[:force]
13
+ puts "Oulu files already installed, doing nothing."
14
+ else
15
+ install_files
16
+ puts "Oulu files installed to #{install_path}/"
17
+ end
18
+ end
19
+
20
+ desc 'update', 'Update Oulu'
21
+ method_options :path => :string
22
+ def update
23
+ if oulu_files_already_exist?
24
+ remove_oulu_directory
25
+ install_files
26
+ puts "Oulu files updated."
27
+ else
28
+ puts "No existing oulu installation. Doing nothing."
29
+ end
30
+ end
31
+
32
+ desc 'version', 'Show Oulu version'
33
+ def version
34
+ say "Oulu #{Oulu::VERSION}"
35
+ end
36
+
37
+ private
38
+
39
+ def oulu_files_already_exist?
40
+ install_path.exist?
41
+ end
42
+
43
+ def install_path
44
+ @install_path ||= if options[:path]
45
+ Pathname.new(File.join(options[:path], 'oulu'))
46
+ else
47
+ Pathname.new('oulu')
48
+ end
49
+ end
50
+
51
+ def install_files
52
+ make_install_directory
53
+ copy_in_scss_files
54
+ end
55
+
56
+ def remove_oulu_directory
57
+ FileUtils.rm_rf("oulu")
58
+ end
59
+
60
+ def make_install_directory
61
+ FileUtils.mkdir_p(install_path)
62
+ end
63
+
64
+ def copy_in_scss_files
65
+ FileUtils.cp_r(all_stylesheets, install_path)
66
+ end
67
+
68
+ def all_stylesheets
69
+ Dir["#{stylesheets_directory}/*"]
70
+ end
71
+
72
+ def stylesheets_directory
73
+ File.join(top_level_directory, "app", "assets", "stylesheets")
74
+ end
75
+
76
+ def top_level_directory
77
+ File.dirname(File.dirname(File.dirname(__FILE__)))
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,3 @@
1
+ module Oulu
2
+ VERSION = "0.9.1"
3
+ end
data/lib/oulu.rb ADDED
@@ -0,0 +1,32 @@
1
+
2
+ # CodeKit needs relative paths
3
+ dir = File.dirname(__FILE__)
4
+ $LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
5
+
6
+ require "oulu/generator"
7
+ require "oulu/version"
8
+ require 'sass'
9
+ require 'oulu'
10
+
11
+ unless defined?(Sass)
12
+ require 'sass'
13
+ end
14
+
15
+ module Oulu
16
+ if defined?(Rails) && defined?(Rails::Engine)
17
+ class Engine < ::Rails::Engine
18
+ require 'oulu/engine'
19
+ end
20
+
21
+ module Rails
22
+ class Railtie < ::Rails::Railtie
23
+ rake_tasks do
24
+ load "tasks/install.rake"
25
+ end
26
+ end
27
+ end
28
+ else
29
+ oulu_path = File.expand_path("../../app/assets/stylesheets", __FILE__)
30
+ ENV["SASS_PATH"] = [ENV["SASS_PATH"], oulu_path].compact.join(File::PATH_SEPARATOR)
31
+ end
32
+ end
@@ -0,0 +1,20 @@
1
+ # Needed for pre-3.1.
2
+
3
+ require "fileutils"
4
+ require "find"
5
+
6
+ namespace :oulu do
7
+ desc "Move files to the Rails assets directory."
8
+ task :install, [:sass_path] do |t, args|
9
+ args.with_defaults(:sass_path => 'public/stylesheets/sass')
10
+ source_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
11
+ FileUtils.mkdir_p("#{Rails.root}/#{args.sass_path}/oulu")
12
+ FileUtils.cp_r("#{source_root}/app/assets/stylesheets/.", "#{Rails.root}/#{args.sass_path}/oulu", { :preserve => true })
13
+ Find.find("#{Rails.root}/#{args.sass_path}/oulu") do |path|
14
+ if path.end_with?(".css.sass")
15
+ path_without_css_extension = path.gsub(/\.css\.sass$/, ".sass")
16
+ FileUtils.mv(path, path_without_css_extension)
17
+ end
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oulu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - machida
@@ -167,6 +167,11 @@ files:
167
167
  - app/assets/stylesheets/settings/variables/_default.sass
168
168
  - bower.json
169
169
  - index.js
170
+ - lib/oulu.rb
171
+ - lib/oulu/engine.rb
172
+ - lib/oulu/generator.rb
173
+ - lib/oulu/version.rb
174
+ - lib/tasks/install.rake
170
175
  - oulu.gemspec
171
176
  - package.json
172
177
  homepage: ''