From c3f77f5e51651a1885049b9d7454696be2ac1b7a Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 29 Aug 2012 08:21:56 -0500 Subject: [PATCH 01/56] * initial commit of jam-admin --- .gitignore | 15 + Gemfile | 50 ++++ Gemfile.lock | 148 ++++++++++ README.md | 10 + README.rdoc | 261 ++++++++++++++++++ Rakefile | 7 + app/assets/images/rails.png | Bin 0 -> 6646 bytes app/assets/javascripts/application.js | 16 ++ app/assets/stylesheets/application.css | 14 + app/controllers/application_controller.rb | 3 + .../.jam_session_members_controller.rb.swp | Bin 0 -> 12288 bytes .../jam_session_members_controller.rb | 6 + .../jam_ruby/jam_sessions_controller.rb | 6 + app/controllers/jam_ruby/users_controller.rb | 11 + app/helpers/application_helper.rb | 2 + app/helpers/jam_session_members_helper.rb | 2 + app/helpers/jam_sessions_helper.rb | 2 + app/helpers/users_helper.rb | 2 + app/mailers/.gitkeep | 0 app/models/.gitkeep | 0 app/views/layouts/application.html.erb | 14 + config.ru | 4 + config/application.rb | 63 +++++ config/boot.rb | 9 + config/database.yml | 21 ++ config/environment.rb | 5 + config/environments/development.rb | 37 +++ config/environments/production.rb | 67 +++++ config/environments/test.rb | 37 +++ config/initializers/active_scaffold.rb | 6 + config/initializers/backtrace_silencers.rb | 7 + config/initializers/inflections.rb | 15 + config/initializers/mime_types.rb | 5 + config/initializers/secret_token.rb | 7 + config/initializers/session_store.rb | 8 + config/initializers/wrap_parameters.rb | 14 + config/locales/en.yml | 5 + config/routes.rb | 67 +++++ db/migrate/20120828033453_create_users.rb | 13 + .../20120828035120_create_jam_sessions.rb | 9 + ...120828035746_create_jam_session_members.rb | 8 + db/seeds.rb | 7 + doc/README_FOR_APP | 2 + lib/assets/.gitkeep | 0 lib/tasks/.gitkeep | 0 log/.gitkeep | 0 public/404.html | 26 ++ public/422.html | 26 ++ public/500.html | 25 ++ public/favicon.ico | 0 public/index.html | 241 ++++++++++++++++ public/robots.txt | 5 + script/rails | 6 + test/fixtures/.gitkeep | 0 test/fixtures/jam_session_members.yml | 11 + test/fixtures/jam_sessions.yml | 7 + test/fixtures/users.yml | 15 + test/functional/.gitkeep | 0 .../jam_session_members_controller_test.rb | 49 ++++ .../jam_sessions_controller_test.rb | 49 ++++ test/functional/users_controller_test.rb | 49 ++++ test/integration/.gitkeep | 0 test/performance/browsing_test.rb | 12 + test/test_helper.rb | 13 + test/unit/.gitkeep | 0 test/unit/jam_session_member_test.rb | 7 + test/unit/jam_session_test.rb | 7 + test/unit/user_test.rb | 7 + vendor/assets/javascripts/.gitkeep | 0 vendor/assets/stylesheets/.gitkeep | 0 vendor/plugins/.gitkeep | 0 71 files changed, 1540 insertions(+) create mode 100644 .gitignore create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 README.md create mode 100644 README.rdoc create mode 100644 Rakefile create mode 100644 app/assets/images/rails.png create mode 100644 app/assets/javascripts/application.js create mode 100644 app/assets/stylesheets/application.css create mode 100644 app/controllers/application_controller.rb create mode 100644 app/controllers/jam_ruby/.jam_session_members_controller.rb.swp create mode 100644 app/controllers/jam_ruby/jam_session_members_controller.rb create mode 100644 app/controllers/jam_ruby/jam_sessions_controller.rb create mode 100644 app/controllers/jam_ruby/users_controller.rb create mode 100644 app/helpers/application_helper.rb create mode 100644 app/helpers/jam_session_members_helper.rb create mode 100644 app/helpers/jam_sessions_helper.rb create mode 100644 app/helpers/users_helper.rb create mode 100644 app/mailers/.gitkeep create mode 100644 app/models/.gitkeep create mode 100644 app/views/layouts/application.html.erb create mode 100644 config.ru create mode 100644 config/application.rb create mode 100644 config/boot.rb create mode 100644 config/database.yml create mode 100644 config/environment.rb create mode 100644 config/environments/development.rb create mode 100644 config/environments/production.rb create mode 100644 config/environments/test.rb create mode 100644 config/initializers/active_scaffold.rb create mode 100644 config/initializers/backtrace_silencers.rb create mode 100644 config/initializers/inflections.rb create mode 100644 config/initializers/mime_types.rb create mode 100644 config/initializers/secret_token.rb create mode 100644 config/initializers/session_store.rb create mode 100644 config/initializers/wrap_parameters.rb create mode 100644 config/locales/en.yml create mode 100644 config/routes.rb create mode 100644 db/migrate/20120828033453_create_users.rb create mode 100644 db/migrate/20120828035120_create_jam_sessions.rb create mode 100644 db/migrate/20120828035746_create_jam_session_members.rb create mode 100644 db/seeds.rb create mode 100644 doc/README_FOR_APP create mode 100644 lib/assets/.gitkeep create mode 100644 lib/tasks/.gitkeep create mode 100644 log/.gitkeep create mode 100644 public/404.html create mode 100644 public/422.html create mode 100644 public/500.html create mode 100644 public/favicon.ico create mode 100644 public/index.html create mode 100644 public/robots.txt create mode 100755 script/rails create mode 100644 test/fixtures/.gitkeep create mode 100644 test/fixtures/jam_session_members.yml create mode 100644 test/fixtures/jam_sessions.yml create mode 100644 test/fixtures/users.yml create mode 100644 test/functional/.gitkeep create mode 100644 test/functional/jam_session_members_controller_test.rb create mode 100644 test/functional/jam_sessions_controller_test.rb create mode 100644 test/functional/users_controller_test.rb create mode 100644 test/integration/.gitkeep create mode 100644 test/performance/browsing_test.rb create mode 100644 test/test_helper.rb create mode 100644 test/unit/.gitkeep create mode 100644 test/unit/jam_session_member_test.rb create mode 100644 test/unit/jam_session_test.rb create mode 100644 test/unit/user_test.rb create mode 100644 vendor/assets/javascripts/.gitkeep create mode 100644 vendor/assets/stylesheets/.gitkeep create mode 100644 vendor/plugins/.gitkeep diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..eb3489a98 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile ~/.gitignore_global + +# Ignore bundler config +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 + +# Ignore all logfiles and tempfiles. +/log/*.log +/tmp diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..23b456b1c --- /dev/null +++ b/Gemfile @@ -0,0 +1,50 @@ +source 'https://rubygems.org' + +# Look for $WORKSPACE, otherwise use "workspace" as dev path. +workspace = ENV["WORKSPACE"] || "~/workspace" + +gem 'rails', '3.2.8' + +# Bundle edge Rails instead: +# gem 'rails', :git => 'git://github.com/rails/rails.git' + +gem 'sqlite3' + + +# Gems used only for assets and not required +# in production environments by default. +group :assets do + gem 'sass-rails', '~> 3.2.3' + gem 'coffee-rails', '~> 3.2.1' + + # See https://github.com/sstephenson/execjs#readme for more supported runtimes + # gem 'therubyracer', :platforms => :ruby + + gem 'uglifier', '>= 1.0.3' +end +gem 'uuidtools', '2.1.2' +gem 'bcrypt-ruby', '3.0.1' +gem 'jquery-rails' +gem 'active_scaffold' +gem 'pg_migrate','0.1.5' #:path => "#{workspace}/pg_migrate_ruby" +gem 'ruby-protocol-buffers', '1.2.2' +gem 'jam_db', :path => "#{workspace}/jam-db/target/ruby_package" +gem 'jam_ruby', :path => "#{workspace}/jam-ruby" +gem 'jampb', :path => "#{workspace}/jam-pb/target/ruby/jampb" + + + +# To use ActiveModel has_secure_password +# gem 'bcrypt-ruby', '~> 3.0.0' + +# To use Jbuilder templates for JSON +# gem 'jbuilder' + +# Use unicorn as the app server +# gem 'unicorn' + +# Deploy with Capistrano +# gem 'capistrano' + +# To use debugger +# gem 'debugger' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..92d474def --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,148 @@ +PATH + remote: ~/workspace/jam-db/target/ruby_package + specs: + jam_db (0.0.1) + pg_migrate (= 0.1.5) + +PATH + remote: ~/workspace/jam-pb/target/ruby/jampb + specs: + jampb (0.0.1) + +PATH + remote: ~/workspace/jam-ruby + specs: + jam_ruby (0.0.1) + +GEM + remote: https://rubygems.org/ + specs: + actionmailer (3.2.8) + actionpack (= 3.2.8) + mail (~> 2.4.4) + actionpack (3.2.8) + activemodel (= 3.2.8) + activesupport (= 3.2.8) + builder (~> 3.0.0) + erubis (~> 2.7.0) + journey (~> 1.0.4) + rack (~> 1.4.0) + rack-cache (~> 1.2) + rack-test (~> 0.6.1) + sprockets (~> 2.1.3) + active_scaffold (3.2.15) + rails (>= 3.1.3) + activemodel (3.2.8) + activesupport (= 3.2.8) + builder (~> 3.0.0) + activerecord (3.2.8) + activemodel (= 3.2.8) + activesupport (= 3.2.8) + arel (~> 3.0.2) + tzinfo (~> 0.3.29) + activeresource (3.2.8) + activemodel (= 3.2.8) + activesupport (= 3.2.8) + activesupport (3.2.8) + i18n (~> 0.6) + multi_json (~> 1.0) + arel (3.0.2) + bcrypt-ruby (3.0.1) + builder (3.0.0) + coffee-rails (3.2.2) + coffee-script (>= 2.2.0) + railties (~> 3.2.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.3.3) + erubis (2.7.0) + execjs (1.4.0) + multi_json (~> 1.0) + hike (1.2.1) + i18n (0.6.0) + journey (1.0.4) + jquery-rails (2.1.1) + railties (>= 3.1.0, < 5.0) + thor (~> 0.14) + json (1.7.5) + little-plugger (1.1.3) + logging (1.7.2) + little-plugger (>= 1.1.3) + mail (2.4.4) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.19) + multi_json (1.3.6) + pg (0.14.0) + pg_migrate (0.1.5) + logging (= 1.7.2) + pg (= 0.14.0) + thor (= 0.15.4) + polyglot (0.3.3) + rack (1.4.1) + rack-cache (1.2) + rack (>= 0.4) + rack-ssl (1.3.2) + rack + rack-test (0.6.1) + rack (>= 1.0) + rails (3.2.8) + actionmailer (= 3.2.8) + actionpack (= 3.2.8) + activerecord (= 3.2.8) + activeresource (= 3.2.8) + activesupport (= 3.2.8) + bundler (~> 1.0) + railties (= 3.2.8) + railties (3.2.8) + actionpack (= 3.2.8) + activesupport (= 3.2.8) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (>= 0.14.6, < 2.0) + rake (0.9.2.2) + rdoc (3.12) + json (~> 1.4) + ruby-protocol-buffers (1.2.2) + sass (3.2.1) + sass-rails (3.2.5) + railties (~> 3.2.0) + sass (>= 3.1.10) + tilt (~> 1.3) + sprockets (2.1.3) + hike (~> 1.2) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sqlite3 (1.3.6) + thor (0.15.4) + tilt (1.3.3) + treetop (1.4.10) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.33) + uglifier (1.2.7) + execjs (>= 0.3.0) + multi_json (~> 1.3) + uuidtools (2.1.2) + +PLATFORMS + ruby + +DEPENDENCIES + active_scaffold + bcrypt-ruby (= 3.0.1) + coffee-rails (~> 3.2.1) + jam_db! + jam_ruby! + jampb! + jquery-rails + pg_migrate (= 0.1.5) + rails (= 3.2.8) + ruby-protocol-buffers (= 1.2.2) + sass-rails (~> 3.2.3) + sqlite3 + uglifier (>= 1.0.3) + uuidtools (= 2.1.2) diff --git a/README.md b/README.md new file mode 100644 index 000000000..d1aff509d --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +Jam-Admin +--------- + +jam-admin is a rails-based administrator portal. + +Immediately the focus is on using active_scaffolding that provides visibility into our data model, and rudimentary CRUD control. + +Overtime we can add more administrative functions and views, but initially this is one of the easiest ways to give 'powertools' behind the scenes with an entirely separate authentication model. + + diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 000000000..7c36f2356 --- /dev/null +++ b/README.rdoc @@ -0,0 +1,261 @@ +== Welcome to Rails + +Rails is a web-application framework that includes everything needed to create +database-backed web applications according to the Model-View-Control pattern. + +This pattern splits the view (also called the presentation) into "dumb" +templates that are primarily responsible for inserting pre-built data in between +HTML tags. The model contains the "smart" domain objects (such as Account, +Product, Person, Post) that holds all the business logic and knows how to +persist themselves to a database. The controller handles the incoming requests +(such as Save New Account, Update Product, Show Post) by manipulating the model +and directing data to the view. + +In Rails, the model is handled by what's called an object-relational mapping +layer entitled Active Record. This layer allows you to present the data from +database rows as objects and embellish these data objects with business logic +methods. You can read more about Active Record in +link:files/vendor/rails/activerecord/README.html. + +The controller and view are handled by the Action Pack, which handles both +layers by its two parts: Action View and Action Controller. These two layers +are bundled in a single package due to their heavy interdependence. This is +unlike the relationship between the Active Record and Action Pack that is much +more separate. Each of these packages can be used independently outside of +Rails. You can read more about Action Pack in +link:files/vendor/rails/actionpack/README.html. + + +== Getting Started + +1. At the command prompt, create a new Rails application: + rails new myapp (where myapp is the application name) + +2. Change directory to myapp and start the web server: + cd myapp; rails server (run with --help for options) + +3. Go to http://localhost:3000/ and you'll see: + "Welcome aboard: You're riding Ruby on Rails!" + +4. Follow the guidelines to start developing your application. You can find +the following resources handy: + +* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html +* Ruby on Rails Tutorial Book: http://www.railstutorial.org/ + + +== Debugging Rails + +Sometimes your application goes wrong. Fortunately there are a lot of tools that +will help you debug it and get it back on the rails. + +First area to check is the application log files. Have "tail -f" commands +running on the server.log and development.log. Rails will automatically display +debugging and runtime information to these files. Debugging info will also be +shown in the browser on requests from 127.0.0.1. + +You can also log your own messages directly into the log file from your code +using the Ruby logger class from inside your controllers. Example: + + class WeblogController < ActionController::Base + def destroy + @weblog = Weblog.find(params[:id]) + @weblog.destroy + logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") + end + end + +The result will be a message in your log file along the lines of: + + Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1! + +More information on how to use the logger is at http://www.ruby-doc.org/core/ + +Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are +several books available online as well: + +* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe) +* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) + +These two books will bring you up to speed on the Ruby language and also on +programming in general. + + +== Debugger + +Debugger support is available through the debugger command when you start your +Mongrel or WEBrick server with --debugger. This means that you can break out of +execution at any point in the code, investigate and change the model, and then, +resume execution! You need to install ruby-debug to run the server in debugging +mode. With gems, use sudo gem install ruby-debug. Example: + + class WeblogController < ActionController::Base + def index + @posts = Post.all + debugger + end + end + +So the controller will accept the action, run the first line, then present you +with a IRB prompt in the server window. Here you can do things like: + + >> @posts.inspect + => "[#nil, "body"=>nil, "id"=>"1"}>, + #"Rails", "body"=>"Only ten..", "id"=>"2"}>]" + >> @posts.first.title = "hello from a debugger" + => "hello from a debugger" + +...and even better, you can examine how your runtime objects actually work: + + >> f = @posts.first + => #nil, "body"=>nil, "id"=>"1"}> + >> f. + Display all 152 possibilities? (y or n) + +Finally, when you're ready to resume execution, you can enter "cont". + + +== Console + +The console is a Ruby shell, which allows you to interact with your +application's domain model. Here you'll have all parts of the application +configured, just like it is when the application is running. You can inspect +domain models, change values, and save to the database. Starting the script +without arguments will launch it in the development environment. + +To start the console, run rails console from the application +directory. + +Options: + +* Passing the -s, --sandbox argument will rollback any modifications + made to the database. +* Passing an environment name as an argument will load the corresponding + environment. Example: rails console production. + +To reload your controllers and models after launching the console run +reload! + +More information about irb can be found at: +link:http://www.rubycentral.org/pickaxe/irb.html + + +== dbconsole + +You can go to the command line of your database directly through rails +dbconsole. You would be connected to the database with the credentials +defined in database.yml. Starting the script without arguments will connect you +to the development database. Passing an argument will connect you to a different +database, like rails dbconsole production. Currently works for MySQL, +PostgreSQL and SQLite 3. + +== Description of Contents + +The default directory structure of a generated Ruby on Rails application: + + |-- app + | |-- assets + | |-- images + | |-- javascripts + | `-- stylesheets + | |-- controllers + | |-- helpers + | |-- mailers + | |-- models + | `-- views + | `-- layouts + |-- config + | |-- environments + | |-- initializers + | `-- locales + |-- db + |-- doc + |-- lib + | `-- tasks + |-- log + |-- public + |-- script + |-- test + | |-- fixtures + | |-- functional + | |-- integration + | |-- performance + | `-- unit + |-- tmp + | |-- cache + | |-- pids + | |-- sessions + | `-- sockets + `-- vendor + |-- assets + `-- stylesheets + `-- plugins + +app + Holds all the code that's specific to this particular application. + +app/assets + Contains subdirectories for images, stylesheets, and JavaScript files. + +app/controllers + Holds controllers that should be named like weblogs_controller.rb for + automated URL mapping. All controllers should descend from + ApplicationController which itself descends from ActionController::Base. + +app/models + Holds models that should be named like post.rb. Models descend from + ActiveRecord::Base by default. + +app/views + Holds the template files for the view that should be named like + weblogs/index.html.erb for the WeblogsController#index action. All views use + eRuby syntax by default. + +app/views/layouts + Holds the template files for layouts to be used with views. This models the + common header/footer method of wrapping views. In your views, define a layout + using the layout :default and create a file named default.html.erb. + Inside default.html.erb, call <% yield %> to render the view using this + layout. + +app/helpers + Holds view helpers that should be named like weblogs_helper.rb. These are + generated for you automatically when using generators for controllers. + Helpers can be used to wrap functionality for your views into methods. + +config + Configuration files for the Rails environment, the routing map, the database, + and other dependencies. + +db + Contains the database schema in schema.rb. db/migrate contains all the + sequence of Migrations for your schema. + +doc + This directory is where your application documentation will be stored when + generated using rake doc:app + +lib + Application specific libraries. Basically, any kind of custom code that + doesn't belong under controllers, models, or helpers. This directory is in + the load path. + +public + The directory available for the web server. Also contains the dispatchers and the + default HTML files. This should be set as the DOCUMENT_ROOT of your web + server. + +script + Helper scripts for automation and generation. + +test + Unit and functional tests along with fixtures. When using the rails generate + command, template test files will be generated for you and placed in this + directory. + +vendor + External libraries that the application depends on. Also includes the plugins + subdirectory. If the app has frozen rails, those gems also go here, under + vendor/rails/. This directory is in the load path. diff --git a/Rakefile b/Rakefile new file mode 100644 index 000000000..3065cf5e9 --- /dev/null +++ b/Rakefile @@ -0,0 +1,7 @@ +#!/usr/bin/env rake +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +JamAdmin::Application.load_tasks diff --git a/app/assets/images/rails.png b/app/assets/images/rails.png new file mode 100644 index 0000000000000000000000000000000000000000..d5edc04e65f555e3ba4dcdaad39dc352e75b575e GIT binary patch literal 6646 zcmVpVcQya!6@Dsmj@#jv7C*qh zIhOJ6_K0n?*d`*T7TDuW-}m`9Kz3~>+7`DUkbAraU%yi+R{N~~XA2B%zt-4=tLimUer9!2M~N{G5bftFij_O&)a zsHnOppFIzebQ`RA0$!yUM-lg#*o@_O2wf422iLnM6cU(ktYU8#;*G!QGhIy9+ZfzKjLuZo%@a z-i@9A`X%J{^;2q&ZHY3C(B%gqCPW!8{9C0PMcNZccefK){s|V5-xxtHQc@uf>XqhD z7#N^siWqetgq29aX>G^olMf=bbRF6@Y(}zYxw6o!9WBdG1unP}<(V;zKlcR2p86fq zYjaqB^;Ycq>Wy@5T1xOzG3tucG3e%nPvajaN{CrFbnzv^9&K3$NrDm*eQe4`BGQ2bI;dFEwyt>hK%X!L6)82aOZp zsrGcJ#7PoX7)s|~t6is?FfX*7vWdREi58tiY4S)t6u*|kv?J)d_$r+CH#eZ?Ef+I_ z(eVlX8dh~4QP?o*E`_MgaNFIKj*rtN(0Raj3ECjSXcWfd#27NYs&~?t`QZFT}!Zaf=ldZIhi}LhQlqLo+o5(Pvui&{7PD__^53f9j>HW`Q z_V8X5j~$|GP9qXu0C#!@RX2}lXD35@3N5{BkUi%jtaPQ*H6OX2zIz4QPuqmTv3`vG{zc>l3t0B9E75h< z8&twGh%dp7WPNI+tRl%#gf2}Epg8st+~O4GjtwJsXfN;EjAmyr6z5dnaFU(;IV~QK zW62fogF~zA``(Q>_SmD!izc6Y4zq*97|NAPHp1j5X7Op2%;GLYm>^HEMyObo6s7l) zE3n|aOHi5~B84!}b^b*-aL2E)>OEJX_tJ~t<#VJ?bT?lDwyDB&5SZ$_1aUhmAY}#* zs@V1I+c5md9%R-o#_DUfqVtRk>59{+Opd5Yu%dAU#VQW}^m}x-30ftBx#527{^pI4 z6l2C6C7QBG$~NLYb3rVdLD#Z{+SleOp`(Lg5J}`kxdTHe(nV5BdpLrD=l|)e$gEqA zwI6vuX-PFCtcDIH>bGY2dwq&^tf+&R?)nY-@7_j%4CMRAF}C9w%p86W<2!aSY$p+k zrkFtG=cGo38RnrG28;?PNk%7a@faaXq&MS*&?1Z`7Ojw7(#>}ZG4nMAs3VXxfdW>i zY4VX02c5;f7jDPY_7@Oa)CHH}cH<3y#}_!nng^W+h1e-RL*YFYOteC@h?BtJZ+?sE zy)P5^8Mregx{nQaw1NY-|3>{Z)|0`?zc?G2-acYiSU`tj#sSGfm7k86ZQ0SQgPevcklHxM9<~4yW zR796sisf1|!#{Z=e^)0;_8iUhL8g(;j$l=02FTPZ(dZV@s#aQ`DHkLM6=YsbE4iQ!b#*374l0Jw5;jD%J;vQayq=nD8-kHI~f9Ux|32SJUM`> zGp2UGK*4t?cRKi!2he`zI#j0f${I#f-jeT?u_C7S4WsA0)ryi-1L0(@%pa^&g5x=e z=KW9+Nn(=)1T&S8g_ug%dgk*~l2O-$r9#zEGBdQsweO%t*6F4c8JC36JtTizCyy+E4h%G(+ z5>y$%0txMuQ$e~wjFgN(xrAndHQo`Za+K*?gUVDTBV&Ap^}|{w#CIq{DRe}+l@(Ec zCCV6f_?dY_{+f{}6XGn!pL_up?}@>KijT^$w#Lb6iHW&^8RP~g6y=vZBXx~B9nI^i zGexaPjcd(%)zGw!DG_dDwh-7x6+ST#R^${iz_M$uM!da8SxgB_;Z0G%Y*HpvLjKw; zX=ir7i1O$-T|*TBoH$dlW+TLf5j5sep^DlDtkox;Kg{Q%EXWedJq@J@%VAcK)j3y1 zShM!CS#qax;D@RND%2t3W6kv+#Ky0F9<3YKDbV^XJ=^$s(Vtza8V72YY)577nnldI zHMA0PUo!F3j(ubV*CM@PiK<^|RM2(DuCbG7`W}Rg(xdYC>C~ z;1KJGLN&$cRxSZunjXcntykmpFJ7;dk>shY(DdK&3K_JDJ6R%D`e~6Qv67@Rwu+q9 z*|NG{r}4F8f{Dfzt0+cZMd$fvlX3Q`dzM46@r?ISxr;9gBTG2rmfiGOD*#c*3f)cc zF+PFZobY$-^}J8 z%n=h4;x2}cP!@SiVd!v;^Wwo0(N??-ygDr7gG^NKxDjSo{5T{?$|Qo5;8V!~D6O;F*I zuY!gd@+2j_8Rn=UWDa#*4E2auWoGYDddMW7t0=yuC(xLWky?vLimM~!$3fgu!dR>p z?L?!8z>6v$|MsLb&dU?ob)Zd!B)!a*Z2eTE7 zKCzP&e}XO>CT%=o(v+WUY`Az*`9inbTG& z_9_*oQKw;sc8{ipoBC`S4Tb7a%tUE)1fE+~ib$;|(`|4QbXc2>VzFi%1nX%ti;^s3~NIL0R}!!a{0A zyCRp0F7Y&vcP&3`&Dzv5!&#h}F2R-h&QhIfq*ts&qO13{_CP}1*sLz!hI9VoTSzTu zok5pV0+~jrGymE~{TgbS#nN5+*rF7ij)cnSLQw0Ltc70zmk|O!O(kM<3zw-sUvkx~ z2`y+{xAwKSa-0}n7{$I@Zop7CWy%_xIeN1e-7&OjQ6vZZPbZ^3_ z(~=;ZSP98S2oB#35b1~_x`2gWiPdIVddEf`AD9<@c_s)TM;3J$T_l?pr{<7PTgdiy zBc5IGx)g~n=s+Z$RzYCmv8PlJu%gkh^;%mTGMc)UwRINVD~K;`Rl!5@hhGg;y>5qj zq|u-Yf0q_~Y+Mbivkkfa0nAOzB1acnytogsj_m7FB(-FjihMek#GAU4M!iXCgdK8a zjoKm?*|iz7;dHm4$^hh(`Ufl>yb>$hjIA-;>{>C}G0Di%bGvUsJkfLAV|xq32c>RqJqTBJ3Dx zYC;*Dt|S$b6)aCJFnK(Eey$M1DpVV~_MIhwK> zygo(jWC|_IRw|456`roEyXtkNLWNAt-4N1qyN$I@DvBzt;e|?g<*HK1%~cq|^u*}C zmMrwh>{QAq?Ar~4l^DqT%SQ)w)FA(#7#u+N;>E975rYML>)LgE`2<7nN=C1pC{IkV zVw}_&v6j&S?QVh*)wF3#XmE@0($^BVl1969csLKUBNer{suVd!a~B!0MxWY?=(GD6 zy$G&ERFR#i6G4=2F?R4}Mz3B?3tnpoX3)qFF2sh9-Jn*e%9F>i{WG7$_~XyOO2!+@ z6k+38KyD@-0=uee54D0!Z1@B^ilj~StchdOn(*qvg~s5QJpWGc!6U^Aj!xt-HZn_V zS%|fyQ5YS@EP2lBIodXCLjG_+a)%En+7jzngk@J>6D~^xbxKkvf-R0-c%mX+o{?&j zZZ%RxFeav8Y0gkwtdtrwUb-i0Egd2C=ADu%w5VV-hNJvl)GZ?M;y$!?b=S+wKRK7Q zcOjPT!p<*#8m;TsBih=@Xc&c)?Vy`Ys>IvK@|1%N+M6J-^RCRaZcPP2eQh9DEGZr+ z?8B~wF14mk4Xkuen{wY^CWwS1PI<8gikY*)3?RSo5l8es4*J z43k_BIwc}of=6Pfs%xIxlMDGOJN zvl!a>G)52XMqA%fbgkZi%)%bN*ZzZw2!rn4@+J)2eK#kWuEW{)W~-`y1vhA5-7p%R z&f5N!a9f8cK1Xa=O}=9{wg%}Ur^+8Y(!UCeqw>%wj@|bYHD-bZO~mk3L$9_^MmF3G zvCiK^e@q6G?tHkM8%GqsBMZaB20W$UEt_5r~jc#WlR>Bv{6W>A=!#InoY zLOd04@Rz?*7PpW8u|+}bt`?+Z(GsX{Br4A2$ZZ(26Degmr9`O=t2KgHTL*==R3xcP z&Y(J7hC@6_x8zVz!CX3l4Xtss6i7r#E6kXMNN1~>9KTRzewfp))ij%)SBBl0fZdYP zd!zzQD5u8yk-u|41|Rqz7_tCFUMThZJVj)yQf6^Cwtn|Ew6cm5J|u1Bq>MWX-AfB&NE;C z62@=-0le`E6-CurMKjoIy)BuUmhMGJb}pPx!@GLWMT+wH2R?wA=MEy)o57~feFp8P zY@YXAyt4<1FD<|iw{FGQu~GEI<4C64)V*QiVk+VzOV^9GWf4ir#oYgHJz!wq>iZV#_6@_{)&lum)4x z_Of*CLVQ7wdT#XT-(h0qH%mcIF7yzMIvvTN3bPceK>PpJi(=3Nny zbSn}p$dGKQUlX&-t~RR)#F7I<8NCD^yke(vdf#4^aAh}M-{tS9-&^tC4`KU_pToXy z+|K8sx}a)Kh{h{;*V1#hs1xB%(?j>)g~`Wv(9F)f=Qn)(daVB7hZtcp^#LrEr1T1J zZSJ*lVyVVjhy)mkex9Whn=EinKDHe@KlfQI-Fl7M?-c~HnW0;C;+MbUY8?FToy;A+ zs&Nc7VZ=Of+e!G6s#+S5WBU)kgQq_I1@!uH74GJ-+O|%0HXm9Mqlvp|j%0`T>fr9^ zK;qo>XdwZW<>%tTA+<(1^6(>=-2N;hRgBnjvEjN;VbKMbFg--WrGy|XESoH1p|M4` z86(gC^vB4qScASZ&cdpT{~QDN-jC|GJ(RYoW1VW4!SSn- zhQds9&RBKn6M&GVK_Aayt(Hekbnw=tr>f z^o@v9_*iQO1*zeOrts9Q-$pc@!StS&kz$cF`s@pM`rmJXTP&h5G)A74!0e%ZJbl}( zssI|_!%~_hZFypv*S^JE5N&Kvmx7KiG<|fGMO=WrH+@Yhuj+KwiS#l4>@%2nl zS)mDikfmokO4q2A)hRVZBq2-5q&XC>%HOLkOYxZ66(s86?=0s4z5xbiOV)}L-&6b)h6(~CIaR#JNw~46+WBiU7IhB zq!NuR4!TsYnyBg>@G=Ib*cMq^k<}AMpCeYEf&dzfiGI-wOQ7hb+nA zkN7_){y&c3xC0 AQ~&?~ literal 0 HcmV?d00001 diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 000000000..c6dda8b6b --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,16 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD +// GO AFTER THE REQUIRES BELOW. +// +//= require jquery +//= require jquery_ujs +//= require_tree . +//= require active_scaffold diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 000000000..5311f2b45 --- /dev/null +++ b/app/assets/stylesheets/application.css @@ -0,0 +1,14 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the top of the + * compiled file, but it's generally better to create a new file per style scope. + * + *= require_self + *= require_tree . + *= require active_scaffold + */ diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 000000000..e8065d950 --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,3 @@ +class ApplicationController < ActionController::Base + protect_from_forgery +end diff --git a/app/controllers/jam_ruby/.jam_session_members_controller.rb.swp b/app/controllers/jam_ruby/.jam_session_members_controller.rb.swp new file mode 100644 index 0000000000000000000000000000000000000000..eeb64638a480912bfa5af5f7a3760d1760eaca61 GIT binary patch literal 12288 zcmeI&%}T>S5C`yS5pSaC3yk$_Q|+NpdJ#_w1+nNskg!R%7)`QEHdQLczEr_?@hyA< zXKS_4gY_!@7l!?sWZB;>WTMvfS)V)2Hc8tdx*hZ`Zt637+aPkfy7SBH+Hf(is6009U<00Izz00bcLj|3`Pqp94tzPR(|qOYy= zizzw?KmY;|fB*y_009U<00Izz00jP^fJ%sZ+eB8v|NsB`{(qPGtHe}dEKy1L93z1S z0SG_<0uX=z1Rwwb2tWV=5P-nX0=h^@f{ED=nN?h+k2-X*8V*gCaN}I%ms0xP?aE;A zS^D0eSH3qmF+7p#_u+)%OgYD^8SeDEhMs$TVr`bjs*>9IQA8$5w~VR literal 0 HcmV?d00001 diff --git a/app/controllers/jam_ruby/jam_session_members_controller.rb b/app/controllers/jam_ruby/jam_session_members_controller.rb new file mode 100644 index 000000000..de1365835 --- /dev/null +++ b/app/controllers/jam_ruby/jam_session_members_controller.rb @@ -0,0 +1,6 @@ +module JamRuby +class JamSessionMembersController < ApplicationController + active_scaffold "JamRuby::JamSessionMember" do |conf| + end +end +end diff --git a/app/controllers/jam_ruby/jam_sessions_controller.rb b/app/controllers/jam_ruby/jam_sessions_controller.rb new file mode 100644 index 000000000..482044095 --- /dev/null +++ b/app/controllers/jam_ruby/jam_sessions_controller.rb @@ -0,0 +1,6 @@ +module JamRuby +class JamSessionsController < ApplicationController + active_scaffold "JamRuby::JamSession" do |conf| + end +end +end diff --git a/app/controllers/jam_ruby/users_controller.rb b/app/controllers/jam_ruby/users_controller.rb new file mode 100644 index 000000000..bcaa2f095 --- /dev/null +++ b/app/controllers/jam_ruby/users_controller.rb @@ -0,0 +1,11 @@ +module JamRuby +class UsersController < ApplicationController + active_scaffold "JamRuby::User" do |conf| + conf.subform.columns = ["name", "email", "admin"] + + conf.create.columns = [:name, :email, :admin, :password, :password_confirmation] + conf.update.columns = [:name, :email, :admin, :password, :password_confirmation] + + end +end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb new file mode 100644 index 000000000..de6be7945 --- /dev/null +++ b/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/app/helpers/jam_session_members_helper.rb b/app/helpers/jam_session_members_helper.rb new file mode 100644 index 000000000..78f50b7f8 --- /dev/null +++ b/app/helpers/jam_session_members_helper.rb @@ -0,0 +1,2 @@ +module JamSessionMembersHelper +end \ No newline at end of file diff --git a/app/helpers/jam_sessions_helper.rb b/app/helpers/jam_sessions_helper.rb new file mode 100644 index 000000000..bf244b019 --- /dev/null +++ b/app/helpers/jam_sessions_helper.rb @@ -0,0 +1,2 @@ +module JamSessionsHelper +end \ No newline at end of file diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 000000000..476a5ae2b --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,2 @@ +module UsersHelper +end \ No newline at end of file diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/app/models/.gitkeep b/app/models/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 000000000..12e32a409 --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + JamAdmin + <%= stylesheet_link_tag "application", :media => "all" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/config.ru b/config.ru new file mode 100644 index 000000000..58f786e6f --- /dev/null +++ b/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run JamAdmin::Application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 000000000..3c2195308 --- /dev/null +++ b/config/application.rb @@ -0,0 +1,63 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +if defined?(Bundler) + # If you precompile assets before deploying to production, use this line + Bundler.require(*Rails.groups(:assets => %w(development test))) + # If you want your assets lazily compiled in production, use this line + # Bundler.require(:default, :assets, Rails.env) +end + +include JamRuby +module JamAdmin + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Custom directories with classes and modules you want to be autoloadable. + # config.autoload_paths += %W(#{config.root}/extras) + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named. + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running. + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Configure the default encoding used in templates for Ruby 1.9. + config.encoding = "utf-8" + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters += [:password] + + # Enable escaping HTML in JSON. + config.active_support.escape_html_entities_in_json = true + + # Use SQL instead of Active Record's schema dumper when creating the database. + # This is necessary if your schema can't be completely dumped by the schema dumper, + # like if you have constraints or database-specific column types + # config.active_record.schema_format = :sql + + # Enforce whitelist mode for mass assignment. + # This will create an empty whitelist of attributes available for mass-assignment for all models + # in your app. As such, your models will need to explicitly whitelist or blacklist accessible + # parameters by using an attr_accessible or attr_protected declaration. + config.active_record.whitelist_attributes = true + + # Enable the asset pipeline + config.assets.enabled = true + + # Version of your assets, change this if you want to expire all your assets + config.assets.version = '1.0' + end +end diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 000000000..170a460bb --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,9 @@ +require 'rubygems' +require 'jam_ruby' + +# Set up gems listed in the Gemfile. +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) + +include JamRuby diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 000000000..c1ad9e417 --- /dev/null +++ b/config/database.yml @@ -0,0 +1,21 @@ +test: + adapter: postgresql + database: jam_websockets_test + host: localhost + port: 5432 + pool: 3 + username: postgres + password: postgres + timeout: 2000 + encoding: unicode + +development: + adapter: postgresql + database: jam + host: localhost + port: 5432 + pool: 3 + username: postgres + password: postgres + timeout: 2000 + encoding: unicode diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 000000000..4942864e3 --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,5 @@ +# Load the rails application +require File.expand_path('../application', __FILE__) + +# Initialize the rails application +JamAdmin::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 000000000..71d33fbe6 --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,37 @@ +JamAdmin::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + config.active_record.auto_explain_threshold_in_seconds = 0.5 + + # Do not compress assets + config.assets.compress = false + + # Expands the lines which load the assets + config.assets.debug = true +end diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 000000000..c51b8304b --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,67 @@ +JamAdmin::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # Code is not reloaded between requests + config.cache_classes = true + + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = false + + # Compress JavaScripts and CSS + config.assets.compress = true + + # Don't fallback to assets pipeline if a precompiled asset is missed + config.assets.compile = false + + # Generate digests for assets URLs + config.assets.digest = true + + # Defaults to nil and saved in location specified by config.assets.prefix + # config.assets.manifest = YOUR_PATH + + # Specifies the header that your server uses for sending files + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # See everything in the log (default is :info) + # config.log_level = :debug + + # Prepend all log lines with the following tags + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + + # Enable threaded mode + # config.threadsafe! + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + # config.active_record.auto_explain_threshold_in_seconds = 0.5 +end diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 000000000..79a74c4ac --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,37 @@ +JamAdmin::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Configure static asset server for tests with Cache-Control for performance + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # Log error messages when you accidentally call methods on nil + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Print deprecation notices to the stderr + config.active_support.deprecation = :stderr +end diff --git a/config/initializers/active_scaffold.rb b/config/initializers/active_scaffold.rb new file mode 100644 index 000000000..4bfdd3ea4 --- /dev/null +++ b/config/initializers/active_scaffold.rb @@ -0,0 +1,6 @@ + +ActiveScaffold::DataStructures::Column.show_blank_record = false + +ActiveScaffold.set_defaults do |config| + +end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb new file mode 100644 index 000000000..59385cdf3 --- /dev/null +++ b/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb new file mode 100644 index 000000000..5d8d9be23 --- /dev/null +++ b/config/initializers/inflections.rb @@ -0,0 +1,15 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format +# (all these examples are active by default): +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end +# +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb new file mode 100644 index 000000000..72aca7e44 --- /dev/null +++ b/config/initializers/mime_types.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf +# Mime::Type.register_alias "text/html", :iphone diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb new file mode 100644 index 000000000..f71a3cafa --- /dev/null +++ b/config/initializers/secret_token.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +JamAdmin::Application.config.secret_token = 'e27a8deff5bc124d1c74cb86ebf38ac4a246091b859bcccf4f8076454e0ff3e04ffc87c9a0f4ddc801c4753e20b2a3cf06e5efc815cfe8e6377f912b737c5f77' diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb new file mode 100644 index 000000000..8a09aad3d --- /dev/null +++ b/config/initializers/session_store.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +JamAdmin::Application.config.session_store :cookie_store, key: '_jam-admin_session' + +# Use the database for sessions instead of the cookie-based default, +# which shouldn't be used to store highly confidential information +# (create the session table with "rails generate session_migration") +# JamAdmin::Application.config.session_store :active_record_store diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 000000000..999df2018 --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end + +# Disable root element in JSON by default. +ActiveSupport.on_load(:active_record) do + self.include_root_in_json = false +end diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 000000000..179c14ca5 --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,5 @@ +# Sample localization file for English. Add more files in this directory for other locales. +# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. + +en: + hello: "Hello world" diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 000000000..308d1bed1 --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,67 @@ +JamAdmin::Application.routes.draw do + +namespace :jam_ruby do + scope as: 'jam_ruby' do + resources :jam_session_members do as_routes end + resources :jam_sessions do as_routes end + resources :users do as_routes end + end +end + + # The priority is based upon order of creation: + # first created -> highest priority. + + # Sample of regular route: + # match 'products/:id' => 'catalog#view' + # Keep in mind you can assign values other than :controller and :action + + # Sample of named route: + # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase + # This route can be invoked with purchase_url(:id => product.id) + + # Sample resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Sample resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Sample resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Sample resource route with more complex sub-resources + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', :on => :collection + # end + # end + + # Sample resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end + + # You can have the root of your site routed with "root" + # just remember to delete public/index.html. + # root :to => 'welcome#index' + + # See how all your routes lay out with "rake routes" + + # This is a legacy wild controller route that's not recommended for RESTful applications. + # Note: This route will make all actions in every controller accessible via GET requests. + # match ':controller(/:action(/:id))(.:format)' +end diff --git a/db/migrate/20120828033453_create_users.rb b/db/migrate/20120828033453_create_users.rb new file mode 100644 index 000000000..030317e0f --- /dev/null +++ b/db/migrate/20120828033453_create_users.rb @@ -0,0 +1,13 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.string :name + t.string :email + t.string :remember_token + t.string :password_digest + t.boolean :admin + + t.timestamps + end + end +end diff --git a/db/migrate/20120828035120_create_jam_sessions.rb b/db/migrate/20120828035120_create_jam_sessions.rb new file mode 100644 index 000000000..7c1e444b1 --- /dev/null +++ b/db/migrate/20120828035120_create_jam_sessions.rb @@ -0,0 +1,9 @@ +class CreateJamSessions < ActiveRecord::Migration + def change + create_table :jam_sessions do |t| + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20120828035746_create_jam_session_members.rb b/db/migrate/20120828035746_create_jam_session_members.rb new file mode 100644 index 000000000..a33b6c07f --- /dev/null +++ b/db/migrate/20120828035746_create_jam_session_members.rb @@ -0,0 +1,8 @@ +class CreateJamSessionMembers < ActiveRecord::Migration + def change + create_table :jam_session_members do |t| + + t.timestamps + end + end +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 000000000..4edb1e857 --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP new file mode 100644 index 000000000..fe41f5cc2 --- /dev/null +++ b/doc/README_FOR_APP @@ -0,0 +1,2 @@ +Use this README file to introduce your application and point to useful places in the API for learning more. +Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. diff --git a/lib/assets/.gitkeep b/lib/assets/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/log/.gitkeep b/log/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/public/404.html b/public/404.html new file mode 100644 index 000000000..9a48320a5 --- /dev/null +++ b/public/404.html @@ -0,0 +1,26 @@ + + + + The page you were looking for doesn't exist (404) + + + + + +
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+ + diff --git a/public/422.html b/public/422.html new file mode 100644 index 000000000..83660ab18 --- /dev/null +++ b/public/422.html @@ -0,0 +1,26 @@ + + + + The change you wanted was rejected (422) + + + + + +
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+ + diff --git a/public/500.html b/public/500.html new file mode 100644 index 000000000..f3648a0db --- /dev/null +++ b/public/500.html @@ -0,0 +1,25 @@ + + + + We're sorry, but something went wrong (500) + + + + + +
+

