moxify 0.1.5 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,49 +1,4 @@
1
- *.gemspec
2
1
  *.gem
3
2
  .bundle
4
3
  Gemfile.lock
5
- pkg/*
6
-
7
-
8
- # rcov generated
9
- coverage
10
-
11
- # rdoc generated
12
- rdoc
13
-
14
- # yard generated
15
- doc
16
- .yardoc
17
-
18
- # bundler
19
- .bundle
20
-
21
- # jeweler generated
22
- pkg
23
-
24
- # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
25
- #
26
- # * Create a file at ~/.gitignore
27
- # * Include files you want ignored
28
- # * Run: git config --global core.excludesfile ~/.gitignore
29
- #
30
- # After doing this, these files will be ignored in all your git projects,
31
- # saving you from having to 'pollute' every project you touch with them
32
- #
33
- # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
34
- #
35
- # For MacOS:
36
- #
37
- .DS_Store
38
- #
39
- # For TextMate
40
- *.tmproj
41
- tmtags
42
- #
43
- # For emacs:
44
- #*~
45
- #\#*
46
- #.\#*
47
- #
48
- # For vim:
49
- #*.swp
4
+ pkg
data/Rakefile CHANGED
@@ -1,2 +1,2 @@
1
1
  require 'bundler'
2
- Bundler::GemHelper.install_tasks
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,17 @@
1
+ <% content_for :header, t('.there_are_no_users') %>
2
+ <p>
3
+ <%=t('.remember_admin_location')%>
4
+ </p>
5
+ <p>
6
+ <strong><%= [request.protocol, request.host_with_port, '/admin'].join %></strong>
7
+ </p>
8
+ <p>
9
+ <%= t('.lets_start') %>
10
+ </p>
11
+
12
+ <div class='form-actions'>
13
+ <div class='form-actions-left'>
14
+ <%= link_to t('.continue'), new_user_registration_path,
15
+ :class => 'button' %>
16
+ </div>
17
+ </div>
@@ -0,0 +1,18 @@
1
+ en:
2
+ plugins:
3
+ refinery_core:
4
+ title: Core
5
+ description: Core Plugin
6
+ refinery_dialogs:
7
+ description: Dialog Plugin
8
+ refinery_dashboard:
9
+ description: Gibt eine Übersicht über Aktivitäten
10
+ refinery_settings:
11
+ description: Einstellungen verwalten
12
+ welcome:
13
+ remember_admin_location: "Merken Sie sich Ihren Administrationsbereich:"
14
+ users:
15
+ create:
16
+ welcome: 'Willkommen %{who}'
17
+ forgot:
18
+ password_encryption: 'Sie müssen ihr Passwort zurücksetzen, da es Änderungen in der Art der Passwortverschlüsselung gab, sodass Passwörter noch stärker verschlüsselt werden als vorher.'
@@ -0,0 +1,19 @@
1
+ en:
2
+ plugins:
3
+ refinery_core:
4
+ title: Core
5
+ description: Core plugin
6
+ refinery_dialogs:
7
+ title: Dialogs
8
+ description: Dialogs plugin
9
+ refinery_dashboard:
10
+ description: Gives an overview of activity
11
+ refinery_settings:
12
+ description: Manage settings
13
+ welcome:
14
+ remember_admin_location: "Remember your admin area is at:"
15
+ users:
16
+ create:
17
+ welcome: 'Welcome %{who}'
18
+ forgot:
19
+ password_encryption: You need to reset your password because there were changes in the password encryption methods so that passwords are stored with even stronger encryption than before.
data/config/routes.rb CHANGED
@@ -1,45 +1,5 @@
1
- Refinery::Application.routes.draw do
2
- #match '/admin(/*path)' => 'admin/base#error_404'
3
- #match '/admin' => 'admin/dashboard#index'
4
- get 'admin', :to => 'admin/dashboard#index', :as => :refinery_root
5
- get 'admin', :to => 'admin/dashboard#index', :as => :user_root
6
-
7
- scope :except => :show do
8
- namespace :admin do
9
-
10
- # refinerycms-pages
11
- resources :pages do
12
- post :update_positions, :on => :collection
13
- end
14
-
15
- resources :pages_dialogs, :only => [] do
16
- collection do
17
- get :link_to
18
- get :test_url
19
- get :test_email
20
- end
21
- end
22
-
23
- resources :page_parts, :only => [:new, :create, :destroy]
24
-
25
- # refinerycms-images
26
- resources :images
27
-
28
- # refinerycms-authentication
29
- resources :users
30
-
31
- # refinerycms-resources
32
- resources :resources
33
-
34
- # refinerycms-settings
35
- resources :settings,
36
- :except => :show,
37
- :as => :refinery_settings,
38
- :controller => :refinery_settings
39
-
40
- # refinerycms-dashboard
41
- root :to => 'dashboard#index'
42
- resources :dialogs, :only => :show
43
- end
44
- end
1
+ ::Refinery::Application.routes.draw do
2
+ match '/refinery(/*path)', :to => redirect {|params, request|
3
+ "/admin#{"/#{params[:path]}" unless params[:path].blank?}"
4
+ }
45
5
  end
@@ -1,3 +1,3 @@
1
1
  module Moxify
2
- VERSION = "0.1.5"
3
- end
2
+ VERSION = "0.1.7"
3
+ end
data/lib/moxify.rb CHANGED
@@ -1,23 +1,64 @@
1
- require 'refinery'
2
- require 'moxify/url_tempfile'
1
+ require 'refinerycms-base'
3
2
 
4
- module Refinery
5
- module Moxify
6
- class Engine < Rails::Engine
7
- initializer "static assets" do |app|
8
- app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
3
+ module Moxify
4
+
5
+ class Engine < Rails::Engine
6
+
7
+ initializer "static assets" do |app|
8
+ app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
9
+ end
10
+
11
+ initializer "require dragonfly hook" do |app|
12
+ require 'moxify/dragonfly_quality_hook'
13
+ end
14
+
15
+ config.after_initialize do
16
+ ::Refinery::Plugin.register do |plugin|
17
+ plugin.name ="moxification"
18
+ plugin.version = Moxify::VERSION
19
+ plugin.hide_from_menu = true
20
+ plugin.always_allow_access = true
9
21
  end
22
+ end
23
+
24
+ # override refinery routes to use admin namespace
25
+ initializer "moxify.override_routing", :after => :disable_dependency_loading do |app|
10
26
 
11
- initializer "require dragonfly hook" do |app|
12
- require 'moxify/dragonfly_quality_hook'
27
+ # override routes
28
+ collected_routes = []
29
+ Rails.application.routes.routes.each do |route|
30
+ if route.path =~ /refinery/ and
31
+ not route.path =~ /^\/refinery\(\/\*path\)/ # this is our catch all route
32
+
33
+ route.instance_variable_set "@path", route.path.gsub(/refinery/, "admin")
34
+
35
+ # make sure we generate new path_info for changed paths
36
+ conditions = route.conditions
37
+ conditions[:path_info] = ::Rack::Mount::Strexp.compile(route.path, route.requirements, ::ActionDispatch::Routing::SEPARATORS, true)
38
+
39
+ # overwrite conditions with new path_info
40
+ route.instance_variable_set "@conditions", conditions
41
+ end
42
+
43
+ # add every route to our collection
44
+ collected_routes << route
13
45
  end
46
+
47
+ # clear set
48
+ _routes = Rails.application.routes
49
+ _routes.clear!
50
+ _routes.disable_clear_and_finalize = false
14
51
 
15
- ::Refinery::Plugin.register do |plugin|
16
- plugin.name ="moxify"
17
- plugin.version = "0.1.3"
18
- plugin.hide_from_menu = true
19
- plugin.always_allow_access = true
52
+ # now put our collected routes in
53
+ for route in collected_routes
54
+ _routes.add_route(route.app, route.conditions, route.requirements, route.defaults, route.name)
20
55
  end
56
+
57
+ # finalize
58
+ _routes.finalize!
59
+
21
60
  end
61
+
22
62
  end
23
- end
63
+
64
+ end
data/moxify.gemspec CHANGED
@@ -6,44 +6,16 @@ Gem::Specification.new do |s|
6
6
  s.name = %q{moxify}
7
7
  s.version = Moxify::VERSION
8
8
  s.description = 'A blanket full of toy cars for Refinery CMS'
9
- s.date = %q{2011-04-20}
10
9
  s.summary = 'My port of Refinery CMS'
11
10
  s.email = %q{mail@bitflut.com}
12
11
  s.homepage = %q{http://bitflut.com}
13
12
  s.authors = ['Marian Andre']
14
13
  s.license = %q{MIT}
15
- s.require_paths = %w(lib)
16
- s.files = Dir['lib/**/*', 'config/**/*', 'app/**/*', 'public/**/*']
17
14
 
