radiant-sheets-extension 1.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/LICENSE +21 -0
  2. data/README.md +33 -0
  3. data/Rakefile +129 -0
  4. data/app/controllers/admin/scripts_controller.rb +13 -0
  5. data/app/controllers/admin/sheet_resource_controller.rb +54 -0
  6. data/app/controllers/admin/styles_controller.rb +13 -0
  7. data/app/helpers/admin/scripts_helper.rb +5 -0
  8. data/app/helpers/admin/styles_helper.rb +5 -0
  9. data/app/models/javascript_page.rb +16 -0
  10. data/app/models/sheet.rb +93 -0
  11. data/app/models/stylesheet_page.rb +16 -0
  12. data/app/views/admin/scripts/edit.html.haml +30 -0
  13. data/app/views/admin/scripts/index.html.haml +33 -0
  14. data/app/views/admin/scripts/new.html.haml +30 -0
  15. data/app/views/admin/sheets/_edit_scripts.html.haml +40 -0
  16. data/app/views/admin/sheets/_upload_script.html.haml +16 -0
  17. data/app/views/admin/styles/edit.html.haml +30 -0
  18. data/app/views/admin/styles/index.html.haml +33 -0
  19. data/app/views/admin/styles/new.html.haml +30 -0
  20. data/config/locales/en.yml +17 -0
  21. data/config/routes.rb +6 -0
  22. data/cucumber.yml +1 -0
  23. data/features/admin/managing_javascripts.feature +147 -0
  24. data/features/admin/managing_stylesheets.feature +108 -0
  25. data/features/support/env.rb +11 -0
  26. data/features/support/paths.rb +11 -0
  27. data/lib/coffee_filter.rb +5 -0
  28. data/lib/javascript_tags.rb +58 -0
  29. data/lib/radiant-sheets-extension/version.rb +3 -0
  30. data/lib/radiant-sheets-extension.rb +2 -0
  31. data/lib/sass_filter.rb +18 -0
  32. data/lib/scss_filter.rb +19 -0
  33. data/lib/stylesheet_tags.rb +61 -0
  34. data/lib/tasks/sheets_extension_tasks.rake +79 -0
  35. data/public/images/admin/javascript.png +0 -0
  36. data/public/images/admin/stylesheet.png +0 -0
  37. data/radiant-sheets-extension.gemspec +32 -0
  38. data/sass.html +82 -0
  39. data/sheets_extension.rb +96 -0
  40. data/spec/controllers/admin/scripts_controller_spec.rb +123 -0
  41. data/spec/controllers/admin/styles_controller_spec.rb +124 -0
  42. data/spec/datasets/javascripts_dataset.rb +15 -0
  43. data/spec/datasets/stylesheets_dataset.rb +17 -0
  44. data/spec/helpers/admin/scripts_helper_spec.rb +5 -0
  45. data/spec/helpers/admin/styles_helper_spec.rb +5 -0
  46. data/spec/lib/javascript_tags_spec.rb +36 -0
  47. data/spec/lib/stylesheet_tags_spec.rb +41 -0
  48. data/spec/models/javascript_page_spec.rb +80 -0
  49. data/spec/models/page_spec.rb +5 -0
  50. data/spec/models/stylesheet_page_spec.rb +80 -0
  51. data/spec/spec.opts +6 -0
  52. data/spec/spec_helper.rb +36 -0
  53. metadata +169 -0