We're sorry, but something went wrong.

+
+ + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 000000000..e69de29bb diff --git a/public/index.html b/public/index.html new file mode 100644 index 000000000..a1d50995c --- /dev/null +++ b/public/index.html @@ -0,0 +1,241 @@ + + + + Ruby on Rails: Welcome aboard + + + + +
+ + +
+ + + + +
+

Getting started

+

Here’s how to get rolling:

+ +
    +
  1. +

    Use rails generate to create your models and controllers

    +

    To see all available options, run it without parameters.

    +
  2. + +
  3. +

    Set up a default route and remove public/index.html

    +

    Routes are set up in config/routes.rb.

    +
  4. + +
  5. +

    Create your database

    +

    Run rake db:create to create your database. If you're not using SQLite (the default), edit config/database.yml with your username and password.

    +
  6. +
+
+
+ + +
+ + diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 000000000..085187fa5 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-Agent: * +# Disallow: / diff --git a/script/rails b/script/rails new file mode 100755 index 000000000..f8da2cffd --- /dev/null +++ b/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +APP_PATH = File.expand_path('../../config/application', __FILE__) +require File.expand_path('../../config/boot', __FILE__) +require 'rails/commands' diff --git a/test/fixtures/.gitkeep b/test/fixtures/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/jam_session_members.yml b/test/fixtures/jam_session_members.yml new file mode 100644 index 000000000..c63aac0b6 --- /dev/null +++ b/test/fixtures/jam_session_members.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/jam_sessions.yml b/test/fixtures/jam_sessions.yml new file mode 100644 index 000000000..0227c6092 --- /dev/null +++ b/test/fixtures/jam_sessions.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + name: MyString + +two: + name: MyString diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 000000000..93a6a4185 --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,15 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + name: MyString + email: MyString + remember_token: MyString + password_digest: MyString + admin: false + +two: + name: MyString + email: MyString + remember_token: MyString + password_digest: MyString + admin: false diff --git a/test/functional/.gitkeep b/test/functional/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test/functional/jam_session_members_controller_test.rb b/test/functional/jam_session_members_controller_test.rb new file mode 100644 index 000000000..94d055d21 --- /dev/null +++ b/test/functional/jam_session_members_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class JamSessionMembersControllerTest < ActionController::TestCase + setup do + @jam_session_member = jam_session_members(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:jam_session_members) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create jam_session_member" do + assert_difference('JamSessionMember.count') do + post :create, jam_session_member: { } + end + + assert_redirected_to jam_session_member_path(assigns(:jam_session_member)) + end + + test "should show jam_session_member" do + get :show, id: @jam_session_member + assert_response :success + end + + test "should get edit" do + get :edit, id: @jam_session_member + assert_response :success + end + + test "should update jam_session_member" do + put :update, id: @jam_session_member, jam_session_member: { } + assert_redirected_to jam_session_member_path(assigns(:jam_session_member)) + end + + test "should destroy jam_session_member" do + assert_difference('JamSessionMember.count', -1) do + delete :destroy, id: @jam_session_member + end + + assert_redirected_to jam_session_members_path + end +end diff --git a/test/functional/jam_sessions_controller_test.rb b/test/functional/jam_sessions_controller_test.rb new file mode 100644 index 000000000..542e05188 --- /dev/null +++ b/test/functional/jam_sessions_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class JamSessionsControllerTest < ActionController::TestCase + setup do + @jam_session = jam_sessions(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:jam_sessions) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create jam_session" do + assert_difference('JamSession.count') do + post :create, jam_session: { name: @jam_session.name } + end + + assert_redirected_to jam_session_path(assigns(:jam_session)) + end + + test "should show jam_session" do + get :show, id: @jam_session + assert_response :success + end + + test "should get edit" do + get :edit, id: @jam_session + assert_response :success + end + + test "should update jam_session" do + put :update, id: @jam_session, jam_session: { name: @jam_session.name } + assert_redirected_to jam_session_path(assigns(:jam_session)) + end + + test "should destroy jam_session" do + assert_difference('JamSession.count', -1) do + delete :destroy, id: @jam_session + end + + assert_redirected_to jam_sessions_path + end +end diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb new file mode 100644 index 000000000..ecd90c037 --- /dev/null +++ b/test/functional/users_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class UsersControllerTest < ActionController::TestCase + setup do + @user = users(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:users) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create user" do + assert_difference('User.count') do + post :create, user: { admin: @user.admin, email: @user.email, name: @user.name, password_digest: @user.password_digest, remember_token: @user.remember_token } + end + + assert_redirected_to user_path(assigns(:user)) + end + + test "should show user" do + get :show, id: @user + assert_response :success + end + + test "should get edit" do + get :edit, id: @user + assert_response :success + end + + test "should update user" do + put :update, id: @user, user: { admin: @user.admin, email: @user.email, name: @user.name, password_digest: @user.password_digest, remember_token: @user.remember_token } + assert_redirected_to user_path(assigns(:user)) + end + + test "should destroy user" do + assert_difference('User.count', -1) do + delete :destroy, id: @user + end + + assert_redirected_to users_path + end +end diff --git a/test/integration/.gitkeep b/test/integration/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test/performance/browsing_test.rb b/test/performance/browsing_test.rb new file mode 100644 index 000000000..3fea27b91 --- /dev/null +++ b/test/performance/browsing_test.rb @@ -0,0 +1,12 @@ +require 'test_helper' +require 'rails/performance_test_help' + +class BrowsingTest < ActionDispatch::PerformanceTest + # Refer to the documentation for all available options + # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory] + # :output => 'tmp/performance', :formats => [:flat] } + + def test_homepage + get '/' + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 000000000..8bf1192ff --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,13 @@ +ENV["RAILS_ENV"] = "test" +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. + # + # Note: You'll currently still have to declare fixtures explicitly in integration tests + # -- they do not yet inherit this setting + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/test/unit/.gitkeep b/test/unit/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test/unit/jam_session_member_test.rb b/test/unit/jam_session_member_test.rb new file mode 100644 index 000000000..43a1dd732 --- /dev/null +++ b/test/unit/jam_session_member_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class JamSessionMemberTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/jam_session_test.rb b/test/unit/jam_session_test.rb new file mode 100644 index 000000000..83d4611db --- /dev/null +++ b/test/unit/jam_session_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class JamSessionTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb new file mode 100644 index 000000000..82f61e010 --- /dev/null +++ b/test/unit/user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/vendor/assets/javascripts/.gitkeep b/vendor/assets/javascripts/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/assets/stylesheets/.gitkeep b/vendor/assets/stylesheets/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/plugins/.gitkeep b/vendor/plugins/.gitkeep new file mode 100644 index 000000000..e69de29bb From aa21fb12e25dcfbac65d6822d406599945c2de88 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 29 Aug 2012 23:06:52 -0500 Subject: [PATCH 02/56] * deleting swp file --- .../.jam_session_members_controller.rb.swp | Bin 12288 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/controllers/jam_ruby/.jam_session_members_controller.rb.swp diff --git a/app/controllers/jam_ruby/.jam_session_members_controller.rb.swp b/app/controllers/jam_ruby/.jam_session_members_controller.rb.swp deleted file mode 100644 index eeb64638a480912bfa5af5f7a3760d1760eaca61..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI&%}T>S5C`yS5pSaC3yk$_Q|+NpdJ#_w1+nNskg!R%7)`QEHdQLczEr_?@hyA< zXKS_4gY_!@7l!?sWZB;>WTMvfS)V)2Hc8tdx*hZ`Zt637+aPkfy7SBH+Hf(is6009U<00Izz00bcLj|3`Pqp94tzPR(|qOYy= zizzw?KmY;|fB*y_009U<00Izz00jP^fJ%sZ+eB8v|NsB`{(qPGtHe}dEKy1L93z1S z0SG_<0uX=z1Rwwb2tWV=5P-nX0=h^@f{ED=nN?h+k2-X*8V*gCaN}I%ms0xP?aE;A zS^D0eSH3qmF+7p#_u+)%OgYD^8SeDEhMs$TVr`bjs*>9IQA8$5w~VR From ba20fe7e75086b909cb022649ff2dc7b34a366dc Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 29 Aug 2012 23:15:42 -0500 Subject: [PATCH 03/56] * adding super simple nav on index.html --- public/index.html | 40 +++++++--------------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/public/index.html b/public/index.html index a1d50995c..53120698d 100644 --- a/public/index.html +++ b/public/index.html @@ -1,7 +1,7 @@ - Ruby on Rails: Welcome aboard + Jamkazam Administrative Portal - - - -
- -
- -
-

Getting started

- -
    -
  1. - Users -
  2. - -
  3. - Jam Sessions -
  4. - -
  5. - Jam Session Members -
  6. -
