trackman 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/trackman.rb CHANGED
@@ -1,20 +1,16 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
3
 
4
- require File.expand_path('../trackman/utility/core_extensions', __FILE__)
5
- require File.expand_path('../trackman/utility/railtie', __FILE__)
4
+ require File.expand_path("../trackman/utility/core_extensions", __FILE__)
6
5
 
7
6
  module Trackman
8
- #TODO do something better than this to share the scope
9
- def self.autoloads path, items
10
- items.each do |s|
11
- if block_given?
12
- yield(s, "#{path}/#{s.trackman_underscore}" )
13
- else
14
- autoload s, "#{path}/#{s.trackman_underscore}"
15
- end
16
- end
17
- end
7
+ autoload :Assets, 'trackman/assets'
8
+ autoload :Scaffold, 'trackman/scaffold'
9
+ autoload :Components, 'trackman/components'
10
+ autoload :Errors, 'trackman/errors'
11
+ autoload :Path, 'trackman/path'
12
+ autoload :Utility, 'trackman/utility'
13
+ end
18
14
 
19
- autoloads 'trackman', [:Assets, :Configuration, :Scaffold, :Components, :Errors, :Path, :Utility]
20
- end
15
+ require File.expand_path("../trackman/utility/debugger", __FILE__)
16
+ require File.expand_path("../trackman/utility/railtie", __FILE__)
@@ -1,10 +1,14 @@
1
1
  module Trackman
2
2
  module Assets
3
- @@classes = [:Asset, :HtmlAsset, :RemoteAsset, :CssAsset]
4
- @@modules = [:CompositeAsset, :AssetFactory, :BundledAsset, :RemoteAssetFactory, :Persistence]
5
-
6
- Trackman.autoloads 'trackman/assets', (@@classes + @@modules) do |s, p|
7
- autoload s, p
8
- end
3
+ autoload :Asset, 'trackman/assets/asset'
4
+ autoload :HtmlAsset, 'trackman/assets/html_asset'
5
+ autoload :RemoteAsset, 'trackman/assets/remote_asset'
6
+ autoload :CssAsset, 'trackman/assets/css_asset'
7
+
8
+ autoload :CompositeAsset, 'trackman/assets/composite_asset'
9
+ autoload :AssetFactory, 'trackman/assets/asset_factory'
10
+ autoload :BundledAsset, 'trackman/assets/bundled_asset'
11
+ autoload :RemoteAssetFactory, 'trackman/assets/remote_asset_factory'
12
+ autoload :Persistence, 'trackman/assets/persistence'
9
13
  end
10
14
  end
@@ -1,8 +1,8 @@
1
1
  module Trackman
2
2
  module Assets
3
3
  class Asset
4
- extend AssetFactory, Components::Conventions
5
- extend Components::Diffable, Components::Shippable
4
+ extend AssetFactory, Trackman::Components::Conventions
5
+ extend Trackman::Components::Diffable, Trackman::Components::Shippable
6
6
  include Comparable
7
7
 
8
8
  def initialize attributes = {}
@@ -65,10 +65,7 @@ module Trackman
65
65
  local = Asset.all
66
66
  remote = RemoteAsset.all
67
67
 
68
- diff_result = diff(local, remote)
69
-
70
- Trackman::Utility::Debugger.trace diff_result.inspect
71
-
68
+ diff_result = diff(local, remote)
72
69
  ship diff_result
73
70
 
74
71
  true
@@ -20,12 +20,12 @@ module Trackman
20
20
 
21
21
  def add_content_behavior instance
22
22
  if asset_pipeline_enabled?
23
- instance.extend Path::Rails32Resolver, BundledAsset
23
+ instance.extend Trackman::Path::Rails32Resolver, BundledAsset
24
24
  return instance
25
25
  elsif rails_defined? #fallback to rails without asset pipeline
26
- instance.extend Path::RailsResolver
26
+ instance.extend Trackman::Path::RailsResolver
27
27
  end
28
- instance.extend Components::Hashable
28
+ instance.extend Trackman::Components::Hashable
29
29
 
30
30
  instance
31
31
  end
@@ -1,7 +1,7 @@
1
1
  module Trackman
2
2
  module Assets
3
3
  module BundledAsset
4
- include Components::Hashable
4
+ include Trackman::Components::Hashable
5
5
 
6
6
  def env
7
7
  @@env ||= ::Rails.application.assets.index
@@ -1,9 +1,7 @@
1
1
  module Trackman
2
2
  module Assets
3
3
  module Persistence
4
- Trackman.autoloads 'trackman/assets/persistence', [:Remote] do |s, p|
5
- autoload s, p
6
- end
4
+ autoload :Remote, 'trackman/assets/persistence/remote'
7
5
  end
8
6
  end
9
7
  end
@@ -1,9 +1,8 @@
1
1
  module Trackman
2
2
  module Components
3
- @@modules = [:Conventions, :Diffable, :Hashable, :Shippable]
4
-
5
- Trackman.autoloads 'trackman/components', @@modules do |s,p|
6
- autoload s, p
7
- end
3
+ autoload :Conventions, 'trackman/components/conventions'
4
+ autoload :Diffable, 'trackman/components/diffable'
5
+ autoload :Hashable, 'trackman/components/hashable'
6
+ autoload :Shippable, 'trackman/components/shippable'
8
7
  end