@@ -0,0 +1,80 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe StylesheetPage do
4
+ dataset :stylesheets
5
+ let(:css){ pages(:css) }
6
+ let(:site_css){ pages(:site_css) }
7
+
8
+ subject{ css }
9
+ its(:cache?) { should be_true }
10
+ its(:sheet?) { should be_true }
11
+ its(:virtual?) { should be_true }
12
+ its(:layout) { should be_nil }
13
+
14
+ describe '.root' do
15
+ subject{ StylesheetPage.root }
16
+ it { should == css }
17
+ end
18
+
19
+ describe '.new_with_defaults' do
20
+ describe '#parts' do
21
+ let(:parts){ StylesheetPage.new_with_defaults.parts }
22
+ subject{ parts }
23
+ its(:length) { should == 1 }
24
+ it "should have a body part" do
25
+ parts[0].name.should == 'body'
26
+ end
27
+ end
28
+ end
29
+
30
+ describe '#headers' do
31
+ it "should have a 'Content-Type' of 'text/css'" do
32
+ css.headers['Content-Type'].should == 'text/css'
33
+ end
34
+ end
35
+
36
+ describe '#find_by_path' do
37
+ context 'with a valid url' do
38
+ it 'should return the child found by the given slug' do
39
+ css.find_by_path('/css/site.css').should == site_css
40
+ end
41
+ end
42
+ end
43
+
44
+ context 'when validating a new page' do
45
+ it "should automatically set the title to the given slug" do
46
+ j = StylesheetPage.new(:slug => 'site.css')
47
+ j.valid?
48
+ j.title.should == 'site.css'
49
+ end
50
+ it "should automatically set the breadcrumb to the given slug" do
51
+ j = StylesheetPage.new(:slug => 'site.css')
52
+ j.valid?
53
+ j.breadcrumb.should == 'site.css'
54
+ end
55
+ end
56
+
57
+ context 'when saving a new page' do
58
+ subject { s = StylesheetPage.new_with_defaults
59
+ s.slug = 'test.css'
60
+ s.save!
61
+ s }
62
+ its(:status){ should == Status[:published] }
63
+ its(:status_id){ should == Status[:published].id }
64
+
65
+ its(:published_at){ should_not be_nil }
66
+ it "should have a published_at greater than or equal to the current time" do
67
+ subject.published_at.to_i.should <= Time.zone.now.to_i
68
+ end
69
+
70
+ context 'with the default page status set to draft' do
71
+ it 'should save a new page with a published status' do
72
+ Radiant::Config['defaults.page.status'] = 'draft'
73
+ new_sheet = StylesheetPage.new_with_defaults
74
+ new_sheet.slug = 'published.css'
75
+ new_sheet.save!
76
+ new_sheet.status.should == Status[:published]
77
+ end
78
+ end
79
+ end
80
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,6 @@
1
+ --colour
2
+ --format
3
+ progress
4
+ --loadby
5
+ mtime
6
+ --reverse
@@ -0,0 +1,36 @@
1
+ unless defined? RADIANT_ROOT
2
+ ENV["RAILS_ENV"] = "test"
3
+ case
4
+ when ENV["RADIANT_ENV_FILE"]
5
+ require ENV["RADIANT_ENV_FILE"]
6
+ when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
7
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../../")}/config/environment"
8
+ else
9
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../")}/config/environment"
10
+ end
11
+ end
12
+ require "#{RADIANT_ROOT}/spec/spec_helper"
13
+
14
+ Dataset::Resolver.default << (File.dirname(__FILE__) + "/datasets")
15
+
16
+ if File.directory?(File.dirname(__FILE__) + "/matchers")
17
+ Dir[File.dirname(__FILE__) + "/matchers/*.rb"].each {|file| require file }
18
+ end
19
+
20
+ Spec::Runner.configure do |config|
21
+ # config.use_transactional_fixtures = true
22
+ # config.use_instantiated_fixtures = false
23
+ # config.fixture_path = RAILS_ROOT + '/spec/fixtures'
24
+
25
+ # You can declare fixtures for each behaviour like this:
26
+ # describe "...." do
27
+ # fixtures :table_a, :table_b
28
+ #
29
+ # Alternatively, if you prefer to declare them only once, you can
30
+ # do so here, like so ...
31
+ #
32
+ # config.global_fixtures = :table_a, :table_b
33
+ #
34
+ # If you declare global fixtures, be aware that they will be declared
35
+ # for all of your examples, even those that don't use them.
36
+ end
metadata ADDED
@@ -0,0 +1,169 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: radiant-sheets-extension
3
+ version: !ruby/object:Gem::Version
4
+ hash: 961915988
5
+ prerelease: 6
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ - pre
11
+ version: 1.0.0.pre
12
+ platform: ruby
13
+ authors:
14
+ - Radiant CMS Dev Team
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2011-06-03 00:00:00 -04:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: sass
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ hash: 7
31
+ segments:
32
+ - 3
33
+ - 1
34
+ - 2
35
+ version: 3.1.2
36
+ type: :runtime
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
39
+ name: coffee-script
40
+ prerelease: false
41
+ requirement: &id002 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ hash: 7
47
+ segments:
48
+ - 2
49
+ - 2
50
+ - 0
51
+ version: 2.2.0
52
+ type: :runtime
53
+ version_requirements: *id002
54
+ description: Manage CSS and Javascript content in Radiant CMS as Sheets, a subset of Pages.
55
+ email:
56
+ - radiant@radiantcms.org
57
+ executables: []
58
+
59
+ extensions: []
60
+
61
+ extra_rdoc_files: []
62
+
63
+ files:
64
+ - app/controllers/admin/scripts_controller.rb
65
+ - app/controllers/admin/sheet_resource_controller.rb
66
+ - app/controllers/admin/styles_controller.rb
67
+ - app/helpers/admin/scripts_helper.rb
68
+ - app/helpers/admin/styles_helper.rb
69
+ - app/models/javascript_page.rb
70
+ - app/models/sheet.rb
71
+ - app/models/stylesheet_page.rb
72
+ - app/views/admin/scripts/edit.html.haml
73
+ - app/views/admin/scripts/index.html.haml
74
+ - app/views/admin/scripts/new.html.haml
75
+ - app/views/admin/sheets/_edit_scripts.html.haml
76
+ - app/views/admin/sheets/_upload_script.html.haml
77
+ - app/views/admin/styles/edit.html.haml
78
+ - app/views/admin/styles/index.html.haml
79
+ - app/views/admin/styles/new.html.haml
80
+ - config/locales/en.yml
81
+ - config/routes.rb
82
+ - cucumber.yml
83
+ - features/admin/managing_javascripts.feature
84
+ - features/admin/managing_stylesheets.feature
85
+ - features/support/env.rb
86
+ - features/support/paths.rb
87
+ - lib/coffee_filter.rb
88
+ - lib/javascript_tags.rb
89
+ - lib/radiant-sheets-extension/version.rb
90
+ - lib/radiant-sheets-extension.rb
91
+ - lib/sass_filter.rb
92
+ - lib/scss_filter.rb
93
+ - lib/stylesheet_tags.rb
94
+ - lib/tasks/sheets_extension_tasks.rake
95
+ - LICENSE
96
+ - public/images/admin/javascript.png
97
+ - public/images/admin/stylesheet.png
98
+ - radiant-sheets-extension.gemspec
99
+ - Rakefile
100
+ - README.md
101
+ - sass.html
102
+ - sheets_extension.rb
103
+ - spec/controllers/admin/scripts_controller_spec.rb
104
+ - spec/controllers/admin/styles_controller_spec.rb
105
+ - spec/datasets/javascripts_dataset.rb
106
+ - spec/datasets/stylesheets_dataset.rb
107
+ - spec/helpers/admin/scripts_helper_spec.rb
108
+ - spec/helpers/admin/styles_helper_spec.rb
109
+ - spec/lib/javascript_tags_spec.rb
110
+ - spec/lib/stylesheet_tags_spec.rb
111
+ - spec/models/javascript_page_spec.rb
112
+ - spec/models/page_spec.rb
113
+ - spec/models/stylesheet_page_spec.rb
114
+ - spec/spec.opts
115
+ - spec/spec_helper.rb
116
+ has_rdoc: true
117
+ homepage: http://radiantcms.org/
118
+ licenses: []
119
+
120
+ post_install_message: "\n Add this to your radiant project with:\n config.gem 'radiant-sheets-extension', :version => '~>1.0.0.pre'\n "
121
+ rdoc_options: []
122
+
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ hash: 3
131
+ segments:
132
+ - 0
133
+ version: "0"
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ">"
138
+ - !ruby/object:Gem::Version
139
+ hash: 25
140
+ segments:
141
+ - 1
142
+ - 3
143
+ - 1
144
+ version: 1.3.1
145
+ requirements: []
146
+
147
+ rubyforge_project:
148
+ rubygems_version: 1.6.2
149
+ signing_key:
150
+ specification_version: 3
151
+ summary: Sheets for Radiant CMS
152
+ test_files:
153
+ - spec/controllers/admin/scripts_controller_spec.rb
154
+ - spec/controllers/admin/styles_controller_spec.rb
155
+ - spec/datasets/javascripts_dataset.rb
156
+ - spec/datasets/stylesheets_dataset.rb
157
+ - spec/helpers/admin/scripts_helper_spec.rb
158
+ - spec/helpers/admin/styles_helper_spec.rb
159
+ - spec/lib/javascript_tags_spec.rb
160
+ - spec/lib/stylesheet_tags_spec.rb
161
+ - spec/models/javascript_page_spec.rb
162
+ - spec/models/page_spec.rb
163
+ - spec/models/stylesheet_page_spec.rb
164
+ - spec/spec.opts
165
+ - spec/spec_helper.rb
166
+ - features/admin/managing_javascripts.feature
167
+ - features/admin/managing_stylesheets.feature
168
+ - features/support/env.rb
169
+ - features/support/paths.rb