18
- s.add_dependency 'refinerycms', '~> 0.9.9.10'
19
-
20
- s.files = [
21
- '.gitignore',
22
- 'Gemfile',
23
- 'Gemfile',
24
- 'Rakefile',
25
- 'app',
26
- 'app/views',
27
- 'app/views/admin',
28
- 'app/views/admin/_head.html.erb',
29
- 'app/views/layouts',
30
- 'app/views/layouts/application.html.erb',
31
- 'app/views/shared',
32
- 'app/views/shared/_site_bar.html.erb',
33
- 'config',
34
- 'config/routes.rb',
35
- 'lib',
36
- 'lib/gemspec.rb',
37
- 'lib/moxify',
38
- 'lib/moxify/dragonfly_quality_hook.rb',
39
- 'lib/moxify/url_tempfile.rb',
40
- 'lib/moxify/version.rb',
41
- 'lib/moxify.rb',
42
- 'moxify.gemspec',
43
- 'public',
44
- 'public/stylesheets',
45
- 'public/stylesheets/refinery',
46
- 'public/stylesheets/refinery/moxify.css',
47
- 'public/stylesheets/refinery/site_bar.css'
48
- ]
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib", "config", "app", "public"]
19
+
20
+ s.add_dependency 'refinerycms', '~> 0.9.9.18'
49
21
  end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Moxify routing" do
