allen 0.2.0 → 0.3.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/.gitignore +0 -0
- data/.travis.yml +0 -0
- data/Gemfile +0 -0
- data/Guardfile +0 -0
- data/LICENSE +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/allen.gemspec +0 -0
- data/lib/allen/asset_bundle.rb +43 -0
- data/lib/allen/cli.rb +3 -0
- data/lib/allen/dsl.rb +5 -1
- data/lib/allen/preprocessors.rb +0 -0
- data/lib/allen/project.rb +48 -7
- data/lib/allen/projects/static_project.rb +4 -0
- data/lib/allen/projects/umbraco_project.rb +24 -0
- data/lib/allen/rake.rb +0 -0
- data/lib/allen/settings.rb +1 -0
- data/lib/allen/task_definer.rb +18 -52
- data/lib/allen/version.rb +1 -1
- data/lib/allen.rb +0 -0
- data/lib/settings.rb +0 -0
- data/spec/lib/allen/dsl_spec.rb +14 -0
- data/spec/lib/allen/preprocessors_spec.rb +0 -0
- data/spec/lib/allen/project_spec.rb +7 -7
- data/spec/lib/allen/rake_spec.rb +0 -0
- data/spec/lib/allen/settings_spec.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- data/templates/.gitignore +3 -0
- data/templates/Gemfile.tt +0 -0
- data/templates/README.md.tt +1 -1
- data/templates/Rakefile.tt +0 -2
- data/templates/src/%name%.Umbraco/App_Code/.gitkeep +0 -0
- data/templates/src/%name%.Umbraco/App_Data/.gitkeep +0 -0
- data/templates/src/%name%.Umbraco/App_Plugins/.gitkeep +0 -0
- data/templates/src/%name%.Umbraco/assets/javascripts/app/application.coffee +0 -0
- data/templates/src/%name%.Umbraco/assets/stylesheets/app/application.less +0 -0
- data/templates/src/%name%.Umbraco/css/.gitkeep +0 -0
- data/templates/src/%name%.Umbraco/fonts/.gitkeep +0 -0
- data/templates/src/%name%.Umbraco/img/.gitkeep +0 -0
- data/templates/src/%name%.Umbraco/js/.gitkeep +0 -0
- data/templates/src/%name%.Umbraco/macroScripts/.gitkeep +0 -0
- data/templates/src/%name%.Umbraco/masterpages/.gitkeep +0 -0
- data/templates/src/%name%.Umbraco/usercontrols/.gitkeep +0 -0
- data/templates/src/%name%.Umbraco/xslt/.gitkeep +0 -0
- data/templates/src/.nuget/NuGet.Config +0 -0
- data/templates/src/.nuget/NuGet.exe +0 -0
- data/templates/src/.nuget/NuGet.targets +0 -0
- metadata +5 -2
data/.gitignore
CHANGED
File without changes
|
data/.travis.yml
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/Guardfile
CHANGED
File without changes
|
data/LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/allen.gemspec
CHANGED
File without changes
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Allen
|
2
|
+
class AssetBundle < Struct.new(:preprocessor, :input, :output)
|
3
|
+
def build
|
4
|
+
Bundler.with_clean_env { preprocessor.build(input, output) }
|
5
|
+
end
|
6
|
+
|
7
|
+
def compress
|
8
|
+
Bundler.with_clean_env { preprocessor.compress(input, output) }
|
9
|
+
end
|
10
|
+
|
11
|
+
def watch
|
12
|
+
Bundler.with_clean_env { preprocessor.watch(input, output) }
|
13
|
+
end
|
14
|
+
|
15
|
+
alias_method :build!, :build
|
16
|
+
alias_method :watch!, :watch
|
17
|
+
alias_method :compress!, :compress
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
class AssetBundleCollection < Struct.new(:js_bundle, :css_bundle)
|
22
|
+
def bundles
|
23
|
+
[js_bundle, css_bundle]
|
24
|
+
end
|
25
|
+
|
26
|
+
def build
|
27
|
+
bundles.each(&:build)
|
28
|
+
end
|
29
|
+
|
30
|
+
def compress
|
31
|
+
bundles.each(&:compress)
|
32
|
+
end
|
33
|
+
|
34
|
+
def watch
|
35
|
+
bundles.each(&:watch)
|
36
|
+
end
|
37
|
+
|
38
|
+
alias_method :build!, :build
|
39
|
+
alias_method :watch!, :watch
|
40
|
+
alias_method :compress!, :compress
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
data/lib/allen/cli.rb
CHANGED
@@ -10,6 +10,7 @@ module Allen
|
|
10
10
|
|
11
11
|
desc "new ClientName", "Initialize an Umbraco project"
|
12
12
|
def new(name)
|
13
|
+
@full_name = name
|
13
14
|
@name = File.basename(File.expand_path(name)).gsub(/\W/, '_').squeeze('_').camelize
|
14
15
|
self.destination_root = File.join(File.dirname(File.expand_path(name)), @name)
|
15
16
|
|
@@ -27,6 +28,8 @@ module Allen
|
|
27
28
|
template 'README.md.tt'
|
28
29
|
template 'Rakefile.tt'
|
29
30
|
template 'Gemfile.tt'
|
31
|
+
|
32
|
+
system "git init #{destination_root}"
|
30
33
|
end
|
31
34
|
|
32
35
|
no_tasks do
|
data/lib/allen/dsl.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'allen'
|
2
2
|
require 'allen/project'
|
3
|
+
Dir[File.dirname(__FILE__) + '/projects/*.rb'].each {|file| require file }
|
3
4
|
require 'allen/settings'
|
4
5
|
|
5
6
|
module Allen
|
@@ -9,7 +10,10 @@ module Allen
|
|
9
10
|
end
|
10
11
|
|
11
12
|
def project(name, &block)
|
12
|
-
|
13
|
+
settings = Allen.settings.clone
|
14
|
+
settings.configure(block)
|
15
|
+
klass = Allen.const_get (settings.type.to_s + "_project").classify
|
16
|
+
project = klass.new(name, settings)
|
13
17
|
Allen.projects << project
|
14
18
|
project
|
15
19
|
end
|
data/lib/allen/preprocessors.rb
CHANGED
File without changes
|
data/lib/allen/project.rb
CHANGED
@@ -1,25 +1,66 @@
|
|
1
1
|
require 'allen/settings'
|
2
2
|
require 'allen/preprocessors'
|
3
|
+
require 'allen/asset_bundle'
|
3
4
|
|
4
5
|
module Allen
|
5
6
|
class Project
|
6
7
|
attr_accessor :name, :settings
|
7
8
|
|
8
|
-
def initialize(name="Umbraco",
|
9
|
+
def initialize(name="Umbraco", settings=Allen.settings.clone)
|
9
10
|
@name = name
|
10
|
-
@settings =
|
11
|
+
@settings = settings
|
11
12
|
@settings.configure do
|
12
13
|
name name
|
13
14
|
end
|
14
|
-
@settings.configure(block) if block
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
|
17
|
+
def build!
|
18
|
+
assets.build!
|
19
|
+
generate_meta_data!
|
19
20
|
end
|
20
21
|
|
21
|
-
def
|
22
|
-
Preprocessors.for(settings.js_preprocessor)
|
22
|
+
def install!
|
23
23
|
end
|
24
|
+
|
25
|
+
def uninstall!
|
26
|
+
end
|
27
|
+
|
28
|
+
def assets
|
29
|
+
@asset_bundle_collection ||= AssetBundleCollection.new(js, css)
|
30
|
+
end
|
31
|
+
|
32
|
+
def js
|
33
|
+
@js_asset_bundle ||= begin
|
34
|
+
preprocessor = Preprocessors.for(settings.js_preprocessor)
|
35
|
+
input = "#{settings.src_dir}/#{settings.client}.#{name}/#{settings.js_input}"
|
36
|
+
output = "#{settings.src_dir}/#{settings.client}.#{name}/#{settings.js_output}"
|
37
|
+
AssetBundle.new(preprocessor, input, output)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def css
|
42
|
+
@css_asset_bundle ||= begin
|
43
|
+
preprocessor = Preprocessors.for(settings.css_preprocessor)
|
44
|
+
input = "#{settings.src_dir}/#{settings.client}.#{name}/#{settings.css_input}"
|
45
|
+
output = "#{settings.src_dir}/#{settings.client}.#{name}/#{settings.css_output}"
|
46
|
+
AssetBundle.new(preprocessor, input, output)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def generate_meta_data!
|
53
|
+
#create a version file with the time and the latest git commit
|
54
|
+
version_file = File.open("#{settings.webroot}/version","w")
|
55
|
+
version_file.puts "built: #{Time.now.to_s}"
|
56
|
+
version_file.puts `git log -1`
|
57
|
+
version_file.close
|
58
|
+
|
59
|
+
#create a commit-hash file with just the last commit hash in it
|
60
|
+
hash_file = File.open("#{settings.webroot}/commit-hash","w")
|
61
|
+
hash_file.print `git log -1 --format="%H"`.chomp
|
62
|
+
hash_file.close
|
63
|
+
end
|
64
|
+
|
24
65
|
end
|
25
66
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Allen
|
2
|
+
class UmbracoProject < Project
|
3
|
+
|
4
|
+
def install!
|
5
|
+
super
|
6
|
+
packages = Nokogiri::XML(File.read("#{settings.webroot}/packages.config"))
|
7
|
+
umbraco = packages.xpath("//package[@id='UmbracoCms']")
|
8
|
+
|
9
|
+
package_name = umbraco.xpath('@id').text
|
10
|
+
package_version = umbraco.xpath('@version').text
|
11
|
+
package_path = "#{src_dir}/packages/#{package_name}.#{package_version}/UmbracoFiles"
|
12
|
+
|
13
|
+
['umbraco', 'umbraco_client', 'install'].map do |directory|
|
14
|
+
File.join package_path, directory
|
15
|
+
end.each do |directory|
|
16
|
+
cp_r directory, settings.webroot
|
17
|
+
end
|
18
|
+
|
19
|
+
build!
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
data/lib/allen/rake.rb
CHANGED
File without changes
|
data/lib/allen/settings.rb
CHANGED
data/lib/allen/task_definer.rb
CHANGED
@@ -11,47 +11,21 @@ module Allen
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def define_tasks
|
14
|
-
# Default Tasks
|
15
14
|
task :default => :build
|
16
15
|
|
17
|
-
# Build Task
|
18
16
|
desc "Build the solution in debug mode and compile all assets"
|
19
|
-
task :build => ['assets:build', '
|
20
|
-
Rake.application.invoke_task('solution:msbuild["debug"]')
|
21
|
-
end
|
22
|
-
|
23
|
-
# Release Build
|
24
|
-
desc "Build the solution in release mode, compile and compress all assets"
|
25
|
-
task :release => ['assets:build', 'assets:compress'] do
|
26
|
-
Rake.application.invoke_task('solution:msbuild["release"]')
|
27
|
-
end
|
17
|
+
task :build => ['assets:build', 'solution:msbuild']
|
28
18
|
|
29
19
|
namespace :solution do
|
30
20
|
desc "Build the solution with a chosen configuration"
|
31
|
-
msbuild :msbuild
|
21
|
+
msbuild :msbuild do |msb|
|
32
22
|
msb.solution = "#{settings.solution}"
|
33
|
-
msb.properties = { :configuration =>
|
23
|
+
msb.properties = { :configuration => :release }
|
34
24
|
msb.parameters = settings.parameters
|
35
25
|
msb.targets = settings.targets
|
36
26
|
end
|
37
27
|
end
|
38
28
|
|
39
|
-
namespace :deploy do
|
40
|
-
desc "Creates files for deployment"
|
41
|
-
task :build do
|
42
|
-
#create a version file with the time and the latest git commit
|
43
|
-
version_file = File.open("#{settings.webroot}/version","w")
|
44
|
-
version_file.puts "built: #{Time.now.to_s}"
|
45
|
-
version_file.puts `git log -1`
|
46
|
-
version_file.close
|
47
|
-
|
48
|
-
#create a commit-hash file with just the last commit hash in it
|
49
|
-
hash_file = File.open("#{settings.webroot}/commit-hash","w")
|
50
|
-
hash_file.print `git log -1 --format="%H"`.chomp
|
51
|
-
hash_file.close
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
29
|
namespace :assets do
|
56
30
|
desc "Watches assets for every project"
|
57
31
|
multitask :watch => projects.map { |project| "#{project.name.downcase}:assets:watch" }
|
@@ -66,16 +40,13 @@ module Allen
|
|
66
40
|
projects.each do |project|
|
67
41
|
namespace project.name.downcase do
|
68
42
|
desc "Build the #{project.name} project in debug mode and compile assets"
|
69
|
-
task :build
|
70
|
-
|
43
|
+
task :build do
|
44
|
+
project.build!
|
71
45
|
end
|
72
46
|
|
73
|
-
desc "
|
74
|
-
|
75
|
-
|
76
|
-
msb.properties = { :configuration => args.config.to_sym }
|
77
|
-
msb.parameters = project.settings.parameters
|
78
|
-
msb.targets = project.settings.targets
|
47
|
+
desc "Install dependencies for the #{project.name} project"
|
48
|
+
task :install do
|
49
|
+
project.install!
|
79
50
|
end
|
80
51
|
|
81
52
|
namespace :assets do
|
@@ -91,39 +62,35 @@ module Allen
|
|
91
62
|
|
92
63
|
namespace :css do
|
93
64
|
desc "Builds CSS for the #{project.name} project"
|
94
|
-
input = "#{project.settings.src_dir}/#{project.settings.client}.#{project.name}/#{project.settings.css_input}"
|
95
|
-
output = "#{project.settings.src_dir}/#{project.settings.client}.#{project.name}/#{project.settings.css_output}"
|
96
|
-
preprocessor = project.css_preprocessor
|
97
|
-
|
98
65
|
task :build do
|
99
|
-
|
66
|
+
project.css.build!
|
100
67
|
end
|
101
68
|
|
69
|
+
desc "Compresses CSS for the #{project.name} project"
|
102
70
|
task :compress do
|
103
|
-
|
71
|
+
project.css.compress!
|
104
72
|
end
|
105
73
|
|
74
|
+
desc "Watches CSS for the #{project.name} project"
|
106
75
|
task :watch do
|
107
|
-
|
76
|
+
project.css.watch!
|
108
77
|
end
|
109
78
|
end
|
110
79
|
|
111
80
|
namespace :js do
|
112
81
|
desc "Builds JS for the #{project.name} project"
|
113
|
-
input = "#{project.settings.src_dir}/#{project.settings.client}.#{project.name}/#{project.settings.js_input}"
|
114
|
-
output = "#{project.settings.src_dir}/#{project.settings.client}.#{project.name}/#{project.settings.js_output}"
|
115
|
-
preprocessor = project.js_preprocessor
|
116
|
-
|
117
82
|
task :build do
|
118
|
-
|
83
|
+
project.js.build!
|
119
84
|
end
|
120
85
|
|
86
|
+
desc "Compresses JS for the #{project.name} project"
|
121
87
|
task :compress do
|
122
|
-
|
88
|
+
project.js.compress!
|
123
89
|
end
|
124
90
|
|
91
|
+
desc "Watches JS for the #{project.name} project"
|
125
92
|
task :watch do
|
126
|
-
|
93
|
+
project.js.watch!
|
127
94
|
end
|
128
95
|
end
|
129
96
|
end
|
@@ -131,4 +98,3 @@ module Allen
|
|
131
98
|
end
|
132
99
|
end
|
133
100
|
end
|
134
|
-
|
data/lib/allen/version.rb
CHANGED
data/lib/allen.rb
CHANGED
File without changes
|
data/lib/settings.rb
CHANGED
File without changes
|
data/spec/lib/allen/dsl_spec.rb
CHANGED
@@ -33,5 +33,19 @@ describe Allen::DSL do
|
|
33
33
|
proj1.settings.cache.should == false
|
34
34
|
proj2.settings.compressor.should == :uglify
|
35
35
|
end
|
36
|
+
|
37
|
+
it "assumes the project is an UmbracoProject" do
|
38
|
+
proj1 = project "Ralphy"
|
39
|
+
proj1.settings.type.should == :umbraco
|
40
|
+
proj1.class.should == Allen::UmbracoProject
|
41
|
+
end
|
42
|
+
|
43
|
+
it "can have a type other than umbraco" do
|
44
|
+
proj1 = project "Ralphy" do
|
45
|
+
type :static
|
46
|
+
end
|
47
|
+
proj1.settings.type.should == :static
|
48
|
+
proj1.class.should == Allen::StaticProject
|
49
|
+
end
|
36
50
|
end
|
37
51
|
|
File without changes
|
@@ -33,46 +33,46 @@ describe Allen::Project do
|
|
33
33
|
it "knows its css preprocessor" do
|
34
34
|
project = Allen::Project.new
|
35
35
|
project.settings.css_preprocessor :coyote
|
36
|
-
project.
|
36
|
+
project.css.preprocessor.should == Allen::Preprocessors::Coyote
|
37
37
|
end
|
38
38
|
|
39
39
|
it "knows about sass" do
|
40
40
|
project = Allen::Project.new
|
41
41
|
project.settings.css_preprocessor :sass
|
42
|
-
project.
|
42
|
+
project.css.preprocessor.should == Allen::Preprocessors::Sass
|
43
43
|
end
|
44
44
|
|
45
45
|
it "knows about banshee" do
|
46
46
|
project = Allen::Project.new
|
47
47
|
project.settings.css_preprocessor :banshee
|
48
|
-
project.
|
48
|
+
project.css.preprocessor.should == Allen::Preprocessors::Banshee
|
49
49
|
end
|
50
50
|
|
51
51
|
it "raises when it doesn't know the css preprocessor" do
|
52
52
|
project = Allen::Project.new
|
53
53
|
project.settings.css_preprocessor :pawikwkasdf
|
54
54
|
expect {
|
55
|
-
project.
|
55
|
+
project.css.preprocessor
|
56
56
|
}.to raise_error StandardError, /unknown preprocessor: pawikwkasdf/
|
57
57
|
end
|
58
58
|
|
59
59
|
it "knows its js preprocessor" do
|
60
60
|
project = Allen::Project.new
|
61
61
|
project.settings.js_preprocessor :coyote
|
62
|
-
project.
|
62
|
+
project.js.preprocessor.should == Allen::Preprocessors::Coyote
|
63
63
|
end
|
64
64
|
|
65
65
|
it "knows about banshee" do
|
66
66
|
project = Allen::Project.new
|
67
67
|
project.settings.js_preprocessor :banshee
|
68
|
-
project.
|
68
|
+
project.js.preprocessor.should == Allen::Preprocessors::Banshee
|
69
69
|
end
|
70
70
|
|
71
71
|
it "raises when it doesn't know the js preprocessor" do
|
72
72
|
project = Allen::Project.new
|
73
73
|
project.settings.js_preprocessor :fsdfasdfadsf
|
74
74
|
expect {
|
75
|
-
project.
|
75
|
+
project.js.preprocessor
|
76
76
|
}.to raise_error StandardError, /unknown preprocessor: fsdfasdfadsf/
|
77
77
|
end
|
78
78
|
end
|
data/spec/lib/allen/rake_spec.rb
CHANGED
File without changes
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
File without changes
|
data/templates/.gitignore
CHANGED
data/templates/Gemfile.tt
CHANGED
File without changes
|
data/templates/README.md.tt
CHANGED
data/templates/Rakefile.tt
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-03-
|
13
|
+
date: 2013-03-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thor
|
@@ -191,10 +191,13 @@ files:
|
|
191
191
|
- allen.gemspec
|
192
192
|
- bin/allen
|
193
193
|
- lib/allen.rb
|
194
|
+
- lib/allen/asset_bundle.rb
|
194
195
|
- lib/allen/cli.rb
|
195
196
|
- lib/allen/dsl.rb
|
196
197
|
- lib/allen/preprocessors.rb
|
197
198
|
- lib/allen/project.rb
|
199
|
+
- lib/allen/projects/static_project.rb
|
200
|
+
- lib/allen/projects/umbraco_project.rb
|
198
201
|
- lib/allen/rake.rb
|
199
202
|
- lib/allen/settings.rb
|
200
203
|
- lib/allen/task_definer.rb
|