architecture-js 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,6 +3,7 @@ source "http://rubygems.org"
3
3
  gem "fssm", "~> 0.2.8.1"
4
4
  gem "jsmin", "~> 1.0.1"
5
5
  gem "sprockets", "1.0.2"
6
+ gem "modjs-architecture"
6
7
 
7
8
  group :test do
8
9
  gem "simplecov", "~> 0.5.4", :require => false
data/Gemfile.lock CHANGED
@@ -2,6 +2,13 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  ZenTest (4.6.2)
5
+ architecture-js (0.1.11)
6
+ fssm
7
+ fssm (~> 0.2.8.1)
8
+ jsmin
9
+ jsmin (~> 1.0.1)
10
+ sprockets (= 1.0.2)
11
+ sprockets (= 1.0.2)
5
12
  autotest-growl (0.2.16)
6
13
  diff-lcs (1.1.3)
7
14
  fssm (0.2.8.1)
@@ -13,6 +20,9 @@ GEM
13
20
  rdoc
14
21
  jsmin (1.0.1)
15
22
  json (1.6.5)
23
+ modjs-architecture (0.1.1)
24
+ architecture-js (~> 0.1.11)
25
+ architecture-js (~> 0.1.11)
16
26
  multi_json (1.0.4)
17
27
  rake (0.9.2.2)
18
28
  rdoc (3.12)
@@ -41,6 +51,7 @@ DEPENDENCIES
41
51
  fssm (~> 0.2.8.1)
42
52
  jeweler (~> 1.8.3)
43
53
  jsmin (~> 1.0.1)
54
+ modjs-architecture
44
55
  rspec (~> 2.8.0)
45
56
  simplecov (~> 0.5.4)
46
57
  sprockets (= 1.0.2)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.11
1
+ 0.1.12
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "architecture-js"
8
- s.version = "0.1.11"
8
+ s.version = "0.1.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dayton Nolan"]
12
- s.date = "2012-02-04"
12
+ s.date = "2012-02-17"
13
13
  s.description = "Architecture.js helps you generate scaffolding, manage third-party packages, compile, and compress your application."
14
14
  s.email = "daytonn@gmail.com"
15
15
  s.executables = ["architect"]
@@ -31,7 +31,6 @@ Gem::Specification.new do |s|
31
31
  "bin/architect",
32
32
  "lib/architecture-js.rb",
33
33
  "lib/architecture-js/architect.rb",
34
- "lib/architecture-js/command.rb",
35
34
  "lib/architecture-js/dependencies.rb",
36
35
  "lib/architecture-js/generator.rb",
37
36
  "lib/architecture-js/helpers.rb",
@@ -39,9 +38,8 @@ Gem::Specification.new do |s|
39
38
  "lib/architecture-js/project.rb",
40
39
  "repository/modjs/plugins/jquery-elements.js",
41
40
  "spec/.DS_Store",
41
+ "spec/architect_spec.rb",
42
42
  "spec/architecture-js_spec.rb",
43
- "spec/cli_spec.rb",
44
- "spec/command_spec.rb",
45
43
  "spec/fixtures/.DS_Store",
46
44
  "spec/fixtures/_hidden.js",
47
45
  "spec/fixtures/compiled_src.js",
@@ -57,6 +55,7 @@ Gem::Specification.new do |s|
57
55
  "spec/fixtures/src_file.js",
58
56
  "spec/fixtures/templates/test_template_one.js",
59
57
  "spec/fixtures/templates/test_template_two.js",
58
+ "spec/fixtures/test_framework.rb",
60
59
  "spec/fixtures/test_template_options.js",
61
60
  "spec/fixtures/test_template_two.js",
62
61
  "spec/fixtures/update.architecture",
@@ -81,6 +80,7 @@ Gem::Specification.new do |s|
81
80
  s.add_runtime_dependency(%q<fssm>, ["~> 0.2.8.1"])
82
81
  s.add_runtime_dependency(%q<jsmin>, ["~> 1.0.1"])
83
82
  s.add_runtime_dependency(%q<sprockets>, ["= 1.0.2"])
83
+ s.add_runtime_dependency(%q<modjs-architecture>, [">= 0"])
84
84
  s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
85
85
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
86
86
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
@@ -93,6 +93,7 @@ Gem::Specification.new do |s|
93
93
  s.add_dependency(%q<fssm>, ["~> 0.2.8.1"])
94
94
  s.add_dependency(%q<jsmin>, ["~> 1.0.1"])
95
95
  s.add_dependency(%q<sprockets>, ["= 1.0.2"])
96
+ s.add_dependency(%q<modjs-architecture>, [">= 0"])
96
97
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
97
98
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
98
99
  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
