requirejs_integrator 2.0.1 → 3.0.1

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.
@@ -1 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+ # Copyright (C) 2015,2016 Szymon Kopciewski
4
+ #
5
+ # This file is part of RequirejsIntegrator.
6
+ #
7
+ # This program is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+
20
+ require "requirejs_integrator/version"
21
+ require "requirejs_integrator/config"
1
22
  require "requirejs_integrator/tasks"
@@ -0,0 +1,67 @@
1
+ # encoding: utf-8
2
+
3
+ # Copyright (C) 2015,2016 Szymon Kopciewski
4
+ #
5
+ # This file is part of RequirejsIntegrator.
6
+ #
7
+ # This program is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+
20
+ require "requirejs_integrator/command_template"
21
+
22
+ module RequirejsIntegrator
23
+ module Command
24
+ class Compile < CommandTemplate
25
+ def run
26
+ @output.puts "*** Compile js files ***"
27
+ @executor.system "node #{rjs_path} -o \
28
+ #{config_file_path} \
29
+ appDir=#{app_dir_path} \
30
+ baseUrl=./ \
31
+ mainConfigFile=#{main_config_file_path} \
32
+ dir=#{destination_path}"
33
+ end
34
+
35
+ private
36
+
37
+ def rjs_path
38
+ File.join(Gem.datadir("requirejs_integrator"), "r.js.bundled")
39
+ end
40
+
41
+ def app_dir_path
42
+ File.join(
43
+ Rake.application.original_dir,
44
+ @config.fetch("project_ui_dir"),
45
+ @config.fetch("project_public_dir"),
46
+ @config.fetch("project_javascripts_dir")
47
+ )
48
+ end
49
+
50
+ def main_config_file_path
51
+ File.join(
52
+ app_dir_path,
53
+ "main.js"
54
+ )
55
+ end
56
+
57
+ def destination_path
58
+ File.join(
59
+ Rake.application.original_dir,
60
+ @config.fetch("project_ui_dir"),
61
+ @config.fetch("project_public_dir"),
62
+ @config.fetch("project_js_compressed_dir")
63
+ )
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+
3
+ # Copyright (C) 2015,2016 Szymon Kopciewski
4
+ #
5
+ # This file is part of RequirejsIntegrator.
6
+ #
7
+ # This program is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+
20
+ require "requirejs_integrator/command_template"
21
+ require "fileutils"
22
+
23
+ module RequirejsIntegrator
24
+ module Command
25
+ class GenerateConfiguration < CommandTemplate
26
+ def run
27
+ config_dir = File.dirname config_file_path
28
+ return if File.exist?(config_file_path)
29
+ @output.puts "*** Creating default RequireJS configuration ***"
30
+ FileUtils.mkdir_p config_dir
31
+ FileUtils.cp default_config_file_path, config_file_path
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,50 @@
1
+ # encoding: utf-8
2
+
3
+ # Copyright (C) 2015,2016 Szymon Kopciewski
4
+ #
5
+ # This file is part of RequirejsIntegrator.
6
+ #
7
+ # This program is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+
20
+ module RequirejsIntegrator
21
+ class CommandTemplate
22
+ def initialize(config:, output: $stdout, executor: ::Kernel)
23
+ @config = config
24
+ @output = output
25
+ @executor = executor
26
+ end
27
+
28
+ def run
29
+ raise NotImplementedError
30
+ end
31
+
32
+ private
33
+
34
+ def config_file_path
35
+ File.join(
36
+ Rake.application.original_dir,
37
+ @config.fetch("project_ui_dir"),
38
+ @config.fetch("project_config_dir"),
39
+ @config.fetch("project_requirejs_config_file")
40
+ )
41
+ end
42
+
43
+ def default_config_file_path
44
+ File.join(
45
+ Gem.datadir("requirejs_integrator"),
46
+ "build.js.default"
47
+ )
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+
3
+ # Copyright (C) 2015,2016 Szymon Kopciewski
4
+ #
5
+ # This file is part of RequirejsIntegrator.
6
+ #
7
+ # This program is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+
20
+ require "piko_model"
21
+
22
+ module RequirejsIntegrator
23
+ class Config < PikoModel::Model
24
+ field "project_javascripts_dir", default: "javascripts"
25
+ field "project_js_compressed_dir", default: "js"
26
+ field "project_ui_dir", default: "."
27
+ field "project_public_dir", default: "public"
28
+ field "project_config_dir", default: "config"
29
+ field "project_requirejs_config_file", default: "build.js"
30
+ end
31
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # Copyright (C) 2015 Szymon Kopciewski
3
+ # Copyright (C) 2015,2016 Szymon Kopciewski
4
4
  #