9
8
  end
@@ -1,9 +1,7 @@
1
1
  module Trackman
2
2
  module Errors
3
- @@classes = [:AssetNotFoundError, :ConfigNotFoundError, :ConfigSetupError]
4
-
5
- Trackman.autoloads 'trackman/errors', @@classes do |s,p|
6
- autoload s, p
7
- end
3
+ autoload :AssetNotFoundError, 'trackman/errors/asset_not_found_error'
4
+ autoload :ConfigNotFoundError, 'trackman/errors/config_not_found_error'
5
+ autoload :ConfigSetupError, 'trackman/errors/config_setup_error'
8
6
  end
9
7
  end
data/lib/trackman/path.rb CHANGED
@@ -1,9 +1,7 @@
1
1
  module Trackman
2
2
  module Path
3
- @@modules = [:Resolver, :Rails32Resolver, :RailsResolver]
4
-
5
- Trackman.autoloads 'trackman/path', @@modules do |s,p|
6
- autoload s, p
7
- end
3
+ autoload :Resolver, 'trackman/path/resolver'
4
+ autoload :Rails32Resolver, 'trackman/path/rails32_resolver'
5
+ autoload :RailsResolver, 'trackman/path/rails_resolver'
8
6
  end
9
7
  end
@@ -1,7 +1,5 @@
1
1
  module Trackman
2
2
  module Scaffold
3
- Trackman.autoloads 'trackman/scaffold', [:ContentSaver] do |s,p|
4
- autoload s, p
5
- end
3
+ autoload :ContentSaver, 'trackman/scaffold/content_saver'
6
4
  end
7
5
  end
@@ -1,9 +1,5 @@
1
1
  module Trackman
2
2
  module Utility
3
- @@modules = [:Configuration, :Debugger]
4
-
5
- ::Trackman.autoloads 'trackman/utility', @@modules do |s,p|
6
- autoload s, p
7
- end
3
+ autoload :Configuration, 'trackman/utility/configuration'
8
4
  end
9
5
  end
@@ -27,7 +27,7 @@ module Trackman
27
27
  result = run "heroku config -s" do |option|
28
28
  "heroku config -s #{option}"
29
29
  end
30
- Trackman::Configuration.s_to_h(result)
30
+ self.class.s_to_h(result)
31
31
  end
32
32
 
33
33
 
@@ -7,7 +7,7 @@ module Trackman
7
7
  @@server_url = ENV['TRACKMAN_URL']
8
8
 
9
9
  def self.debug_mode?
10
- !ENV['TRACKMAN_DEBUG_MODE'].nil? && ENV['TRACKMAN_DEBUG_MODE'] == 'true'
10
+ @@debug ||= ENV['TRACKMAN_DEBUG_MODE'] == 'true'
11
11
  end
12
12
 
13
13
  def self.trace data
@@ -20,5 +20,23 @@ module Trackman
20
20
  end
21
21
  end
22
22
  end
23
+ if Trackman::Utility::Debugger.debug_mode?
24
+ RestClient.log = Logger.new(STDOUT)
23
25
 
24
- RestClient.log = Logger.new(STDOUT) if Trackman::Utility::Debugger.debug_mode?
26
+ #loads module first
27
+ Trackman::Components::Diffable
28
+
29
+ module Trackman
30
+ module Components
31
+ module Diffable
32
+ alias old_diff diff
33
+
34
+ def diff local, remote
35
+ result = old_diff local, remote
36
+ Trackman::Utility::Debugger.trace "Diff result:\n#{result.inspect}"
37
+ result
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -19,8 +19,8 @@ if defined?(Rails)
19
19
  module Trackman
20
20
  class Railtie < Rails::Railtie
21
21
  rake_tasks do
22
- path = '../rails_generators/trackman_tasks/templates/*.rake'
23
- Dir[File.join(File.dirname(__FILE__), path)].each { |f| load f }
22
+ path = File.expand_path('../../../../rails_generators/trackman_tasks/templates/trackman.rake', __FILE__)
23
+ load path
24
24
  end
25
25
 
26
26
  initializer "trackman.hook" do |app|
@@ -1,3 +1,3 @@
1
1
  module Trackman
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.6"
3
3
  end
@@ -4,14 +4,12 @@ require 'trackman'
4
4
  namespace :trackman do
5
5
  desc "Syncs your assets with the server, this is what gets executed when you deploy to heroku."
6
6
  task :sync => :environment do
7
- RestClient.log = Logger.new(STDOUT) if Debugger.debug_mode?
8
-
9
7
  Trackman::Assets::Asset.sync
10
8
  end
11
9
 
12
10
  desc "Sets up the heroku configs required by Trackman"
13
11
  task :setup, :app do |t, args|
14
12
  heroku_version = Gem.loaded_specs["heroku"].version.to_s
15
- Trackman::Configuration.new(heroku_version, :app => args[:app]).setup
13
+ Trackman::Utility::Configuration.new(heroku_version, :app => args[:app]).setup
16
14
  end
17
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-09-28 00:00:00.000000000 Z
13
+ date: 2012-09-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client