@@ -106,6 +107,7 @@ Gem::Specification.new do |s|
106
107
  s.add_dependency(%q<fssm>, ["~> 0.2.8.1"])
107
108
  s.add_dependency(%q<jsmin>, ["~> 1.0.1"])
108
109
  s.add_dependency(%q<sprockets>, ["= 1.0.2"])
110
+ s.add_dependency(%q<modjs-architecture>, [">= 0"])
109
111
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
110
112
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
111
113
  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
@@ -1,14 +1,23 @@
1
- require "#{File.dirname(__FILE__)}/architecture-js/helpers"
1
+ module ArchitectureJS
2
+ end
3
+
4
+ require "architecture-js/helpers"
2
5
 
3
6
  module ArchitectureJS
4
- BASE_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
5
- LIB_DIR = File.expand_path(File.join(File.dirname(__FILE__)))
6
- ROOT_DIR = Dir.getwd
7
- VERSION = File.read("#{BASE_DIR}/VERSION")
8
- FRAMEWORKS = Hash.new
7
+ def base_directory
8
+ File.expand_path(File.join(File.dirname(__FILE__), '..'))
9
+ end
10
+
11
+ def lib_directory
12
+ File.expand_path(File.join(File.dirname(__FILE__)))
13
+ end
14
+
15
+ def root_directory
16
+ File.expand_path(File.join(File.dirname(Dir.getwd)))
17
+ end
9
18
 
10
19
  def register_framework(name, constructor)
11
- FRAMEWORKS[name] = constructor
20
+ ArchitectureJS::FRAMEWORKS[name] = constructor
12
21
  end
13
22
 
14
23
  def create_project_from_config(project_dir = nil)
@@ -25,8 +34,17 @@ module ArchitectureJS
25
34
  project = ArchitectureJS::FRAMEWORKS[config[:framework]].new(config, project_dir)
26
35
  end
27
36
 
28
- module_function :register_framework,
37
+ module_function :base_directory,
38
+ :lib_directory,
39
+ :register_framework,
29
40
  :create_project_from_config
30
41
  end
31
42
 
32
- Dir.glob(File.dirname(__FILE__) + '/architecture-js/*') { |file| require file }
43
+ module ArchitectureJS
44
+ VERSION = File.read("#{base_directory}/VERSION")
45
+ FRAMEWORKS = Hash.new
46
+ end
47
+
48
+ %w(dependencies generator notification project architect).each do |lib|
49
+ require "architecture-js/#{lib}"
50
+ end
@@ -1,3 +1,5 @@
1
+ require 'optparse'
2
+
1
3
  module Architect
2
4
 
3
5
  class << self
@@ -12,96 +14,129 @@ module Architect
12
14
 
13
15
  attr_reader :args,
14
16
  :command,
15
- :commands,
16
- :options,
17
- :subcommands
18
-
19
- def initialize
20
- @command = ARGV[0].to_sym if ARGV[0]
21
- @args = Array.try_convert(ARGV)
22
- @args.shift
23
- @options = {}
24
- @subcommands = {}
25
- @commands = [:create, :generate, :compile, :watch]
26
- @help = create_help
27
- end
17
+ :options
28
18
 
29
- def run
30
- parse_args unless @args.empty?
31
- if @command
32
- if options[:h]
33
- help @command
34
- else
35
- if @commands.include? @command
36
- self.send @command
37
- else
38
- puts ArchitectureJS::Notification.error "#{@command} is not a valid command"
39
- end
40
- end
19
+ def initialize(path = nil)
20
+ if path
21
+ @root = File.expand_path(path)
41
22
  else
42
- help
23
+ @root = File.expand_path(Dir.getwd)
43
24
  end
44
25
  end
45
26
 
46
- def create
47
- app_name = @args[0]
48
- sub_dir = @args[1] || nil
27
+ def run
28
+ parse_options
29
+ self.send(@command)
30
+ end
49
31
 
50
- if app_name.nil?
51
- puts "Error! Application name is required (architect create app_name)"
52
- exit
32
+ def create
33
+ app_name = @args.first
34
+ if @args[1]
35
+ sub_dir = @args[1] unless @args[1].match /^-/
53
36
  end
54
-
55
- config = { name: app_name }
56
- config[:root] = sub_dir unless sub_dir.nil?
57
- ArchitectureJS::Command.create(config)
37
+ framework = @options[:framework]
38
+
39
+ raise 'you must specify a project name: architect create [project_name]' if args[0].nil?
40
+
41
+ @root = File.expand_path sub_dir if sub_dir
42
+ config = { name: app_name, framework: framework }
43
+
44
+ require "#{framework}-architecture" unless framework == 'none'
45
+
46
+ project = ArchitectureJS::FRAMEWORKS[framework].new(config, @root)
47
+ project.create
58
48
  end
