touchstone 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown CHANGED
@@ -32,6 +32,9 @@ This will:
32
32
  * ~~Add a before filter to your application controller. *NB*: This defaults to setting a private method for the filter. If you already have `private` defined in your application controller, you will need to remove the duplicate declaration.~~ **Not currently working. You will need to update application\_controller.rb manually. See below.**
33
33
  * Mounts the engine in your routes.rb file
34
34
 
35
+ ## Authentication
36
+ By default, Touchstone will require http\_basic authentication to access. The credentials for access will be read from a YAML file called touchstone.yml in your config folder. You will need to create this file unless you choose not to restrict access to Touchstone (not recommended).
37
+
35
38
  ## Installation continued
36
39
  Copy the migrations across to your application by running `rake touchstone:install:migrations`. This will add migrations to create the tables for the 3 classes set out above.
37
40
 
@@ -1,4 +1,10 @@
1
1
  module Touchstone
2
2
  class ApplicationController < ActionController::Base
3
+
4
+ if Touchstone.authenticate == true
5
+ config = YAML::load(File.open("#{Rails.root}/config/touchstone.yml"))
6
+ http_basic_authenticate_with :name => config['name'], :password => config['password']
7
+ end
8
+
3
9
  end
4
10
  end
@@ -1,44 +1,46 @@
1
- class Touchstone::CampaignsController < ApplicationController
1
+ module Touchstone
2
+ class CampaignsController < ApplicationController
2
3
 
3
- layout 'touchstone/touchstone'
4
+ layout 'touchstone/touchstone'
4
5
 
5
- def index
6
- @campaigns = Campaign.all
7
- end
6
+ def index
7
+ @campaigns = Campaign.all
8
+ end
8
9
 
9
- def new
10
- @campaign = Campaign.new
11
- end
10
+ def new
11
+ @campaign = Campaign.new
12
+ end
12
13
 
13
- def create
14
- @campaign = Campaign.new(params[:campaign])
15
- if @campaign.save
16
- flash[:notice] = "Campaign added"
17
- redirect_to campaigns_url
18
- else
19
- flash[:error] = "Could not add campaign"
20
- redirect_to new_campaign_url
14
+ def create
15
+ @campaign = Campaign.new(params[:campaign])
16
+ if @campaign.save
17
+ flash[:notice] = "Campaign added"
18
+ redirect_to campaigns_url
19
+ else
20
+ flash[:error] = "Could not add campaign"
21
+ redirect_to new_campaign_url
22
+ end
21
23
  end
22
- end
23
24
 
24
- def show
25
- @campaign = Campaign.find(params[:id])
26
- @columns = Touchstone.column_names
27
- end
25
+ def show
26
+ @campaign = Campaign.find(params[:id])
27
+ @columns = Touchstone.column_names
28
+ end
28
29
 
29
- def edit
30
- @campaign = Campaign.find(params[:id])
31
- end
30
+ def edit
31
+ @campaign = Campaign.find(params[:id])
32
+ end
32
33
 
33
- def update
34
- @campaign = Campaign.find(params[:id])
35
- if @campaign.update_attributes(params[:campaign]) && @campaign.save
36
- flash[:notice] = "Campaign details updated"
37
- redirect_to campaign_path(@campaign)
38
- else
39
- flash[:error] = "Could not update details at this time."
40
- redirect_to campaign_path(@campaign)
34
+ def update
35
+ @campaign = Campaign.find(params[:id])
36
+ if @campaign.update_attributes(params[:campaign]) && @campaign.save
37
+ flash[:notice] = "Campaign details updated"
38
+ redirect_to campaign_path(@campaign)
39
+ else
40
+ flash[:error] = "Could not update details at this time."
41
+ redirect_to campaign_path(@campaign)
42
+ end
41
43
  end
42
- end
43
44
 
45
+ end
44
46
  end
@@ -23,4 +23,11 @@ Touchstone.config do |c|
23
23
 
24
24
  c.currency = "$"
25
25
 
26
+ # If set to true, http_basic authentication will be in place
27
+ # before you can access Touchstone. You should create a YAML
28
+ # file in Rails.root/config called touchstone.yml containing
29
+ # a name and password
30
+
31
+ c.authenticate = true
32
+
26
33
  end
@@ -30,5 +30,13 @@ module Touchstone
30
30
  @currency || "$"
31
31
  end
32
32
 
33
+ def authenticate=authenticate
34
+ @authenticate = authenticate
35
+ end
36
+
37
+ def authenticate
38
+ @authenticate
39
+ end
40
+
33
41
  end
34
42
  end
@@ -1,3 +1,3 @@
1
1
  module Touchstone
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
data/lib/touchstone.rb CHANGED
@@ -23,6 +23,10 @@ module Touchstone
23
23
  Touchstone::Configuration.currency
24
24
  end
25
25
 
26
+ def authenticate
27
+ Touchstone::Configuration.authenticate
28
+ end
29
+
26
30
  end
27
31
 
28
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: touchstone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -159,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  segments:
161
161
  - 0
162
- hash: -3797469945151478900
162
+ hash: 3352637730166065621
163
163
  required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  none: false
165
165
  requirements:
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  segments:
170
170
  - 0
171
- hash: -3797469945151478900
171
+ hash: 3352637730166065621
172
172
  requirements: []
173
173
  rubyforge_project:
174
174
  rubygems_version: 1.8.20