icosmith-rails 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ace1c7064be2cb160af04110d6e12959cd46cc18
4
- data.tar.gz: 1d182775959fba97be5e287e93a6f0d2613de22b
3
+ metadata.gz: 4c134aac66158b8042802c93fc56787d41d6b1c4
4
+ data.tar.gz: ced08eb6800f49061cc9663325ae2e43be58c1ae
5
5
  SHA512:
6
- metadata.gz: 43e86bcec1d982c0265a48e0dc30e696a87afff04e3763b9fc8763ee1e64a651fc14998767b2922e35ce180ccf06b75cd1d8221f55feb0495a5d213c43776937
7
- data.tar.gz: 26ee4680f0690f9aa919035e2b8b4ee36db5fcdfec12129f26edae98b32972cccbee6d872855f0d26cb8bc526c03575bae3a34cc323048a1ba40e3ddabff73bf
6
+ metadata.gz: 1356a401150207942c900bffd347dbc90104a6aefb10cf6b3e71b65fd82d53d6989e48e592509ac1e9e760264215ca8e9cc8ac00ac112954c9578eba566b6dd8
7
+ data.tar.gz: 323097275afec4011d0b579de0f8cd54c93f572c5fba22f31808cc8669044b072fd2f75dcb27a1a22b9638c0ed1e6d225556551279c1ec818cb2c8ba73e77bbe
data/Gemfile.lock CHANGED
@@ -1,20 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- icosmith-rails (0.1.0)
5
- rest-client
6
- rubyzip
4
+ icosmith-rails (0.2.0)
5
+ rest-client (~> 1.6.7)
6
+ rubyzip (< 1.0.0)
7
+ thor (~> 0.18.1)
7
8
 
8
9
  GEM
9
10
  remote: http://rubygems.org/
10
11
  specs:
11
- columnize (0.3.6)
12
- debugger (1.6.0)
13
- columnize (>= 0.3.1)
12
+ byebug (2.0.0)
13
+ columnize (~> 0.3.6)
14
14
  debugger-linecache (~> 1.2.0)
15
- debugger-ruby_core_source (~> 1.2.1)
15
+ columnize (0.3.6)
16
16
  debugger-linecache (1.2.0)
17
- debugger-ruby_core_source (1.2.3)
18
17
  diff-lcs (1.2.4)
19
18
  mime-types (1.25)
20
19
  rest-client (1.6.7)
@@ -27,12 +26,13 @@ GEM
27
26
  rspec-expectations (2.13.0)
28
27
  diff-lcs (>= 1.1.3, < 2.0)
29
28
  rspec-mocks (2.13.1)
30
- rubyzip (1.0.0)
29
+ rubyzip (0.9.9)
30
+ thor (0.18.1)
31
31
 
32
32
  PLATFORMS
33
33
  ruby
34
34
 
35
35
  DEPENDENCIES
36
- debugger
36
+ byebug
37
37
  icosmith-rails!
38
38
  rspec
data/README.md CHANGED
@@ -24,6 +24,19 @@ If you are using Rails, use the setup generator
24
24
  Otherwise create a `config/icosmith` directory and copy `icosmith.yml` and
25
25
  `manifest.json` from [lib/generators/icosmith/setup/templates](lib/generators/icosmith/setup/templates)
26
26
 
27
+ If you aren't using Rails, add this to your `Rakefile`:
28
+
29
+ ```ruby
30
+ begin
31
+ require 'icosmith-rails'
32
+ load 'icosmith-rails/tasks/icosmith.rake'
33
+ rescue LoadError
34
+ task :icosmith do
35
+ abort "Icosmith is not available."
36
+ end
37
+ end
38
+ ```
39
+
27
40
  ## Configuration
28
41
 
29
42
  `manifest.json`:
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
- load "lib/tasks/icosmith.rake"
3
+ load "lib/icosmith-rails/tasks/icosmith.rake"
4
4
 
5
5
  require "rspec/core/rake_task"
6
6
  desc "Run all examples"
@@ -6,7 +6,7 @@ require 'icosmith-rails/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "icosmith-rails"
8
8
  gem.version = Icosmith::VERSION
9
- gem.authors = ["tulios", "ggarnier"]
9
+ gem.authors = ["tulios", "Guilherme Garnier"]
10
10
  gem.email = ["ornelas.tulio@gmail.com", "guilherme.garnier@gmail.com"]
11
11
  gem.summary = "Rails integration with an icosmith server"
12
12
  gem.description = "Creates a rake task to generate a new font from svg files using icosmith server"
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
19
19
  gem.require_paths = ["lib"]
20
20
 
21
21
  gem.add_dependency "rest-client", "~> 1.6.7"
22
- gem.add_dependency "rubyzip", "~> 1.0.0"
22
+ gem.add_dependency "rubyzip", "< 1.0.0"
23
23
  gem.add_dependency "thor", "~> 0.18.1"
24
24
 
25
25
  gem.add_development_dependency "rspec"
@@ -5,7 +5,8 @@ module Icosmith
5
5
  SVG_ZIPFILENAME = "svg.zip"