59
49
 
60
50
  def generate
61
51
  puts 'To be implemented'
52
+
53
+ #conf_path = "#{config[:project].root}/ninjs.conf"
54
+ #raise "ninjs.conf was not located in #{conf_path}" unless File.exists? conf_path
55
+ #generator = ArchitectureJS::Generator.new(config)
56
+ #generator.generate
62
57
  end
63
58
 
64
59
  def compile
65
- if options[:c] || options[:compress]
66
- ArchitectureJS::Command.compile({ force_compress: true })
67
- else
68
- ArchitectureJS::Command.compile
69
- end
60
+ project = ArchitectureJS::create_project_from_config(File.expand_path(Dir.getwd))
61
+ project.config[:output] = 'compressed' if options[:c] || options[:compress]
62
+ project.update
70
63
  end
71
64
 
72
65
  def watch
73
- ArchitectureJS::Command.watch
74
- end
66
+ require "fssm"
67
+ path ||= Dir.getwd
68
+ path = File.expand_path(path)
69
+
70
+ puts ArchitectureJS::Notification.log "architect is watching for changes. Press Ctrl-C to stop."
71
+ project = ArchitectureJS::Project::new_from_config(path)
72
+ project.update
73
+ watch_hash = Hash.new
74
+ watch_files = Dir["#{path}/**/"]
75
+ watch_files.shift # remove the project root
76
+ remove the build_dir
77
+ watch_files.reject! { |dir| dir.match(/#{path}\/#{project.config[:build_dir]}/) }
78
+
79
+ watch_files.each do |dir|
80
+ watch_hash[dir] = "**/*.js"
81
+ end
75
82
 
76
- private
77
- def parse_args
78
- @args.each_index do |i|
79
- if @args[i] =~ /^\-/
80
- parse_flag @args[i]
81
- elsif args[i] =~ /\:/
82
- parse_key_value_pair @args[i]
83
- else
84
- add_subcommand @args[i], i
83
+ watch_hash[path] = "**/*.architecture"
84
+ watch_hash["#{ArchitectureJS::base_directory}/repository"] = "**/*.js" # check changes to the repository as well
85
+
86
+ FSSM.monitor do
87
+ watch_hash.each do |dir, g|
88
+ path "#{dir}" do
89
+ glob g
90
+
91
+ update do |base, relative|
92
+ puts ArchitectureJS::Notification.event "change detected in #{relative}"
93
+ project.config.read if relative.match(/conf$/)
94
+ project.update
95
+ end
96
+
97
+ create do |base, relative|
98
+ puts ArchitectureJS::Notification.event "#{relative} created"
99
+ project.update
100
+ end
101
+
102
+ delete do |base, relative|
103
+ puts ArchitectureJS::Notification.event "#{relative} deleted"
104
+ project.update
105
+ end
85
106
  end
86
107
  end
87
108
  end
109
+ end
88
110
 
89
- def parse_flag(arg)
90
- key = arg.gsub(/^\-+/, '')
91
- @options[key] = true
92
- @options[key.to_sym] = true
93
- end
111
+ private
112
+ def parse_options
113
+ @options = {}
114
+ OptionParser.new do |opts|
115
+ opts.banner = "Usage: example.rb [options]"
116
+
117
+ options[:version] = false
118
+ opts.on("-v", "--version", "Version info") do
119
+ @options[:version] = true
120
+ end
94
121
 
95
- def parse_key_value_pair(arg)
96
- m = arg.match(/([\w|\-|]+)\:(\"|\')?(.*)(\"|\')?/)
97
- key = m.captures[0]
98
- value = m.captures[2]
99
- @options[key] = value
100
- @options[key.to_sym] = value
101
- end
122
+ options[:framework] = 'none'
123
+ opts.on('-f', '--framework FRAMEWORK', 'with framework') do |framework|
124
+ @options[:framework] = framework
125
+ end
126
+
127
+ @options[:compress] = false
128
+ opts.on('-c', '--compress', 'with compression') do
129
+ @options[:compress] = true
130
+ end
131
+
132
+ opts.on('-h', '--help', 'Display help') do
133
+ puts 'Show help'
134
+ end
135
+ end.parse!
102
136
 
103
- def add_subcommand(arg, index)
104
- #@subcommands[arg] = [sub args]
137
+ @command = ARGV[0].to_sym
138
+ @args = Array.try_convert(ARGV)
139
+ @args.shift # remove command
105
140
  end
106
141
 
107
142
  def help(command = nil)
@@ -1,4 +1,5 @@
1
1
  module ArchitectureJS
2
+
2
3
  class Project
3
4
  attr_accessor :root,
4
5
  :src_files,
@@ -9,9 +10,6 @@ module ArchitectureJS
9
10
  :generator,
10
11
  :config
11
12
 
12
- # this line adds the default framework to ArchitectureJS
13
- ArchitectureJS::register_framework 'none', self
14
-
15
13
  def self.new_from_config(path)
16
14
  config_file = Dir.entries(path).select {|f| f =~ /\.architecture$/ }.first
17
15
 
@@ -30,7 +28,7 @@ module ArchitectureJS
30
28
  @config_file = "#{config[:name].downcase}.architecture"
31
29
  root ||= Dir.getwd
32
30
  @root = File.expand_path(root)
33
- @template_directories = ["#{ArchitectureJS::BASE_DIR}/templates", "#{@root}/templates"]
31
+ @template_directories = ["#{ArchitectureJS::base_directory}/templates", "#{@root}/templates"]
34
32
  @directories = ['lib', 'src']
35
33
  @src_files = Array.new
36
34
  @config = {
@@ -123,7 +121,7 @@ module ArchitectureJS
123
121
 
124
122
  def compile_src_file(file_path, file_name)
125
123
  sprockets = Sprockets::Secretary.new(
126
- root: ArchitectureJS::BASE_DIR,
124
+ root: ArchitectureJS::base_directory,
127
125
  asset_root: @config[:asset_root],
128
126
  load_path: ['repository'],
129
127
  source_files: [file_path]
@@ -154,4 +152,7 @@ module ArchitectureJS
154
152
  end
155
153
 
156
154
  end # class Project
157
- end # module ArchitectureJS
155
+ end # module ArchitectureJS
156
+
157
+ # this line adds the default framework to ArchitectureJS
158
+ ArchitectureJS::register_framework('none', ArchitectureJS::Project)
@@ -0,0 +1,78 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'architect' do
4
+
5
+ context "CLI" do
6
+ before :each do
7
+ @bin = "#{ArchitectureJS::base_directory}/bin/architect"
8
+ FileUtils.mkdir "#{TMP_DIR}" unless File.exists? "#{TMP_DIR}"
9
+ `cd #{TMP_DIR}; #{@bin} create myapp`
10
+ FileUtils.cp "#{FIXTURES}/lib1.js", "#{TMP_DIR}/src/lib1.js"
11
+ FileUtils.cp "#{FIXTURES}/lib2.js", "#{TMP_DIR}/src/lib2.js"
12
+ FileUtils.cp "#{FIXTURES}/src_file.js", "#{TMP_DIR}/src/myapp.js"
13
+ end
14
+
15
+ after :each do
16
+ FileUtils.rm_rf "#{TMP_DIR}" if File.exists? "#{TMP_DIR}"
17
+ end
18
+
19
+ it 'should create a new application' do
20
+ "#{TMP_DIR}/myapp.architecture".should be_same_file_as "#{FIXTURES}/myapp.architecture"
21
+ File.directory?("#{TMP_DIR}/lib").should be_true
22
+ File.directory?("#{TMP_DIR}/src").should be_true
23
+ end
24
+
25
+ it 'should create a new application in a subdirectory' do
26
+ suppress_output { %x(cd #{TMP_DIR}; #{@bin} create myapp sub) }
27
+ "#{TMP_DIR}/sub/myapp.architecture".should be_same_file_as "#{FIXTURES}/myapp.architecture"
28
+ File.directory?("#{TMP_DIR}/sub/lib").should be_true
29
+ File.directory?("#{TMP_DIR}/sub/src").should be_true
30
+ File.exists?("#{TMP_DIR}/sub/src/myapp.js").should be_true
31
+ FileUtils.rm_rf "#{TMP_DIR}/sub"
32
+ end
33
+
34
+ it 'should compile the application' do
35
+ suppress_output { %x(cd #{TMP_DIR}; #{@bin} compile) }
36
+ File.exists?("#{TMP_DIR}/lib/myapp.js").should be_true
37
+ "#{TMP_DIR}/lib/myapp.js".should be_same_file_as "#{FIXTURES}/compressed.js"
38
+ end
39
+ end
40
+ =begin
41
+ context 'alternate framework' do
42
+
43
+ before :each do
44
+ @bin = "#{ArchitectureJS::base_directory}/bin/architect"
45
+ FileUtils.mkdir TMP_DIR unless File.exists? TMP_DIR
46
+ end
47
+
48
+ after :each do
49
+ FileUtils.rm_rf TMP_DIR if File.exists? TMP_DIR
50
+ end
51
+
52
+ it 'should create a new application with an alternate framework' do
53
+ puts `cd #{TMP_DIR}; #{@bin} create myapp -f modjs`
54
+
55
+ File.directory?("#{TMP_DIR}/application").should be_true
56
+ File.directory?("#{TMP_DIR}/elements").should be_true
57
+ File.directory?("#{TMP_DIR}/lib").should be_true
58
+ File.directory?("#{TMP_DIR}/models").should be_true
59
+ File.directory?("#{TMP_DIR}/modules").should be_true
60
+ File.directory?("#{TMP_DIR}/plugins").should be_true
61
+ File.directory?("#{TMP_DIR}/spec").should be_true
62
+ end
63
+
64
+ it 'should create a new application in a subdirectory with an alternate framework' do
65
+ puts `cd #{TMP_DIR}; #{@bin} create myapp sub -f modjs`
66
+
67
+ File.directory?("#{TMP_DIR}/sub/application").should be_true
68
+ File.directory?("#{TMP_DIR}/sub/elements").should be_true
69
+ File.directory?("#{TMP_DIR}/sub/lib").should be_true
70
+ File.directory?("#{TMP_DIR}/sub/models").should be_true
71
+ File.directory?("#{TMP_DIR}/sub/modules").should be_true
72
+ File.directory?("#{TMP_DIR}/sub/plugins").should be_true
73
+ File.directory?("#{TMP_DIR}/sub/spec").should be_true
74
+ end
75
+
76
+ end
77
+ =end
78
+ end
@@ -1,20 +1,20 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe ArchitectureJS do
4
- it 'should have a BASE_DIR constant' do
5
- ArchitectureJS::BASE_DIR.should_not be_nil
4
+ it 'should have a base_directory constant' do
5
+ ArchitectureJS::base_directory.should_not be_nil
6
6
  end
7
7
 
8
- it 'should have a LIB_DIR constant' do
9
- ArchitectureJS::LIB_DIR.should_not be_nil
8
+ it 'should have a lib_directory constant' do
9
+ ArchitectureJS::lib_directory.should_not be_nil
10
10
  end
11
11
 
12
- it 'should have a ROOT_DIR' do
13
- ArchitectureJS::ROOT_DIR.should_not be_nil
12
+ it 'should have a lib_directory' do
13
+ ArchitectureJS::lib_directory.should_not be_nil
14
14
  end
15
15
 
16
16
  it 'should have the correct VERSION' do
17
- version = File.open("#{ArchitectureJS::BASE_DIR}/VERSION").read
17
+ version = File.open("#{ArchitectureJS::base_directory}/VERSION").read
18
18
  ArchitectureJS::VERSION.should === version
19
19
  end
20
20
 
@@ -0,0 +1,21 @@
1
+ module TestFramework
2
+ class Project < ArchitectureJS::Project
3
+
4
+ def initialize(config, root = nil)
5
+ @config = {
6
+ framework: 'test',
7
+ src_dir: 'modules',
8
+ build_dir: 'application',
9
+ dependencies: [],
10
+ autoload: []
11
+ }
12
+ @config.merge! config unless config.nil?
13
+
14
+ super(@config, root)
15
+ @directories = %w'application elements lib models modules plugins spec'
16
+ end
17
+ end
18
+ end
19
+
20
+ # this line adds the default framework to ArchitectureJS
21
+ ArchitectureJS::register_framework('test', TestFramework::Project)
data/spec/project_spec.rb CHANGED
@@ -39,7 +39,7 @@ describe ArchitectureJS::Project do
39
39
  end
40
40
 
41
41
  it "should have template_directories" do
42
- @project.template_directories.should == ["#{ArchitectureJS::BASE_DIR}/templates", "#{TMP_DIR}/templates"]
42
+ @project.template_directories.should == ["#{ArchitectureJS::base_directory}/templates", "#{TMP_DIR}/templates"]
43
43
  end
44
44
 
45
45
  it "should have a generator" do
data/spec/spec_helper.rb CHANGED
@@ -4,6 +4,7 @@ require 'architecture-js'
4
4
  require 'fileutils'
5
5
  require 'rspec'
6
6
  require 'digest/md5'
7
+ require 'fixtures/test_framework.rb'
7
8
 
8
9
  RSpec.configure do |config|
9
10
  config.color_enabled = true
@@ -32,6 +33,6 @@ def suppress_output(&block)
32
33
  fake.string
33
34
  end
34
35
 
35
- SPEC_DIR = "#{ArchitectureJS::BASE_DIR}/spec"
36
+ SPEC_DIR = "#{ArchitectureJS::base_directory}/spec"
36
37
  TMP_DIR = "#{SPEC_DIR}/tmp"
37
38
  FIXTURES = "#{SPEC_DIR}/fixtures"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: architecture-js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-04 00:00:00.000000000Z
12
+ date: 2012-02-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fssm
16
- requirement: &70096504653840 !ruby/object:Gem::Requirement
16
+ requirement: &70245509245260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.2.8.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70096504653840
24
+ version_requirements: *70245509245260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: jsmin
27
- requirement: &70096504653360 !ruby/object:Gem::Requirement
27
+ requirement: &70245509244780 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70096504653360
35
+ version_requirements: *70245509244780
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sprockets
38
- requirement: &70096504652780 !ruby/object:Gem::Requirement
38
+ requirement: &70245509233900 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - =
@@ -43,10 +43,21 @@ dependencies:
43
43
  version: 1.0.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70096504652780
46
+ version_requirements: *70245509233900
47
+ - !ruby/object:Gem::Dependency
48
+ name: modjs-architecture
49
+ requirement: &70245509233300 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70245509233300
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: rspec
49
- requirement: &70096504652120 !ruby/object:Gem::Requirement
60
+ requirement: &70245509232700 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ~>
@@ -54,10 +65,10 @@ dependencies:
54
65
  version: 2.8.0
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *70096504652120
68
+ version_requirements: *70245509232700
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: bundler
60
- requirement: &70096504651540 !ruby/object:Gem::Requirement
71
+ requirement: &70245509232100 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ~>
@@ -65,10 +76,10 @@ dependencies:
65
76
  version: 1.0.0
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *70096504651540
79
+ version_requirements: *70245509232100
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: jeweler
71
- requirement: &70096504651000 !ruby/object:Gem::Requirement
82
+ requirement: &70245509231520 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ~>
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: 1.8.3
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *70096504651000
90
+ version_requirements: *70245509231520
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: ZenTest
82
- requirement: &70096504642800 !ruby/object:Gem::Requirement
93
+ requirement: &70245509230980 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ~>
@@ -87,10 +98,10 @@ dependencies:
87
98
  version: 4.6.2
88
99
  type: :development
89
100
  prerelease: false
90
- version_requirements: *70096504642800
101
+ version_requirements: *70245509230980
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: autotest-growl
93
- requirement: &70096504642320 !ruby/object:Gem::Requirement
104
+ requirement: &70245509230400 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ~>
@@ -98,10 +109,10 @@ dependencies:
98
109
  version: 0.2.16
99
110
  type: :development
100
111
  prerelease: false
101
- version_requirements: *70096504642320
112
+ version_requirements: *70245509230400
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: jsmin
104
- requirement: &70096504641760 !ruby/object:Gem::Requirement
115
+ requirement: &70245509229780 !ruby/object:Gem::Requirement
105
116
  none: false
106
117
  requirements:
107
118
  - - ! '>='
@@ -109,10 +120,10 @@ dependencies:
109
120
  version: '0'
110
121
  type: :runtime
111
122
  prerelease: false
112
- version_requirements: *70096504641760
123
+ version_requirements: *70245509229780
113
124
  - !ruby/object:Gem::Dependency
114
125
  name: fssm
115
- requirement: &70096504641240 !ruby/object:Gem::Requirement
126
+ requirement: &70245509229300 !ruby/object:Gem::Requirement
116
127
  none: false
117
128
  requirements:
118
129
  - - ! '>='
@@ -120,10 +131,10 @@ dependencies:
120
131
  version: '0'
121
132
  type: :runtime
122
133
  prerelease: false
123
- version_requirements: *70096504641240
134
+ version_requirements: *70245509229300
124
135
  - !ruby/object:Gem::Dependency
125
136
  name: sprockets
126
- requirement: &70096504640760 !ruby/object:Gem::Requirement
137
+ requirement: &70245509228800 !ruby/object:Gem::Requirement
127
138
  none: false
128
139
  requirements:
129
140
  - - =
@@ -131,7 +142,7 @@ dependencies:
131
142
  version: 1.0.2
132
143
  type: :runtime
133
144
  prerelease: false
134
- version_requirements: *70096504640760
145
+ version_requirements: *70245509228800
135
146
  description: Architecture.js helps you generate scaffolding, manage third-party packages,
136
147
  compile, and compress your application.
137
148
  email: daytonn@gmail.com
@@ -155,7 +166,6 @@ files:
155
166
  - bin/architect
156
167
  - lib/architecture-js.rb
157
168
  - lib/architecture-js/architect.rb
158
- - lib/architecture-js/command.rb
159
169
  - lib/architecture-js/dependencies.rb
160
170
  - lib/architecture-js/generator.rb
161
171
  - lib/architecture-js/helpers.rb
@@ -163,9 +173,8 @@ files:
163
173
  - lib/architecture-js/project.rb
164
174
  - repository/modjs/plugins/jquery-elements.js
165
175
  - spec/.DS_Store
176
+ - spec/architect_spec.rb
166
177
  - spec/architecture-js_spec.rb
167
- - spec/cli_spec.rb
168
- - spec/command_spec.rb
169
178
  - spec/fixtures/.DS_Store
170
179
  - spec/fixtures/_hidden.js
171
180
  - spec/fixtures/compiled_src.js
@@ -181,6 +190,7 @@ files:
181
190
  - spec/fixtures/src_file.js
182
191
  - spec/fixtures/templates/test_template_one.js
183
192
  - spec/fixtures/templates/test_template_two.js
193
+ - spec/fixtures/test_framework.rb
184
194
  - spec/fixtures/test_template_options.js
185
195
  - spec/fixtures/test_template_two.js
186
196
  - spec/fixtures/update.architecture
@@ -206,7 +216,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
206
216
  version: '0'
207
217
  segments:
208
218
  - 0
209
- hash: 25093799947828401
219
+ hash: -4407288014740277425
210
220
  required_rubygems_version: !ruby/object:Gem::Requirement
211
221
  none: false
212
222
  requirements:
@@ -1,89 +0,0 @@
1
- module ArchitectureJS
2
- module Command
3
- def watch(path = nil)
4
- require "fssm"
5
- path ||= Dir.getwd
6
- path = File.expand_path(path)
7
-
8
- puts ArchitectureJS::Notification.log "ArchitectureJS are watching for changes. Press Ctrl-C to stop."
9
- project = ArchitectureJS::Project::new_from_config(path)
10
- project.update
11
- watch_hash = Hash.new
12
- watch_files = Dir["#{path}/**/"]
13
- watch_files.shift # remove the project root
14
- # remove the build_dir
15
- watch_files.reject! { |dir| dir.match(/#{path}\/#{project.config[:build_dir]}/) }
16
-
17
- watch_files.each do |dir|
18
- watch_hash[dir] = "**/*.js"
19
- end
20
-
21
- watch_hash[path] = "**/*.architecture"
22
- watch_hash["#{ArchitectureJS::BASE_DIR}/repository"] = "**/*.js" # check changes to the repository as well
23
-
24
- FSSM.monitor do
25
- watch_hash.each do |dir, g|
26
- path "#{dir}" do
27
- glob g
28
-
29
- update do |base, relative|
30
- puts ArchitectureJS::Notification.event "change detected in #{relative}"
31
- project.config.read if relative.match(/conf$/)
32
- project.update
33
- end
34
-
35
- create do |base, relative|
36
- puts ArchitectureJS::Notification.event "#{relative} created"
37
- project.update
38
- end
39
-
40
- delete do |base, relative|
41
- puts ArchitectureJS::Notification.event "#{relative} deleted"
42
- project.update
43
- end
44
- end
45
- end
46
- end
47
- end # watch
48
-
49
- def create(config = nil)
50
- settings = {
51
- name: nil,
52
- root: File.expand_path(Dir.getwd)
53
- }
54
-
55
- settings.merge!(config) unless config.nil?
56
-
57
- raise 'you must specify a project name: architect create ProjectName' if settings[:name].nil?
58
-
59
- project = ArchitectureJS::Project.new({ name: settings[:name] }, settings[:root])# TODO add settings[:framework]
60
- project.create
61
- end
62
-
63
- def compile(options = nil)
64
- settings = {
65
- force_compress: false,
66
- path: File.expand_path(Dir.getwd)
67
- }
68
-
69
- settings.merge!(options) if options
70
-
71
- project = ArchitectureJS::create_project_from_config(settings[:path])
72
- project.config[:output] = 'compressed' if settings[:force_compress]
73
- project.update
74
- end
75
-
76
- # TODO make generate generic to accept a type, look up in either local templates or master, and pass it options and flags parsed for use in erb files
77
- def generate(config)
78
- conf_path = "#{config[:project].root}/ninjs.conf"
79
- raise "ninjs.conf was not located in #{conf_path}" unless File.exists? conf_path
80
- generator = ArchitectureJS::Generator.new(config)
81
- generator.generate
82
- end
83
-
84
- module_function :create,
85
- :watch,
86
- :compile,
87
- :generate
88
- end
89
- end
data/spec/cli_spec.rb DELETED
@@ -1,42 +0,0 @@
1
- require 'spec_helper'
2
- # TODO write tests for CLI
3
- describe 'CLI' do
4
- before :each do
5
- @bin = "#{ArchitectureJS::BASE_DIR}/bin/architect"
6
- FileUtils.mkdir "#{TMP_DIR}" unless File.exists? "#{TMP_DIR}"
7
- suppress_output { %x(cd #{TMP_DIR}; #{@bin} create myapp) }
8
- FileUtils.cp "#{FIXTURES}/lib1.js", "#{TMP_DIR}/src/lib1.js"
9
- FileUtils.cp "#{FIXTURES}/lib2.js", "#{TMP_DIR}/src/lib2.js"
10
- FileUtils.cp "#{FIXTURES}/src_file.js", "#{TMP_DIR}/src/myapp.js"
11
- end
12
-
13
- after :each do
14
- FileUtils.rm_rf "#{TMP_DIR}" if File.exists? "#{TMP_DIR}"
15
- end
16
-
17
- it 'should create a new application' do
18
- "#{TMP_DIR}/myapp.architecture".should be_same_file_as "#{FIXTURES}/myapp.architecture"
19
- File.directory? "#{TMP_DIR}/lib"
20
- File.directory? "#{TMP_DIR}/src"
21
- end
22
-
23
- it 'should create a new application in a subdirectory' do
24
- suppress_output { %x(cd #{TMP_DIR}; #{@bin} create myapp sub) }
25
- "#{TMP_DIR}/sub/myapp.architecture".should be_same_file_as "#{FIXTURES}/myapp.architecture"
26
- File.directory? "#{TMP_DIR}/sub/lib"
27
- File.directory? "#{TMP_DIR}/sub/src"
28
- File.exists? "#{TMP_DIR}/sub/myapp.js"
29
- FileUtils.rm_rf "#{TMP_DIR}/sub"
30
- end
31
-
32
- it 'should compile the application' do
33
- suppress_output { %x(cd #{TMP_DIR}; #{@bin} compile) }
34
- File.exists?("#{TMP_DIR}/lib/myapp.js").should be_true
35
- "#{TMP_DIR}/lib/myapp.js".should be_same_file_as "#{FIXTURES}/compressed.js"
36
- end
37
-
38
- it 'should generate a template' do
39
- #suppress_output { %x`cd #{TMP_DIR}; #{@bin} generate blank test` }
40
- #File.exists?("#{TMP_DIR}/test.js").should be_true
41
- end
42
- end
data/spec/command_spec.rb DELETED
@@ -1,61 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe ArchitectureJS::Command do
4
-
5
- context 'API' do
6
- before :each do
7
- suppress_output do
8
- @project = ArchitectureJS::Project.new({ name: 'myapp' }, TMP_DIR)
9
- @project.create
10
- end
11
- end
12
-
13
- after :each do
14
- FileUtils.rm_rf TMP_DIR
15
- end
16
-
17
- it 'should have a watch command' do
18
- ArchitectureJS::Command.should respond_to :watch
19
- end
20
-
21
- it 'should have a compile command' do
22
- ArchitectureJS::Command.should respond_to :compile
23
- end
24
-
25
- it 'should have a generate command' do
26
- ArchitectureJS::Command.should respond_to :generate
27
- end
28
-
29
- it 'should have a create command' do
30
- ArchitectureJS::Command.should respond_to :create
31
- end
32
- end
33
-
34
- context 'Usage' do
35
- before :each do
36
- suppress_output { ArchitectureJS::Command.create({ name: 'myapp', root: TMP_DIR }) }
37
- end
38
-
39
- after :each do
40
- FileUtils.rm_rf TMP_DIR
41
- end
42
-
43
- it 'should create a new application' do
44
- "#{TMP_DIR}/myapp.architecture".should be_same_file_as "#{FIXTURES}/myapp.architecture"
45
- File.directory?("#{TMP_DIR}/lib").should be_true
46
- File.directory?("#{TMP_DIR}/src").should be_true
47
- end
48
-
49
- it 'should compile the application' do
50
- FileUtils.cp "#{FIXTURES}/lib1.js", "#{TMP_DIR}/src/lib1.js"
51
- FileUtils.cp "#{FIXTURES}/lib2.js", "#{TMP_DIR}/src/lib2.js"
52
- FileUtils.cp "#{FIXTURES}/src_file.js", "#{TMP_DIR}/src/myapp.js"
53
-
54
- suppress_output { ArchitectureJS::Command.compile({ path: TMP_DIR }) }
55
-
56
- File.exists?("#{TMP_DIR}/lib/myapp.js").should be_true
57
- "#{TMP_DIR}/lib/myapp.js".should be_same_file_as "#{FIXTURES}/compressed.js"
58
- end
59
-
60
- end # Usage
61
- end