-
-
- - -
- - From 44c94f538b1f8e4914d2c33b41d4417a06b1883b Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Wed, 16 Jan 2013 06:02:09 -0600 Subject: [PATCH 11/56] VRFS-214: created deb package config for jam-admin by cloning jam-web build setup --- .rspec | 1 + Gemfile | 9 ++ Gemfile.lock | 91 ++++++++++++---- .../jam_session_members_controller.rb | 6 -- .../jam_ruby/jam_sessions_controller.rb | 6 -- app/controllers/jam_ruby/users_controller.rb | 11 -- build | 68 ++++++++++++ config/database.yml | 9 ++ config/unicorn.rb | 102 ++++++++++++++++++ script/package/jam-admin.conf | 7 ++ script/package/post-install.sh | 16 +++ script/package/post-uninstall.sh | 27 +++++ script/package/pre-install.sh | 36 +++++++ script/package/pre-uninstall.sh | 0 script/package/upstart-run.sh | 20 ++++ spec/spec_helper.rb | 38 +++++++ 16 files changed, 402 insertions(+), 45 deletions(-) create mode 100644 .rspec delete mode 100644 app/controllers/jam_ruby/jam_session_members_controller.rb delete mode 100644 app/controllers/jam_ruby/jam_sessions_controller.rb delete mode 100644 app/controllers/jam_ruby/users_controller.rb create mode 100755 build create mode 100644 config/unicorn.rb create mode 100644 script/package/jam-admin.conf create mode 100755 script/package/post-install.sh create mode 100755 script/package/post-uninstall.sh create mode 100755 script/package/pre-install.sh create mode 100755 script/package/pre-uninstall.sh create mode 100755 script/package/upstart-run.sh create mode 100644 spec/spec_helper.rb diff --git a/.rspec b/.rspec new file mode 100644 index 000000000..4e1e0d2f7 --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--color diff --git a/Gemfile b/Gemfile index 434ce8b9f..fb1531168 100644 --- a/Gemfile +++ b/Gemfile @@ -73,3 +73,12 @@ end # To use debugger # gem 'debugger' + +group :development, :test do + gem 'rspec-rails', '2.11.0' + gem 'guard-rspec', '0.5.5' + gem 'jasmine', '1.3.1' + gem 'pry' + gem 'execjs', '1.4.0' + gem 'therubyracer', '0.11.0beta8' +end diff --git a/Gemfile.lock b/Gemfile.lock index 90bce5b3b..99d111fbc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,19 +1,3 @@ -PATH - remote: ~/workspace/jam-db/target/ruby_package - specs: - jam_db (0.0.1) - pg_migrate (= 0.1.6) - -PATH - remote: ~/workspace/jam-pb/target/ruby/jampb - specs: - jampb (0.0.1) - -PATH - remote: ~/workspace/jam-ruby - specs: - jam_ruby (0.0.1) - GEM remote: https://rubygems.org/ remote: https://jamjam:blueberryjam@www.jamkazam.com/gems/ @@ -59,6 +43,7 @@ GEM activesupport (3.2.9) i18n (~> 0.6) multi_json (~> 1.0) + addressable (2.3.2) amq-client (0.9.10) amq-protocol (>= 0.9.4) eventmachine @@ -83,7 +68,10 @@ GEM builder (3.0.4) cabin (0.4.4) json + childprocess (0.3.6) + ffi (~> 1.0, >= 1.0.6) clamp (0.5.0) + coderay (1.0.8) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) @@ -93,16 +81,18 @@ GEM coffee-script-source (1.4.0) country-select (1.1.1) daemons (1.1.9) - devise (2.1.2) + devise (2.2.2) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.1) railties (~> 3.1) warden (~> 1.2.1) + diff-lcs (1.1.3) erubis (2.7.0) eventmachine (1.0.0) execjs (1.4.0) multi_json (~> 1.0) fastercsv (1.5.5) + ffi (1.3.1) formtastic (2.2.1) actionpack (>= 3.0) fpm (0.4.6) @@ -111,6 +101,13 @@ GEM cabin (~> 0.4.3) clamp json + guard (1.6.1) + listen (>= 0.6.0) + lumberjack (>= 1.0.2) + pry (>= 0.9.10) + thor (>= 0.14.6) + guard-rspec (0.5.5) + guard (>= 0.8.4) has_scope (0.5.1) hashr (0.0.22) hike (1.2.1) @@ -118,6 +115,16 @@ GEM inherited_resources (1.3.1) has_scope (~> 0.5.0) responders (~> 0.6) + jam_db (0.0.86) + pg_migrate (= 0.1.6) + jam_ruby (0.0.97) + jampb (0.0.3888) + jasmine (1.3.1) + jasmine-core (~> 1.3.1) + rack (~> 1.0) + rspec (>= 1.3.1) + selenium-webdriver (>= 0.1.3) + jasmine-core (1.3.1) journey (1.0.4) jquery-rails (2.1.4) railties (>= 3.0, < 5.0) @@ -127,9 +134,14 @@ GEM actionpack (>= 3.0.0) activesupport (>= 3.0.0) kgio (2.7.4) + libwebsocket (0.1.7.1) + addressable + websocket + listen (0.7.2) little-plugger (1.1.3) logging (1.7.2) little-plugger (>= 1.1.3) + lumberjack (1.0.2) mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) @@ -139,6 +151,7 @@ GEM activerecord (~> 3.1) activesupport (~> 3.1) polyamorous (~> 0.5.0) + method_source (0.8.1) mime-types (1.19) multi_json (1.5.0) orm_adapter (0.4.0) @@ -150,7 +163,11 @@ GEM polyamorous (0.5.0) activerecord (~> 3.0) polyglot (0.3.3) - rack (1.4.3) + pry (0.9.11.2) + coderay (~> 1.0.5) + method_source (~> 0.8) + slop (~> 3.4) + rack (1.4.4) rack-cache (1.2) rack (>= 0.4) rack-ssl (1.3.2) @@ -176,24 +193,47 @@ GEM rake (10.0.3) rdoc (3.12) json (~> 1.4) + ref (1.0.2) responders (0.9.3) railties (~> 3.1) rest-client (1.6.7) mime-types (>= 1.16) + rspec (2.11.0) + rspec-core (~> 2.11.0) + rspec-expectations (~> 2.11.0) + rspec-mocks (~> 2.11.0) + rspec-core (2.11.1) + rspec-expectations (2.11.3) + diff-lcs (~> 1.1.3) + rspec-mocks (2.11.3) + rspec-rails (2.11.0) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec (~> 2.11.0) ruby-protocol-buffers (1.2.2) + rubyzip (0.9.9) sass (3.2.5) - sass-rails (3.2.5) + sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) + selenium-webdriver (2.27.2) + childprocess (>= 0.2.5) + libwebsocket (~> 0.1.3) + multi_json (~> 1.0) + rubyzip sendgrid (1.1.0) json json + slop (3.4.3) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) + therubyracer (0.11.0beta8) + ref thin (1.5.0) daemons (>= 1.0.9) eventmachine (>= 0.12.6) @@ -220,6 +260,7 @@ GEM uuidtools (2.1.2) warden (1.2.1) rack (>= 1.0) + websocket (1.0.6) will_paginate (3.0.3) PLATFORMS @@ -235,17 +276,23 @@ DEPENDENCIES coffee-rails (~> 3.2.1) country-select eventmachine (= 1.0.0) + execjs (= 1.4.0) fpm - jam_db! - jam_ruby! - jampb! + guard-rspec (= 0.5.5) + jam_db + jam_ruby + jampb + jasmine (= 1.3.1) jquery-rails meta_search (>= 1.1.0.pre) pg_migrate + pry rails (= 3.2.9) + rspec-rails (= 2.11.0) ruby-protocol-buffers (= 1.2.2) sass-rails (~> 3.2.3) sendgrid (= 1.1.0) + therubyracer (= 0.11.0beta8) thin tire (= 0.5.1) uglifier (>= 1.0.3) diff --git a/app/controllers/jam_ruby/jam_session_members_controller.rb b/app/controllers/jam_ruby/jam_session_members_controller.rb deleted file mode 100644 index de1365835..000000000 --- a/app/controllers/jam_ruby/jam_session_members_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -module JamRuby -class JamSessionMembersController < ApplicationController - active_scaffold "JamRuby::JamSessionMember" do |conf| - end -end -end diff --git a/app/controllers/jam_ruby/jam_sessions_controller.rb b/app/controllers/jam_ruby/jam_sessions_controller.rb deleted file mode 100644 index 482044095..000000000 --- a/app/controllers/jam_ruby/jam_sessions_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -module JamRuby -class JamSessionsController < ApplicationController - active_scaffold "JamRuby::JamSession" do |conf| - end -end -end diff --git a/app/controllers/jam_ruby/users_controller.rb b/app/controllers/jam_ruby/users_controller.rb deleted file mode 100644 index 59940514f..000000000 --- a/app/controllers/jam_ruby/users_controller.rb +++ /dev/null @@ -1,11 +0,0 @@ -module JamRuby -class UsersController < ApplicationController - active_scaffold "JamRuby::User" do |conf| - conf.subform.columns = ["name", "email", "admin", "can_invite"] - - conf.create.columns = [:name, :email, :admin, :password, :password_confirmation, :can_invite] - conf.update.columns = [:name, :email, :admin, :password, :password_confirmation, :can_invite] - - end -end -end diff --git a/build b/build new file mode 100755 index 000000000..c60445a4d --- /dev/null +++ b/build @@ -0,0 +1,68 @@ +#!/bin/bash + +echo "updating dependencies" + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# 'target' is the output directory +rm -rf $DIR/target +mkdir $DIR/target +mkdir $DIR/target/deb + +# put all dependencies into vendor/bundle +rm -rf vendor/bundle +rm Gemfile.lock # if we don't want versions to float, pin it in the Gemfile, not count on Gemfile.lock +bundle install --path vendor/bundle +bundle update + +if [ "$?" = "0" ]; then + echo "success: updated dependencies" +else + echo "could not update dependencies" + exit 1 +fi + +if [ -z $SKIP_TESTS ]; then + + echo "running rspec tests" + bundle exec rspec + if [ "$?" = "0" ]; then + echo "success: ran rspec tests" + else + echo "running rspec tests failed." + exit 1 + fi +fi + +if [ -n "$PACKAGE" ]; then + + if [ -z "$BUILD_NUMBER" ]; then + echo "BUILD NUMBER is not defined" + exit 1 + fi + + type -P dpkg-architecture > /dev/null + + + if [ "$?" = "0" ]; then + ARCH=`dpkg-architecture -qDEB_HOST_ARCH` + else + echo "WARN: unable to determine architecture." + ARCH=`all` + fi + + + set -e + # cache all gems local, and tell bundle to use local gems only + bundle install --path vendor/bundle --local + # prepare production acssets + rm -rf $DIR/public/assets + bundle exec rake assets:precompile RAILS_ENV=production + + # create debian using fpm + bundle exec fpm -s dir -t deb -p target/deb/jam-admin_0.1.${BUILD_NUMBER}_${ARCH}.deb -n "jam-admin" -v "0.1.$BUILD_NUMBER" --prefix /var/lib/jam-admin --after-install $DIR/script/package/post-install.sh --before-install $DIR/script/package/pre-install.sh --before-remove $DIR/script/package/pre-uninstall.sh --after-remove $DIR/script/package/post-uninstall.sh Gemfile .bundle config Rakefile script config.ru lib public vendor app + +fi + +echo "build complete" + diff --git a/config/database.yml b/config/database.yml index 4473bb511..2664c08ae 100644 --- a/config/database.yml +++ b/config/database.yml @@ -18,3 +18,12 @@ development: password: postgres timeout: 2000 encoding: unicode + +production: + adapter: postgresql + database: jam + username: postgres + password: postgres + host: localhost + pool: 5 + timeout: 5000 diff --git a/config/unicorn.rb b/config/unicorn.rb new file mode 100644 index 000000000..6a901300b --- /dev/null +++ b/config/unicorn.rb @@ -0,0 +1,102 @@ +# Sample verbose configuration file for Unicorn (not Rack) +# +# This configuration file documents many features of Unicorn +# that may not be needed for some applications. See +# http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb +# for a much simpler configuration file. +# +# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete +# documentation. + +# Use at least one worker per core if you're on a dedicated server, +# more will usually help for _short_ waits on databases/caches. +worker_processes 4 + +# Since Unicorn is never exposed to outside clients, it does not need to +# run on the standard HTTP port (80), there is no reason to start Unicorn +# as root unless it's from system init scripts. +# If running the master process as root and the workers as an unprivileged +# user, do this to switch euid/egid in the workers (also chowns logs): +user "jam-admin", "jam-admin" + +# Help ensure your application will always spawn in the symlinked +# "current" directory that Capistrano sets up. +working_directory "/var/lib/jam-admin" # available in 0.94.0+ + +# listen on both a Unix domain socket and a TCP port, +# we use a shorter backlog for quicker failover when busy +listen "/tmp/.sock", :backlog => 64 +listen 3100, :tcp_nopush => true + +# nuke workers after 30 seconds instead of 60 seconds (the default) +timeout 30 + +# feel free to point this anywhere accessible on the filesystem +pid "/var/run/jam-admin.pid" + +# By default, the Unicorn logger will write to stderr. +# Additionally, ome applications/frameworks log to stderr or stdout, +# so prevent them from going to /dev/null when daemonized here: +stderr_path "/var/lib/jam-admin/log/unicorn.stderr.log" +stdout_path "/var/lib/jam-admin/log/unicorn.stdout.log" + +# combine Ruby 2.0.0dev or REE with "preload_app true" for memory savings +# http://rubyenterpriseedition.com/faq.html#adapt_apps_for_cow +preload_app true +GC.respond_to?(:copy_on_write_friendly=) and + GC.copy_on_write_friendly = true + +# Enable this flag to have unicorn test client connections by writing the +# beginning of the HTTP headers before calling the application. This +# prevents calling the application for connections that have disconnected +# while queued. This is only guaranteed to detect clients on the same +# host unicorn runs on, and unlikely to detect disconnects even on a +# fast LAN. +check_client_connection false + +before_fork do |server, worker| + # the following is highly recomended for Rails + "preload_app true" + # as there's no need for the master process to hold a connection + defined?(ActiveRecord::Base) and + ActiveRecord::Base.connection.disconnect! + + # The following is only recommended for memory/DB-constrained + # installations. It is not needed if your system can house + # twice as many worker_processes as you have configured. + # + # # This allows a new master process to incrementally + # # phase out the old master process with SIGTTOU to avoid a + # # thundering herd (especially in the "preload_app false" case) + # # when doing a transparent upgrade. The last worker spawned + # # will then kill off the old master process with a SIGQUIT. + # old_pid = "#{server.config[:pid]}.oldbin" + # if old_pid != server.pid + # begin + # sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU + # Process.kill(sig, File.read(old_pid).to_i) + # rescue Errno::ENOENT, Errno::ESRCH + # end + # end + # + # Throttle the master from forking too quickly by sleeping. Due + # to the implementation of standard Unix signal handlers, this + # helps (but does not completely) prevent identical, repeated signals + # from being lost when the receiving process is busy. + # sleep 1 +end + +after_fork do |server, worker| + # per-process listener ports for debugging/admin/migrations + # addr = "127.0.0.1:#{9293 + worker.nr}" + # server.listen(addr, :tries => -1, :delay => 5, :tcp_nopush => true) + + # the following is *required* for Rails + "preload_app true", + defined?(ActiveRecord::Base) and + ActiveRecord::Base.establish_connection + + # if preload_app is true, then you may also want to check and + # restart any other shared sockets/descriptors such as Memcached, + # and Redis. TokyoCabinet file handles are safe to reuse + # between any number of forked children (assuming your kernel + # correctly implements pread()/pwrite() system calls) +end diff --git a/script/package/jam-admin.conf b/script/package/jam-admin.conf new file mode 100644 index 000000000..7c5fbc998 --- /dev/null +++ b/script/package/jam-admin.conf @@ -0,0 +1,7 @@ +description "jam-admin" + +start on startup +start on runlevel [2345] +stop on runlevel [016] + +exec start-stop-daemon --start --chdir /var/lib/jam-admin --exec /var/lib/jam-admin/script/package/upstart-run.sh diff --git a/script/package/post-install.sh b/script/package/post-install.sh new file mode 100755 index 000000000..355f4ca4a --- /dev/null +++ b/script/package/post-install.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -eu + +NAME="jam-admin" + +USER="$NAME" +GROUP="$NAME" + +# copy upstart file +cp /var/lib/$NAME/script/package/$NAME.conf /etc/init/$NAME.conf + +mkdir -p /var/lib/$NAME/log +mkdir -p /var/lib/$NAME/tmp + +chown -R $USER:$GROUP /var/lib/$NAME diff --git a/script/package/post-uninstall.sh b/script/package/post-uninstall.sh new file mode 100755 index 000000000..ce97ec14e --- /dev/null +++ b/script/package/post-uninstall.sh @@ -0,0 +1,27 @@ +#!/bin/sh + + + +NAME="jam-admin" + +set -e +if [ "$1" = "remove" ] +then + set +e + # stop the process, if any is found. we don't want this failing to cause an error, though. + sudo stop $NAME + set -e + + if [ -f /etc/init/$NAME.conf ]; then + rm /etc/init/$NAME.conf + fi +fi + +if [ "$1" = "purge" ] +then + if [ -d /var/lib/$NAME ]; then + rm -rf /var/lib/$NAME + fi + + userdel $NAME +fi diff --git a/script/package/pre-install.sh b/script/package/pre-install.sh new file mode 100755 index 000000000..5a1d06406 --- /dev/null +++ b/script/package/pre-install.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +set -eu + +NAME="jam-admin" + +HOME="/var/lib/$NAME" +USER="$NAME" +GROUP="$NAME" + +# if NIS is used, then errors can occur but be non-fatal +if which ypwhich >/dev/null 2>&1 && ypwhich >/dev/null 2>&1 +then + set +e +fi + +if ! getent group "$GROUP" >/dev/null +then + addgroup --system "$GROUP" >/dev/null +fi + +# creating user if it isn't already there +if ! getent passwd "$USER" >/dev/null +then + adduser \ + --system \ + --home $HOME \ + --shell /bin/false \ + --disabled-login \ + --ingroup "$GROUP" \ + --gecos "$USER" \ + "$USER" >/dev/null +fi + +# NISno longer a possible problem; stop ignoring errors +set -e diff --git a/script/package/pre-uninstall.sh b/script/package/pre-uninstall.sh new file mode 100755 index 000000000..e69de29bb diff --git a/script/package/upstart-run.sh b/script/package/upstart-run.sh new file mode 100755 index 000000000..c2e7ad259 --- /dev/null +++ b/script/package/upstart-run.sh @@ -0,0 +1,20 @@ +#!/bin/bash -l + +# default config values +PORT=3000 +BUILD_NUMBER=1 + + +CONFIG_FILE="/etc/jam-admin/upstart.conf" +if [ -e "$CONFIG_FILE" ]; then + . "$CONFIG_FILE" +fi + +# I don't like doing this, but the next command (bundle exec) retouches/generates +# the gemfile. This unfortunately means the next debian update doesn't update this file. +# Ultimately this means an old Gemfile.lock is left behind for a new package, +# and bundle won't run because it thinks it has the wrong versions of gems +rm Gemfile.lock + +BUILD_NUMBER=$BUILD_NUMBER exec bundle exec unicorn_rails -p $PORT -E production -c config/unicorn.rb # -D +#BUILD_NUMBER=$BUILD_NUMBER /usr/local/rbenv/shims/bundle exec rails s -p $PORT diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 000000000..090912782 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,38 @@ +# This file is copied to spec/ when you run 'rails generate rspec:install' +ENV["RAILS_ENV"] ||= 'test' +require File.expand_path("../../config/environment", __FILE__) +require 'rspec/rails' +require 'rspec/autorun' + +# Requires supporting ruby files with custom matchers and macros, etc, +# in spec/support/ and its subdirectories. +Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} + +RSpec.configure do |config| + # ## Mock Framework + # + # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: + # + # config.mock_with :mocha + # config.mock_with :flexmock + # config.mock_with :rr + + # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures + config.fixture_path = "#{::Rails.root}/spec/fixtures" + + # If you're not using ActiveRecord, or you'd prefer not to run each of your + # examples within a transaction, remove the following line or assign false + # instead of true. + config.use_transactional_fixtures = true + + # If true, the base class of anonymous controllers will be inferred + # automatically. This will be the default behavior in future versions of + # rspec-rails. + config.infer_base_class_for_anonymous_controllers = false + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = "random" +end From 1abc90a5fbf1539f8674a4dbf9f1e2e6b8bf8094 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 16 Jan 2013 22:52:43 -0600 Subject: [PATCH 12/56] * -f so no error if not present --- script/package/upstart-run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/package/upstart-run.sh b/script/package/upstart-run.sh index c2e7ad259..51bb64f4a 100755 --- a/script/package/upstart-run.sh +++ b/script/package/upstart-run.sh @@ -14,7 +14,7 @@ fi # the gemfile. This unfortunately means the next debian update doesn't update this file. # Ultimately this means an old Gemfile.lock is left behind for a new package, # and bundle won't run because it thinks it has the wrong versions of gems -rm Gemfile.lock +rm -f Gemfile.lock BUILD_NUMBER=$BUILD_NUMBER exec bundle exec unicorn_rails -p $PORT -E production -c config/unicorn.rb # -D #BUILD_NUMBER=$BUILD_NUMBER /usr/local/rbenv/shims/bundle exec rails s -p $PORT From 7094b3c345f3df77cbe8ce7fe5b25c4c0d07f8f9 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 16 Jan 2013 22:59:59 -0600 Subject: [PATCH 13/56] * adding jenkins build script to jam-admin --- jenkins | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 jenkins diff --git a/jenkins b/jenkins new file mode 100755 index 000000000..0acf5a9a9 --- /dev/null +++ b/jenkins @@ -0,0 +1,29 @@ +#!/bin/bash + +DEB_SERVER=http://localhost:9010/apt-i386 + +echo "starting build..." +./build + +if [ "$?" = "0" ]; then + echo "build succeeded" + + if [ ! -z "$PACKAGE" ]; then + echo "publishing ubuntu package (.deb)" + DEBPATH=`find target/deb -name *.deb` + DEBNAME=`basename $DEBPATH` + + curl -f -T $DEBPATH $DEB_SERVER/$DEBNAME + + if [ "$?" != "0" ]; then + echo "deb publish failed" + exit 1 + fi + echo "done publishing deb" + fi +else + echo "build failed" + exit 1 +fi + + From 16e4edca57c50540d12799706da16ffdd891de39 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 16 Jan 2013 23:03:22 -0600 Subject: [PATCH 14/56] * adding vim exclusion; also testing bitbucket hook to jenkins --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index eb3489a98..6ae23e215 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ # Ignore all logfiles and tempfiles. /log/*.log /tmp +*~ From dab083acd9d15cfeef1e59412666665625ff232c Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 17 Jan 2013 22:21:12 -0600 Subject: [PATCH 15/56] * making /etc/jam-admin dir --- script/package/post-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/package/post-install.sh b/script/package/post-install.sh index 355f4ca4a..656e47e06 100755 --- a/script/package/post-install.sh +++ b/script/package/post-install.sh @@ -12,5 +12,7 @@ cp /var/lib/$NAME/script/package/$NAME.conf /etc/init/$NAME.conf mkdir -p /var/lib/$NAME/log mkdir -p /var/lib/$NAME/tmp +mkdir -p /etc/$NAME chown -R $USER:$GROUP /var/lib/$NAME +chown -R $USER:$GROUP /etc/$NAME From 4494b1e07127f8f017ca676c75115e1d9fc781dc Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 17 Jan 2013 23:03:59 -0600 Subject: [PATCH 16/56] * creating log dir in var --- script/package/post-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/package/post-install.sh b/script/package/post-install.sh index 656e47e06..1ed894877 100755 --- a/script/package/post-install.sh +++ b/script/package/post-install.sh @@ -13,6 +13,8 @@ cp /var/lib/$NAME/script/package/$NAME.conf /etc/init/$NAME.conf mkdir -p /var/lib/$NAME/log mkdir -p /var/lib/$NAME/tmp mkdir -p /etc/$NAME +mkdir -p /var/log/$NAME chown -R $USER:$GROUP /var/lib/$NAME chown -R $USER:$GROUP /etc/$NAME +chown -R $USER:$GROUP /var/log/$NAME From 8ee826696a334e075d6c991b08cdab419272a270 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 18 Jan 2013 00:09:16 -0600 Subject: [PATCH 17/56] * bumping rvmrc to match all other projects, and adding rails-logging gem to mirror jam-web (and because it lets me configure logging the same way using chef and so on) --- .gitignore | 1 + .rvmrc | 2 +- Gemfile | 9 +- Gemfile.lock | 48 ++++++----- config/environments/.production.rb.swp | Bin 0 -> 12288 bytes config/environments/development.rb | 6 ++ config/environments/production.rb | 6 ++ config/logging.rb | 111 +++++++++++++++++++++++++ 8 files changed, 159 insertions(+), 24 deletions(-) create mode 100644 config/environments/.production.rb.swp create mode 100644 config/logging.rb diff --git a/.gitignore b/.gitignore index 6ae23e215..2689b1bfc 100644 --- a/.gitignore +++ b/.gitignore @@ -12,5 +12,6 @@ # Ignore all logfiles and tempfiles. /log/*.log +/log/*.age /tmp *~ diff --git a/.rvmrc b/.rvmrc index 40bd19303..3de722744 100644 --- a/.rvmrc +++ b/.rvmrc @@ -1 +1 @@ -rvm use ruby-1.9.3@jam-admin --create +rvm use ruby-1.9.3-p327@jam-admin --create diff --git a/Gemfile b/Gemfile index fb1531168..490e053b1 100644 --- a/Gemfile +++ b/Gemfile @@ -45,14 +45,17 @@ gem 'country-select' gem 'eventmachine', '1.0.0' gem 'amqp', '0.9.8' -# gem 'logging-rails', :require => 'logging/rails' -gem 'tire', '0.5.1' +gem 'logging-rails', :require => 'logging/rails' gem 'pg_migrate' # ,'0.1.5' #:path => "#{workspace}/pg_migrate_ruby" gem 'ruby-protocol-buffers', '1.2.2' gem 'sendgrid', '1.1.0' +group :libv8 do + gem 'libv8', "~> 3.11.8" +end + group :development do gem 'thin' # bundle exec rails server thin end @@ -80,5 +83,5 @@ group :development, :test do gem 'jasmine', '1.3.1' gem 'pry' gem 'execjs', '1.4.0' - gem 'therubyracer', '0.11.0beta8' + gem 'therubyracer' #, '0.11.0beta8' end diff --git a/Gemfile.lock b/Gemfile.lock index 99d111fbc..fbea59e01 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,19 @@ +PATH + remote: ~/workspace/jam-db/target/ruby_package + specs: + jam_db (0.0.1) + pg_migrate (= 0.1.6) + +PATH + remote: ~/workspace/jam-pb/target/ruby/jampb + specs: + jampb (0.0.1) + +PATH + remote: ~/workspace/jam-ruby + specs: + jam_ruby (0.0.1) + GEM remote: https://rubygems.org/ remote: https://jamjam:blueberryjam@www.jamkazam.com/gems/ @@ -109,16 +125,11 @@ GEM guard-rspec (0.5.5) guard (>= 0.8.4) has_scope (0.5.1) - hashr (0.0.22) hike (1.2.1) i18n (0.6.1) inherited_resources (1.3.1) has_scope (~> 0.5.0) responders (~> 0.6) - jam_db (0.0.86) - pg_migrate (= 0.1.6) - jam_ruby (0.0.97) - jampb (0.0.3888) jasmine (1.3.1) jasmine-core (~> 1.3.1) rack (~> 1.0) @@ -134,6 +145,7 @@ GEM actionpack (>= 3.0.0) activesupport (>= 3.0.0) kgio (2.7.4) + libv8 (3.11.8.13) libwebsocket (0.1.7.1) addressable websocket @@ -141,6 +153,8 @@ GEM little-plugger (1.1.3) logging (1.7.2) little-plugger (>= 1.1.3) + logging-rails (0.4.0) + logging (~> 1.6) lumberjack (1.0.2) mail (2.4.4) i18n (>= 0.4.0) @@ -163,7 +177,7 @@ GEM polyamorous (0.5.0) activerecord (~> 3.0) polyglot (0.3.3) - pry (0.9.11.2) + pry (0.9.11.3) coderay (~> 1.0.5) method_source (~> 0.8) slop (~> 3.4) @@ -196,8 +210,6 @@ GEM ref (1.0.2) responders (0.9.3) railties (~> 3.1) - rest-client (1.6.7) - mime-types (>= 1.16) rspec (2.11.0) rspec-core (~> 2.11.0) rspec-expectations (~> 2.11.0) @@ -232,7 +244,8 @@ GEM multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - therubyracer (0.11.0beta8) + therubyracer (0.11.3) + libv8 (~> 3.11.8.12) ref thin (1.5.0) daemons (>= 1.0.9) @@ -240,12 +253,6 @@ GEM rack (>= 1.0.0) thor (0.15.4) tilt (1.3.3) - tire (0.5.1) - activemodel (>= 3.0) - hashr (~> 0.0.19) - multi_json (~> 1.0) - rake - rest-client (~> 1.6) treetop (1.4.12) polyglot polyglot (>= 0.3.1) @@ -279,11 +286,13 @@ DEPENDENCIES execjs (= 1.4.0) fpm guard-rspec (= 0.5.5) - jam_db - jam_ruby - jampb + jam_db! + jam_ruby! + jampb! jasmine (= 1.3.1) jquery-rails + libv8 (~> 3.11.8) + logging-rails meta_search (>= 1.1.0.pre) pg_migrate pry @@ -292,9 +301,8 @@ DEPENDENCIES ruby-protocol-buffers (= 1.2.2) sass-rails (~> 3.2.3) sendgrid (= 1.1.0) - therubyracer (= 0.11.0beta8) + therubyracer thin - tire (= 0.5.1) uglifier (>= 1.0.3) unicorn uuidtools (= 2.1.2) diff --git a/config/environments/.production.rb.swp b/config/environments/.production.rb.swp new file mode 100644 index 0000000000000000000000000000000000000000..396c46a0c5672cd15f3d47865ace7693211d70dd GIT binary patch literal 12288 zcmeHNO^+Nk5bYo(d7+vTcPRnMcuqa$yh zJjfE)Km(RJW+Kmi5t67VGO1aSSnDEc1w4)_8%4V(fV2X5Sp_rO(P9ay99_e9Y( z;9Fn@yb3G>9pGW$0Pw@zQS=G$J`e-X0)HX?KY?q&m%u7OoSX;36Bq~#1O@^Fw_`x4 zG-B)!tM7C5IIeGPir9!mo3zI(r(>~I=3J`SO^mP;ou@IrSWHlKR-bDD7l6^VhnM!!0FId=$vTro5d3pGPqcnI9Cq({U!jh#fvf*Jw&n4rrZj%NrkL4CJR0maK*Y=jt&xt zyY}lG-{ix@$kHLhMi+3l4h$q1WMIy%geMabTStw75-&s%w}$-I>lT5rRAw1!S~=$5 zV_RAx72Ca@IcGT65QGn`pWrV)^WfjU7q@7ma- zQclrTMvf|n(nGpY$v5vDJ3gigdyfrlHA*!qNG-8JRmqfH@FoA z1}xdzk%BWc=$+#UWX0Io7KfYQ=qC9 za+RR#p@qGmF2jqwyDCzNzHy6?21MFX zcN2d6l7ll8KWdZyzEgn|Z=Ki}afoysVTYSrSU zR?j3SN^ascMT)FHwvEU&nhRAW+*IIn-}bET&7p7(TY$8k@|!?=YkKfgM))j?R49mq mmjj1m#H(=~cE5dK;nMs$UM$o7`oUnieUkah_9P9dj{X6hx~H}P literal 0 HcmV?d00001 diff --git a/config/environments/development.rb b/config/environments/development.rb index a2ddffff5..ffd6b0e8f 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -37,4 +37,10 @@ JamAdmin::Application.configure do # Expands the lines which load the assets config.assets.debug = true + + # Set the logging destination(s) + config.log_to = %w[stdout file] + + # Show the logging configuration on STDOUT + config.show_log_configuration = true end diff --git a/config/environments/production.rb b/config/environments/production.rb index c51b8304b..f263f212d 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -64,4 +64,10 @@ JamAdmin::Application.configure do # Log the query plan for queries taking more than this (works # with SQLite, MySQL, and PostgreSQL) # config.active_record.auto_explain_threshold_in_seconds = 0.5 + + # Set the logging destination(s) + config.log_to = %w[file] + + # Show the logging configuration on STDOUT + config.show_log_configuration = false end diff --git a/config/logging.rb b/config/logging.rb new file mode 100644 index 000000000..42cb34eff --- /dev/null +++ b/config/logging.rb @@ -0,0 +1,111 @@ + +Logging::Rails.configure do |config| + + # Objects will be converted to strings using the :format_as method. + Logging.format_as :inspect + + # The default layout used by the appenders. + layout = Logging.layouts.pattern(:pattern => '[%d] %-5l %c : %m\n') + + # Setup a color scheme called 'bright' than can be used to add color codes + # to the pattern layout. Color schemes should only be used with appenders + # that write to STDOUT or STDERR; inserting terminal color codes into a file + # is generally considered bad form. + # + Logging.color_scheme( 'bright', + :levels => { + :info => :green, + :warn => :yellow, + :error => :red, + :fatal => [:white, :on_red] + }, + :date => :blue, + :logger => :cyan, + :message => :magenta + ) + + # Configure an appender that will write log events to STDOUT. A colorized + # pattern layout is used to format the log events into strings before + # writing. + # + Logging.appenders.stdout( 'stdout', + :auto_flushing => true, + :layout => Logging.layouts.pattern( + :pattern => '[%d] %-5l %c : %m\n', + :color_scheme => 'bright' + ) + ) if config.log_to.include? 'stdout' + + # Configure an appender that will write log events to a file. The file will + # be rolled on a daily basis, and the past 7 rolled files will be kept. + # Older files will be deleted. The default pattern layout is used when + # formatting log events into strings. + # + Logging.appenders.rolling_file( 'file', + :filename => config.paths['log'].first, + :keep => 7, + :age => 'daily', + :truncate => false, + :auto_flushing => true, + :layout => layout + ) if config.log_to.include? 'file' + + # Configure an appender that will send an email for "error" and "fatal" log + # events. All other log events will be ignored. Furthermore, log events will + # be buffered for one minute (or 200 events) before an email is sent. This + # is done to prevent a flood of messages. + # + Logging.appenders.email( 'email', + :from => "server@#{config.action_mailer.smtp_settings[:domain]}", + :to => "developers@#{config.action_mailer.smtp_settings[:domain]}", + :subject => "Rails Error [#{%x(uname -n).strip}]", + :server => config.action_mailer.smtp_settings[:address], + :domain => config.action_mailer.smtp_settings[:domain], + :acct => config.action_mailer.smtp_settings[:user_name], + :passwd => config.action_mailer.smtp_settings[:password], + :authtype => config.action_mailer.smtp_settings[:authentication], + + :auto_flushing => 200, # send an email after 200 messages have been buffered + :flush_period => 60, # send an email after one minute + :level => :error, # only process log events that are "error" or "fatal" + :layout => layout + ) if config.log_to.include? 'email' + + # Setup the root logger with the Rails log level and the desired set of + # appenders. The list of appenders to use should be set in the environment + # specific configuration file. + # + # For example, in a production application you would not want to log to + # STDOUT, but you would want to send an email for "error" and "fatal" + # messages: + # + # => config/environments/production.rb + # + # config.log_to = %w[file email] + # + # In development you would want to log to STDOUT and possibly to a file: + # + # => config/environments/development.rb + # + # config.log_to = %w[stdout file] + # + Logging.logger.root.level = config.log_level + Logging.logger.root.appenders = config.log_to unless config.log_to.empty? + + # Under Phusion Passenger smart spawning, we need to reopen all IO streams + # after workers have forked. + # + # The rolling file appender uses shared file locks to ensure that only one + # process will roll the log file. Each process writing to the file must have + # its own open file descriptor for `flock` to function properly. Reopening + # the file descriptors after forking ensures that each worker has a unique + # file descriptor. + # + if defined?(PhusionPassenger) + PhusionPassenger.on_event(:starting_worker_process) do |forked| + Logging.reopen if forked + end + end + +end + From c56e0b792b6a7d4a6c7cefe644dd3546660f8fb5 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sat, 19 Jan 2013 08:41:03 -0600 Subject: [PATCH 18/56] * making certain active_admin assets precompile --- config/application.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/application.rb b/config/application.rb index 3c2195308..05deafd74 100644 --- a/config/application.rb +++ b/config/application.rb @@ -59,5 +59,8 @@ module JamAdmin # Version of your assets, change this if you want to expire all your assets config.assets.version = '1.0' + + # to make active_admin assets precompile + config.assets.precompile += %w[ active_admin.css active_admin.js ] end end From 5f87da13d473af21a1c6f1814fd380065cc6201b Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sat, 19 Jan 2013 08:56:49 -0600 Subject: [PATCH 19/56] * addig production to list of assets envirometns --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 05deafd74..d5cc2fb1e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -4,7 +4,7 @@ require 'rails/all' if defined?(Bundler) # If you precompile assets before deploying to production, use this line - Bundler.require(*Rails.groups(:assets => %w(development test))) + Bundler.require(*Rails.groups(:assets => %w(development test production))) # If you want your assets lazily compiled in production, use this line # Bundler.require(:default, :assets, Rails.env) end From d146f4e98a14007f7acdf392f460fd335fc77062 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sat, 19 Jan 2013 09:11:53 -0600 Subject: [PATCH 20/56] * trying some more to fix this assets precompile issue --- config/application.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/application.rb b/config/application.rb index d5cc2fb1e..99bc3283a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -4,7 +4,7 @@ require 'rails/all' if defined?(Bundler) # If you precompile assets before deploying to production, use this line - Bundler.require(*Rails.groups(:assets => %w(development test production))) + Bundler.require(*Rails.groups(:assets => %w(development test))) # If you want your assets lazily compiled in production, use this line # Bundler.require(:default, :assets, Rails.env) end @@ -61,6 +61,6 @@ module JamAdmin config.assets.version = '1.0' # to make active_admin assets precompile - config.assets.precompile += %w[ active_admin.css active_admin.js ] + config.assets.precompile += ['active_admin.css', 'active_admin.js', 'active_admin/print.css'] end end From d3595afba1443678b3a2c918f8b3bfe41cdff2de Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 28 Jan 2013 20:56:59 -0600 Subject: [PATCH 21/56] * stopping swp files from being committed --- .gitignore | 1 + config/environments/.production.rb.swp | Bin 12288 -> 0 bytes 2 files changed, 1 insertion(+) delete mode 100644 config/environments/.production.rb.swp diff --git a/.gitignore b/.gitignore index 2689b1bfc..267357b2b 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ /log/*.age /tmp *~ +*.swp diff --git a/config/environments/.production.rb.swp b/config/environments/.production.rb.swp deleted file mode 100644 index 396c46a0c5672cd15f3d47865ace7693211d70dd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeHNO^+Nk5bYo(d7+vTcPRnMcuqa$yh zJjfE)Km(RJW+Kmi5t67VGO1aSSnDEc1w4)_8%4V(fV2X5Sp_rO(P9ay99_e9Y( z;9Fn@yb3G>9pGW$0Pw@zQS=G$J`e-X0)HX?KY?q&m%u7OoSX;36Bq~#1O@^Fw_`x4 zG-B)!tM7C5IIeGPir9!mo3zI(r(>~I=3J`SO^mP;ou@IrSWHlKR-bDD7l6^VhnM!!0FId=$vTro5d3pGPqcnI9Cq({U!jh#fvf*Jw&n4rrZj%NrkL4CJR0maK*Y=jt&xt zyY}lG-{ix@$kHLhMi+3l4h$q1WMIy%geMabTStw75-&s%w}$-I>lT5rRAw1!S~=$5 zV_RAx72Ca@IcGT65QGn`pWrV)^WfjU7q@7ma- zQclrTMvf|n(nGpY$v5vDJ3gigdyfrlHA*!qNG-8JRmqfH@FoA z1}xdzk%BWc=$+#UWX0Io7KfYQ=qC9 za+RR#p@qGmF2jqwyDCzNzHy6?21MFX zcN2d6l7ll8KWdZyzEgn|Z=Ki}afoysVTYSrSU zR?j3SN^ascMT)FHwvEU&nhRAW+*IIn-}bET&7p7(TY$8k@|!?=YkKfgM))j?R49mq mmjj1m#H(=~cE5dK;nMs$UM$o7`oUnieUkah_9P9dj{X6hx~H}P From 6fec4217616bf2b6d35fa7827a17727177e93629 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 28 Jan 2013 20:58:16 -0600 Subject: [PATCH 22/56] * removing offending initializer --- config/initializers/active_scaffold.rb | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 config/initializers/active_scaffold.rb diff --git a/config/initializers/active_scaffold.rb b/config/initializers/active_scaffold.rb deleted file mode 100644 index 4bfdd3ea4..000000000 --- a/config/initializers/active_scaffold.rb +++ /dev/null @@ -1,6 +0,0 @@ - -ActiveScaffold::DataStructures::Column.show_blank_record = false - -ActiveScaffold.set_defaults do |config| - -end From a9f0ec895d74e9ae395cb692783a6fc68f491909 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 28 Jan 2013 21:09:05 -0600 Subject: [PATCH 23/56] * removing more traces of active_scaffold --- Gemfile | 1 - app/assets/javascripts/application.js | 1 - app/assets/stylesheets/application.css | 1 - 3 files changed, 3 deletions(-) diff --git a/Gemfile b/Gemfile index 490e053b1..2d8a80354 100644 --- a/Gemfile +++ b/Gemfile @@ -37,7 +37,6 @@ gem 'uuidtools', '2.1.2' gem 'bcrypt-ruby', '3.0.1' gem 'jquery-rails' -gem 'active_scaffold' gem 'activeadmin' gem "meta_search", '>= 1.1.0.pre' diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index c6dda8b6b..9097d830e 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,4 +13,3 @@ //= require jquery //= require jquery_ujs //= require_tree . -//= require active_scaffold diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 5311f2b45..3192ec897 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -10,5 +10,4 @@ * *= require_self *= require_tree . - *= require active_scaffold */ From 6bb24a91ca3b5b9bcd8507dc71c92a129aedaee5 Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Mon, 11 Feb 2013 01:41:10 -0600 Subject: [PATCH 24/56] added aasm gem --- Gemfile | 2 ++ Gemfile.lock | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 2d8a80354..d4a57926b 100644 --- a/Gemfile +++ b/Gemfile @@ -84,3 +84,5 @@ group :development, :test do gem 'execjs', '1.4.0' gem 'therubyracer' #, '0.11.0beta8' end + +gem 'aasm' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index fbea59e01..12b628e2a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,6 +18,7 @@ GEM remote: https://rubygems.org/ remote: https://jamjam:blueberryjam@www.jamkazam.com/gems/ specs: + aasm (3.0.16) actionmailer (3.2.9) actionpack (= 3.2.9) mail (~> 2.4.4) @@ -31,8 +32,6 @@ GEM rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.2.1) - active_scaffold (3.2.17) - rails (>= 3.1.3) activeadmin (0.5.1) arbre (>= 1.0.1) bourbon (>= 1.0.0) @@ -274,7 +273,7 @@ PLATFORMS ruby DEPENDENCIES - active_scaffold + aasm activeadmin amqp (= 0.9.8) bcrypt-ruby (= 3.0.1) From 8d95a154758e80d6414df848ceda566f44a28548 Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Tue, 12 Feb 2013 19:02:08 -0600 Subject: [PATCH 25/56] refreshed to fix bundle install issues --- Gemfile.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d0d0810d4..013ad9b1f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,16 +1,16 @@ PATH - remote: ~/workspace/jam-db/target/ruby_package + remote: /home/jam/workspace/jam-db/target/ruby_package specs: jam_db (0.0.1) pg_migrate (= 0.1.6) PATH - remote: ~/workspace/jam-pb/target/ruby/jampb + remote: /home/jam/workspace/jam-pb/target/ruby/jampb specs: jampb (0.0.1) PATH - remote: ~/workspace/jam-ruby + remote: /home/jam/workspace/jam-ruby specs: jam_ruby (0.0.1) @@ -62,7 +62,7 @@ GEM amq-client (0.9.11) amq-protocol (>= 1.0.1) eventmachine - amq-protocol (1.1.0) + amq-protocol (1.2.0) amqp (0.9.8) amq-client (~> 0.9.5) amq-protocol (>= 0.9.4) @@ -194,9 +194,9 @@ GEM polyamorous (~> 0.5.0) method_source (0.8.1) mime-types (1.21) - multi_json (1.5.1) - net-scp (1.0.6) - net-ssh (>= 2.6.5) + multi_json (1.6.0) + net-scp (1.0.4) + net-ssh (>= 1.99.1) net-ssh (2.6.5) nokogiri (1.5.6) orm_adapter (0.4.0) @@ -208,7 +208,7 @@ GEM polyamorous (0.5.0) activerecord (~> 3.0) polyglot (0.3.3) - pry (0.9.11.4) + pry (0.9.12) coderay (~> 1.0.5) method_source (~> 0.8) slop (~> 3.4) From 223928673b17bcbf44bc53403f0c0b0f4148d80c Mon Sep 17 00:00:00 2001 From: Seth Call Date: Tue, 12 Feb 2013 22:43:57 -0600 Subject: [PATCH 26/56] * VRFS-217 artifacts page added to help one upload client builds, and 2 capybara tests --- .gitignore | 3 + Gemfile | 12 ++- Gemfile.lock | 117 +++++++++++++++++-------- app/admin/jam_ruby_artifact_updates.rb | 24 +++++ config/application.rb | 10 +++ config/boot.rb | 14 +++ config/database.yml | 2 +- config/initializers/carrierwave.rb | 25 ++++++ spec/factories.rb | 16 ++++ spec/features/artifact_updates_spec.rb | 37 ++++++++ spec/spec_db.rb | 28 ++++++ spec/spec_helper.rb | 17 ++++ spec/support/uses_temp_files.rb | 33 +++++++ spec/support/utilities.rb | 15 ++++ 14 files changed, 311 insertions(+), 42 deletions(-) create mode 100644 app/admin/jam_ruby_artifact_updates.rb create mode 100644 config/initializers/carrierwave.rb create mode 100644 spec/factories.rb create mode 100644 spec/features/artifact_updates_spec.rb create mode 100644 spec/spec_db.rb create mode 100644 spec/support/uses_temp_files.rb create mode 100644 spec/support/utilities.rb diff --git a/.gitignore b/.gitignore index 267357b2b..3499f2018 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ /tmp *~ *.swp +artifacts +*.iml +.idea diff --git a/Gemfile b/Gemfile index 2d8a80354..e7d23fbb1 100644 --- a/Gemfile +++ b/Gemfile @@ -32,15 +32,15 @@ group :assets do end gem 'will_paginate', '3.0.3' gem 'bootstrap-will_paginate', '0.0.6' - +gem 'carrierwave' gem 'uuidtools', '2.1.2' gem 'bcrypt-ruby', '3.0.1' gem 'jquery-rails' - gem 'activeadmin' gem "meta_search", '>= 1.1.0.pre' - +gem 'fog', "~> 1.3.1" gem 'country-select' +gem 'aasm', '3.0.16' gem 'eventmachine', '1.0.0' gem 'amqp', '0.9.8' @@ -77,10 +77,14 @@ end # gem 'debugger' group :development, :test do - gem 'rspec-rails', '2.11.0' + gem 'capybara' + gem 'rspec-rails' gem 'guard-rspec', '0.5.5' gem 'jasmine', '1.3.1' gem 'pry' gem 'execjs', '1.4.0' gem 'therubyracer' #, '0.11.0beta8' + gem 'factory_girl_rails', '4.1.0' + gem 'database_cleaner', '0.7.0' + gem 'launchy' end diff --git a/Gemfile.lock b/Gemfile.lock index fbea59e01..d0d0810d4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,6 +18,7 @@ GEM remote: https://rubygems.org/ remote: https://jamjam:blueberryjam@www.jamkazam.com/gems/ specs: + aasm (3.0.16) actionmailer (3.2.9) actionpack (= 3.2.9) mail (~> 2.4.4) @@ -31,8 +32,6 @@ GEM rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.2.1) - active_scaffold (3.2.17) - rails (>= 3.1.3) activeadmin (0.5.1) arbre (>= 1.0.1) bourbon (>= 1.0.0) @@ -60,10 +59,10 @@ GEM i18n (~> 0.6) multi_json (~> 1.0) addressable (2.3.2) - amq-client (0.9.10) - amq-protocol (>= 0.9.4) + amq-client (0.9.11) + amq-protocol (>= 1.0.1) eventmachine - amq-protocol (1.0.1) + amq-protocol (1.1.0) amqp (0.9.8) amq-client (~> 0.9.5) amq-protocol (>= 0.9.4) @@ -78,14 +77,24 @@ GEM bootstrap-sass (2.0.4.0) bootstrap-will_paginate (0.0.6) will_paginate - bourbon (3.0.1) + bourbon (3.1.0) sass (>= 3.2.0) thor builder (3.0.4) cabin (0.4.4) json - childprocess (0.3.6) - ffi (~> 1.0, >= 1.0.6) + capybara (2.0.2) + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + selenium-webdriver (~> 2.0) + xpath (~> 1.0.0) + carrierwave (0.8.0) + activemodel (>= 3.2.0) + activesupport (>= 3.2.0) + childprocess (0.3.8) + ffi (~> 1.0, >= 1.0.11) clamp (0.5.0) coderay (1.0.8) coffee-rails (3.2.2) @@ -97,7 +106,8 @@ GEM coffee-script-source (1.4.0) country-select (1.1.1) daemons (1.1.9) - devise (2.2.2) + database_cleaner (0.7.0) + devise (2.2.3) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.1) railties (~> 3.1) @@ -105,10 +115,27 @@ GEM diff-lcs (1.1.3) erubis (2.7.0) eventmachine (1.0.0) + excon (0.13.4) execjs (1.4.0) multi_json (~> 1.0) + factory_girl (4.1.0) + activesupport (>= 3.0.0) + factory_girl_rails (4.1.0) + factory_girl (~> 4.1.0) + railties (>= 3.0.0) fastercsv (1.5.5) ffi (1.3.1) + fog (1.3.1) + builder + excon (~> 0.13.0) + formatador (~> 0.2.0) + mime-types + multi_json (~> 1.0) + net-scp (~> 1.0.4) + net-ssh (>= 2.1.3) + nokogiri (~> 1.5.0) + ruby-hmac + formatador (0.2.4) formtastic (2.2.1) actionpack (>= 3.0) fpm (0.4.6) @@ -117,10 +144,11 @@ GEM cabin (~> 0.4.3) clamp json - guard (1.6.1) + guard (1.6.2) listen (>= 0.6.0) lumberjack (>= 1.0.2) pry (>= 0.9.10) + terminal-table (>= 1.4.3) thor (>= 0.14.6) guard-rspec (0.5.5) guard (>= 0.8.4) @@ -137,18 +165,17 @@ GEM selenium-webdriver (>= 0.1.3) jasmine-core (1.3.1) journey (1.0.4) - jquery-rails (2.1.4) + jquery-rails (2.2.1) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - json (1.7.6) + json (1.7.7) kaminari (0.14.1) actionpack (>= 3.0.0) activesupport (>= 3.0.0) - kgio (2.7.4) + kgio (2.8.0) + launchy (2.2.0) + addressable (~> 2.3) libv8 (3.11.8.13) - libwebsocket (0.1.7.1) - addressable - websocket listen (0.7.2) little-plugger (1.1.3) logging (1.7.2) @@ -166,8 +193,12 @@ GEM activesupport (~> 3.1) polyamorous (~> 0.5.0) method_source (0.8.1) - mime-types (1.19) - multi_json (1.5.0) + mime-types (1.21) + multi_json (1.5.1) + net-scp (1.0.6) + net-ssh (>= 2.6.5) + net-ssh (2.6.5) + nokogiri (1.5.6) orm_adapter (0.4.0) pg (0.14.0) pg_migrate (0.1.6) @@ -177,14 +208,14 @@ GEM polyamorous (0.5.0) activerecord (~> 3.0) polyglot (0.3.3) - pry (0.9.11.3) + pry (0.9.11.4) coderay (~> 1.0.5) method_source (~> 0.8) slop (~> 3.4) - rack (1.4.4) + rack (1.4.5) rack-cache (1.2) rack (>= 0.4) - rack-ssl (1.3.2) + rack-ssl (1.3.3) rack rack-test (0.6.2) rack (>= 1.0) @@ -205,24 +236,27 @@ GEM thor (>= 0.14.6, < 2.0) raindrops (0.10.0) rake (10.0.3) - rdoc (3.12) + rdoc (3.12.1) json (~> 1.4) ref (1.0.2) responders (0.9.3) railties (~> 3.1) - rspec (2.11.0) - rspec-core (~> 2.11.0) - rspec-expectations (~> 2.11.0) - rspec-mocks (~> 2.11.0) - rspec-core (2.11.1) - rspec-expectations (2.11.3) + rspec (2.12.0) + rspec-core (~> 2.12.0) + rspec-expectations (~> 2.12.0) + rspec-mocks (~> 2.12.0) + rspec-core (2.12.2) + rspec-expectations (2.12.1) diff-lcs (~> 1.1.3) - rspec-mocks (2.11.3) - rspec-rails (2.11.0) + rspec-mocks (2.12.2) + rspec-rails (2.12.2) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec (~> 2.11.0) + rspec-core (~> 2.12.0) + rspec-expectations (~> 2.12.0) + rspec-mocks (~> 2.12.0) + ruby-hmac (0.4.0) ruby-protocol-buffers (1.2.2) rubyzip (0.9.9) sass (3.2.5) @@ -230,11 +264,11 @@ GEM railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - selenium-webdriver (2.27.2) + selenium-webdriver (2.29.0) childprocess (>= 0.2.5) - libwebsocket (~> 0.1.3) multi_json (~> 1.0) rubyzip + websocket (~> 1.0.4) sendgrid (1.1.0) json json @@ -244,6 +278,7 @@ GEM multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) + terminal-table (1.4.5) therubyracer (0.11.3) libv8 (~> 3.11.8.12) ref @@ -260,30 +295,37 @@ GEM uglifier (1.3.0) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) - unicorn (4.5.0) + unicorn (4.6.0) kgio (~> 2.6) rack raindrops (~> 0.7) uuidtools (2.1.2) warden (1.2.1) rack (>= 1.0) - websocket (1.0.6) + websocket (1.0.7) will_paginate (3.0.3) + xpath (1.0.0) + nokogiri (~> 1.3) PLATFORMS ruby DEPENDENCIES - active_scaffold + aasm (= 3.0.16) activeadmin amqp (= 0.9.8) bcrypt-ruby (= 3.0.1) bootstrap-sass (= 2.0.4) bootstrap-will_paginate (= 0.0.6) + capybara + carrierwave coffee-rails (~> 3.2.1) country-select + database_cleaner (= 0.7.0) eventmachine (= 1.0.0) execjs (= 1.4.0) + factory_girl_rails (= 4.1.0) + fog (~> 1.3.1) fpm guard-rspec (= 0.5.5) jam_db! @@ -291,13 +333,14 @@ DEPENDENCIES jampb! jasmine (= 1.3.1) jquery-rails + launchy libv8 (~> 3.11.8) logging-rails meta_search (>= 1.1.0.pre) pg_migrate pry rails (= 3.2.9) - rspec-rails (= 2.11.0) + rspec-rails ruby-protocol-buffers (= 1.2.2) sass-rails (~> 3.2.3) sendgrid (= 1.1.0) diff --git a/app/admin/jam_ruby_artifact_updates.rb b/app/admin/jam_ruby_artifact_updates.rb new file mode 100644 index 000000000..ea82e4962 --- /dev/null +++ b/app/admin/jam_ruby_artifact_updates.rb @@ -0,0 +1,24 @@ +ActiveAdmin.register JamRuby::ArtifactUpdate do + menu :label => 'Artifacts' + + config.sort_order = 'product,environment' + + form :html => { :multipart => true } do |f| + f.inputs "Details" do + f.input :version, :hint => "Should match Jenkins build number of artifact" + f.input :environment, :hint => "Typically just 'public'" + f.input :product, :as => :select, :collection => JamRuby::ArtifactUpdate::PRODUCTS + end + f.inputs "Artifact Upload" do + f.input :uri, :as => :file, :hint => "Upload the artifact from Jenkins" + end + + f.buttons + + end + + #collection_action :upload_artifact, :method => :post do + # # Do some CSV importing work here... + # redirect_to :action => :index, :notice => "CSV imported successfully!" + #end +end diff --git a/config/application.rb b/config/application.rb index 99bc3283a..a42f511a9 100644 --- a/config/application.rb +++ b/config/application.rb @@ -62,5 +62,15 @@ module JamAdmin # to make active_admin assets precompile config.assets.precompile += ['active_admin.css', 'active_admin.js', 'active_admin/print.css'] + + # set to false to instead use amazon. You will also need to supply amazon secrets + config.store_artifacts_to_disk = true + + # these only need to be set if store_artifact_to_files = false + config.aws_artifact_access_key_id = ENV['AWS_KEY'] + config.aws_artifact_secret_access_key = ENV['AWS_SECRET'] + config.aws_artifact_region = 'us-east-1' + config.aws_artifact_bucket = 'jamkazam-dev' + config.aws_artifact_cache = '315576000' end end diff --git a/config/boot.rb b/config/boot.rb index 170a460bb..f0a158207 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -6,4 +6,18 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +# include JamRuby as it's our common library include JamRuby + + +# change default port of jam-admin so that it's easy to run both +require 'rails/commands/server' + +module Rails + class Server + alias :default_options_alias :default_options + def default_options + default_options_alias.merge!(:Port => 3333) + end + end +end \ No newline at end of file diff --git a/config/database.yml b/config/database.yml index 2664c08ae..dbacbabc4 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,6 +1,6 @@ test: adapter: postgresql - database: jam_websockets_test + database: jam_admin_test host: localhost port: 5432 pool: 3 diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb new file mode 100644 index 000000000..5915f635e --- /dev/null +++ b/config/initializers/carrierwave.rb @@ -0,0 +1,25 @@ +require 'carrierwave' + +CarrierWave.root = Rails.root.join(Rails.public_path).to_s +CarrierWave.base_path = ENV['RAILS_RELATIVE_URL_ROOT'] + +CarrierWave.configure do |config| + if JamAdmin::Application.config.store_artifacts_to_disk + config.storage = :file + else + config.storage = :fog + config.fog_credentials = { + :provider => 'AWS', + :aws_access_key_id => JamAdmin::Application.config.aws_artifact_access_key_id, + :aws_secret_access_key => JamAdmin::Application.config.aws_artifact_secret_access_key, + :region => JamAdmin::Application.config.aws_artifact_region, + } + config.fog_directory = JamAdmin::Application.config.aws_artifact_bucket # required + config.fog_public = true # optional, defaults to true + config.fog_attributes = {'Cache-Control'=>"max-age=#{JamAdmin::Application.config.aws_artifact_cache}"} # optional, defaults to {} + end +end + +require 'carrierwave/orm/activerecord' + + diff --git a/spec/factories.rb b/spec/factories.rb new file mode 100644 index 000000000..da3371e8a --- /dev/null +++ b/spec/factories.rb @@ -0,0 +1,16 @@ +FactoryGirl.define do + factory :user, :class => AdminUser do + sequence(:email) { |n| "person_#{n}@example.com"} + password "foobar" + password_confirmation "foobar" + end + + factory :artifact_update, :class => JamRuby::ArtifactUpdate do + sequence(:version) { |n| "0.1.#{n}" } + uri { "http://somewhere/jkclient.msi" } + product { "JamClient/Win32" } + environment { "public" } + sha1 { "blurp" } + end + +end diff --git a/spec/features/artifact_updates_spec.rb b/spec/features/artifact_updates_spec.rb new file mode 100644 index 000000000..e61475501 --- /dev/null +++ b/spec/features/artifact_updates_spec.rb @@ -0,0 +1,37 @@ +require 'spec_helper' + +describe "Artifact Update" do + + include UsesTempFiles + ARTIFACT_FILE='jkclient-0.1.1.exe' + + subject { page } + + let(:user) { FactoryGirl.create(:user) } + before { sign_in user } + + describe "crud" do + before { visit admin_jam_ruby_artifact_updates_path } + it { should have_selector('h2', text: "Jam Ruby Artifact Updates") } + + describe "upload artifact" do + + in_directory_with_file(ARTIFACT_FILE) + + before do + visit new_admin_jam_ruby_artifact_update_path + fill_in "jam_ruby_artifact_update_version", with: "1" + fill_in "jam_ruby_artifact_update_environment", with: "public" + select('JamClient/Win32', from: "jam_ruby_artifact_update_product") + fill_in "jam_ruby_artifact_update_environment", with: "public" + attach_file("jam_ruby_artifact_update_uri", ARTIFACT_FILE) + click_button "Create Artifact update" + end + + # Successful sign-in goes to the client + it { + save_and_open_page + should have_selector('.flash.flash_notice', text: "Artifact update was successfully created." ) } + end + end +end diff --git a/spec/spec_db.rb b/spec/spec_db.rb new file mode 100644 index 000000000..d3fc33e9a --- /dev/null +++ b/spec/spec_db.rb @@ -0,0 +1,28 @@ +class SpecDb + + TEST_DB_NAME="jam_admin_test" + + def self.recreate_database(db_config) + recreate_database_jdbc(db_config) + end + + def self.recreate_database_jdbc(db_config) + db_test_name = db_config["database"] + # jump into the 'postgres' database, just so we have somewhere to 'land' other than our test db, + # since we are going to drop/recreate it + db_config["database"] = "postgres" + ActiveRecord::Base.establish_connection(db_config) + ActiveRecord::Base.connection.execute("DROP DATABASE IF EXISTS #{db_test_name}") + ActiveRecord::Base.connection.execute("CREATE DATABASE #{db_test_name}") + db_config["database"] = db_test_name + JamDb::Migrator.new.migrate(:dbname => db_config["database"], :user => db_config["username"], :password => db_config["password"], :host => db_config["host"]) + end + + def self.recreate_database_pg + + conn = PG::Connection.open("dbname=postgres") + conn.exec("DROP DATABASE IF EXISTS #{TEST_DB_NAME}") + conn.exec("CREATE DATABASE #{TEST_DB_NAME}") + JamDb::Migrator.new.migrate(:dbname => TEST_DB_NAME) + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 090912782..0d352bac4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,13 +1,30 @@ + +# provision database +require 'active_record' +require 'jam_db' +require 'jam_ruby' +require 'spec_db' +# recreate test database and migrate it +db_config = YAML::load(File.open('config/database.yml'))["test"] +SpecDb::recreate_database(db_config) + # This file is copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'rspec/autorun' +# load capybara +require 'capybara/rails' + +#include Rails.application.routes.url_helpers + # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} + + RSpec.configure do |config| # ## Mock Framework # diff --git a/spec/support/uses_temp_files.rb b/spec/support/uses_temp_files.rb new file mode 100644 index 000000000..263bfed1b --- /dev/null +++ b/spec/support/uses_temp_files.rb @@ -0,0 +1,33 @@ +#http://gabebw.wordpress.com/2011/03/21/temp-files-in-rspec/ + +# this will make a folder jam-ruby/spec/tmp if used in an rspec test, and delete it after +# our .gitignore would also keep spec/tmp out, if somehow it did not get deleted. +module UsesTempFiles + def self.included(example_group) + example_group.extend(self) + end + + def in_directory_with_file(file) + before do + @pwd = Dir.pwd + @tmp_dir = File.join(File.dirname(__FILE__), 'tmp') + FileUtils.mkdir_p(@tmp_dir) + Dir.chdir(@tmp_dir) + + FileUtils.mkdir_p(File.dirname(file)) + FileUtils.touch(file) + end + + define_method(:content_for_file) do |content| + f = File.new(File.join(@tmp_dir, file), 'a+') + f.write(content) + f.flush # VERY IMPORTANT + f.close + end + + after do + Dir.chdir(@pwd) + FileUtils.rm_rf(@tmp_dir) + end + end +end \ No newline at end of file diff --git a/spec/support/utilities.rb b/spec/support/utilities.rb new file mode 100644 index 000000000..94e08ed21 --- /dev/null +++ b/spec/support/utilities.rb @@ -0,0 +1,15 @@ +include ApplicationHelper + +def cookie_jar + Capybara.current_session.driver.browser.current_session.instance_variable_get(:@rack_mock_session).cookie_jar +end + +def sign_in(user) + visit new_admin_user_session_path # login page + fill_in "Email", with: user.email + fill_in "Password", with: user.password + click_button "Login" + + # Sign in when not using Capybara as well. + #cookie_jar[:remember_token] = user.remember_token +end \ No newline at end of file From 81008b5dfce1a1ac170b0e81495490742f4e74a0 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 13 Feb 2013 00:52:32 -0600 Subject: [PATCH 27/56] * prefering aasm with version matching jam-ruby --- Gemfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Gemfile b/Gemfile index ef961323b..e7d23fbb1 100644 --- a/Gemfile +++ b/Gemfile @@ -88,5 +88,3 @@ group :development, :test do gem 'database_cleaner', '0.7.0' gem 'launchy' end - -gem 'aasm' From 4fdaae875b81607a49fb04cde0c287cf79a668bf Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 13 Feb 2013 21:25:17 -0600 Subject: [PATCH 28/56] * removing superflous launchy refeence --- spec/features/artifact_updates_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/features/artifact_updates_spec.rb b/spec/features/artifact_updates_spec.rb index e61475501..a5b43fd40 100644 --- a/spec/features/artifact_updates_spec.rb +++ b/spec/features/artifact_updates_spec.rb @@ -30,7 +30,6 @@ describe "Artifact Update" do # Successful sign-in goes to the client it { - save_and_open_page should have_selector('.flash.flash_notice', text: "Artifact update was successfully created." ) } end end From 64baaae9a9d93f9d567e77100c3041259af22216 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 1 Mar 2013 07:37:10 -0600 Subject: [PATCH 29/56] * VRFS-259: changing some defaults of user signup; also fixing emails not being sent as new user is created --- Gemfile.lock | 68 +++++++++++++------------- app/admin/jam_ruby_users.rb | 17 +++++++ config/initializers/email.rb | 11 +++++ config/initializers/jam_ruby_user.rb | 10 +++- spec/features/artifact_updates_spec.rb | 1 - spec/features/jam_ruby_users.rb | 38 ++++++++++++++ 6 files changed, 109 insertions(+), 36 deletions(-) create mode 100644 config/initializers/email.rb create mode 100644 spec/features/jam_ruby_users.rb diff --git a/Gemfile.lock b/Gemfile.lock index 013ad9b1f..7e6b7a190 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,16 +1,16 @@ PATH - remote: /home/jam/workspace/jam-db/target/ruby_package + remote: ~/workspace/jam-db/target/ruby_package specs: jam_db (0.0.1) pg_migrate (= 0.1.6) PATH - remote: /home/jam/workspace/jam-pb/target/ruby/jampb + remote: ~/workspace/jam-pb/target/ruby/jampb specs: jampb (0.0.1) PATH - remote: /home/jam/workspace/jam-ruby + remote: ~/workspace/jam-ruby specs: jam_ruby (0.0.1) @@ -58,9 +58,9 @@ GEM activesupport (3.2.9) i18n (~> 0.6) multi_json (~> 1.0) - addressable (2.3.2) - amq-client (0.9.11) - amq-protocol (>= 1.0.1) + addressable (2.3.3) + amq-client (0.9.12) + amq-protocol (>= 1.2.0) eventmachine amq-protocol (1.2.0) amqp (0.9.8) @@ -77,7 +77,7 @@ GEM bootstrap-sass (2.0.4.0) bootstrap-will_paginate (0.0.6) will_paginate - bourbon (3.1.0) + bourbon (3.1.1) sass (>= 3.2.0) thor builder (3.0.4) @@ -96,14 +96,14 @@ GEM childprocess (0.3.8) ffi (~> 1.0, >= 1.0.11) clamp (0.5.0) - coderay (1.0.8) + coderay (1.0.9) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.4.0) + coffee-script-source (1.5.0) country-select (1.1.1) daemons (1.1.9) database_cleaner (0.7.0) @@ -112,7 +112,7 @@ GEM orm_adapter (~> 0.1) railties (~> 3.1) warden (~> 1.2.1) - diff-lcs (1.1.3) + diff-lcs (1.2.1) erubis (2.7.0) eventmachine (1.0.0) excon (0.13.4) @@ -124,7 +124,7 @@ GEM factory_girl (~> 4.1.0) railties (>= 3.0.0) fastercsv (1.5.5) - ffi (1.3.1) + ffi (1.4.0) fog (1.3.1) builder excon (~> 0.13.0) @@ -154,7 +154,7 @@ GEM guard (>= 0.8.4) has_scope (0.5.1) hike (1.2.1) - i18n (0.6.1) + i18n (0.6.4) inherited_resources (1.3.1) has_scope (~> 0.5.0) responders (~> 0.6) @@ -176,7 +176,7 @@ GEM launchy (2.2.0) addressable (~> 2.3) libv8 (3.11.8.13) - listen (0.7.2) + listen (0.7.3) little-plugger (1.1.3) logging (1.7.2) little-plugger (>= 1.1.3) @@ -194,9 +194,9 @@ GEM polyamorous (~> 0.5.0) method_source (0.8.1) mime-types (1.21) - multi_json (1.6.0) - net-scp (1.0.4) - net-ssh (>= 1.99.1) + multi_json (1.6.1) + net-scp (1.0.6) + net-ssh (>= 2.6.5) net-ssh (2.6.5) nokogiri (1.5.6) orm_adapter (0.4.0) @@ -236,35 +236,35 @@ GEM thor (>= 0.14.6, < 2.0) raindrops (0.10.0) rake (10.0.3) - rdoc (3.12.1) + rdoc (3.12.2) json (~> 1.4) ref (1.0.2) responders (0.9.3) railties (~> 3.1) - rspec (2.12.0) - rspec-core (~> 2.12.0) - rspec-expectations (~> 2.12.0) - rspec-mocks (~> 2.12.0) - rspec-core (2.12.2) - rspec-expectations (2.12.1) - diff-lcs (~> 1.1.3) - rspec-mocks (2.12.2) - rspec-rails (2.12.2) + rspec (2.13.0) + rspec-core (~> 2.13.0) + rspec-expectations (~> 2.13.0) + rspec-mocks (~> 2.13.0) + rspec-core (2.13.0) + rspec-expectations (2.13.0) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.13.0) + rspec-rails (2.13.0) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 2.12.0) - rspec-expectations (~> 2.12.0) - rspec-mocks (~> 2.12.0) + rspec-core (~> 2.13.0) + rspec-expectations (~> 2.13.0) + rspec-mocks (~> 2.13.0) ruby-hmac (0.4.0) ruby-protocol-buffers (1.2.2) rubyzip (0.9.9) - sass (3.2.5) + sass (3.2.6) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - selenium-webdriver (2.29.0) + selenium-webdriver (2.30.0) childprocess (>= 0.2.5) multi_json (~> 1.0) rubyzip @@ -279,7 +279,7 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) terminal-table (1.4.5) - therubyracer (0.11.3) + therubyracer (0.11.4) libv8 (~> 3.11.8.12) ref thin (1.5.0) @@ -287,7 +287,7 @@ GEM eventmachine (>= 0.12.6) rack (>= 1.0.0) thor (0.15.4) - tilt (1.3.3) + tilt (1.3.4) treetop (1.4.12) polyglot polyglot (>= 0.3.1) @@ -295,7 +295,7 @@ GEM uglifier (1.3.0) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) - unicorn (4.6.0) + unicorn (4.6.2) kgio (~> 2.6) rack raindrops (~> 0.7) diff --git a/app/admin/jam_ruby_users.rb b/app/admin/jam_ruby_users.rb index 7080c5fa8..27968a33f 100644 --- a/app/admin/jam_ruby_users.rb +++ b/app/admin/jam_ruby_users.rb @@ -92,4 +92,21 @@ ActiveAdmin.register JamRuby::User do end end + + controller do + + def create + @jam_ruby_user = JamRuby::User.new(params[:jam_ruby_user]) + @jam_ruby_user.administratively_created = true + if @jam_ruby_user.password.nil? || @jam_ruby_user.password.length == 0 + # a nil password in the form means we simply won't create one; however, + # the password_digest has to be set to something to make 'has_secure_password' happy + @jam_ruby_user.password_digest = SecureRandom.urlsafe_base64 + end + + # call `create!` to ensure that the rest of the action continues as normal + create! + end + end + end diff --git a/config/initializers/email.rb b/config/initializers/email.rb new file mode 100644 index 000000000..8b6bb118f --- /dev/null +++ b/config/initializers/email.rb @@ -0,0 +1,11 @@ +ActionMailer::Base.raise_delivery_errors = true +ActionMailer::Base.delivery_method = Rails.env == "test" ? :test : :smtp +ActionMailer::Base.smtp_settings = { + :address => "smtp.sendgrid.net", + :port => 587, + :domain => "www.jamkazam.com", + :authentication => :plain, + :user_name => "jamkazam", + :password => "jamjamblueberryjam", + :enable_starttls_auto => true +} \ No newline at end of file diff --git a/config/initializers/jam_ruby_user.rb b/config/initializers/jam_ruby_user.rb index 1d6887321..9c8ef68a5 100644 --- a/config/initializers/jam_ruby_user.rb +++ b/config/initializers/jam_ruby_user.rb @@ -25,6 +25,14 @@ class JamRuby::User end end + def country + @country = "United States" + end + + def musician + @musician = true + end + def confirm_url @signup_confirm_url ||= CONFIRM_URL end @@ -54,7 +62,7 @@ class JamRuby::User if EMAIL_TMPL_WELCOMES.index(self.email_template).nil? self.email_template = EMAIL_TMPL_WELCOME end - UserMailer.send(self.email_template, self, "#{url}/#{self.signup_token}") + UserMailer.send(self.email_template, self, "#{url}/#{self.signup_token}").deliver end after_save do diff --git a/spec/features/artifact_updates_spec.rb b/spec/features/artifact_updates_spec.rb index a5b43fd40..c6e7df0b8 100644 --- a/spec/features/artifact_updates_spec.rb +++ b/spec/features/artifact_updates_spec.rb @@ -28,7 +28,6 @@ describe "Artifact Update" do click_button "Create Artifact update" end - # Successful sign-in goes to the client it { should have_selector('.flash.flash_notice', text: "Artifact update was successfully created." ) } end diff --git a/spec/features/jam_ruby_users.rb b/spec/features/jam_ruby_users.rb new file mode 100644 index 000000000..e1edda0ef --- /dev/null +++ b/spec/features/jam_ruby_users.rb @@ -0,0 +1,38 @@ +require 'spec_helper' + +describe "End Users" do + + subject { page } + + # create an administrative user + let(:user) { FactoryGirl.create(:user) } + + before { sign_in user } + + describe "enduser management" do + + # let's go the management page for users + before { visit admin_jam_ruby_users_path } + it { should have_selector('h2', text: "Jam Ruby Users") } + + describe "create new user" do + + before do + + # create a new user + visit new_admin_jam_ruby_user_path + fill_in "jam_ruby_user_email", with: "some_silly_guy@sillyguys.com" + click_button "Create User" + + end + + it { + # ok we should see the a flash that the user was created, and that an email was sent + sleep 5 + save_and_open_page + should have_selector('.flash.flash_notice', text: "User was successfully created." ); + UserMailer.deliveries.length.should == 1 + } + end + end +end From 73eb44e0412ef3e941eb14e8d3338b708878f27f Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sat, 2 Mar 2013 13:51:54 -0600 Subject: [PATCH 30/56] * jam-admin broke due to moving dependency. backstory is: https://github.com/gregbell/active_admin/issues/1939 --- Gemfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gemfile b/Gemfile index e7d23fbb1..b98c0d8ff 100644 --- a/Gemfile +++ b/Gemfile @@ -29,6 +29,9 @@ group :assets do # gem 'therubyracer', :platforms => :ruby gem 'uglifier', '>= 1.0.3' + + # this version is pinned due to this: https://github.com/gregbell/active_admin/issues/1939 + gem 'coffee-script-source', '~> 1.4.0' # ADD THIS LINE, 1.5.0 doesn't compile ActiveAdmin JavaScript files end gem 'will_paginate', '3.0.3' gem 'bootstrap-will_paginate', '0.0.6' From 51c7eac5b1d397dc9ef23ce90a23a00156fb0290 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 14 Mar 2013 23:24:13 -0500 Subject: [PATCH 31/56] * VRFS-259: beta signup --- Gemfile | 1 + Gemfile.lock | 20 +++++++------ app/admin/admin_user.rb | 20 ------------- app/admin/jam_ruby_invited_users.rb | 25 ++++++++++++++++ app/admin/user.rb | 8 ++++++ app/assets/javascripts/active_admin.js | 1 + app/models/admin_user.rb | 40 -------------------------- config/application.rb | 9 +++++- config/initializers/active_admin.rb | 6 ++-- config/initializers/jam_ruby_user.rb | 8 +++--- config/routes.rb | 3 +- spec/factories.rb | 37 ++++++++++++++++++++++-- spec/features/artifact_updates_spec.rb | 2 +- spec/features/invited_users_spec.rb | 37 ++++++++++++++++++++++++ spec/features/jam_ruby_users.rb | 38 ------------------------ spec/spec_helper.rb | 5 +++- spec/support/utilities.rb | 4 +-- 17 files changed, 143 insertions(+), 121 deletions(-) delete mode 100644 app/admin/admin_user.rb create mode 100644 app/admin/jam_ruby_invited_users.rb create mode 100644 app/admin/user.rb delete mode 100644 app/models/admin_user.rb create mode 100644 spec/features/invited_users_spec.rb delete mode 100644 spec/features/jam_ruby_users.rb diff --git a/Gemfile b/Gemfile index b98c0d8ff..9a552a3b7 100644 --- a/Gemfile +++ b/Gemfile @@ -39,6 +39,7 @@ gem 'carrierwave' gem 'uuidtools', '2.1.2' gem 'bcrypt-ruby', '3.0.1' gem 'jquery-rails' +gem 'rails3-jquery-autocomplete' gem 'activeadmin' gem "meta_search", '>= 1.1.0.pre' gem 'fog', "~> 1.3.1" diff --git a/Gemfile.lock b/Gemfile.lock index 7e6b7a190..26038cfc7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -93,9 +93,9 @@ GEM carrierwave (0.8.0) activemodel (>= 3.2.0) activesupport (>= 3.2.0) - childprocess (0.3.8) + childprocess (0.3.9) ffi (~> 1.0, >= 1.0.11) - clamp (0.5.0) + clamp (0.5.1) coderay (1.0.9) coffee-rails (3.2.2) coffee-script (>= 2.2.0) @@ -103,7 +103,7 @@ GEM coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.5.0) + coffee-script-source (1.4.0) country-select (1.1.1) daemons (1.1.9) database_cleaner (0.7.0) @@ -197,7 +197,7 @@ GEM multi_json (1.6.1) net-scp (1.0.6) net-ssh (>= 2.6.5) - net-ssh (2.6.5) + net-ssh (2.6.6) nokogiri (1.5.6) orm_adapter (0.4.0) pg (0.14.0) @@ -227,6 +227,8 @@ GEM activesupport (= 3.2.9) bundler (~> 1.0) railties (= 3.2.9) + rails3-jquery-autocomplete (1.0.11) + rails (~> 3.0) railties (3.2.9) actionpack (= 3.2.9) activesupport (= 3.2.9) @@ -259,12 +261,12 @@ GEM ruby-hmac (0.4.0) ruby-protocol-buffers (1.2.2) rubyzip (0.9.9) - sass (3.2.6) + sass (3.2.7) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - selenium-webdriver (2.30.0) + selenium-webdriver (2.31.0) childprocess (>= 0.2.5) multi_json (~> 1.0) rubyzip @@ -287,11 +289,11 @@ GEM eventmachine (>= 0.12.6) rack (>= 1.0.0) thor (0.15.4) - tilt (1.3.4) + tilt (1.3.5) treetop (1.4.12) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.35) + tzinfo (0.3.36) uglifier (1.3.0) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) @@ -320,6 +322,7 @@ DEPENDENCIES capybara carrierwave coffee-rails (~> 3.2.1) + coffee-script-source (~> 1.4.0) country-select database_cleaner (= 0.7.0) eventmachine (= 1.0.0) @@ -340,6 +343,7 @@ DEPENDENCIES pg_migrate pry rails (= 3.2.9) + rails3-jquery-autocomplete rspec-rails ruby-protocol-buffers (= 1.2.2) sass-rails (~> 3.2.3) diff --git a/app/admin/admin_user.rb b/app/admin/admin_user.rb deleted file mode 100644 index 3aac52f3e..000000000 --- a/app/admin/admin_user.rb +++ /dev/null @@ -1,20 +0,0 @@ -ActiveAdmin.register AdminUser do - index do - column :email - column :current_sign_in_at - column :last_sign_in_at - column :sign_in_count - default_actions - end - - filter :email - - form do |f| - f.inputs "Admin Details" do - f.input :email - f.input :password - f.input :password_confirmation - end - f.actions - end -end diff --git a/app/admin/jam_ruby_invited_users.rb b/app/admin/jam_ruby_invited_users.rb new file mode 100644 index 000000000..e1cc4f2b1 --- /dev/null +++ b/app/admin/jam_ruby_invited_users.rb @@ -0,0 +1,25 @@ +ActiveAdmin.register JamRuby::InvitedUser do + menu :label => 'Invite Users' + + config.sort_order = 'created_at' + + form :html => { :multipart => true } do |f| + f.inputs "Required Data" do + f.input :email, :as => :email, :hint => "The email of the person you want to invite" + f.input :sender,:as => :select, :as => :select, :collection => User.where('admin = true'), :value => nil, :hint => "If you are sending a personalized invitation, then select a user" + f.input :autofriend, :hint => "Do you want the sender of this invite to be friends upon invitation acceptance?" + + end + f.inputs "Optional Stuff" do + f.input :note, :input_html => { :class => 'autogrow' }, :hint => "You can add a personalized note, if you wish" + end + + f.buttons + + end + + #collection_action :upload_artifact, :method => :post do + # # Do some CSV importing work here... + # redirect_to :action => :index, :notice => "CSV imported successfully!" + #end +end diff --git a/app/admin/user.rb b/app/admin/user.rb new file mode 100644 index 000000000..f67079634 --- /dev/null +++ b/app/admin/user.rb @@ -0,0 +1,8 @@ + ActiveAdmin.register JamRuby::User do + # define routes for "autocomplete :admin_user, :email" + collection_action :autocomplete_user_email, :method => :get + + controller do + autocomplete :invited_user, :email + end +end diff --git a/app/assets/javascripts/active_admin.js b/app/assets/javascripts/active_admin.js index d2b66c59f..7498ec940 100644 --- a/app/assets/javascripts/active_admin.js +++ b/app/assets/javascripts/active_admin.js @@ -1 +1,2 @@ //= require active_admin/base +//= require autocomplete-rails \ No newline at end of file diff --git a/app/models/admin_user.rb b/app/models/admin_user.rb deleted file mode 100644 index 9654e04fd..000000000 --- a/app/models/admin_user.rb +++ /dev/null @@ -1,40 +0,0 @@ -class AdminUser < ActiveRecord::Base - # Include default devise modules. Others available are: - # :token_authenticatable, :confirmable, - # :lockable, :timeoutable and :omniauthable - devise :database_authenticatable, - :recoverable, :rememberable, :trackable, :validatable - - # Setup accessible (or protected) attributes for your model - attr_accessible :email, :password, :password_confirmation, :remember_me - - def jam_user - JamRuby::User.where(:email => self.email)[0] - end - - def self.sync_users - JamRuby::User.where(:admin => true).each do |uu| - if (au = self.find_by_email(uu.email)).nil? - au = self.create(:email => uu.email) - au.update_attribute(:encrypted_password, uu.password_digest) - else - if au.encrypted_password != uu.password_digest - au.update_attribute(:encrypted_password, uu.password_digest) - end - end - end - - self.all.each do |au| - if uu = au.jam_user - if uu.admin? - if au.encrypted_password != uu.password_digest - au.update_attribute(:encrypted_password, uu.password_digest) - end - else - au.destroy - end - end - end - end - -end diff --git a/config/application.rb b/config/application.rb index a42f511a9..70117e4d4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -2,14 +2,21 @@ require File.expand_path('../boot', __FILE__) require 'rails/all' +# initialize ActiveRecord's db connection +# why? Because user.rb uses validates :acceptance, which needs a connection to the database. if there is better way... +ActiveRecord::Base.establish_connection(YAML::load(File.open('config/database.yml'))[Rails.env]) + if defined?(Bundler) # If you precompile assets before deploying to production, use this line + Bundler.require(*Rails.groups(:assets => %w(development test))) # If you want your assets lazily compiled in production, use this line # Bundler.require(:default, :assets, Rails.env) end include JamRuby + + module JamAdmin class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. @@ -24,7 +31,7 @@ module JamAdmin # config.plugins = [ :exception_notification, :ssl_requirement, :all ] # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + config.active_record.observers = "JamRuby::InvitedUserObserver" # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. diff --git a/config/initializers/active_admin.rb b/config/initializers/active_admin.rb index 2ac34eb21..6eaf50bd0 100644 --- a/config/initializers/active_admin.rb +++ b/config/initializers/active_admin.rb @@ -55,7 +55,7 @@ ActiveAdmin.setup do |config| # # This setting changes the method which Active Admin calls # within the controller. - config.authentication_method = :authenticate_admin_user! + config.authentication_method = :authenticate_user! # == Current User @@ -65,7 +65,7 @@ ActiveAdmin.setup do |config| # # This setting changes the method which Active Admin calls # to return the currently logged in user. - config.current_user_method = :current_admin_user + config.current_user_method = :current_user # == Logging Out @@ -78,7 +78,7 @@ ActiveAdmin.setup do |config| # will call the method to return the path. # # Default: - config.logout_link_path = :destroy_admin_user_session_path + config.logout_link_path = :destroy_user_session_path # This setting changes the http method used when rendering the # link. For example :get, :delete, :put, etc.. diff --git a/config/initializers/jam_ruby_user.rb b/config/initializers/jam_ruby_user.rb index 9c8ef68a5..dfaebced6 100644 --- a/config/initializers/jam_ruby_user.rb +++ b/config/initializers/jam_ruby_user.rb @@ -1,4 +1,4 @@ -class JamRuby::User + class JamRuby::User EMAIL_TMPL_WELCOME = 'welcome_message' EMAIL_TMPL_WELCOME_BETA = 'welcome_betauser' @@ -50,7 +50,7 @@ class JamRuby::User end def admin_user - AdminUser.where(:email => self.email)[0] + User.where(:email => self.email)[0] end after_create do @@ -62,7 +62,7 @@ class JamRuby::User if EMAIL_TMPL_WELCOMES.index(self.email_template).nil? self.email_template = EMAIL_TMPL_WELCOME end - UserMailer.send(self.email_template, self, "#{url}/#{self.signup_token}").deliver + # UserMailer.send(self.email_template, self, "#{url}/#{self.signup_token}").deliver end after_save do @@ -70,7 +70,7 @@ class JamRuby::User if self.admin_changed? if self.admin if self.admin_user.nil? - au = AdminUser.create(:email => self.email) + au = User.create(:email => self.email) au.update_attribute(:encrypted_password, self.password_digest) end else diff --git a/config/routes.rb b/config/routes.rb index 4942b7681..e03b212b0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,8 @@ JamAdmin::Application.routes.draw do ActiveAdmin.routes(self) - devise_for :admin_users, ActiveAdmin::Devise.config + # ActiveAdmin::Devise.config, + devise_for :users, :class_name => "JamRuby::User" # The priority is based upon order of creation: # first created -> highest priority. diff --git a/spec/factories.rb b/spec/factories.rb index da3371e8a..438107c40 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -1,10 +1,33 @@ FactoryGirl.define do - factory :user, :class => AdminUser do + factory :user, :class => JamRuby::User do sequence(:email) { |n| "person_#{n}@example.com"} + sequence(:first_name) { |n| "Person" } + sequence(:last_name) { |n| "#{n}" } password "foobar" password_confirmation "foobar" - end + email_confirmed true + musician true + city "Apex" + state "NC" + country "USA" + terms_of_service true + + factory :admin do + admin true + end + + before(:create) do |user| + user.musician_instruments << FactoryGirl.build(:musician_instrument, user: user) + end + + factory :single_user_session do + after(:create) do |user, evaluator| + music_session = FactoryGirl.create(:music_session, :creator => user) + connection = FactoryGirl.create(:connection, :user => user, :music_session => music_session) + end + end + end factory :artifact_update, :class => JamRuby::ArtifactUpdate do sequence(:version) { |n| "0.1.#{n}" } uri { "http://somewhere/jkclient.msi" } @@ -13,4 +36,14 @@ FactoryGirl.define do sha1 { "blurp" } end + factory :musician_instrument, :class=> JamRuby::MusicianInstrument do + instrument { Instrument.find('electric guitar') } + proficiency_level 1 + priority 0 + end + + factory :instrument, :class => JamRuby::Instrument do + description { |n| "Instrument #{n}" } + end + end diff --git a/spec/features/artifact_updates_spec.rb b/spec/features/artifact_updates_spec.rb index c6e7df0b8..5c3279fec 100644 --- a/spec/features/artifact_updates_spec.rb +++ b/spec/features/artifact_updates_spec.rb @@ -7,7 +7,7 @@ describe "Artifact Update" do subject { page } - let(:user) { FactoryGirl.create(:user) } + let(:user) { FactoryGirl.create(:admin) } before { sign_in user } describe "crud" do diff --git a/spec/features/invited_users_spec.rb b/spec/features/invited_users_spec.rb new file mode 100644 index 000000000..0ddf9f89c --- /dev/null +++ b/spec/features/invited_users_spec.rb @@ -0,0 +1,37 @@ +require 'spec_helper' + +describe InvitedUser do + + subject { page } + + # create an administrative user + let(:user) { FactoryGirl.create(:admin) } + + before { sign_in user } + + describe "enduser management" do + + # let's go the management page for users + before { visit admin_jam_ruby_invited_users_path } + it { should have_selector('h2', text: "Jam Ruby Invited Users") } + + describe "create service invite" do + + before do + + # create a new user + visit new_admin_jam_ruby_invited_user_path + fill_in "jam_ruby_invited_user_email", with: "some_silly_guy@jamkazam.com" + #fill_in "jam_ruby_invited_user_sender_id", with: "some_silly_guy@jamkazam.com" + #fill_in "jam_ruby_invited_user_autofriend", with: "some_silly_guy@jamkazam.com" + click_button "Create Invited user" + + end + + it { + should have_selector('.flash.flash_notice', text: "Invited user was successfully created." ); + UserMailer.deliveries.length.should == 1 + } + end + end +end diff --git a/spec/features/jam_ruby_users.rb b/spec/features/jam_ruby_users.rb deleted file mode 100644 index e1edda0ef..000000000 --- a/spec/features/jam_ruby_users.rb +++ /dev/null @@ -1,38 +0,0 @@ -require 'spec_helper' - -describe "End Users" do - - subject { page } - - # create an administrative user - let(:user) { FactoryGirl.create(:user) } - - before { sign_in user } - - describe "enduser management" do - - # let's go the management page for users - before { visit admin_jam_ruby_users_path } - it { should have_selector('h2', text: "Jam Ruby Users") } - - describe "create new user" do - - before do - - # create a new user - visit new_admin_jam_ruby_user_path - fill_in "jam_ruby_user_email", with: "some_silly_guy@sillyguys.com" - click_button "Create User" - - end - - it { - # ok we should see the a flash that the user was created, and that an email was sent - sleep 5 - save_and_open_page - should have_selector('.flash.flash_notice', text: "User was successfully created." ); - UserMailer.deliveries.length.should == 1 - } - end - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0d352bac4..7d3a7f216 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,11 +2,14 @@ # provision database require 'active_record' require 'jam_db' -require 'jam_ruby' require 'spec_db' # recreate test database and migrate it db_config = YAML::load(File.open('config/database.yml'))["test"] SpecDb::recreate_database(db_config) +ActiveRecord::Base.establish_connection(YAML::load(File.open('config/database.yml'))["test"]) + +require 'jam_ruby' + # This file is copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] ||= 'test' diff --git a/spec/support/utilities.rb b/spec/support/utilities.rb index 94e08ed21..2055c9495 100644 --- a/spec/support/utilities.rb +++ b/spec/support/utilities.rb @@ -5,10 +5,10 @@ def cookie_jar end def sign_in(user) - visit new_admin_user_session_path # login page + visit new_user_session_path # login page fill_in "Email", with: user.email fill_in "Password", with: user.password - click_button "Login" + click_button "Sign in" # Sign in when not using Capybara as well. #cookie_jar[:remember_token] = user.remember_token From c910fe5860b5a2ebf6b70f67d2253776df07fc0e Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 15 Mar 2013 00:36:58 -0500 Subject: [PATCH 32/56] * checking in fix for need for RAILS_ENV=test --- spec/spec_helper.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7d3a7f216..7bded3dc9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,7 @@ +ENV["RAILS_ENV"] ||= 'test' + + # provision database require 'active_record' require 'jam_db' @@ -8,11 +11,12 @@ db_config = YAML::load(File.open('config/database.yml'))["test"] SpecDb::recreate_database(db_config) ActiveRecord::Base.establish_connection(YAML::load(File.open('config/database.yml'))["test"]) +# This file is copied to spec/ when you run 'rails generate rspec:install' + require 'jam_ruby' -# This file is copied to spec/ when you run 'rails generate rspec:install' -ENV["RAILS_ENV"] ||= 'test' + require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'rspec/autorun' From 1f7f308b136b8f355971f320e1560c614e44ea09 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 15 Mar 2013 01:02:55 -0500 Subject: [PATCH 33/56] * fixing startup of jam-admin --- config/boot.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/config/boot.rb b/config/boot.rb index f0a158207..2b59194e5 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,15 +1,10 @@ require 'rubygems' -require 'jam_ruby' # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) -# include JamRuby as it's our common library -include JamRuby - - # change default port of jam-admin so that it's easy to run both require 'rails/commands/server' From a2861c4bb0064b1f6d3b562221549ac9d83dee8d Mon Sep 17 00:00:00 2001 From: Seth Call Date: Tue, 16 Apr 2013 19:39:07 -0500 Subject: [PATCH 34/56] * some old jam-admin changes. I cant say what exactly they do (old mac recovery) --- config/application.rb | 2 + config/routes.rb | 114 ++++++++++++++++++++++++------------------ 2 files changed, 66 insertions(+), 50 deletions(-) diff --git a/config/application.rb b/config/application.rb index 70117e4d4..b402905fd 100644 --- a/config/application.rb +++ b/config/application.rb @@ -33,6 +33,8 @@ module JamAdmin # Activate observers that should always be running. config.active_record.observers = "JamRuby::InvitedUserObserver" + config.assets.prefix = ENV['RAILS_RELATIVE_URL_ROOT'] || '/' + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # config.time_zone = 'Central Time (US & Canada)' diff --git a/config/routes.rb b/config/routes.rb index e03b212b0..cedeaa5dd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,65 +1,79 @@ JamAdmin::Application.routes.draw do - root :to => "admin/dashboard#index" - - ActiveAdmin.routes(self) # ActiveAdmin::Devise.config, - devise_for :users, :class_name => "JamRuby::User" - # The priority is based upon order of creation: - # first created -> highest priority. - # Sample of regular route: - # match 'products/:id' => 'catalog#view' - # Keep in mind you can assign values other than :controller and :action - # Sample of named route: - # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase - # This route can be invoked with purchase_url(:id => product.id) - # Sample resource route (maps HTTP verbs to controller actions automatically): - # resources :products + devise_for :users, :class_name => "JamRuby::User", :path_prefix => '/admin', :path => '', :path_names => {:sign_in => 'login', :sign_out => 'logout'} - # Sample resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - # Sample resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end + scope ENV['RAILS_RELATIVE_URL_ROOT'] || '/' do + root :to => "admin/dashboard#index" - # Sample resource route with more complex sub-resources - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', :on => :collection - # end - # end - # Sample resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end - # You can have the root of your site routed with "root" - # just remember to delete public/index.html. - # root :to => 'welcome#index' + ActiveAdmin.routes(self) - # See how all your routes lay out with "rake routes" - # This is a legacy wild controller route that's not recommended for RESTful applications. - # Note: This route will make all actions in every controller accessible via GET requests. - # match ':controller(/:action(/:id))(.:format)' + + + # The priority is based upon order of creation: + # first created -> highest priority. + + # Sample of regular route: + # match 'products/:id' => 'catalog#view' + # Keep in mind you can assign values other than :controller and :action + + # Sample of named route: + # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase + # This route can be invoked with purchase_url(:id => product.id) + + # Sample resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Sample resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Sample resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Sample resource route with more complex sub-resources + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', :on => :collection + # end + # end + + # Sample resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end + + # You can have the root of your site routed with "root" + # just remember to delete public/index.html. + # root :to => 'welcome#index' + + # See how all your routes lay out with "rake routes" + + # This is a legacy wild controller route that's not recommended for RESTful applications. + # Note: This route will make all actions in every controller accessible via GET requests. + # match ':controller(/:action(/:id))(.:format)' + end + end From 70831b622b7d91006e995553597b66f253eec51a Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 22 Apr 2013 16:28:10 -0500 Subject: [PATCH 35/56] * fixing jam-admin login break --- Gemfile | 2 +- Gemfile.lock | 169 +++++++++++++------------ app/helpers/application_helper.rb | 1 + config/initializers/active_admin.rb | 4 +- config/routes.rb | 3 - spec/features/artifact_updates_spec.rb | 2 +- spec/features/invited_users_spec.rb | 7 +- 7 files changed, 96 insertions(+), 92 deletions(-) diff --git a/Gemfile b/Gemfile index 9a552a3b7..095d1efd6 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,7 @@ else gem 'jam_ruby' end -gem 'rails', '3.2.9' +gem 'rails' gem 'bootstrap-sass', '2.0.4' gem 'bcrypt-ruby', '3.0.1' diff --git a/Gemfile.lock b/Gemfile.lock index 26038cfc7..0811b290f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,20 +19,20 @@ GEM remote: https://jamjam:blueberryjam@www.jamkazam.com/gems/ specs: aasm (3.0.16) - actionmailer (3.2.9) - actionpack (= 3.2.9) - mail (~> 2.4.4) - actionpack (3.2.9) - activemodel (= 3.2.9) - activesupport (= 3.2.9) + actionmailer (3.2.13) + actionpack (= 3.2.13) + mail (~> 2.5.3) + actionpack (3.2.13) + activemodel (= 3.2.13) + activesupport (= 3.2.13) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) - rack (~> 1.4.0) + rack (~> 1.4.5) rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.2.1) - activeadmin (0.5.1) + activeadmin (0.6.0) arbre (>= 1.0.1) bourbon (>= 1.0.0) devise (>= 1.1.2) @@ -44,25 +44,25 @@ GEM meta_search (>= 0.9.2) rails (>= 3.0.0) sass (>= 3.1.0) - activemodel (3.2.9) - activesupport (= 3.2.9) + activemodel (3.2.13) + activesupport (= 3.2.13) builder (~> 3.0.0) - activerecord (3.2.9) - activemodel (= 3.2.9) - activesupport (= 3.2.9) + activerecord (3.2.13) + activemodel (= 3.2.13) + activesupport (= 3.2.13) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.9) - activemodel (= 3.2.9) - activesupport (= 3.2.9) - activesupport (3.2.9) - i18n (~> 0.6) + activeresource (3.2.13) + activemodel (= 3.2.13) + activesupport (= 3.2.13) + activesupport (3.2.13) + i18n (= 0.6.1) multi_json (~> 1.0) - addressable (2.3.3) + addressable (2.3.4) amq-client (0.9.12) amq-protocol (>= 1.2.0) eventmachine - amq-protocol (1.2.0) + amq-protocol (1.3.0) amqp (0.9.8) amq-client (~> 0.9.5) amq-protocol (>= 0.9.4) @@ -70,32 +70,30 @@ GEM arbre (1.0.1) activesupport (>= 3.0.0) arel (3.0.2) - arr-pm (0.0.7) + arr-pm (0.0.8) cabin (> 0) - backports (2.3.0) + backports (2.6.2) bcrypt-ruby (3.0.1) bootstrap-sass (2.0.4.0) bootstrap-will_paginate (0.0.6) will_paginate - bourbon (3.1.1) + bourbon (3.1.4) sass (>= 3.2.0) thor builder (3.0.4) - cabin (0.4.4) - json - capybara (2.0.2) + cabin (0.6.0) + capybara (2.1.0) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) - selenium-webdriver (~> 2.0) - xpath (~> 1.0.0) + xpath (~> 2.0) carrierwave (0.8.0) activemodel (>= 3.2.0) activesupport (>= 3.2.0) childprocess (0.3.9) ffi (~> 1.0, >= 1.0.11) - clamp (0.5.1) + clamp (0.3.1) coderay (1.0.9) coffee-rails (3.2.2) coffee-script (>= 2.2.0) @@ -112,7 +110,7 @@ GEM orm_adapter (~> 0.1) railties (~> 3.1) warden (~> 1.2.1) - diff-lcs (1.2.1) + diff-lcs (1.2.4) erubis (2.7.0) eventmachine (1.0.0) excon (0.13.4) @@ -124,7 +122,7 @@ GEM factory_girl (~> 4.1.0) railties (>= 3.0.0) fastercsv (1.5.5) - ffi (1.4.0) + ffi (1.7.0) fog (1.3.1) builder excon (~> 0.13.0) @@ -138,26 +136,27 @@ GEM formatador (0.2.4) formtastic (2.2.1) actionpack (>= 3.0) - fpm (0.4.6) - arr-pm (~> 0.0.7) - backports (= 2.3.0) - cabin (~> 0.4.3) - clamp - json - guard (1.6.2) - listen (>= 0.6.0) + fpm (0.4.33) + arr-pm (~> 0.0.8) + backports (= 2.6.2) + cabin (>= 0.6.0) + clamp (= 0.3.1) + json (~> 1.7.7) + open4 + guard (1.8.0) + formatador (>= 0.2.4) + listen (>= 1.0.0) lumberjack (>= 1.0.2) pry (>= 0.9.10) - terminal-table (>= 1.4.3) thor (>= 0.14.6) guard-rspec (0.5.5) guard (>= 0.8.4) has_scope (0.5.1) - hike (1.2.1) - i18n (0.6.4) - inherited_resources (1.3.1) + hike (1.2.2) + i18n (0.6.1) + inherited_resources (1.4.0) has_scope (~> 0.5.0) - responders (~> 0.6) + responders (~> 0.9) jasmine (1.3.1) jasmine-core (~> 1.3.1) rack (~> 1.0) @@ -173,17 +172,20 @@ GEM actionpack (>= 3.0.0) activesupport (>= 3.0.0) kgio (2.8.0) - launchy (2.2.0) + launchy (2.3.0) addressable (~> 2.3) - libv8 (3.11.8.13) - listen (0.7.3) + libv8 (3.11.8.17) + listen (1.0.2) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + rb-kqueue (>= 0.2) little-plugger (1.1.3) logging (1.7.2) little-plugger (>= 1.1.3) logging-rails (0.4.0) logging (~> 1.6) - lumberjack (1.0.2) - mail (2.4.4) + lumberjack (1.0.3) + mail (2.5.3) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) @@ -193,12 +195,13 @@ GEM activesupport (~> 3.1) polyamorous (~> 0.5.0) method_source (0.8.1) - mime-types (1.21) - multi_json (1.6.1) - net-scp (1.0.6) - net-ssh (>= 2.6.5) - net-ssh (2.6.6) - nokogiri (1.5.6) + mime-types (1.23) + multi_json (1.7.2) + net-scp (1.0.4) + net-ssh (>= 1.99.1) + net-ssh (2.6.7) + nokogiri (1.5.9) + open4 (1.3.0) orm_adapter (0.4.0) pg (0.14.0) pg_migrate (0.1.6) @@ -208,7 +211,7 @@ GEM polyamorous (0.5.0) activerecord (~> 3.0) polyglot (0.3.3) - pry (0.9.12) + pry (0.9.12.1) coderay (~> 1.0.5) method_source (~> 0.8) slop (~> 3.4) @@ -219,38 +222,43 @@ GEM rack rack-test (0.6.2) rack (>= 1.0) - rails (3.2.9) - actionmailer (= 3.2.9) - actionpack (= 3.2.9) - activerecord (= 3.2.9) - activeresource (= 3.2.9) - activesupport (= 3.2.9) + rails (3.2.13) + actionmailer (= 3.2.13) + actionpack (= 3.2.13) + activerecord (= 3.2.13) + activeresource (= 3.2.13) + activesupport (= 3.2.13) bundler (~> 1.0) - railties (= 3.2.9) + railties (= 3.2.13) rails3-jquery-autocomplete (1.0.11) rails (~> 3.0) - railties (3.2.9) - actionpack (= 3.2.9) - activesupport (= 3.2.9) + railties (3.2.13) + actionpack (= 3.2.13) + activesupport (= 3.2.13) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) - raindrops (0.10.0) - rake (10.0.3) + raindrops (0.11.0) + rake (10.0.4) + rb-fsevent (0.9.3) + rb-inotify (0.9.0) + ffi (>= 0.5.0) + rb-kqueue (0.2.0) + ffi (>= 0.5.0) rdoc (3.12.2) json (~> 1.4) - ref (1.0.2) + ref (1.0.4) responders (0.9.3) railties (~> 3.1) rspec (2.13.0) rspec-core (~> 2.13.0) rspec-expectations (~> 2.13.0) rspec-mocks (~> 2.13.0) - rspec-core (2.13.0) + rspec-core (2.13.1) rspec-expectations (2.13.0) diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.13.0) + rspec-mocks (2.13.1) rspec-rails (2.13.0) actionpack (>= 3.0) activesupport (>= 3.0) @@ -261,12 +269,12 @@ GEM ruby-hmac (0.4.0) ruby-protocol-buffers (1.2.2) rubyzip (0.9.9) - sass (3.2.7) + sass (3.2.8) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - selenium-webdriver (2.31.0) + selenium-webdriver (2.32.1) childprocess (>= 0.2.5) multi_json (~> 1.0) rubyzip @@ -274,27 +282,26 @@ GEM sendgrid (1.1.0) json json - slop (3.4.3) + slop (3.4.4) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - terminal-table (1.4.5) therubyracer (0.11.4) libv8 (~> 3.11.8.12) ref - thin (1.5.0) + thin (1.5.1) daemons (>= 1.0.9) eventmachine (>= 0.12.6) rack (>= 1.0.0) thor (0.15.4) - tilt (1.3.5) + tilt (1.3.7) treetop (1.4.12) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.36) - uglifier (1.3.0) + tzinfo (0.3.37) + uglifier (2.0.1) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) unicorn (4.6.2) @@ -306,7 +313,7 @@ GEM rack (>= 1.0) websocket (1.0.7) will_paginate (3.0.3) - xpath (1.0.0) + xpath (2.0.0) nokogiri (~> 1.3) PLATFORMS @@ -342,7 +349,7 @@ DEPENDENCIES meta_search (>= 1.1.0.pre) pg_migrate pry - rails (= 3.2.9) + rails rails3-jquery-autocomplete rspec-rails ruby-protocol-buffers (= 1.2.2) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be7945..a2f487023 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,3 @@ module ApplicationHelper + end diff --git a/config/initializers/active_admin.rb b/config/initializers/active_admin.rb index 6eaf50bd0..df2ef1086 100644 --- a/config/initializers/active_admin.rb +++ b/config/initializers/active_admin.rb @@ -55,7 +55,7 @@ ActiveAdmin.setup do |config| # # This setting changes the method which Active Admin calls # within the controller. - config.authentication_method = :authenticate_user! + #config.authentication_method = :authenticate_admin_user! # == Current User @@ -65,7 +65,7 @@ ActiveAdmin.setup do |config| # # This setting changes the method which Active Admin calls # to return the currently logged in user. - config.current_user_method = :current_user + #config.current_user_method = :current_admin_user # == Logging Out diff --git a/config/routes.rb b/config/routes.rb index cedeaa5dd..1e82b08ee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,9 +2,6 @@ JamAdmin::Application.routes.draw do # ActiveAdmin::Devise.config, - - - devise_for :users, :class_name => "JamRuby::User", :path_prefix => '/admin', :path => '', :path_names => {:sign_in => 'login', :sign_out => 'logout'} diff --git a/spec/features/artifact_updates_spec.rb b/spec/features/artifact_updates_spec.rb index 5c3279fec..19e7a8f04 100644 --- a/spec/features/artifact_updates_spec.rb +++ b/spec/features/artifact_updates_spec.rb @@ -29,7 +29,7 @@ describe "Artifact Update" do end it { - should have_selector('.flash.flash_notice', text: "Artifact update was successfully created." ) } + should have_selector('#main_content .panel:first-child h3', text: "Jam Ruby Artifact Update Details" ) } end end end diff --git a/spec/features/invited_users_spec.rb b/spec/features/invited_users_spec.rb index 0ddf9f89c..424c1bdda 100644 --- a/spec/features/invited_users_spec.rb +++ b/spec/features/invited_users_spec.rb @@ -20,6 +20,7 @@ describe InvitedUser do before do # create a new user + UserMailer.deliveries.clear visit new_admin_jam_ruby_invited_user_path fill_in "jam_ruby_invited_user_email", with: "some_silly_guy@jamkazam.com" #fill_in "jam_ruby_invited_user_sender_id", with: "some_silly_guy@jamkazam.com" @@ -28,10 +29,8 @@ describe InvitedUser do end - it { - should have_selector('.flash.flash_notice', text: "Invited user was successfully created." ); - UserMailer.deliveries.length.should == 1 - } + it { should have_selector('#main_content .panel:first-child h3', text: "Jam Ruby Invited User Details" ); } + it { UserMailer.deliveries.length.should == 1 } end end end From 03bfd143db81c63947e0f516624548689711907f Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sat, 18 May 2013 19:04:30 -0500 Subject: [PATCH 36/56] * postgres-copy added to jam-admin --- Gemfile | 1 + Gemfile.lock | 18 ++++++++--------- app/controllers/application_controller.rb | 24 +++++++++++++++++++++++ app/helpers/application_helper.rb | 1 + app/helpers/users_helper.rb | 1 + app/views/layouts/application.html.erb | 1 + config/initializers/active_admin.rb | 4 ++-- config/routes.rb | 9 ++------- 8 files changed, 41 insertions(+), 18 deletions(-) diff --git a/Gemfile b/Gemfile index 095d1efd6..a79417adf 100644 --- a/Gemfile +++ b/Gemfile @@ -45,6 +45,7 @@ gem "meta_search", '>= 1.1.0.pre' gem 'fog', "~> 1.3.1" gem 'country-select' gem 'aasm', '3.0.16' +gem 'postgres-copy' gem 'eventmachine', '1.0.0' gem 'amqp', '0.9.8' diff --git a/Gemfile.lock b/Gemfile.lock index 0811b290f..284972e33 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,7 @@ PATH remote: ~/workspace/jam-db/target/ruby_package specs: jam_db (0.0.1) - pg_migrate (= 0.1.6) + pg_migrate (= 0.1.7) PATH remote: ~/workspace/jam-pb/target/ruby/jampb @@ -62,7 +62,7 @@ GEM amq-client (0.9.12) amq-protocol (>= 1.2.0) eventmachine - amq-protocol (1.3.0) + amq-protocol (1.5.0) amqp (0.9.8) amq-client (~> 0.9.5) amq-protocol (>= 0.9.4) @@ -77,7 +77,7 @@ GEM bootstrap-sass (2.0.4.0) bootstrap-will_paginate (0.0.6) will_paginate - bourbon (3.1.4) + bourbon (3.1.6) sass (>= 3.2.0) thor builder (3.0.4) @@ -122,7 +122,7 @@ GEM factory_girl (~> 4.1.0) railties (>= 3.0.0) fastercsv (1.5.5) - ffi (1.7.0) + ffi (1.8.1) fog (1.3.1) builder excon (~> 0.13.0) @@ -175,7 +175,7 @@ GEM launchy (2.3.0) addressable (~> 2.3) libv8 (3.11.8.17) - listen (1.0.2) + listen (1.0.3) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) rb-kqueue (>= 0.2) @@ -196,7 +196,7 @@ GEM polyamorous (~> 0.5.0) method_source (0.8.1) mime-types (1.23) - multi_json (1.7.2) + multi_json (1.7.3) net-scp (1.0.4) net-ssh (>= 1.99.1) net-ssh (2.6.7) @@ -204,7 +204,7 @@ GEM open4 (1.3.0) orm_adapter (0.4.0) pg (0.14.0) - pg_migrate (0.1.6) + pg_migrate (0.1.7) logging (= 1.7.2) pg (= 0.14.0) thor (= 0.15.4) @@ -259,7 +259,7 @@ GEM rspec-expectations (2.13.0) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.13.1) - rspec-rails (2.13.0) + rspec-rails (2.13.1) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) @@ -296,7 +296,7 @@ GEM eventmachine (>= 0.12.6) rack (>= 1.0.0) thor (0.15.4) - tilt (1.3.7) + tilt (1.4.0) treetop (1.4.12) polyglot polyglot (>= 0.3.1) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e8065d950..be1a244dd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,27 @@ class ApplicationController < ActionController::Base protect_from_forgery + + def authenticate_admin_user! #use predefined method name + session["murp"] = false + puts "session id #{session["session_id"]}" + puts "session #{session.inspect}" + puts "current_user #{current_admin_user} user_signed_in? #{user_signed_in?}" + redirect_to '/' and return if user_signed_in? && !current_user.is_admin? + authenticate_user! + end + def current_admin_user #use predefined method name + puts "current user #{current_user}" + return nil if user_signed_in? && !current_user.is_admin? + current_user + end + + #def authenticate_spawn_ruby_user! + # p "oh hai: #{current_user}:redirecting3" + # + # redirect_to new_user_session_path unless current_user.try(:is_admin?) + #end + + #def current_spawn_ruby_user + # return current_user + #end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a2f487023..6e9385e59 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,3 +1,4 @@ module ApplicationHelper + end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 476a5ae2b..147256533 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -1,2 +1,3 @@ module UsersHelper + end \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b19a0b0c8..1c6037853 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -14,3 +14,4 @@ + 1 \ No newline at end of file diff --git a/config/initializers/active_admin.rb b/config/initializers/active_admin.rb index df2ef1086..cde926609 100644 --- a/config/initializers/active_admin.rb +++ b/config/initializers/active_admin.rb @@ -55,7 +55,7 @@ ActiveAdmin.setup do |config| # # This setting changes the method which Active Admin calls # within the controller. - #config.authentication_method = :authenticate_admin_user! + config.authentication_method = :authenticate_admin_user! # == Current User @@ -65,7 +65,7 @@ ActiveAdmin.setup do |config| # # This setting changes the method which Active Admin calls # to return the currently logged in user. - #config.current_user_method = :current_admin_user + config.current_user_method = :current_admin_user # == Logging Out diff --git a/config/routes.rb b/config/routes.rb index 1e82b08ee..2160c0812 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,19 +2,14 @@ JamAdmin::Application.routes.draw do # ActiveAdmin::Devise.config, - devise_for :users, :class_name => "JamRuby::User", :path_prefix => '/admin', :path => '', :path_names => {:sign_in => 'login', :sign_out => 'logout'} - - scope ENV['RAILS_RELATIVE_URL_ROOT'] || '/' do + devise_for :users, :class_name => "JamRuby::User", :path_prefix => '/', :path => '', :path_names => {:sign_in => 'login', :sign_out => 'logout'} + root :to => "admin/dashboard#index" - - ActiveAdmin.routes(self) - - # The priority is based upon order of creation: # first created -> highest priority. From a4ef4b20efaf67f97b3f0cde1212bff4b3b88d4c Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 3 Jun 2013 06:55:00 -0500 Subject: [PATCH 37/56] Revert "* postgres-copy added to jam-admin" This reverts commit 03bfd143db81c63947e0f516624548689711907f. --- Gemfile | 1 - Gemfile.lock | 18 ++++++++--------- app/controllers/application_controller.rb | 24 ----------------------- app/helpers/application_helper.rb | 1 - app/helpers/users_helper.rb | 1 - app/views/layouts/application.html.erb | 1 - config/initializers/active_admin.rb | 4 ++-- config/routes.rb | 9 +++++++-- 8 files changed, 18 insertions(+), 41 deletions(-) diff --git a/Gemfile b/Gemfile index a79417adf..095d1efd6 100644 --- a/Gemfile +++ b/Gemfile @@ -45,7 +45,6 @@ gem "meta_search", '>= 1.1.0.pre' gem 'fog', "~> 1.3.1" gem 'country-select' gem 'aasm', '3.0.16' -gem 'postgres-copy' gem 'eventmachine', '1.0.0' gem 'amqp', '0.9.8' diff --git a/Gemfile.lock b/Gemfile.lock index 284972e33..0811b290f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,7 @@ PATH remote: ~/workspace/jam-db/target/ruby_package specs: jam_db (0.0.1) - pg_migrate (= 0.1.7) + pg_migrate (= 0.1.6) PATH remote: ~/workspace/jam-pb/target/ruby/jampb @@ -62,7 +62,7 @@ GEM amq-client (0.9.12) amq-protocol (>= 1.2.0) eventmachine - amq-protocol (1.5.0) + amq-protocol (1.3.0) amqp (0.9.8) amq-client (~> 0.9.5) amq-protocol (>= 0.9.4) @@ -77,7 +77,7 @@ GEM bootstrap-sass (2.0.4.0) bootstrap-will_paginate (0.0.6) will_paginate - bourbon (3.1.6) + bourbon (3.1.4) sass (>= 3.2.0) thor builder (3.0.4) @@ -122,7 +122,7 @@ GEM factory_girl (~> 4.1.0) railties (>= 3.0.0) fastercsv (1.5.5) - ffi (1.8.1) + ffi (1.7.0) fog (1.3.1) builder excon (~> 0.13.0) @@ -175,7 +175,7 @@ GEM launchy (2.3.0) addressable (~> 2.3) libv8 (3.11.8.17) - listen (1.0.3) + listen (1.0.2) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) rb-kqueue (>= 0.2) @@ -196,7 +196,7 @@ GEM polyamorous (~> 0.5.0) method_source (0.8.1) mime-types (1.23) - multi_json (1.7.3) + multi_json (1.7.2) net-scp (1.0.4) net-ssh (>= 1.99.1) net-ssh (2.6.7) @@ -204,7 +204,7 @@ GEM open4 (1.3.0) orm_adapter (0.4.0) pg (0.14.0) - pg_migrate (0.1.7) + pg_migrate (0.1.6) logging (= 1.7.2) pg (= 0.14.0) thor (= 0.15.4) @@ -259,7 +259,7 @@ GEM rspec-expectations (2.13.0) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.13.1) - rspec-rails (2.13.1) + rspec-rails (2.13.0) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) @@ -296,7 +296,7 @@ GEM eventmachine (>= 0.12.6) rack (>= 1.0.0) thor (0.15.4) - tilt (1.4.0) + tilt (1.3.7) treetop (1.4.12) polyglot polyglot (>= 0.3.1) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index be1a244dd..e8065d950 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,27 +1,3 @@ class ApplicationController < ActionController::Base protect_from_forgery - - def authenticate_admin_user! #use predefined method name - session["murp"] = false - puts "session id #{session["session_id"]}" - puts "session #{session.inspect}" - puts "current_user #{current_admin_user} user_signed_in? #{user_signed_in?}" - redirect_to '/' and return if user_signed_in? && !current_user.is_admin? - authenticate_user! - end - def current_admin_user #use predefined method name - puts "current user #{current_user}" - return nil if user_signed_in? && !current_user.is_admin? - current_user - end - - #def authenticate_spawn_ruby_user! - # p "oh hai: #{current_user}:redirecting3" - # - # redirect_to new_user_session_path unless current_user.try(:is_admin?) - #end - - #def current_spawn_ruby_user - # return current_user - #end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6e9385e59..a2f487023 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,4 +1,3 @@ module ApplicationHelper - end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 147256533..476a5ae2b 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -1,3 +1,2 @@ module UsersHelper - end \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1c6037853..b19a0b0c8 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -14,4 +14,3 @@ - 1 \ No newline at end of file diff --git a/config/initializers/active_admin.rb b/config/initializers/active_admin.rb index cde926609..df2ef1086 100644 --- a/config/initializers/active_admin.rb +++ b/config/initializers/active_admin.rb @@ -55,7 +55,7 @@ ActiveAdmin.setup do |config| # # This setting changes the method which Active Admin calls # within the controller. - config.authentication_method = :authenticate_admin_user! + #config.authentication_method = :authenticate_admin_user! # == Current User @@ -65,7 +65,7 @@ ActiveAdmin.setup do |config| # # This setting changes the method which Active Admin calls # to return the currently logged in user. - config.current_user_method = :current_admin_user + #config.current_user_method = :current_admin_user # == Logging Out diff --git a/config/routes.rb b/config/routes.rb index 2160c0812..1e82b08ee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,14 +2,19 @@ JamAdmin::Application.routes.draw do # ActiveAdmin::Devise.config, - scope ENV['RAILS_RELATIVE_URL_ROOT'] || '/' do - devise_for :users, :class_name => "JamRuby::User", :path_prefix => '/', :path => '', :path_names => {:sign_in => 'login', :sign_out => 'logout'} + devise_for :users, :class_name => "JamRuby::User", :path_prefix => '/admin', :path => '', :path_names => {:sign_in => 'login', :sign_out => 'logout'} + + scope ENV['RAILS_RELATIVE_URL_ROOT'] || '/' do root :to => "admin/dashboard#index" + + ActiveAdmin.routes(self) + + # The priority is based upon order of creation: # first created -> highest priority. From 92d43fb2aaa652d9c856f2207061eadf8625b5ae Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 3 Jun 2013 07:03:31 -0500 Subject: [PATCH 38/56] * take out acciddentaly devise debugging stuff --- Gemfile | 2 ++ Gemfile.lock | 71 +++++++++++++++++++++++++++++----------------------- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/Gemfile b/Gemfile index 095d1efd6..6f358610a 100644 --- a/Gemfile +++ b/Gemfile @@ -45,6 +45,8 @@ gem "meta_search", '>= 1.1.0.pre' gem 'fog', "~> 1.3.1" gem 'country-select' gem 'aasm', '3.0.16' +gem 'postgres-copy' +gem 'aws-sdk' gem 'eventmachine', '1.0.0' gem 'amqp', '0.9.8' diff --git a/Gemfile.lock b/Gemfile.lock index 0811b290f..19cdf8a61 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,7 @@ PATH remote: ~/workspace/jam-db/target/ruby_package specs: jam_db (0.0.1) - pg_migrate (= 0.1.6) + pg_migrate (= 0.1.7) PATH remote: ~/workspace/jam-pb/target/ruby/jampb @@ -62,7 +62,7 @@ GEM amq-client (0.9.12) amq-protocol (>= 1.2.0) eventmachine - amq-protocol (1.3.0) + amq-protocol (1.6.0) amqp (0.9.8) amq-client (~> 0.9.5) amq-protocol (>= 0.9.4) @@ -72,16 +72,21 @@ GEM arel (3.0.2) arr-pm (0.0.8) cabin (> 0) - backports (2.6.2) + aws-sdk (1.11.0) + json (~> 1.4) + nokogiri (>= 1.4.4) + uuidtools (~> 2.1) + backports (2.3.0) bcrypt-ruby (3.0.1) bootstrap-sass (2.0.4.0) bootstrap-will_paginate (0.0.6) will_paginate - bourbon (3.1.4) + bourbon (3.1.6) sass (>= 3.2.0) thor builder (3.0.4) - cabin (0.6.0) + cabin (0.4.4) + json capybara (2.1.0) mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -93,7 +98,7 @@ GEM activesupport (>= 3.2.0) childprocess (0.3.9) ffi (~> 1.0, >= 1.0.11) - clamp (0.3.1) + clamp (0.6.1) coderay (1.0.9) coffee-rails (3.2.2) coffee-script (>= 2.2.0) @@ -105,7 +110,7 @@ GEM country-select (1.1.1) daemons (1.1.9) database_cleaner (0.7.0) - devise (2.2.3) + devise (2.2.4) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.1) railties (~> 3.1) @@ -122,7 +127,7 @@ GEM factory_girl (~> 4.1.0) railties (>= 3.0.0) fastercsv (1.5.5) - ffi (1.7.0) + ffi (1.8.1) fog (1.3.1) builder excon (~> 0.13.0) @@ -136,13 +141,12 @@ GEM formatador (0.2.4) formtastic (2.2.1) actionpack (>= 3.0) - fpm (0.4.33) - arr-pm (~> 0.0.8) - backports (= 2.6.2) - cabin (>= 0.6.0) - clamp (= 0.3.1) - json (~> 1.7.7) - open4 + fpm (0.4.6) + arr-pm (~> 0.0.7) + backports (= 2.3.0) + cabin (~> 0.4.3) + clamp + json guard (1.8.0) formatador (>= 0.2.4) listen (>= 1.0.0) @@ -164,10 +168,10 @@ GEM selenium-webdriver (>= 0.1.3) jasmine-core (1.3.1) journey (1.0.4) - jquery-rails (2.2.1) + jquery-rails (3.0.0) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - json (1.7.7) + json (1.8.0) kaminari (0.14.1) actionpack (>= 3.0.0) activesupport (>= 3.0.0) @@ -175,7 +179,7 @@ GEM launchy (2.3.0) addressable (~> 2.3) libv8 (3.11.8.17) - listen (1.0.2) + listen (1.1.5) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) rb-kqueue (>= 0.2) @@ -185,8 +189,7 @@ GEM logging-rails (0.4.0) logging (~> 1.6) lumberjack (1.0.3) - mail (2.5.3) - i18n (>= 0.4.0) + mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) meta_search (1.1.3) @@ -196,22 +199,26 @@ GEM polyamorous (~> 0.5.0) method_source (0.8.1) mime-types (1.23) - multi_json (1.7.2) + multi_json (1.7.5) net-scp (1.0.4) net-ssh (>= 1.99.1) net-ssh (2.6.7) nokogiri (1.5.9) - open4 (1.3.0) orm_adapter (0.4.0) pg (0.14.0) - pg_migrate (0.1.6) + pg_migrate (0.1.7) logging (= 1.7.2) pg (= 0.14.0) thor (= 0.15.4) polyamorous (0.5.0) activerecord (~> 3.0) polyglot (0.3.3) - pry (0.9.12.1) + postgres-copy (0.6.0) + activerecord (>= 3.0.0) + pg + rails (>= 3.0.0) + responders + pry (0.9.12.2) coderay (~> 1.0.5) method_source (~> 0.8) slop (~> 3.4) @@ -248,7 +255,7 @@ GEM ffi (>= 0.5.0) rdoc (3.12.2) json (~> 1.4) - ref (1.0.4) + ref (1.0.5) responders (0.9.3) railties (~> 3.1) rspec (2.13.0) @@ -259,7 +266,7 @@ GEM rspec-expectations (2.13.0) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.13.1) - rspec-rails (2.13.0) + rspec-rails (2.13.2) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) @@ -269,12 +276,12 @@ GEM ruby-hmac (0.4.0) ruby-protocol-buffers (1.2.2) rubyzip (0.9.9) - sass (3.2.8) + sass (3.2.9) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - selenium-webdriver (2.32.1) + selenium-webdriver (2.33.0) childprocess (>= 0.2.5) multi_json (~> 1.0) rubyzip @@ -282,7 +289,7 @@ GEM sendgrid (1.1.0) json json - slop (3.4.4) + slop (3.4.5) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) @@ -296,12 +303,12 @@ GEM eventmachine (>= 0.12.6) rack (>= 1.0.0) thor (0.15.4) - tilt (1.3.7) + tilt (1.4.1) treetop (1.4.12) polyglot polyglot (>= 0.3.1) tzinfo (0.3.37) - uglifier (2.0.1) + uglifier (2.1.1) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) unicorn (4.6.2) @@ -323,6 +330,7 @@ DEPENDENCIES aasm (= 3.0.16) activeadmin amqp (= 0.9.8) + aws-sdk bcrypt-ruby (= 3.0.1) bootstrap-sass (= 2.0.4) bootstrap-will_paginate (= 0.0.6) @@ -348,6 +356,7 @@ DEPENDENCIES logging-rails meta_search (>= 1.1.0.pre) pg_migrate + postgres-copy pry rails rails3-jquery-autocomplete From 81b3f56b1a3a1170d344b6493e67db47275a0604 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 3 Jun 2013 07:18:57 -0500 Subject: [PATCH 39/56] * switch to public bucket --- config/application.rb | 1 + config/initializers/carrierwave.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index b402905fd..82b6a9bf8 100644 --- a/config/application.rb +++ b/config/application.rb @@ -79,6 +79,7 @@ module JamAdmin config.aws_artifact_access_key_id = ENV['AWS_KEY'] config.aws_artifact_secret_access_key = ENV['AWS_SECRET'] config.aws_artifact_region = 'us-east-1' + config.aws_artifact_bucket_public = 'jamkazam-dev-public' config.aws_artifact_bucket = 'jamkazam-dev' config.aws_artifact_cache = '315576000' end diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index 5915f635e..8a3a54052 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -14,7 +14,7 @@ CarrierWave.configure do |config| :aws_secret_access_key => JamAdmin::Application.config.aws_artifact_secret_access_key, :region => JamAdmin::Application.config.aws_artifact_region, } - config.fog_directory = JamAdmin::Application.config.aws_artifact_bucket # required + config.fog_directory = JamAdmin::Application.config.aws_artifact_bucket_public # required config.fog_public = true # optional, defaults to true config.fog_attributes = {'Cache-Control'=>"max-age=#{JamAdmin::Application.config.aws_artifact_cache}"} # optional, defaults to {} end From c9759fcd1a3fb0c578b2d0ef1e5adca93c2466ae Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 3 Jun 2013 07:39:59 -0500 Subject: [PATCH 40/56] * updating production aws values, and adding jquery-ui-rails gem because it's no longer a part of jquery-rails --- Gemfile | 1 + Gemfile.lock | 4 ++++ config/environments/production.rb | 3 +++ 3 files changed, 8 insertions(+) diff --git a/Gemfile b/Gemfile index 6f358610a..a83f26da1 100644 --- a/Gemfile +++ b/Gemfile @@ -39,6 +39,7 @@ gem 'carrierwave' gem 'uuidtools', '2.1.2' gem 'bcrypt-ruby', '3.0.1' gem 'jquery-rails' +gem 'jquery-ui-rails' gem 'rails3-jquery-autocomplete' gem 'activeadmin' gem "meta_search", '>= 1.1.0.pre' diff --git a/Gemfile.lock b/Gemfile.lock index 19cdf8a61..2cd70bf02 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -171,6 +171,9 @@ GEM jquery-rails (3.0.0) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) + jquery-ui-rails (4.0.3) + jquery-rails + railties (>= 3.1.0) json (1.8.0) kaminari (0.14.1) actionpack (>= 3.0.0) @@ -351,6 +354,7 @@ DEPENDENCIES jampb! jasmine (= 1.3.1) jquery-rails + jquery-ui-rails launchy libv8 (~> 3.11.8) logging-rails diff --git a/config/environments/production.rb b/config/environments/production.rb index f263f212d..30cd4e4e1 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -70,4 +70,7 @@ JamAdmin::Application.configure do # Show the logging configuration on STDOUT config.show_log_configuration = false + + config.aws_artifact_bucket_public = 'jamkazam-public' + config.aws_artifact_bucket = 'jamkazam' end From a07cb231fa5067668d279e06105b3426cca74499 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 3 Jun 2013 08:09:52 -0500 Subject: [PATCH 41/56] * trying second solution for jquery-ui chage --- Gemfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index a83f26da1..079cca80a 100644 --- a/Gemfile +++ b/Gemfile @@ -38,8 +38,7 @@ gem 'bootstrap-will_paginate', '0.0.6' gem 'carrierwave' gem 'uuidtools', '2.1.2' gem 'bcrypt-ruby', '3.0.1' -gem 'jquery-rails' -gem 'jquery-ui-rails' +gem 'jquery-rails', '2.3.0' # pinned because jquery-ui-rails was split from jquery-rails, but activeadmin doesn't support this gem yet gem 'rails3-jquery-autocomplete' gem 'activeadmin' gem "meta_search", '>= 1.1.0.pre' From 05acfe63ba1ff40e5339d6dff5956a4172266110 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 24 Jun 2013 22:23:08 -0500 Subject: [PATCH 42/56] * adding helper scriptfor running on production --- Gemfile.lock | 57 +++++++++++++++++++++++++++------------------------- run.sh | 4 ++++ 2 files changed, 34 insertions(+), 27 deletions(-) create mode 100644 run.sh diff --git a/Gemfile.lock b/Gemfile.lock index 2cd70bf02..e130b7fe5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -72,21 +72,20 @@ GEM arel (3.0.2) arr-pm (0.0.8) cabin (> 0) - aws-sdk (1.11.0) + aws-sdk (1.11.3) json (~> 1.4) - nokogiri (>= 1.4.4) + nokogiri (< 1.6.0) uuidtools (~> 2.1) - backports (2.3.0) + backports (3.3.2) bcrypt-ruby (3.0.1) bootstrap-sass (2.0.4.0) bootstrap-will_paginate (0.0.6) will_paginate - bourbon (3.1.6) + bourbon (3.1.8) sass (>= 3.2.0) thor builder (3.0.4) - cabin (0.4.4) - json + cabin (0.6.1) capybara (2.1.0) mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -127,7 +126,7 @@ GEM factory_girl (~> 4.1.0) railties (>= 3.0.0) fastercsv (1.5.5) - ffi (1.8.1) + ffi (1.9.0) fog (1.3.1) builder excon (~> 0.13.0) @@ -141,13 +140,20 @@ GEM formatador (0.2.4) formtastic (2.2.1) actionpack (>= 3.0) - fpm (0.4.6) - arr-pm (~> 0.0.7) - backports (= 2.3.0) - cabin (~> 0.4.3) - clamp - json - guard (1.8.0) + fpm (0.4.38) + arr-pm (~> 0.0.8) + backports (>= 2.6.2) + cabin (>= 0.6.0) + childprocess + clamp (~> 0.6) + ftw (~> 0.0.30) + json (>= 1.7.7) + ftw (0.0.34) + addressable + backports (>= 2.6.2) + cabin (> 0) + http_parser.rb (= 0.5.3) + guard (1.8.1) formatador (>= 0.2.4) listen (>= 1.0.0) lumberjack (>= 1.0.2) @@ -156,7 +162,8 @@ GEM guard-rspec (0.5.5) guard (>= 0.8.4) has_scope (0.5.1) - hike (1.2.2) + hike (1.2.3) + http_parser.rb (0.5.3) i18n (0.6.1) inherited_resources (1.4.0) has_scope (~> 0.5.0) @@ -168,12 +175,9 @@ GEM selenium-webdriver (>= 0.1.3) jasmine-core (1.3.1) journey (1.0.4) - jquery-rails (3.0.0) + jquery-rails (2.3.0) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - jquery-ui-rails (4.0.3) - jquery-rails - railties (>= 3.1.0) json (1.8.0) kaminari (0.14.1) actionpack (>= 3.0.0) @@ -182,7 +186,7 @@ GEM launchy (2.3.0) addressable (~> 2.3) libv8 (3.11.8.17) - listen (1.1.5) + listen (1.2.2) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) rb-kqueue (>= 0.2) @@ -202,11 +206,11 @@ GEM polyamorous (~> 0.5.0) method_source (0.8.1) mime-types (1.23) - multi_json (1.7.5) + multi_json (1.7.7) net-scp (1.0.4) net-ssh (>= 1.99.1) net-ssh (2.6.7) - nokogiri (1.5.9) + nokogiri (1.5.10) orm_adapter (0.4.0) pg (0.14.0) pg_migrate (0.1.7) @@ -250,7 +254,7 @@ GEM rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) raindrops (0.11.0) - rake (10.0.4) + rake (10.1.0) rb-fsevent (0.9.3) rb-inotify (0.9.0) ffi (>= 0.5.0) @@ -307,14 +311,14 @@ GEM rack (>= 1.0.0) thor (0.15.4) tilt (1.4.1) - treetop (1.4.12) + treetop (1.4.14) polyglot polyglot (>= 0.3.1) tzinfo (0.3.37) uglifier (2.1.1) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) - unicorn (4.6.2) + unicorn (4.6.3) kgio (~> 2.6) rack raindrops (~> 0.7) @@ -353,8 +357,7 @@ DEPENDENCIES jam_ruby! jampb! jasmine (= 1.3.1) - jquery-rails - jquery-ui-rails + jquery-rails (= 2.3.0) launchy libv8 (~> 3.11.8) logging-rails diff --git a/run.sh b/run.sh new file mode 100644 index 000000000..2020a9502 --- /dev/null +++ b/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# meant to be run on www.jamkazam.com, pre-chef +RAILS_RELATIVE_URL_ROOT=/admin nohup bundle exec rails s & From d862c8a6d32e411dedb3482f9fb4527e547729d2 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 24 Jun 2013 22:25:30 -0500 Subject: [PATCH 43/56] * removing gemfile --- Gemfile.lock | 379 --------------------------------------------------- 1 file changed, 379 deletions(-) delete mode 100644 Gemfile.lock diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index e130b7fe5..000000000 --- a/Gemfile.lock +++ /dev/null @@ -1,379 +0,0 @@ -PATH - remote: ~/workspace/jam-db/target/ruby_package - specs: - jam_db (0.0.1) - pg_migrate (= 0.1.7) - -PATH - remote: ~/workspace/jam-pb/target/ruby/jampb - specs: - jampb (0.0.1) - -PATH - remote: ~/workspace/jam-ruby - specs: - jam_ruby (0.0.1) - -GEM - remote: https://rubygems.org/ - remote: https://jamjam:blueberryjam@www.jamkazam.com/gems/ - specs: - aasm (3.0.16) - actionmailer (3.2.13) - actionpack (= 3.2.13) - mail (~> 2.5.3) - actionpack (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activeadmin (0.6.0) - arbre (>= 1.0.1) - bourbon (>= 1.0.0) - devise (>= 1.1.2) - fastercsv - formtastic (>= 2.0.0) - inherited_resources (>= 1.3.1) - jquery-rails (>= 1.0.0) - kaminari (>= 0.13.0) - meta_search (>= 0.9.2) - rails (>= 3.0.0) - sass (>= 3.1.0) - activemodel (3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - activerecord (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - activesupport (3.2.13) - i18n (= 0.6.1) - multi_json (~> 1.0) - addressable (2.3.4) - amq-client (0.9.12) - amq-protocol (>= 1.2.0) - eventmachine - amq-protocol (1.6.0) - amqp (0.9.8) - amq-client (~> 0.9.5) - amq-protocol (>= 0.9.4) - eventmachine - arbre (1.0.1) - activesupport (>= 3.0.0) - arel (3.0.2) - arr-pm (0.0.8) - cabin (> 0) - aws-sdk (1.11.3) - json (~> 1.4) - nokogiri (< 1.6.0) - uuidtools (~> 2.1) - backports (3.3.2) - bcrypt-ruby (3.0.1) - bootstrap-sass (2.0.4.0) - bootstrap-will_paginate (0.0.6) - will_paginate - bourbon (3.1.8) - sass (>= 3.2.0) - thor - builder (3.0.4) - cabin (0.6.1) - capybara (2.1.0) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (~> 2.0) - carrierwave (0.8.0) - activemodel (>= 3.2.0) - activesupport (>= 3.2.0) - childprocess (0.3.9) - ffi (~> 1.0, >= 1.0.11) - clamp (0.6.1) - coderay (1.0.9) - coffee-rails (3.2.2) - coffee-script (>= 2.2.0) - railties (~> 3.2.0) - coffee-script (2.2.0) - coffee-script-source - execjs - coffee-script-source (1.4.0) - country-select (1.1.1) - daemons (1.1.9) - database_cleaner (0.7.0) - devise (2.2.4) - bcrypt-ruby (~> 3.0) - orm_adapter (~> 0.1) - railties (~> 3.1) - warden (~> 1.2.1) - diff-lcs (1.2.4) - erubis (2.7.0) - eventmachine (1.0.0) - excon (0.13.4) - execjs (1.4.0) - multi_json (~> 1.0) - factory_girl (4.1.0) - activesupport (>= 3.0.0) - factory_girl_rails (4.1.0) - factory_girl (~> 4.1.0) - railties (>= 3.0.0) - fastercsv (1.5.5) - ffi (1.9.0) - fog (1.3.1) - builder - excon (~> 0.13.0) - formatador (~> 0.2.0) - mime-types - multi_json (~> 1.0) - net-scp (~> 1.0.4) - net-ssh (>= 2.1.3) - nokogiri (~> 1.5.0) - ruby-hmac - formatador (0.2.4) - formtastic (2.2.1) - actionpack (>= 3.0) - fpm (0.4.38) - arr-pm (~> 0.0.8) - backports (>= 2.6.2) - cabin (>= 0.6.0) - childprocess - clamp (~> 0.6) - ftw (~> 0.0.30) - json (>= 1.7.7) - ftw (0.0.34) - addressable - backports (>= 2.6.2) - cabin (> 0) - http_parser.rb (= 0.5.3) - guard (1.8.1) - formatador (>= 0.2.4) - listen (>= 1.0.0) - lumberjack (>= 1.0.2) - pry (>= 0.9.10) - thor (>= 0.14.6) - guard-rspec (0.5.5) - guard (>= 0.8.4) - has_scope (0.5.1) - hike (1.2.3) - http_parser.rb (0.5.3) - i18n (0.6.1) - inherited_resources (1.4.0) - has_scope (~> 0.5.0) - responders (~> 0.9) - jasmine (1.3.1) - jasmine-core (~> 1.3.1) - rack (~> 1.0) - rspec (>= 1.3.1) - selenium-webdriver (>= 0.1.3) - jasmine-core (1.3.1) - journey (1.0.4) - jquery-rails (2.3.0) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - json (1.8.0) - kaminari (0.14.1) - actionpack (>= 3.0.0) - activesupport (>= 3.0.0) - kgio (2.8.0) - launchy (2.3.0) - addressable (~> 2.3) - libv8 (3.11.8.17) - listen (1.2.2) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9) - rb-kqueue (>= 0.2) - little-plugger (1.1.3) - logging (1.7.2) - little-plugger (>= 1.1.3) - logging-rails (0.4.0) - logging (~> 1.6) - lumberjack (1.0.3) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - meta_search (1.1.3) - actionpack (~> 3.1) - activerecord (~> 3.1) - activesupport (~> 3.1) - polyamorous (~> 0.5.0) - method_source (0.8.1) - mime-types (1.23) - multi_json (1.7.7) - net-scp (1.0.4) - net-ssh (>= 1.99.1) - net-ssh (2.6.7) - nokogiri (1.5.10) - orm_adapter (0.4.0) - pg (0.14.0) - pg_migrate (0.1.7) - logging (= 1.7.2) - pg (= 0.14.0) - thor (= 0.15.4) - polyamorous (0.5.0) - activerecord (~> 3.0) - polyglot (0.3.3) - postgres-copy (0.6.0) - activerecord (>= 3.0.0) - pg - rails (>= 3.0.0) - responders - pry (0.9.12.2) - coderay (~> 1.0.5) - method_source (~> 0.8) - slop (~> 3.4) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.3) - rack - rack-test (0.6.2) - rack (>= 1.0) - rails (3.2.13) - actionmailer (= 3.2.13) - actionpack (= 3.2.13) - activerecord (= 3.2.13) - activeresource (= 3.2.13) - activesupport (= 3.2.13) - bundler (~> 1.0) - railties (= 3.2.13) - rails3-jquery-autocomplete (1.0.11) - rails (~> 3.0) - railties (3.2.13) - actionpack (= 3.2.13) - activesupport (= 3.2.13) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - raindrops (0.11.0) - rake (10.1.0) - rb-fsevent (0.9.3) - rb-inotify (0.9.0) - ffi (>= 0.5.0) - rb-kqueue (0.2.0) - ffi (>= 0.5.0) - rdoc (3.12.2) - json (~> 1.4) - ref (1.0.5) - responders (0.9.3) - railties (~> 3.1) - rspec (2.13.0) - rspec-core (~> 2.13.0) - rspec-expectations (~> 2.13.0) - rspec-mocks (~> 2.13.0) - rspec-core (2.13.1) - rspec-expectations (2.13.0) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.13.1) - rspec-rails (2.13.2) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 2.13.0) - rspec-expectations (~> 2.13.0) - rspec-mocks (~> 2.13.0) - ruby-hmac (0.4.0) - ruby-protocol-buffers (1.2.2) - rubyzip (0.9.9) - sass (3.2.9) - sass-rails (3.2.6) - railties (~> 3.2.0) - sass (>= 3.1.10) - tilt (~> 1.3) - selenium-webdriver (2.33.0) - childprocess (>= 0.2.5) - multi_json (~> 1.0) - rubyzip - websocket (~> 1.0.4) - sendgrid (1.1.0) - json - json - slop (3.4.5) - sprockets (2.2.2) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - therubyracer (0.11.4) - libv8 (~> 3.11.8.12) - ref - thin (1.5.1) - daemons (>= 1.0.9) - eventmachine (>= 0.12.6) - rack (>= 1.0.0) - thor (0.15.4) - tilt (1.4.1) - treetop (1.4.14) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.37) - uglifier (2.1.1) - execjs (>= 0.3.0) - multi_json (~> 1.0, >= 1.0.2) - unicorn (4.6.3) - kgio (~> 2.6) - rack - raindrops (~> 0.7) - uuidtools (2.1.2) - warden (1.2.1) - rack (>= 1.0) - websocket (1.0.7) - will_paginate (3.0.3) - xpath (2.0.0) - nokogiri (~> 1.3) - -PLATFORMS - ruby - -DEPENDENCIES - aasm (= 3.0.16) - activeadmin - amqp (= 0.9.8) - aws-sdk - bcrypt-ruby (= 3.0.1) - bootstrap-sass (= 2.0.4) - bootstrap-will_paginate (= 0.0.6) - capybara - carrierwave - coffee-rails (~> 3.2.1) - coffee-script-source (~> 1.4.0) - country-select - database_cleaner (= 0.7.0) - eventmachine (= 1.0.0) - execjs (= 1.4.0) - factory_girl_rails (= 4.1.0) - fog (~> 1.3.1) - fpm - guard-rspec (= 0.5.5) - jam_db! - jam_ruby! - jampb! - jasmine (= 1.3.1) - jquery-rails (= 2.3.0) - launchy - libv8 (~> 3.11.8) - logging-rails - meta_search (>= 1.1.0.pre) - pg_migrate - postgres-copy - pry - rails - rails3-jquery-autocomplete - rspec-rails - ruby-protocol-buffers (= 1.2.2) - sass-rails (~> 3.2.3) - sendgrid (= 1.1.0) - therubyracer - thin - uglifier (>= 1.0.3) - unicorn - uuidtools (= 2.1.2) - will_paginate (= 3.0.3) From a6eccc42865b0f3ba6f3c03ca1244d4309c4787c Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 24 Jun 2013 22:31:52 -0500 Subject: [PATCH 44/56] * run as jam-admin --- run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.sh b/run.sh index 2020a9502..65e4c118a 100644 --- a/run.sh +++ b/run.sh @@ -1,4 +1,4 @@ #!/bin/bash # meant to be run on www.jamkazam.com, pre-chef -RAILS_RELATIVE_URL_ROOT=/admin nohup bundle exec rails s & +sudo su jam-admin -c "RAILS_RELATIVE_URL_ROOT=/admin nohup bundle exec rails s &" From 516cfbf164aa3865767b87c41095f789e6757b93 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 26 Jun 2013 00:00:13 -0500 Subject: [PATCH 45/56] * adding API to jam-admin to enable programmatic uploads of artifacts --- app/controllers/artifacts_controller.rb | 29 +++++++++++++++++++++++++ config/routes.rb | 5 +---- 2 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 app/controllers/artifacts_controller.rb diff --git a/app/controllers/artifacts_controller.rb b/app/controllers/artifacts_controller.rb new file mode 100644 index 000000000..8e7012eff --- /dev/null +++ b/app/controllers/artifacts_controller.rb @@ -0,0 +1,29 @@ +class ArtifactsController < ApplicationController + + respond_to :json + + # create or update a client_artifact row + def update_artifacts + + product = params[:product] + version = params[:version] + uri = params[:uri] + file = params[:file] + environment = params[:environment] + + @artifact = ArtifactUpdate.find_or_create_by_product_and_environment(product, environment) + + @artifact.version = version + @artifact.uri = file + + @artifact.save + + unless @artifact.errors.any? + render :json => {}, :status => :ok + else + response.status = :unprocessable_entity + respond_with @artifact + end + end + +end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 1e82b08ee..ebc1b9790 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,12 +8,9 @@ JamAdmin::Application.routes.draw do scope ENV['RAILS_RELATIVE_URL_ROOT'] || '/' do root :to => "admin/dashboard#index" - - ActiveAdmin.routes(self) - - + match '/api/artifacts' => 'artifacts#update_artifacts', :via => :post # The priority is based upon order of creation: # first created -> highest priority. From 0e79a947da31909e719188f5618fae3646be396f Mon Sep 17 00:00:00 2001 From: Seth Call Date: Tue, 2 Jul 2013 20:45:12 -0500 Subject: [PATCH 46/56] * adding 5 recent sessions to dashboard of jam-admin --- app/admin/dashboard.rb | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/app/admin/dashboard.rb b/app/admin/dashboard.rb index 271185dc0..45d0e5054 100644 --- a/app/admin/dashboard.rb +++ b/app/admin/dashboard.rb @@ -7,26 +7,39 @@ ActiveAdmin.register_page "Dashboard" do span :class => "blank_slate" do span "JamKazam Data Administration Portal" small ul do - li "Admin users are separate from JamKazam users" + li "Admin users are users with the admin boolean set to true" li "Create/Edit JamKazam users using the 'Jam User' menu in header" li "Admin users are created/deleted when toggling the 'admin' flag for JamKazam users" - li "Use the 'Admin Users' header menu to edit admin users" end end end # Here is an example of a simple dashboard with columns and panels. # - # columns do - # column do - # panel "Recent Posts" do - # ul do - # Post.recent(5).map do |post| - # li link_to(post.title, admin_post_path(post)) - # end - # end - # end - # end + columns do + column do + panel "Recent Sessions" do + ul do + MusicSessionHistory.order('created_at desc').limit(5).map do |music_session| + li do + text_node "'#{music_session.description}' created by #{User.find(music_session.user_id).name} at #{music_session.created_at}, " + text_node " members: " + music_session.unique_users.each do |session_member| + text_node " #{session_member.name}" + end + + end + + # ul do + # + # end + #end + # li link_to(music_session.description, admin_post_path(music_session)) + end + end + end + end + end # column do # panel "Info" do From 5c016c39e465aca2b6860371456351524d4744c6 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 19 Jul 2013 16:39:59 -0500 Subject: [PATCH 47/56] * VRFS-424 pointing to int.jamkazam.com for gem server --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 079cca80a..d31c5ef8f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -source 'https://jamjam:blueberryjam@www.jamkazam.com/gems/' +source 'https://jamjam:blueberryjam@int.jamkazam.com/gems/' # Look for $WORKSPACE, otherwise use "workspace" as dev path. workspace = ENV["WORKSPACE"] || "~/workspace" devenv = ENV["BUILD_NUMBER"].nil? # Jenkins sets a build number environment variable From 40eb9aff729ba285ce579984ad57575d40feae20 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 19 Jul 2013 20:45:39 -0500 Subject: [PATCH 48/56] * fixing to make arch sniff --- jenkins | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins b/jenkins index 0acf5a9a9..67733e8c2 100755 --- a/jenkins +++ b/jenkins @@ -1,6 +1,6 @@ #!/bin/bash -DEB_SERVER=http://localhost:9010/apt-i386 +DEB_SERVER=http://localhost:9010/apt-`uname -p` echo "starting build..." ./build From 407430fa2100c48a38db35a1f5cfe71d6a71a7c8 Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Tue, 30 Jul 2013 12:33:34 -0500 Subject: [PATCH 49/56] vrfs-268: added music_session_history/bands tabs --- app/admin/bands.rb | 3 ++ app/admin/music_session_history.rb | 46 ++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 app/admin/bands.rb create mode 100644 app/admin/music_session_history.rb diff --git a/app/admin/bands.rb b/app/admin/bands.rb new file mode 100644 index 000000000..5e7dd2f80 --- /dev/null +++ b/app/admin/bands.rb @@ -0,0 +1,3 @@ +ActiveAdmin.register JamRuby::Band, :as => 'Band' do + +end diff --git a/app/admin/music_session_history.rb b/app/admin/music_session_history.rb new file mode 100644 index 000000000..050213dd4 --- /dev/null +++ b/app/admin/music_session_history.rb @@ -0,0 +1,46 @@ +ActiveAdmin.register JamRuby::MusicSessionHistory, :as => 'Music Session History' do + + config.filters = false + config.per_page = 50 + config.clear_action_items! + + controller do + def scoped_collection + @music_session_histories ||= end_of_association_chain + .includes([:user, :band]) + .order('created_at DESC') + end + end + + index :as => :block do |msh| + div :for => msh do + h3 "Session ##{msh.music_session_id}: #{msh.created_at.strftime('%b %d %Y, %H:%M')}" + columns do + column do + panel 'Session Details' do + attributes_table_for(msh) do + row :description + row :duration do |msh| "#{msh.duration_minutes} minutes" end + row :active do |msh| msh.session_removed_at.nil? end + row :creator do |msh| auto_link(msh.user, msh.user.try(:email)) end + row :band do |msh| auto_link(msh.band, msh.band.try(:name)) end + row :genres + row :perf_data do |msg| link_to('Data Link', "http://#{msh.perf_uri}") end + end + end + end + column do + panel 'User Details' do + table_for(msuh = msh.music_session_user_histories) do + column :user do |msuh| msuh.user_email end + column :joined do |msuh| msuh.created_at.strftime('%b %d %Y, %H:%M') end + column :duration do |msuh| "#{msuh.duration_minutes} minutes" end + column :active do |msuh| msuh.session_removed_at.nil? end + end + end + end + end + end + end + +end From 2d29f0e25aa4f8a16c0b0bf2c5796d95ee70b492 Mon Sep 17 00:00:00 2001 From: Mike Slemmer Date: Thu, 8 Aug 2013 18:37:38 -0700 Subject: [PATCH 50/56] added crash dumps --- app/admin/crash_dumps.rb | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 app/admin/crash_dumps.rb diff --git a/app/admin/crash_dumps.rb b/app/admin/crash_dumps.rb new file mode 100644 index 000000000..0eb125dd5 --- /dev/null +++ b/app/admin/crash_dumps.rb @@ -0,0 +1,3 @@ +ActiveAdmin.register JamRuby::CrashDump, :as => 'Crash Dump' do + +end From c32d63201e73fb3de7526ada1c23b68e651fcf22 Mon Sep 17 00:00:00 2001 From: Mike Slemmer Date: Thu, 8 Aug 2013 19:12:25 -0700 Subject: [PATCH 51/56] as good as it gets --- app/admin/crash_dumps.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app/admin/crash_dumps.rb b/app/admin/crash_dumps.rb index 0eb125dd5..a3be70774 100644 --- a/app/admin/crash_dumps.rb +++ b/app/admin/crash_dumps.rb @@ -1,3 +1,27 @@ ActiveAdmin.register JamRuby::CrashDump, :as => 'Crash Dump' do + # Note: a lame thing is it's not obvious how to make it search on email instead of user_id. + filter :created_at + filter :user_id + filter :client_id + index do + column "Timestamp" do |post| + post.created_at.strftime('%b %d %Y, %H:%M') + end + column "Client Type", :client_type + column "Dump URL" do |post| + link_to post.uri, post.uri + end + + column "User ID", :user_id + + # FIXME (?): This isn't performant (though it likely doesn't matter). Could probably do a join. + column "User Email" do |post| + unless post.user_id.nil? + post.user_email + end + end + column "Client ID", :client_id + actions + end end From af9dcae056314651c94fe7cc8fe40f618d04cfff Mon Sep 17 00:00:00 2001 From: Mike Slemmer Date: Sat, 10 Aug 2013 22:19:30 -0700 Subject: [PATCH 52/56] search based on user email --- app/admin/crash_dumps.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/crash_dumps.rb b/app/admin/crash_dumps.rb index a3be70774..4c48fbbd7 100644 --- a/app/admin/crash_dumps.rb +++ b/app/admin/crash_dumps.rb @@ -1,7 +1,7 @@ ActiveAdmin.register JamRuby::CrashDump, :as => 'Crash Dump' do # Note: a lame thing is it's not obvious how to make it search on email instead of user_id. filter :created_at - filter :user_id + filter :user_email, :as => :string filter :client_id index do From 9af9600f72344180aa16d71ca1bdf53b1ce4f8ef Mon Sep 17 00:00:00 2001 From: Mike Slemmer Date: Thu, 15 Aug 2013 00:07:12 -0700 Subject: [PATCH 53/56] use timestamp instead of created_at --- app/admin/crash_dumps.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/admin/crash_dumps.rb b/app/admin/crash_dumps.rb index 4c48fbbd7..e21edcfb3 100644 --- a/app/admin/crash_dumps.rb +++ b/app/admin/crash_dumps.rb @@ -1,12 +1,12 @@ ActiveAdmin.register JamRuby::CrashDump, :as => 'Crash Dump' do # Note: a lame thing is it's not obvious how to make it search on email instead of user_id. - filter :created_at + filter :timestamp filter :user_email, :as => :string filter :client_id index do column "Timestamp" do |post| - post.created_at.strftime('%b %d %Y, %H:%M') + post.timestamp.strftime('%b %d %Y, %H:%M') end column "Client Type", :client_type column "Dump URL" do |post| From c932a0920c7f1b82c7e3e0998d09e1e96985dc23 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 29 Aug 2013 13:48:54 +0000 Subject: [PATCH 54/56] * VRFS-586 - adding version info to jam-admin (not hidden like it is in jam-web --- app/assets/stylesheets/custom.css.scss | 4 ++++ app/helpers/meta_helper.rb | 7 +++++++ app/views/layouts/application.html.erb | 1 + build | 7 +++++++ config/application.rb | 2 +- config/initializers/active_admin.rb | 10 ++++++++++ lib/jam_admin/version.rb | 3 +++ 7 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 app/assets/stylesheets/custom.css.scss create mode 100644 app/helpers/meta_helper.rb create mode 100644 lib/jam_admin/version.rb diff --git a/app/assets/stylesheets/custom.css.scss b/app/assets/stylesheets/custom.css.scss new file mode 100644 index 000000000..bbaf0546b --- /dev/null +++ b/app/assets/stylesheets/custom.css.scss @@ -0,0 +1,4 @@ +.version-info { + font-size:small; + color:lightgray; +} \ No newline at end of file diff --git a/app/helpers/meta_helper.rb b/app/helpers/meta_helper.rb new file mode 100644 index 000000000..9024d451b --- /dev/null +++ b/app/helpers/meta_helper.rb @@ -0,0 +1,7 @@ +module MetaHelper + + def version() + "web=#{::JamAdmin::VERSION} lib=#{JamRuby::VERSION} db=#{JamDb::VERSION}" + end + +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b19a0b0c8..ad1c7afbd 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -12,5 +12,6 @@