5
5
  # This file is part of RequirejsIntegrator.
6
6
  #
@@ -17,5 +17,16 @@
17
17
  # You should have received a copy of the GNU General Public License
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
- tasks_path = File.join(File.dirname(__FILE__), "tasks")
21
- Dir["#{tasks_path}/*.rake"].each { |ext| load ext } if defined?(Rake)
20
+ module RequirejsIntegrator
21
+ module Tasks
22
+ class << self
23
+ attr_reader :config
24
+ end
25
+
26
+ def self.load(config)
27
+ @config = config
28
+ tasks_path = File.join(File.dirname(__FILE__), "tasks")
29
+ Dir["#{tasks_path}/*.rake"].each { |ext| ::Kernel.load(ext, true) } if defined?(::Rake)
30
+ end
31
+ end
32
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # Copyright (C) 2015 Szymon Kopciewski
3
+ # Copyright (C) 2015,2016 Szymon Kopciewski
4
4
  #
5
5
  # This file is part of RequirejsIntegrator.
6
6
  #
@@ -17,23 +17,13 @@
17
17
  # You should have received a copy of the GNU General Public License
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
- require "system_executor"
21
- require "stdout_outputter"
20
+ require "requirejs_integrator/command/generate_configuration"
22
21
 
23
22
  namespace :ri do
24
23
  desc "Install default r.js config"
25
24
  task :config do
26
- default_config_path = File.join(
27
- Gem.datadir("requirejs_integrator"),
28
- "build_default.js"
29
- )
30
- current_path = Rake.application.original_dir
31
- current_configdir_path = File.join(current_path, "config")
32
- current_config_path = File.join(current_configdir_path, "build.js")
33
- unless File.exist?(current_config_path)
34
- StdoutOutputter::Outputter.new.write "*** Creating default r.js configuration ***"
35
- SystemExecutor::Executor.new.run "mkdir -p #{current_configdir_path}"
36
- SystemExecutor::Executor.new.run "cp #{default_config_path} #{current_config_path}"
37
- end
25
+ RequirejsIntegrator::Command::GenerateConfiguration.new(
26
+ config: RequirejsIntegrator::Tasks.config
27
+ ).run
38
28
  end
39
29
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # Copyright (C) 2015 Szymon Kopciewski
3
+ # Copyright (C) 2015,2016 Szymon Kopciewski
4
4
  #
5
5
  # This file is part of RequirejsIntegrator.
6
6
  #
@@ -17,44 +17,14 @@
17
17
  # You should have received a copy of the GNU General Public License
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
- require "exec_executor"
21
- require "system_executor"
22
- require "stdout_outputter"
20
+ require "requirejs_integrator/command/compile"
23
21
 
24
22
  namespace :ri do
25
23
  desc "Compile js"
26
24
  task :compile do
27
- rjs_path = File.join(Gem.datadir("requirejs_integrator"), "r.js")
28
- project_ui_dir = ENV["PROJECT_UI_DIR"] || "."
29
- project_public_dir = ENV["PROJECT_PUBLIC_DIR"] || "public"
30
- project_js_dir = ENV["PROJECT_JS_DIR"] || "javascripts"
31
- project_rjs_dir = ENV["PROJECT_RJS_DIR"] || "js"
32
- app_dir_path = File.join(
33
- Rake.application.original_dir,
34
- project_ui_dir,
35
- project_public_dir,
36
- project_js_dir
37
- )
38
- dir_path = File.join(
39
- Rake.application.original_dir,
40
- project_ui_dir,
41
- project_public_dir,
42
- project_rjs_dir
43
- )
44
- main_config_file_path = File.join(
45
- Rake.application.original_dir,
46
- project_ui_dir,
47
- project_public_dir,
48
- project_js_dir,
49
- "main.js"
50
- )
51
- StdoutOutputter::Outputter.new.write "*** Compile js files ***"
52
- SystemExecutor::Executor.new.run "node #{rjs_path} -o \
53
- config/build.js \
54
- appDir=#{app_dir_path} \
55
- baseUrl=./ \
56
- mainConfigFile=#{main_config_file_path} \
57
- dir=#{dir_path}"
25
+ RequirejsIntegrator::Command::Compile.new(
26
+ config: RequirejsIntegrator::Tasks.config
27
+ ).run
58
28
  end
