roger 1.1.3 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hound.yml +2 -0
- data/.rubocop.yml +47 -0
- data/.travis.yml +1 -5
- data/CHANGELOG.md +8 -0
- data/Gemfile +3 -3
- data/Rakefile +10 -4
- data/bin/roger +1 -1
- data/doc/mockupfile.md +97 -0
- data/doc/templating.md +5 -1
- data/examples/default_template/Gemfile +1 -1
- data/lib/roger/cli.rb +41 -36
- data/lib/roger/cli/command.rb +2 -4
- data/lib/roger/cli/generate.rb +1 -0
- data/lib/roger/cli/release.rb +2 -2
- data/lib/roger/cli/serve.rb +11 -11
- data/lib/roger/cli/test.rb +6 -5
- data/lib/roger/extractor.rb +42 -43
- data/lib/roger/generators.rb +27 -19
- data/lib/roger/generators/generator.rb +7 -10
- data/lib/roger/generators/new.rb +56 -41
- data/lib/roger/generators/templates/generator.tt +5 -5
- data/lib/roger/helpers/get_callable.rb +15 -14
- data/lib/roger/helpers/logging.rb +35 -13
- data/lib/roger/mockupfile.rb +13 -23
- data/lib/roger/project.rb +41 -34
- data/lib/roger/rack/roger.rb +28 -29
- data/lib/roger/rack/sleep.rb +4 -5
- data/lib/roger/release.rb +95 -72
- data/lib/roger/release/cleaner.rb +14 -13
- data/lib/roger/release/finalizers.rb +10 -10
- data/lib/roger/release/finalizers/dir.rb +17 -19
- data/lib/roger/release/finalizers/git_branch.rb +76 -38
- data/lib/roger/release/finalizers/rsync.rb +60 -49
- data/lib/roger/release/finalizers/zip.rb +32 -29
- data/lib/roger/release/injector.rb +43 -37
- data/lib/roger/release/processors.rb +24 -22
- data/lib/roger/release/processors/mockup.rb +97 -69
- data/lib/roger/release/processors/url_relativizer.rb +57 -30
- data/lib/roger/release/scm.rb +30 -27
- data/lib/roger/release/scm/git.rb +101 -92
- data/lib/roger/resolver.rb +86 -61
- data/lib/roger/server.rb +52 -27
- data/lib/roger/template.rb +102 -74
- data/lib/roger/test.rb +16 -13
- data/lib/roger/version.rb +3 -2
- data/roger.gemspec +9 -5
- data/test/helpers/cli.rb +17 -15
- data/test/project/Gemfile +2 -2
- data/test/project/html/formats/csv.rcsv +0 -0
- data/test/project/lib/generators/test.rb +2 -3
- data/test/project/lib/tests/fail/fail.rb +5 -6
- data/test/project/lib/tests/noop/lib/cli.rb +2 -1
- data/test/project/lib/tests/noop/lib/test.rb +5 -5
- data/test/project/lib/tests/noop/noop.rb +2 -1
- data/test/project/lib/tests/succeed/succeed.rb +5 -6
- data/test/unit/cli/cli_base_test.rb +2 -3
- data/test/unit/cli/cli_generate_test.rb +9 -10
- data/test/unit/cli/cli_serve_test.rb +22 -18
- data/test/unit/cli/cli_test_test.rb +13 -15
- data/test/unit/cli/cli_version_test.rb +4 -4
- data/test/unit/generators_test.rb +8 -10
- data/test/unit/helpers/logging_test.rb +64 -0
- data/test/unit/rack/roger_test.rb +21 -0
- data/test/unit/release/cleaner_test.rb +23 -19
- data/test/unit/release/finalizers/git_branch_test.rb +2 -1
- data/test/unit/release/finalizers/zip_test.rb +48 -0
- data/test/unit/release/mockup_test.rb +48 -0
- data/test/unit/release/processors_test.rb +19 -19
- data/test/unit/release_test.rb +15 -14
- data/test/unit/resolver_test.rb +21 -14
- data/test/unit/server_test.rb +31 -0
- data/test/unit/template_test.rb +58 -36
- data/test/unit/test_test.rb +3 -2
- metadata +35 -9
- data/test/Mockupfile-syntax.rb +0 -93
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d86fb892f4028385d30405b3f4d06fa709cf4d5e
|
4
|
+
data.tar.gz: c0bf2f37b72b13a4b9e070487915d4915717eea1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4f2e4e2948a90dfb8ace4ef4763b85cd4309fb03e144fde95199d04dc0746e9fc38a4af80fb7617ff5f1cee1250fc6209cd1470d7a0369a3959b694af467c27
|
7
|
+
data.tar.gz: 2a4ae577eb0a87c5d8835737ba6974e5c72f057b90d890b3cc6ba75557c546a3652ff94d149ec56be1ff85e95ebf71304066965f6cf4c9944e25f6f80e93fa07
|
data/.hound.yml
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
LineLength:
|
2
|
+
Description: 'Limit lines to 100 characters.'
|
3
|
+
Max: 100
|
4
|
+
Enabled: true
|
5
|
+
|
6
|
+
StringLiterals:
|
7
|
+
EnforcedStyle: double_quotes
|
8
|
+
Enabled: true
|
9
|
+
|
10
|
+
Style/DotPosition:
|
11
|
+
EnforcedStyle: trailing
|
12
|
+
Enabled: true
|
13
|
+
|
14
|
+
Metrics/MethodLength:
|
15
|
+
CountComments: false # count full line comments?
|
16
|
+
Max: 20
|
17
|
+
|
18
|
+
Metrics/AbcSize:
|
19
|
+
Max: 20
|
20
|
+
|
21
|
+
Style/ClassAndModuleChildren:
|
22
|
+
EnforcedStyle: compact
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
# By default, the rails cops are not run. Override in project or home
|
26
|
+
# directory .rubocop.yml files, or by giving the -R/--rails option.
|
27
|
+
AllCops:
|
28
|
+
RunRailsCops: false
|
29
|
+
|
30
|
+
# Disabled cops
|
31
|
+
Metrics/ClassLength:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Metrics/ModuleLength:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Style/EachWithObject:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
Style/AccessorMethodName:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
Lint/AssignmentInCondition:
|
44
|
+
Enabled: false
|
45
|
+
|
46
|
+
Style/SingleLineBlockParams:
|
47
|
+
Enabled: false
|
data/.travis.yml
CHANGED
@@ -3,13 +3,9 @@ rvm:
|
|
3
3
|
- 1.9.3
|
4
4
|
- 2.0.0
|
5
5
|
- 2.1.1
|
6
|
-
-
|
7
|
-
- jruby
|
6
|
+
- 2.2.2
|
8
7
|
before_script:
|
9
8
|
- git config --global user.email "travis-ci@digitpaint.nl"
|
10
9
|
- git config --global user.name "Travis-CI"
|
11
10
|
matrix:
|
12
|
-
allow_failures:
|
13
|
-
- rvm: rbx-2
|
14
|
-
- rvm: jruby
|
15
11
|
fast_finish: true
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## Version 1.2.1
|
4
|
+
* Fix missing env (https://github.com/DigitPaint/roger/issues/24)
|
5
|
+
|
6
|
+
## Version 1.2.0
|
7
|
+
* `roger.project` is now always in `env` when running as a project or as a release. Use this in favor of `env["MOCKUP_PROJECT"]`
|
8
|
+
* All Roger code now is linted by Rubocop. More tests have been added and more documentation as well. Still not everything may have been covered by the tests.
|
9
|
+
|
10
|
+
|
3
11
|
## Version 1.1.3
|
4
12
|
* Add `--version` flag so we can ask what version of Roger we're running.
|
5
13
|
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,9 +1,15 @@
|
|
1
|
-
require
|
1
|
+
require "rake/testtask"
|
2
|
+
require "rubocop/rake_task"
|
2
3
|
|
3
|
-
task :
|
4
|
+
task default: [:test, :rubocop]
|
5
|
+
|
6
|
+
desc "Run rubocop"
|
7
|
+
task :rubocop do
|
8
|
+
RuboCop::RakeTask.new
|
9
|
+
end
|
4
10
|
|
5
11
|
Rake::TestTask.new do |t|
|
6
12
|
t.libs << "test"
|
7
|
-
t.test_files = FileList[
|
13
|
+
t.test_files = FileList["test/unit/**/*_test.rb"]
|
8
14
|
t.verbose = true
|
9
|
-
end
|
15
|
+
end
|
data/bin/roger
CHANGED
data/doc/mockupfile.md
CHANGED
@@ -1,3 +1,100 @@
|
|
1
1
|
# Mockupfile
|
2
2
|
|
3
3
|
The mockupfile is where all the project configuration for releasing, serving etc. happens.
|
4
|
+
|
5
|
+
## Example
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
|
9
|
+
# Some SASS defaults
|
10
|
+
Sass::Plugin.options[:style] = :expanded
|
11
|
+
Sass::Plugin.options[:template_location] = "./html/stylesheets"
|
12
|
+
Sass::Plugin.options[:css_location] = "./html/stylesheets"
|
13
|
+
|
14
|
+
# Set verbosity to true (you can also pass --verbose to roger)
|
15
|
+
# mockup.project.options[:verbose] = true
|
16
|
+
|
17
|
+
# These are defaults, but can be set here
|
18
|
+
# mockup.project.html_path = mockup.project.path + "html"
|
19
|
+
# mockup.project.partial_path = mockup.project.path + "partials"
|
20
|
+
|
21
|
+
# Server is a regular Rack interface.
|
22
|
+
mockup.serve do |server|
|
23
|
+
server.use :sass
|
24
|
+
end
|
25
|
+
|
26
|
+
# Define tests
|
27
|
+
mockup.test do |t|
|
28
|
+
t.use :jshint
|
29
|
+
end
|
30
|
+
|
31
|
+
mockup.release do |release|
|
32
|
+
|
33
|
+
# The variables below can be used anywhere in this section
|
34
|
+
release.target_path # The target path where releases are put
|
35
|
+
release.build_path # The path where the release gets built
|
36
|
+
release.source_path # The source for this mockup
|
37
|
+
|
38
|
+
# Get git version, these variables can be used anywhere in this section
|
39
|
+
release.scm.previous # Get the previous version SCM op (looks for tags)
|
40
|
+
release.scm.version # Get the git version
|
41
|
+
release.scm.date # Get the git date
|
42
|
+
|
43
|
+
# Extract mockup (this is optional)
|
44
|
+
# release.mockup
|
45
|
+
|
46
|
+
# Create custom banner
|
47
|
+
#
|
48
|
+
# The default banner looks like this:
|
49
|
+
#
|
50
|
+
# =======================
|
51
|
+
# = Version : v1.0.0 =
|
52
|
+
# = Date : 2012-06-20 =
|
53
|
+
# =======================
|
54
|
+
release.banner do
|
55
|
+
"bla bla bla"
|
56
|
+
end
|
57
|
+
|
58
|
+
# Sassify CSS (this are the defaults too), all options except form :match and :skip are passed to Sass.compile_file
|
59
|
+
# release.use :sass, :match => ["stylesheets/**/*.scss"], :skip => [/_.*\.scss\Z/], :style => :expanded
|
60
|
+
# The previous statement is the same as:
|
61
|
+
release.use :sass
|
62
|
+
|
63
|
+
# Run requirejs optimizer
|
64
|
+
# release.use :requirejs, {
|
65
|
+
# :build_files => {"javascripts/site.build.js" => "javascripts"},
|
66
|
+
# :rjs => release.source_path + "../vendor/requirejs/r.js",
|
67
|
+
# :node => "node"
|
68
|
+
# }
|
69
|
+
release.use :requirejs
|
70
|
+
|
71
|
+
# Minify, will not minify anything above the :delimiter
|
72
|
+
# release.use :yuicompressor, {
|
73
|
+
# :match => ["**/*.{css,js}"],
|
74
|
+
# :skip => [/javascripts\/vendor\/.*\.js\Z/, /_doc\/.*/],
|
75
|
+
# :delimiter => Regexp.escape("/* -------------------------------------------------------------------------------- */")
|
76
|
+
# }
|
77
|
+
# The previous statement is the same as:
|
78
|
+
release.use :yuicompressor
|
79
|
+
|
80
|
+
# Inject VERSION / DATE (i.e. in TOC)
|
81
|
+
r.inject({ "[VERSION]" => release.scm.version, "[DATE]" => release.scm.date.strftime("%Y-%m-%d") }, into: %w(_doc/toc.html))
|
82
|
+
|
83
|
+
# Inject Banners on everything matching the regexp in all .css files
|
84
|
+
# The banner will be commented as CSS.
|
85
|
+
release.inject({ /\/\*\s*\[BANNER\]\s*\*\// => r.banner(comment: :css) }, into: %w(**/*.css))
|
86
|
+
|
87
|
+
# Inject CHANGELOG
|
88
|
+
release.inject({ "[CHANGELOG]" => { file: "../CHANGELOG", processor: "md" } }, into: %w(_doc/changelog.html))
|
89
|
+
|
90
|
+
# Inject NOTES
|
91
|
+
release.inject({ "[NOTES]" => { file: "../NOTES.md", processor: "md" } }, into: %w(_doc/notes.html))
|
92
|
+
|
93
|
+
# Cleanup on the build
|
94
|
+
release.cleanup "**/.DS_Store"
|
95
|
+
|
96
|
+
# Finalize the release
|
97
|
+
# This is the default finalizer so not required
|
98
|
+
# release.finalize :dir
|
99
|
+
end
|
100
|
+
```
|
data/doc/templating.md
CHANGED
data/lib/roger/cli.rb
CHANGED
@@ -1,24 +1,21 @@
|
|
1
|
-
require
|
1
|
+
require "rubygems"
|
2
2
|
|
3
3
|
# Require bundler gems if available
|
4
|
-
if Object.const_defined?(:Bundler)
|
5
|
-
Bundler.require(:default)
|
6
|
-
end
|
7
|
-
|
4
|
+
Bundler.require(:default) if Object.const_defined?(:Bundler)
|
8
5
|
|
9
|
-
require
|
10
|
-
require
|
6
|
+
require "thor"
|
7
|
+
require "thor/group"
|
11
8
|
|
12
|
-
require
|
13
|
-
require
|
9
|
+
require "pathname"
|
10
|
+
require "fileutils"
|
14
11
|
include FileUtils
|
15
12
|
|
16
13
|
require File.dirname(__FILE__) + "/version"
|
17
14
|
require File.dirname(__FILE__) + "/template"
|
18
15
|
require File.dirname(__FILE__) + "/project"
|
19
16
|
|
20
|
-
|
21
17
|
module Roger
|
18
|
+
# The CLI namespace
|
22
19
|
module Cli; end
|
23
20
|
end
|
24
21
|
|
@@ -31,10 +28,9 @@ require File.dirname(__FILE__) + "/cli/test"
|
|
31
28
|
require File.dirname(__FILE__) + "/generators"
|
32
29
|
require File.dirname(__FILE__) + "/test"
|
33
30
|
|
34
|
-
|
35
31
|
module Roger
|
32
|
+
# The Roger main entrypoint!
|
36
33
|
class Cli::Base < Thor
|
37
|
-
|
38
34
|
def initialize(*args)
|
39
35
|
super
|
40
36
|
self.class.project ||= initialize_project
|
@@ -49,38 +45,49 @@ module Roger
|
|
49
45
|
end
|
50
46
|
|
51
47
|
class_option :path,
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
48
|
+
desc: "Project root path",
|
49
|
+
type: :string,
|
50
|
+
required: false,
|
51
|
+
default: "."
|
56
52
|
|
57
53
|
class_option :html_path,
|
58
|
-
|
59
|
-
|
54
|
+
desc: 'The document root, defaults to "[directory]/html"',
|
55
|
+
type: :string
|
60
56
|
|
61
57
|
class_option :partial_path,
|
62
|
-
|
63
|
-
|
58
|
+
desc: "Defaults to [directory]/partials",
|
59
|
+
type: :string
|
64
60
|
|
65
61
|
class_option :verbose,
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
62
|
+
desc: "Sets verbose output",
|
63
|
+
aliases: ["-v"],
|
64
|
+
default: false,
|
65
|
+
type: :boolean
|
70
66
|
|
71
|
-
map %w
|
67
|
+
map %w(--version) => :version
|
72
68
|
|
73
|
-
desc "test [COMMAND]", "Run one or more tests. Test can be 'all' for all
|
69
|
+
desc "test [COMMAND]", "Run one or more tests. Test can be 'all' for all
|
70
|
+
defined tests or a specific test name"
|
74
71
|
subcommand "test", Cli::Test
|
75
72
|
|
76
73
|
desc "generate [COMMAND]", "Run a generator"
|
77
74
|
subcommand "generate", Cli::Generate
|
78
75
|
|
79
|
-
register
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
76
|
+
register(
|
77
|
+
Cli::Serve,
|
78
|
+
"serve",
|
79
|
+
"serve #{Cli::Serve.arguments.map(&:banner).join(' ')}",
|
80
|
+
Cli::Serve.desc
|
81
|
+
)
|
82
|
+
tasks["serve"].options = Cli::Serve.class_options
|
83
|
+
|
84
|
+
register(
|
85
|
+
Cli::Release,
|
86
|
+
"release",
|
87
|
+
"release #{Cli::Release.arguments.map(&:banner).join(' ')}",
|
88
|
+
Cli::Release.desc
|
89
|
+
)
|
90
|
+
tasks["release"].options = Cli::Release.class_options
|
84
91
|
|
85
92
|
desc "version", "Get the current Roger version"
|
86
93
|
def version
|
@@ -91,14 +98,12 @@ module Roger
|
|
91
98
|
|
92
99
|
# TODO: handle options
|
93
100
|
def initialize_project
|
94
|
-
if(
|
101
|
+
if (Pathname.new(options[:path]) + "../partials").exist?
|
95
102
|
puts "[ERROR]: Don't use the \"html\" path, use the project base path instead"
|
96
103
|
exit(1)
|
97
104
|
end
|
98
105
|
|
99
|
-
Project.new(options[:path], {:shell
|
106
|
+
Project.new(options[:path], { shell: shell }.update(options))
|
100
107
|
end
|
101
|
-
|
102
108
|
end
|
103
|
-
|
104
|
-
end
|
109
|
+
end
|
data/lib/roger/cli/command.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
module Roger
|
2
|
-
|
2
|
+
# Abstract base class for Roger commands
|
3
3
|
class Cli::Command < Thor::Group
|
4
4
|
def self.exit_on_failure?
|
5
5
|
true
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
8
|
def initialize_project
|
10
9
|
@project = Cli::Base.project
|
11
10
|
end
|
@@ -17,5 +16,4 @@ module Roger
|
|
17
16
|
puts " Partials: \"#{project.partial_path}\""
|
18
17
|
end
|
19
18
|
end
|
20
|
-
|
21
|
-
end
|
19
|
+
end
|
data/lib/roger/cli/generate.rb
CHANGED
data/lib/roger/cli/release.rb
CHANGED
data/lib/roger/cli/serve.rb
CHANGED
@@ -1,25 +1,26 @@
|
|
1
1
|
module Roger
|
2
|
+
# The serve command
|
2
3
|
class Cli::Serve < Cli::Command
|
3
|
-
|
4
|
-
|
5
4
|
desc "Serve the current project"
|
6
5
|
|
7
|
-
class_options :
|
8
|
-
:
|
9
|
-
:
|
6
|
+
class_options port: :string, # Defaults to 9000
|
7
|
+
host: :string, # Defaults to 0.0.0.0
|
8
|
+
handler: :string # The handler to use (defaults to mongrel)
|
10
9
|
|
11
10
|
def serve
|
12
11
|
server_options = {}
|
13
|
-
options.each{|k,v| server_options[k.to_sym] = v }
|
12
|
+
options.each { |k, v| server_options[k.to_sym] = v }
|
14
13
|
server_options[:server] = {}
|
15
14
|
[:port, :handler, :host].each do |k|
|
16
|
-
server_options[:server][k] = server_options.delete(k) if server_options.
|
15
|
+
server_options[:server][k] = server_options.delete(k) if server_options.key?(k)
|
17
16
|
end
|
18
17
|
|
19
|
-
|
20
|
-
|
18
|
+
@project.server.set_options(server_options[:server])
|
19
|
+
end
|
21
20
|
|
22
|
-
|
21
|
+
def show_banner
|
22
|
+
server = @project.server
|
23
|
+
puts "Running Roger with #{server.handler.inspect} on #{server.host}:#{server.port}"
|
23
24
|
puts project_banner(@project)
|
24
25
|
end
|
25
26
|
|
@@ -29,4 +30,3 @@ module Roger
|
|
29
30
|
end
|
30
31
|
end
|
31
32
|
end
|
32
|
-
|