<%= alert %>

<%= yield %> +
<%= version %>
diff --git a/build b/build index c60445a4d..06993f7ef 100755 --- a/build +++ b/build @@ -41,6 +41,13 @@ if [ -n "$PACKAGE" ]; then exit 1 fi + cat > lib/jam_web/version.rb << EOF +module JamWeb + VERSION = "0.1.$BUILD_NUMBER" +end +EOF + + type -P dpkg-architecture > /dev/null diff --git a/config/application.rb b/config/application.rb index 82b6a9bf8..5b76766e9 100644 --- a/config/application.rb +++ b/config/application.rb @@ -24,7 +24,7 @@ module JamAdmin # -- all .rb files in that directory are automatically loaded. # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) + config.autoload_paths += %W(#{config.root}/lib) # Only load the plugins named here, in the order given (default is alphabetical). # :all can be used as a placeholder for all plugins not explicitly named. diff --git a/config/initializers/active_admin.rb b/config/initializers/active_admin.rb index df2ef1086..1b7899669 100644 --- a/config/initializers/active_admin.rb +++ b/config/initializers/active_admin.rb @@ -1,3 +1,11 @@ +class Footer < ActiveAdmin::Component + def build + super(id: "footer") + para "version info: web=#{::JamAdmin::VERSION} lib=#{JamRuby::VERSION} db=#{JamDb::VERSION}" + end +end + + ActiveAdmin.setup do |config| # == Site Title @@ -149,4 +157,6 @@ ActiveAdmin.setup do |config| # # Set the CSV builder options (default is {}) # config.csv_options = {} + + config.view_factory.footer = Footer end diff --git a/lib/jam_admin/version.rb b/lib/jam_admin/version.rb new file mode 100644 index 000000000..f74617447 --- /dev/null +++ b/lib/jam_admin/version.rb @@ -0,0 +1,3 @@ +module JamAdmin + VERSION = "0.0.1" +end \ No newline at end of file From c5e97b8507f45620cfea49cfc6f228435cf66437 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 29 Aug 2013 13:49:47 +0000 Subject: [PATCH 55/56] * fixing typo in override of version file --- build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build b/build index 06993f7ef..b0d5493d2 100755 --- a/build +++ b/build @@ -41,8 +41,8 @@ if [ -n "$PACKAGE" ]; then exit 1 fi - cat > lib/jam_web/version.rb << EOF -module JamWeb + cat > lib/jam_admin/version.rb << EOF +module JamAdmin VERSION = "0.1.$BUILD_NUMBER" end EOF From ef69fc7cebb101d45132c4f8c9a5433c523d4bec Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 6 Sep 2013 13:10:28 +0000 Subject: [PATCH 56/56] * fixing jam-admin build; devise went to 3.1.0 and wants a config.secret in the initializer --- config/initializers/devise.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 5b0ec220a..0858d572b 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -6,6 +6,8 @@ Devise.setup do |config| # note that it will be overwritten if you use your own mailer class with default "from" parameter. config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com" + config.secret_key = '19569035c21af920ad2f124c3e7f26016f0aa5f5ce83e44a32e5a76adabf65d0d4e2c360bb44ff0b8660228843cfae8d74faa878aa328aefe849aaad3ff4bed3' + # Configure the class responsible to send e-mails. # config.mailer = "Devise::Mailer" @@ -229,4 +231,4 @@ Devise.setup do |config| # When using omniauth, Devise cannot automatically set Omniauth path, # so you need to do it manually. For the users scope, it would be: # config.omniauth_path_prefix = "/my_engine/users/auth" -end \ No newline at end of file +end