concen 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/.gitignore +10 -0
  2. data/Gemfile +23 -0
  3. data/Gemfile.lock +143 -0
  4. data/README.md +41 -0
  5. data/Rakefile +28 -0
  6. data/app/stylesheets/partials/.sass +21 -0
  7. data/concen.gemspec +33 -0
  8. data/config/initializers/notification.rb +8 -0
  9. data/config/initializers/prepend_routing_paths.rb +6 -0
  10. data/lib/concen/version.rb +1 -1
  11. data/test/dummy/Rakefile +7 -0
  12. data/test/dummy/app/controllers/application_controller.rb +3 -0
  13. data/test/dummy/app/helpers/application_helper.rb +2 -0
  14. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  15. data/test/dummy/config.ru +4 -0
  16. data/test/dummy/config/application.rb +44 -0
  17. data/test/dummy/config/boot.rb +10 -0
  18. data/test/dummy/config/environment.rb +5 -0
  19. data/test/dummy/config/environments/development.rb +26 -0
  20. data/test/dummy/config/environments/production.rb +49 -0
  21. data/test/dummy/config/environments/test.rb +35 -0
  22. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  23. data/test/dummy/config/initializers/inflections.rb +10 -0
  24. data/test/dummy/config/initializers/mime_types.rb +5 -0
  25. data/test/dummy/config/initializers/secret_token.rb +7 -0
  26. data/test/dummy/config/initializers/session_store.rb +8 -0
  27. data/test/dummy/config/locales/en.yml +5 -0
  28. data/test/dummy/config/mongoid.yml +23 -0
  29. data/test/dummy/config/routes.rb +58 -0
  30. data/test/dummy/public/404.html +26 -0
  31. data/test/dummy/public/422.html +26 -0
  32. data/test/dummy/public/500.html +26 -0
  33. data/test/dummy/public/favicon.ico +0 -0
  34. data/test/dummy/public/javascripts/application.js +2 -0
  35. data/test/dummy/public/javascripts/controls.js +965 -0
  36. data/test/dummy/public/javascripts/dragdrop.js +974 -0
  37. data/test/dummy/public/javascripts/effects.js +1123 -0
  38. data/test/dummy/public/javascripts/prototype.js +6001 -0
  39. data/test/dummy/public/javascripts/rails.js +175 -0
  40. data/test/dummy/public/stylesheets/.gitkeep +0 -0
  41. data/test/dummy/script/rails +6 -0
  42. data/test/fabricators.rb +12 -0
  43. data/test/integration/navigation_test.rb +7 -0
  44. data/test/support/integration_case.rb +5 -0
  45. data/test/support/raw_text/code_blocks.html +12 -0
  46. data/test/support/raw_text/code_blocks.txt +19 -0
  47. data/test/support/raw_text/multi_content.html +2 -0
  48. data/test/support/raw_text/multi_content.txt +17 -0
  49. data/test/support/raw_text/smartypants.html +3 -0
  50. data/test/support/raw_text/smartypants.txt +11 -0
  51. data/test/support/raw_text/smartypants_escape.html +1 -0
  52. data/test/support/raw_text/smartypants_escape.txt +9 -0
  53. data/test/test_helper.rb +26 -0
  54. data/test/unit/concen_test.rb +7 -0
  55. data/test/unit/grid_file_test.rb +41 -0
  56. data/test/unit/page_test.rb +95 -0
  57. data/test/unit/user_test.rb +42 -0
  58. metadata +139 -36
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ .DS_Store
2
+ .bundle/
3
+ .rvmrc
4
+ *.gem
5
+ log/*.log
6
+ app/stylesheets/.sass-cache
7
+ pkg/
8
+ test/dummy/db/*.sqlite3
9
+ test/dummy/log/*.log
10
+ test/dummy/tmp/
data/Gemfile ADDED
@@ -0,0 +1,23 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rails", "~> 3.0.9"
4
+
5
+ gem "compass", "0.11.5"
6
+ gem "haml", "~> 3.1.0"
7
+ gem "mustache", "~> 0.99.4"
8
+ gem "redcarpet", "~> 2.0.0b3"
9
+ gem "mongoid", "~> 2.0.0"
10
+ gem "mongo-rails-instrumentation", "~> 0.2.4"
11
+ gem "bson_ext", "~> 1.3.0"
12
+ gem "rack-gridfs", "~> 0.4.1"
13
+ gem "chronic", "~> 0.4.3"
14
+ gem "mime-types", "~> 1.16"
15
+ gem "bcrypt-ruby", "~> 2.1.4"
16
+ gem "domainatrix", "~> 0.0.10"
17
+
18
+ # For test.
19
+ gem "capybara", ">= 0.4.0"
20
+ gem "fabrication", "0.9.4"
21
+ gem "database_cleaner", "0.6.0"
22
+ gem "ansi"
23
+ gem "turn"
data/Gemfile.lock ADDED
@@ -0,0 +1,143 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ abstract (1.0.0)
5
+ actionmailer (3.0.9)
6
+ actionpack (= 3.0.9)
7
+ mail (~> 2.2.19)
8
+ actionpack (3.0.9)
9
+ activemodel (= 3.0.9)
10
+ activesupport (= 3.0.9)
11
+ builder (~> 2.1.2)
12
+ erubis (~> 2.6.6)
13
+ i18n (~> 0.5.0)
14
+ rack (~> 1.2.1)
15
+ rack-mount (~> 0.6.14)
16
+ rack-test (~> 0.5.7)
17
+ tzinfo (~> 0.3.23)
18
+ activemodel (3.0.9)
19
+ activesupport (= 3.0.9)
20
+ builder (~> 2.1.2)
21
+ i18n (~> 0.5.0)
22
+ activerecord (3.0.9)
23
+ activemodel (= 3.0.9)
24
+ activesupport (= 3.0.9)
25
+ arel (~> 2.0.10)
26
+ tzinfo (~> 0.3.23)
27
+ activeresource (3.0.9)
28
+ activemodel (= 3.0.9)
29
+ activesupport (= 3.0.9)
30
+ activesupport (3.0.9)
31
+ addressable (2.2.6)
32
+ ansi (1.2.5)
33
+ arel (2.0.10)
34
+ bcrypt-ruby (2.1.4)
35
+ bson (1.3.1)
36
+ bson_ext (1.3.1)
37
+ builder (2.1.2)
38
+ capybara (1.0.0)
39
+ mime-types (>= 1.16)
40
+ nokogiri (>= 1.3.3)
41
+ rack (>= 1.0.0)
42
+ rack-test (>= 0.5.4)
43
+ selenium-webdriver (~> 0.2.0)
44
+ xpath (~> 0.1.4)
45
+ childprocess (0.1.9)
46
+ ffi (~> 1.0.6)
47
+ chronic (0.4.4)
48
+ chunky_png (1.2.0)
49
+ compass (0.11.5)
50
+ chunky_png (~> 1.2)
51
+ fssm (>= 0.2.7)
52
+ sass (~> 3.1)
53
+ database_cleaner (0.6.0)
54
+ domainatrix (0.0.10)
55
+ addressable
56
+ erubis (2.6.6)
57
+ abstract (>= 1.0.0)
58
+ fabrication (0.9.4)
59
+ ffi (1.0.9)
60
+ fssm (0.2.7)
61
+ haml (3.1.2)
62
+ i18n (0.5.0)
63
+ json_pure (1.5.2)
64
+ mail (2.2.19)
65
+ activesupport (>= 2.3.6)
66
+ i18n (>= 0.4.0)
67
+ mime-types (~> 1.16)
68
+ treetop (~> 1.4.8)
69
+ mime-types (1.16)
70
+ mongo (1.3.1)
71
+ bson (>= 1.3.1)
72
+ mongo-rails-instrumentation (0.2.4)
73
+ mongoid (2.0.2)
74
+ activemodel (~> 3.0)
75
+ mongo (~> 1.3)
76
+ tzinfo (~> 0.3.22)
77
+ mustache (0.99.4)
78
+ nokogiri (1.4.5)
79
+ polyglot (0.3.1)
80
+ rack (1.2.3)
81
+ rack-gridfs (0.4.1)
82
+ mime-types
83
+ mongo (~> 1.2)
84
+ rack
85
+ rack-mount (0.6.14)
86
+ rack (>= 1.0.0)
87
+ rack-test (0.5.7)
88
+ rack (>= 1.0)
89
+ rails (3.0.9)
90
+ actionmailer (= 3.0.9)
91
+ actionpack (= 3.0.9)
92
+ activerecord (= 3.0.9)
93
+ activeresource (= 3.0.9)
94
+ activesupport (= 3.0.9)
95
+ bundler (~> 1.0)
96
+ railties (= 3.0.9)
97
+ railties (3.0.9)
98
+ actionpack (= 3.0.9)
99
+ activesupport (= 3.0.9)
100
+ rake (>= 0.8.7)
101
+ rdoc (~> 3.4)
102
+ thor (~> 0.14.4)
103
+ rake (0.9.2)
104
+ rdoc (3.6.1)
105
+ redcarpet (2.0.0b3)
106
+ rubyzip (0.9.4)
107
+ sass (3.1.5)
108
+ selenium-webdriver (0.2.1)
109
+ childprocess (>= 0.1.7)
110
+ ffi (>= 1.0.7)
111
+ json_pure
112
+ rubyzip
113
+ thor (0.14.6)
114
+ treetop (1.4.9)
115
+ polyglot (>= 0.3.1)
116
+ turn (0.8.2)
117
+ ansi (>= 1.2.2)
118
+ tzinfo (0.3.28)
119
+ xpath (0.1.4)
120
+ nokogiri (~> 1.3)
121
+
122
+ PLATFORMS
123
+ ruby
124
+
125
+ DEPENDENCIES
126
+ ansi
127
+ bcrypt-ruby (~> 2.1.4)
128
+ bson_ext (~> 1.3.0)
129
+ capybara (>= 0.4.0)
130
+ chronic (~> 0.4.3)
131
+ compass (= 0.11.5)
132
+ database_cleaner (= 0.6.0)
133
+ domainatrix (~> 0.0.10)
134
+ fabrication (= 0.9.4)
135
+ haml (~> 3.1.0)
136
+ mime-types (~> 1.16)
137
+ mongo-rails-instrumentation (~> 0.2.4)
138
+ mongoid (~> 2.0.0)
139
+ mustache (~> 0.99.4)
140
+ rack-gridfs (~> 0.4.1)
141
+ rails (~> 3.0.9)
142
+ redcarpet (~> 2.0.0b3)
143
+ turn
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Concen
2
+
3
+ ## Installation
4
+
5
+ Add the following to the Gemfile.
6
+
7
+ ```
8
+ gem "concen"
9
+ ```
10
+
11
+ Add initializer file for concen configurations.
12
+
13
+ ```
14
+ Concen.setup do |config|
15
+ config.application_name = "My Application Name"
16
+ end
17
+ ```
18
+
19
+ ## Accessing Concen
20
+
21
+ To access Concen, use "concen" subdomain for example http://concen.domain.com. Sign in with admin account to continue. [Pow](http://pow.cx/) rack server is recommended because it provides access to subdomain by default.
22
+
23
+ ## Insert Visit Recorder JavaScript for Real Time Traffic Monitoring
24
+
25
+ Visit Recorder will record the visitors' information for pages, which include the Visit Recorder JavaScript.
26
+ To do so, please follow these steps:
27
+
28
+ Insert the Visit Recorder JavaScript in your layout.
29
+
30
+ ```
31
+ = javascript_include_tag visit_recorder_js_url
32
+ ```
33
+
34
+ Call record function before the closing <body> tag.
35
+
36
+ ```
37
+ :javascript
38
+ VisitRecorder.record({});
39
+ ```
40
+
41
+ More complete instruction to use this engine will be added soon.
data/Rakefile ADDED
@@ -0,0 +1,28 @@
1
+ # encoding: UTF-8
2
+ require "rubygems"
3
+ begin
4
+ require "bundler/setup"
5
+ rescue LoadError
6
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
7
+ end
8
+
9
+ require "rake"
10
+ require "rake/rdoctask"
11
+ require "rake/testtask"
12
+
13
+ Rake::TestTask.new(:test) do |t|
14
+ t.libs << "lib"
15
+ t.libs << "test"
16
+ t.pattern = "test/**/*_test.rb"
17
+ t.verbose = false
18
+ end
19
+
20
+ task :default => :test
21
+
22
+ RDoc::Task.new do |rdoc|
23
+ rdoc.rdoc_dir = "rdoc"
24
+ rdoc.title = "Concen"
25
+ rdoc.options << "--line-numbers" << "--inline-source"
26
+ rdoc.rdoc_files.include("README.rdoc")
27
+ rdoc.rdoc_files.include("lib/**/*.rb")
28
+ end
@@ -0,0 +1,21 @@
1
+ = sprite(!group_name, !image_name, !offset=0)
2
+ @if !group_name == "navigation" and !image_name == "button-grid"
3
+ background: url('//public/images/sprites/navigation.png?1281848626') no-repeat 0px #{0+!offset}px
4
+ width: 26px
5
+ height: 26px
6
+ @else if !group_name == "navigation" and !image_name == "button-next-disabled"
7
+ background: url('//public/images/sprites/navigation.png?1281848626') no-repeat 0px #{-26+!offset}px
8
+ width: 26px
9
+ height: 26px
10
+ @else if !group_name == "navigation" and !image_name == "button-next"
11
+ background: url('//public/images/sprites/navigation.png?1281848626') no-repeat 0px #{-52+!offset}px
12
+ width: 26px
13
+ height: 26px
14
+ @else if !group_name == "navigation" and !image_name == "button-prev-disabled"
15
+ background: url('//public/images/sprites/navigation.png?1281848626') no-repeat 0px #{-78+!offset}px
16
+ width: 26px
17
+ height: 26px
18
+ @else if !group_name == "navigation" and !image_name == "button-prev"
19
+ background: url('//public/images/sprites/navigation.png?1281848626') no-repeat 0px #{-104+!offset}px
20
+ width: 26px
21
+ height: 26px
data/concen.gemspec ADDED
@@ -0,0 +1,33 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "concen/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "concen"
7
+ s.version = Concen::VERSION
8
+ s.authors = ["Steve Randy Tantra"]
9
+ s.email = ["steve.randy@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Control and monitor Rails application.}
12
+ s.description = %q{This gem provides a Rails engine for Rails application to control and monitor the application from a web interface. It covers controlling content, monitoring visitors, and monitoring application performance. The engine is flexible in term of form and function. It can be styled and have custom functions. }
13
+
14
+ s.rubyforge_project = "concen"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_development_dependency("compass", "0.11.5")
22
+ s.add_dependency("haml", "~> 3.1.0")
23
+ s.add_dependency("mustache", "~> 0.99.4")
24
+ s.add_dependency("redcarpet", "~> 2.0.0b3")
25
+ s.add_dependency("mongoid", "~> 2.0.0")
26
+ s.add_dependency("mongo-rails-instrumentation", "~> 0.2.4")
27
+ s.add_dependency("bson_ext", "~> 1.3.0")
28
+ s.add_dependency("rack-gridfs", "~> 0.4.1")
29
+ s.add_dependency("chronic", "~> 0.4.3")
30
+ s.add_dependency("mime-types", "~> 1.16")
31
+ s.add_dependency("bcrypt-ruby", "~> 2.1.4")
32
+ s.add_dependency("domainatrix", "~> 0.0.10")
33
+ end
@@ -0,0 +1,8 @@
1
+ ActiveSupport::Notifications.subscribe "process_action.action_controller" do |name, start, finish, id, payload|
2
+ payload.delete(:params)
3
+ extra_hash = {:total_runtime => (finish - start) * 1000}
4
+ payload.merge! extra_hash
5
+ unless payload[:controller].include? "Concen"
6
+ Concen::Response.safely(false).create(payload)
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ # TODO: Use Rails.application.routes.prepend on Rails 3.1
2
+ # and disasble the following code block.
3
+ Concen::Engine.paths.config.routes.to_a.each do |route|
4
+ Rails.application.routes_reloader.paths.unshift(route) if File.exists?(route)
5
+ Rails.application.routes_reloader.paths.uniq!
6
+ end
@@ -1,3 +1,3 @@
1
1
  module Concen
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,44 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "active_model/railtie"
4
+ require "action_controller/railtie"
5
+ require "action_view/railtie"
6
+ require "action_mailer/railtie"
7
+
8
+ Bundler.require
9
+ require "concen"
10
+
11
+ module Dummy
12
+ class Application < Rails::Application
13
+ # Settings in config/environments/* take precedence over those specified here.
14
+ # Application configuration should go into files in config/initializers
15
+ # -- all .rb files in that directory are automatically loaded.
16
+
17
+ # Custom directories with classes and modules you want to be autoloadable.
18
+ # config.autoload_paths += %W(#{config.root}/extras)
19
+
20
+ # Only load the plugins named here, in the order given (default is alphabetical).
21
+ # :all can be used as a placeholder for all plugins not explicitly named.
22
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
23
+
24
+ # Activate observers that should always be running.
25
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
26
+
27
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
28
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
29
+ # config.time_zone = 'Central Time (US & Canada)'
30
+
31
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
32
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
33
+ # config.i18n.default_locale = :de
34
+
35
+ # JavaScript files you want as :defaults (application.js is always included).
36
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
37
+
38
+ # Configure the default encoding used in templates for Ruby 1.9.
39
+ config.encoding = "utf-8"
40
+
41
+ # Configure sensitive parameters which will be filtered from the log file.
42
+ config.filter_parameters += [:password]
43
+ end
44
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,26 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the webserver when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_view.debug_rjs = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Don't care if the mailer can't send
18
+ config.action_mailer.raise_delivery_errors = false
19
+
20
+ # Print deprecation notices to the Rails logger
21
+ config.active_support.deprecation = :log
22
+
23
+ # Only use best-standards-support built into browsers
24
+ config.action_dispatch.best_standards_support = :builtin
25
+ end
26
+