4
+
5
+ it "should redirect on /refinery visit", :type => :request do
6
+ get '/refinery'
7
+ response.should redirect_to '/admin'
8
+ end
9
+
10
+ it "should redirect past refinery", :type => :request do
11
+ get '/refinery/dialogs/images'
12
+ response.should redirect_to '/admin/dialogs/images'
13
+ end
14
+
15
+ it "should override refinery root to /admin", :type => :request do
16
+ refinery_root_path.should == "/admin"
17
+ end
18
+
19
+ it "should override plugin paths", :type => :request do
20
+ [
21
+ {name:'pages',path:'/admin/pages'},
22
+ {name:'dashboard',path:'/admin/dashboard'},
23
+ {name:'images',path:'/admin/images'},
24
+ {name:'resources',path:'/admin/resources'},
25
+ {name:'refinery_settings',path:'/admin/settings'}
26
+ ].each do |plugin|
27
+ eval("admin_#{plugin[:name]}_path").should == plugin[:path]
28
+ end
29
+ end
30
+
31
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe "welcome.html.erb" do
4
+
5
+ context "given no user exists" do
6
+
7
+ before(:each) do
8
+ view.stub(:just_installed?) { true }
9
+ view.stub(:from_dialog?) { false }
10
+ end
11
+
12
+ it "should see /admin reminder" do
13
+ assign :user, stub_model(User).as_new_record
14
+ render
15
+ # view.content_for(:header).should contain("refinery")
16
+ render.should_not contain("Refinery")
17
+ render.should_not contain("refinery")
18
+ end
19
+
20
+ end
21
+
22
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: moxify
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.5
5
+ version: 0.1.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Marian Andre
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-20 00:00:00 +02:00
13
+ date: 2011-04-28 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: 0.9.9.10
24
+ version: 0.9.9.18
25
25
  type: :runtime
26
26
  version_requirements: *id001
27
27
  description: A blanket full of toy cars for Refinery CMS
@@ -39,15 +39,18 @@ files:
39
39
  - app/views/admin/_head.html.erb
40
40
  - app/views/layouts/application.html.erb
41
41
  - app/views/shared/_site_bar.html.erb
42
+ - app/views/welcome.html.erb
43
+ - config/locales/de.yml
44
+ - config/locales/en.yml
42
45
  - config/routes.rb
43
- - lib/gemspec.rb
46
+ - lib/moxify.rb
44
47
  - lib/moxify/dragonfly_quality_hook.rb
45
- - lib/moxify/url_tempfile.rb
46
48
  - lib/moxify/version.rb
47
- - lib/moxify.rb
48
49
  - moxify.gemspec
49
50
  - public/stylesheets/refinery/moxify.css
50
51
  - public/stylesheets/refinery/site_bar.css
52
+ - spec/requests/routes_spec.rb
53
+ - spec/views/sign_up_spec.rb
51
54
  has_rdoc: true
52
55
  homepage: http://bitflut.com
53
56
  licenses:
@@ -57,6 +60,9 @@ rdoc_options: []
57
60
 
58
61
  require_paths:
59
62
  - lib
63
+ - config
64
+ - app
65
+ - public
60
66
  required_ruby_version: !ruby/object:Gem::Requirement
61
67
  none: false
62
68
  requirements:
@@ -76,5 +82,6 @@ rubygems_version: 1.5.2
76
82
  signing_key:
77
83
  specification_version: 3
78
84
  summary: My port of Refinery CMS
79
- test_files: []
80
-
85
+ test_files:
86
+ - spec/requests/routes_spec.rb
87
+ - spec/views/sign_up_spec.rb
data/lib/gemspec.rb DELETED
@@ -1,54 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'pathname'
3
- gempath = Pathname.new(File.expand_path('../../', __FILE__))
4
-
5
- files = %w( Gemfile *.md **/**/{*,.rspec,.gitignore,.yardopts} ).map { |file| Pathname.glob(file) }.flatten
6
- rejection_patterns = [
7
- "^public/system",
8
- "^config/(application|boot|environment).rb$",
9
- "^config/initializers(\/.*\.rb)?$",
10
- "^config/(database|i18n\-js).yml$",
11
- "^lib\/gemspec\.rb",
12
- ".*\/cache\/",
13
- "^script\/*",
14
- "^vendor\/plugins\/?$",
15
- "(^log|\.log)$",
16
- "\.rbc$",
17
- "^tmp(|/.+?)$",
18
- ".gem$",
19
- "^doc($|\/)"
20
- ]
21
-
22
- files.reject! do |f|
23
- !f.exist? or (f.directory? and f.children.empty?) =~ %r{(#{rejection_patterns.join(')|(')})}
24
- end
25
-
26
- gemspec = <<EOF
27
- # DO NOT EDIT THIS FILE DIRECTLY! Instead, use lib/gemspec.rb to generate it.
28
- $:.push File.expand_path("../lib", __FILE__)
29
- require "moxify/version"
30
-
31
- Gem::Specification.new do |s|
32
- s.name = %q{#{gemname = 'moxify'}}
33
- s.version = Moxify::VERSION
34
- s.description = 'A blanket full of toy cars for Refinery CMS'
35
- s.date = %q{#{Time.now.strftime('%Y-%m-%d')}}
36
- s.summary = 'My port of Refinery CMS'
37
- s.email = %q{mail@bitflut.com}
38
- s.homepage = %q{http://bitflut.com}
39
- s.authors = ['Marian Andre']
40
- s.license = %q{MIT}
41
- s.require_paths = %w(lib)
42
- s.files = Dir['lib/**/*', 'config/**/*', 'app/**/*', 'public/**/*']
43
-
44
- s.add_dependency 'refinerycms', '~> 0.9.9.10'
45
-
46
- s.files = [
47
- '#{files.sort.join("',\n '")}'
48
- ]
49
- end
50
- EOF
51
-
52
-
53
- (gemfile = gempath.join("#{gemname}.gemspec")).open('w') {|f| f.puts(gemspec)}
54
- puts `cd #{gempath} && gem build #{gemfile}` if ARGV.any?{|a| a == "BUILD=true"}
@@ -1,17 +0,0 @@
1
- class URLTempfile < Tempfile
2
-
3
- def initialize(url)
4
- @url = URI.parse(url)
5
-
6
- begin
7
- super('url', Dir.tmpdir, :encoding => 'ascii-8bit')
8
-
9
- Net::HTTP.start(@url.host) do |http|
10
- resp = http.get(@url.path)
11
- self.write resp.body
12
- end
13
- ensure
14
- end
15
- end
16
-
17
- end