59
29
 
60
30
  task c: %w(compile)
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # Copyright (C) 2015 Szymon Kopciewski
3
+ # Copyright (C) 2015,2016 Szymon Kopciewski
4
4
  #
5
5
  # This file is part of RequirejsIntegrator.
6
6
  #
@@ -18,5 +18,5 @@
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
20
  module RequirejsIntegrator
21
- VERSION = "2.0.1"
21
+ VERSION = "3.0.1".freeze
22
22
  end
metadata CHANGED
@@ -1,115 +1,102 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: requirejs_integrator
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Szymon Kopciewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-17 00:00:00.000000000 Z
11
+ date: 2016-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: exec_executor
14
+ name: piko_model
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: system_executor
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: '1.0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: '1.0'
41
- - !ruby/object:Gem::Dependency
42
- name: stdout_outputter
28
+ name: rake
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - ~>
31
+ - - ">="
46
32
  - !ruby/object:Gem::Version
47
- version: '1.0'
48
- type: :runtime
33
+ version: '0'
34
+ type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - ~>
38
+ - - ">="
53
39
  - !ruby/object:Gem::Version
54
- version: '1.0'
40
+ version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
- name: rake
42
+ name: pry
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - ! '>='
45
+ - - ">="
60
46
  - !ruby/object:Gem::Version
61
47
  version: '0'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - ! '>='
52
+ - - ">="
67
53
  - !ruby/object:Gem::Version
68
54
  version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
- name: rspec
56
+ name: minitest
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - ! '>='
59
+ - - ">="
74
60
  - !ruby/object:Gem::Version
75
61
  version: '0'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - ! '>='
66
+ - - ">="
81
67
  - !ruby/object:Gem::Version
82
68
  version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
- name: rspec-given
70
+ name: minitest-reporters
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - ! '>='
73
+ - - ">="
88
74
  - !ruby/object:Gem::Version
89
75
  version: '0'
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - ! '>='
80
+ - - ">="
95
81
  - !ruby/object:Gem::Version
96
82
  version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
- name: pry
84
+ name: codeclimate-test-reporter
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
- - - ! '>='
87
+ - - ">="
102
88
  - !ruby/object:Gem::Version
103
89
  version: '0'
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
- - - ! '>='
94
+ - - ">="
109
95
  - !ruby/object:Gem::Version
110
96
  version: '0'
111
97
  description: The tasks for assets managment with requirejs
112
- email: s.kopciewski@gmail.com
98
+ email:
99
+ - s.kopciewski@gmail.com
113
100
  executables: []
114
101
  extensions: []
115
102
  extra_rdoc_files: []
@@ -118,9 +105,13 @@ files:
118
105
  - Gemfile
119
106
  - LICENSE
120
107
  - README.md
121
- - data/requirejs_integrator/build_default.js
122
- - data/requirejs_integrator/r.js
108
+ - data/requirejs_integrator/build.js.default
109
+ - data/requirejs_integrator/r.js.bundled
123
110
  - lib/requirejs_integrator.rb
111
+ - lib/requirejs_integrator/command/compile.rb
112
+ - lib/requirejs_integrator/command/generate_configuration.rb
113
+ - lib/requirejs_integrator/command_template.rb
114
+ - lib/requirejs_integrator/config.rb
124
115
  - lib/requirejs_integrator/tasks.rb
125
116
  - lib/requirejs_integrator/tasks/config.rake
126
117
  - lib/requirejs_integrator/tasks/rjs.rake
@@ -135,17 +126,17 @@ require_paths:
135
126
  - lib
136
127
  required_ruby_version: !ruby/object:Gem::Requirement
137
128
  requirements:
138
- - - ! '>='
129
+ - - ">="
139
130
  - !ruby/object:Gem::Version
140
131
  version: '0'
141
132
  required_rubygems_version: !ruby/object:Gem::Requirement
142
133
  requirements:
143
- - - ! '>='
134
+ - - ">="
144
135
  - !ruby/object:Gem::Version
145
136
  version: '0'
146
137
  requirements: []
147
138
  rubyforge_project:
148
- rubygems_version: 2.2.5
139
+ rubygems_version: 2.4.8
149
140
  signing_key:
150
141
  specification_version: 4
151
142
  summary: The tasks for assets managment with requirejs