6
6
  FONTS_ZIPFILENAME = "fonts.zip"
7
7
 
8
- def initialize
8
+ def initialize(root_path)
9
+ @root_path = root_path
9
10
  load_config
10
11
  setup_parameters
11
12
  create_directories
@@ -15,7 +16,7 @@ module Icosmith
15
16
  FileUtils.rm_f(@svg_zipfile)
16
17
 
17
18
  Icosmith.logger.info "Compressing SVGs"
18
- Zip::File.open(@svg_zipfile, Zip::File::CREATE) do |zipfile|
19
+ Zip::ZipFile.open(@svg_zipfile, Zip::ZipFile::CREATE) do |zipfile|
19
20
  Dir.glob("#{@src_dir}#{File::SEPARATOR}*.svg").each do |filename|
20
21
  zipfile.add(filename.split(File::SEPARATOR).last, filename)
21
22
  end
@@ -82,7 +83,7 @@ module Icosmith
82
83
  end
83
84
 
84
85
  def unzip path, target
85
- Zip::File.open(path) do |zip_file|
86
+ Zip::ZipFile.open(path) do |zip_file|
86
87
  zip_file.each do |file|
87
88
  zip_file.extract(file, File.join(target, file.name))
88
89
  end
@@ -90,7 +91,7 @@ module Icosmith
90
91
  end
91
92
 
92
93
  def load_config
93
- config_filename = File.join(Rails.root, "config", "icosmith", Icosmith::CONFIG_FILENAME)
94
+ config_filename = File.join(@root_path, "config", "icosmith", Icosmith::CONFIG_FILENAME)
94
95
  begin
95
96
  @config = Icosmith::Config.load(config_filename)
96
97
  rescue Exception => e
@@ -98,7 +99,7 @@ module Icosmith
98
99
  exit 1
99
100
  end
100
101
 
101
- @manifest_full_path = File.join(Rails.root, @config.manifest_dir, Icosmith::MANIFEST_FILENAME)
102
+ @manifest_full_path = File.join(@root_path, @config.manifest_dir, Icosmith::MANIFEST_FILENAME)
102
103
  unless File.readable?(@manifest_full_path)
103
104
  puts "Error trying to load manifest file at #{@manifest_full_path}"
104
105
  exit 1
@@ -106,11 +107,11 @@ module Icosmith
106
107
  end
107
108
 
108
109
  def setup_parameters
109
- @src_dir = File.join(Rails.root, @config.svg_dir)
110
- @temp_dir = File.join(Rails.root, "tmp", "icosmith")
110
+ @src_dir = File.join(@root_path, @config.svg_dir)
111
+ @temp_dir = File.join(@root_path, "tmp", "icosmith")
111
112
  @svg_zipfile = File.join(@temp_dir, SVG_ZIPFILENAME)
112
- @css_dir = File.join(Rails.root, @config.css_dir)
113
- @font_dir = File.join(Rails.root, @config.font_dir)
113
+ @css_dir = File.join(@root_path, @config.css_dir)
114
+ @font_dir = File.join(@root_path, @config.font_dir)
114
115
  end
115
116
 
116
117
  def create_directories
@@ -7,7 +7,7 @@ module Icosmith
7
7
  railtie_name :icosmith
8
8
 
9
9
  rake_tasks do
10
- load "tasks/icosmith.rake"
10
+ load "icosmith-rails/tasks/icosmith.rake"
11
11
  end
12
12
 
13
13
  initializer "icosmith.load-config" do |app|
@@ -17,6 +17,11 @@ namespace :icosmith do
17
17
  end
18
18
 
19
19
  def icosmith_generator
20
- @generator ||= Icosmith::Generator.new
20
+ @generator ||= Icosmith::Generator.new(root_path)
21
+ end
22
+
23
+ private
24
+ def root_path
25
+ defined?(Rails) ? Rails.root : Dir.getwd
21
26
  end
22
27
  end
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  module Icosmith
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
- require "zip"
3
+ require "zip/zip"
4
4
  require "rest_client"
5
5
  require "json"
6
6
  require "logger"
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icosmith-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tulios
8
- - ggarnier
8
+ - Guilherme Garnier
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-03 00:00:00.000000000 Z
12
+ date: 2013-09-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -29,14 +29,14 @@ dependencies:
29
29
  name: rubyzip
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - <
33
33
  - !ruby/object:Gem::Version
34
34
  version: 1.0.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - <
40
40
  - !ruby/object:Gem::Version
41
41
  version: 1.0.0
42
42
  - !ruby/object:Gem::Dependency
@@ -106,8 +106,8 @@ files:
106
106
  - lib/icosmith-rails/config.rb
107
107
  - lib/icosmith-rails/generator.rb
108
108
  - lib/icosmith-rails/railtie.rb
109
+ - lib/icosmith-rails/tasks/icosmith.rake
109
110
  - lib/icosmith-rails/version.rb
110
- - lib/tasks/icosmith.rake
111
111
  - spec/spec_helper.rb
112
112
  homepage: https://github.com/tulios/icosmith-rails
113
113
  licenses: